PandaRoot
PndSimpleCombiner.h
Go to the documentation of this file.
1 // ************************************************************************
2 //
3 // PANDA Simple Particle Combiner Class
4 //
5 // Offers simple combinatorics
6 //
7 // ************************************************************************
8 //
9 // Parameters:
10 // - fAna : PndAnalysis instance
11 // - decay : decay specification, e.g. "phi -> K+ K-; D_s+ -> phi pi+ cc" (cc indicates charged conjugate; particle used have to be defined beforehand)
12 // - params : configuration parameters, e.g. "mwin=0.5:mwin(phi)=0.2:emin=0.1:pid=Loose:pide=Tight:algo=PidChargedProbability"
13 // - mwin : mass window for all composites
14 // - mwin(X) : mass window for composite 'X'; X (or cc of X) has to appear in decay
15 // - emin : minimum energy threshold for neutrals
16 // - gphot : GoodPhotonSelector criterion ("All","VeryLoose","Loose","Tight","VeryTight")
17 // - gtrk : GoodTrackSelector criterion ("All","VeryLoose","Loose","Tight","VeryTight")
18 // - pmin : minimum momentum threshold for charged
19 // - ebrem : use bremsstrahlung correction for e+/e- (ElectronPlusBrem/ElectronMinusBrem)
20 // - pid : PID criterion ("All","VeryLoose","Loose","Tight","VeryTight","Best") for all species
21 // - pide, pidmu, pidpi, pidk, pidp : PID criterion for specific species
22 // - algo : PID algorithm (e.g. "PidAlgoEmcBayes;PidAlgoDrc" or "PidChargedProbability") for all species
23 // - algoe, ... algop : PID algorithm for specific species
24 //
25 //
26 // K.Goetzen 01/2015
27 //
28 // ************************************************************************
29 
30 #ifndef PndSimpleCombiner_H
31 #define PndSimpleCombiner_H 1
32 
33 #include "TString.h"
34 #include "RhoCandList.h"
35 #include "TDatabasePDG.h"
36 #include <vector>
37 #include <map>
38 
39 // PANDA headers
40 #include "PndAnalysis.h"
41 
42 #define MAXLISTS 30
43 
44 class PndAnalysis;
48 
49 typedef std::vector<TString> StringList;
50 typedef std::map<TString, TString> StrStrMap;
51 
52 struct SCDecayInfo {
53  int mpdg; // mother(this) pdg code
54  int midx; // list index
55  int ndaug; // number of daughters
56  bool daucc; // do daughters have a cc?
57  double mwin; // mass selection window width
58  double mwinlo; // selection window low edge
59  double mwinhi; // selection window high edge
60  RhoMassParticleSelector *msel; // mass selector
61  std::vector<int> dpdg; // pdg codes of daughters
62  std::vector<int> didx; // list indeces of daughters
63 };
64 
66  public:
67  // *** Constructors
68  PndSimpleCombiner(PndAnalysis *fAna, TString decay, TString params = "", double Ecm = 0);
69 
70  // *** Destructor
72 
73  // *** general methods
74  void SetVerbose(int verb = 1) { fVerbose = verb; }
75  void Combine();
76  void Print();
77  void SetPid(TString crit = "", TString algo = "");
78  void SetPidElectron(TString crit = "", TString algo = "");
79  void SetPidMuon(TString crit = "", TString algo = "");
80  void SetPidPion(TString crit = "", TString algo = "");
81  void SetPidKaon(TString crit = "", TString algo = "");
82  void SetPidProton(TString crit = "", TString algo = "");
83  void SetGoodPhoton(TString crit = "");
84  void SetGoodTrack(TString crit = "");
85 
86  int GetNLists() { return fNLists - 11; }
87  bool GetList(RhoCandList &l, TString comp);
88  bool GetList(RhoCandList &l, int pdg);
89  bool GetListN(RhoCandList &l, int idx);
90  TString GetDecayString() { return fDecay; }
91 
92  private:
93  void InitDecayInfo(SCDecayInfo &info, int pdg, int idx); // init decay info struct
94  void FillGenericLists(); // fills generic lists (e+, e-, ... gamma) which are needed for combinatorics
95  int CombineList(RhoCandList &l, int mpdg, std::vector<int> &idx); // do combinatorics for one mode
96  StringList SplitString(TString s, TString delim); // routine to split a string in pieces
97  bool ParseDecay(TString decay); // parse the combinatorics setup
98  bool ParseParams(TString params); // parse the analysis parameters
99  bool CCInvariant(std::vector<int> &vpdg); // is FS its own charged conjugate?
100  bool CCInvariant(int pdg) { return (pdg == AntiPdg(pdg)); } // is pdg = pdg of anti-particle
101  int AntiPdg(int pdg); // pdg of anti-particle
102  StringList GenerateDecayList(TString decfile); // generate list of decay definitions from EvtGen decay file
103  StringList FixDecayList(StringList dec, StrStrMap mAliasName={}); // fix order of decay definitions and add (simple) missing decays
104 
105  PndAnalysis *fAnalysis;
106  TString fDecay;
107  TString fGlobParams;
108  int fNLists;
109  RhoCandList fList[MAXLISTS];
110  int fVerbose;
111  double fEmin;
112  double fPmin;
113  double fEcm;
114 
117 
118  std::map<int, int> fPdgIdxMap;
119  std::map<int, int> fIdxPdgMap;
120 
121  std::map<int, TString> fIdxListNameMap;
122  std::map<int, TString> fIdxPidCritMap;
123  std::map<int, TString> fIdxPidAlgoMap;
124 
125  std::vector<SCDecayInfo> fDecayInfoArray;
126 };
127 
128 #endif
#define MAXLISTS
std::vector< int > dpdg
std::vector< TString > StringList
std::map< TString, TString > StrStrMap
std::vector< TString > StringList
std::vector< int > didx
RhoMassParticleSelector * msel
void SetVerbose(int verb=1)