PandaRoot
PndParticleRequirements.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 // -------------------------------------------------------------------------
14 // ----- PndParticleRequirements header file -----
15 // ----- Created 16/09/19 by T.Stockmann -----
16 // -------------------------------------------------------------------------
17 
24 #pragma once
25 
26 #include "TVector3.h"
27 #include "TVector2.h"
28 #include "TList.h"
29 
30 #include "PndMCTrackInfo.h"
31 #include <iostream>
32 #include <string>
33 
35 
36  public:
39 
41  virtual ~PndParticleRequirements();
42 
44  void Print(std::ostream &out = std::cout);
45  std::string ShortRequirementsAsString();
46 
47  void Init();
48 
49  friend std::ostream &operator<<(std::ostream &out, PndParticleRequirements &track)
50  {
51  track.Print(out);
52  return out;
53  }
54 
57  void SetMinDecayTime(Double_t val) { fMinDecayTime = val; }
58  void SetMaxDecayTime(Double_t val) { fMaxDecayTime = val; }
59 
60  void SetPIDMothers(std::vector<int> val) { fPIDMothers = val; }
61  void SetPIDDaughters(std::vector<int> val) { fPIDDaughters = val; }
62  void SetPID(int val) { fPID = val; }
63  void SetStage(int val) { fStage = val; }
64  void SetMinTrackingPoints(int val) { fMinTrackingPoints = val; }
65  void AddMaxMomentumDifference(int branchType, TVector2 val) { fMomentumDifference[branchType] = val; }
66  void AddTypeRequirements(int branchType, int howOftenSeen) { fTypeCount[branchType] = howOftenSeen; }
67  void SetCheckTracking(TString barrelPrefix, TString forwardPrefix, TString particlePropagatorName);
68  void SetCheckPid(TString algorithms, double minProb)
69  {
70  fPidAlgorithms = algorithms;
71  fMinPidProb = minProb;
72  fCheckPid = true;
73  }
74 
75  void SetCheckNeutral();
76  int GetNRequirements();
77 
78  int GetPdgCode() const { return fPID; };
79  std::vector<int> GetMothers() const { return fPIDMothers; }
80  std::vector<int> GetDaughters() const { return fPIDDaughters; }
81  int GetStage() const { return fStage; }
82  std::map<int, TVector2> GetMomentumDifference() const { return fMomentumDifference; }
83  std::map<int, int> GetTypeCount() const { return fTypeCount; }
84  Double_t GetMinDecayTime() const { return fMinDecayTime; }
85  Double_t GetMaxDecayTime() const { return fMaxDecayTime; }
86  int GetMinTrackingPoints() const { return fMinTrackingPoints; }
87  bool GetCheckTracking() const { return fCheckTracking; }
88  bool GetCheckNeutral() const { return fCheckNeutral; }
89  bool GetCheckPid() const { return fCheckPid; }
91 
92  std::vector<int> CheckTrack(PndMCTrackInfo &info);
93  void Found() { fFound = true; }
94  void ClearFound() { fFound = false; }
95  bool GetFound() const { return fFound; }
96 
97  protected:
98  int CheckMothers(std::vector<int> mothers);
99  int CheckDaughters(std::vector<int> daughters);
100  int CheckStage(int stage);
101  std::vector<int> CheckTracking(PndMCTrackInfo &info);
102  std::vector<int> CheckTypeCount(PndMCTrackInfo &info);
103  std::vector<int> CheckMomentum(PndMCTrackInfo &info);
104  int CheckPid(PndMCTrackInfo &info);
105  int CheckOverall(std::vector<int> results);
106  void InitTracking();
107  void InitPid();
108  void InitNeutral();
109 
110  private:
111  Double_t fMinDecayTime;
112  Double_t fMaxDecayTime;
113  std::vector<int> fPIDMothers;
114  std::vector<int> fPIDDaughters;
115  int fPID;
116  Int_t fStage;
117  std::map<int, TVector2> fMomentumDifference; //< difference between p transversal and p longitudinal between reco track and MC track
118  std::map<int, int> fTypeCount;
119  TString fBarrelTrackerPrefix;
120  TString fForwardTrackerPrefix;
121  TString fPropagatorParticle;
122  TString fPidAlgorithms;
123  std::vector<int> fCheckBranchesBarrel;
124  std::vector<int> fCheckBranchesForward;
125  int fCheckBranchChargedCand; // branchID of ChargedCand
126  int fMinTrackingPoints;
127  std::vector<TVector2> fMomentumResolution;
128  std::vector<int> fPidBranches; //< list of branches taking into account for PID determination
129  double fMinPidProb; //< required minimum pid probability
130 
131  bool fFound;
132  bool fCheckTracking;
133  bool fCheckNeutral;
134  bool fCheckPoints;
135  bool fCheckPid;
136 
137  ClassDef(PndParticleRequirements, 1);
138 };
139 
int CheckPid(PndMCTrackInfo &info)
void AddTypeRequirements(int branchType, int howOftenSeen)
int CheckStage(int stage)
std::vector< int > CheckTrack(PndMCTrackInfo &info)
void SetMinDecayTime(Double_t val)
int CheckDaughters(std::vector< int > daughters)
PndPidProbability GetPidProbability(PndMCTrackInfo &info)
void SetPIDDaughters(std::vector< int > val)
std::map< int, TVector2 > GetMomentumDifference() const
void SetCheckPid(TString algorithms, double minProb)
std::vector< int > CheckTracking(PndMCTrackInfo &info)
void SetMaxDecayTime(Double_t val)
void SetPIDMothers(std::vector< int > val)
std::string ShortRequirementsAsString()
void Print(std::ostream &out=std::cout)
void AddMaxMomentumDifference(int branchType, TVector2 val)
std::vector< int > GetMothers() const
int CheckOverall(std::vector< int > results)
friend std::ostream & operator<<(std::ostream &out, PndParticleRequirements &track)
std::vector< int > CheckTypeCount(PndMCTrackInfo &info)
std::vector< int > GetDaughters() const
int CheckMothers(std::vector< int > mothers)
std::map< int, int > GetTypeCount() const
void SetCheckTracking(TString barrelPrefix, TString forwardPrefix, TString particlePropagatorName)
std::vector< int > CheckMomentum(PndMCTrackInfo &info)
virtual ~PndParticleRequirements()