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 SetGoodNeutron(TString crit = "");
85  void SetGoodAntiNeutron(TString crit = "");
86  void SetGoodTrack(TString crit = "");
87 
88  int GetNLists() { return fNLists - 11; }
89  bool GetList(RhoCandList &l, TString comp);
90  bool GetList(RhoCandList &l, int pdg);
91  bool GetListN(RhoCandList &l, int idx);
92  TString GetDecayString() { return fDecay; }
93 
94  private:
95  void InitDecayInfo(SCDecayInfo &info, int pdg, int idx); // init decay info struct
96  void FillGenericLists(); // fills generic lists (e+, e-, ... gamma) which are needed for combinatorics
97  int CombineList(RhoCandList &l, int mpdg, std::vector<int> &idx); // do combinatorics for one mode
98  StringList SplitString(TString s, TString delim); // routine to split a string in pieces
99  bool ParseDecay(TString decay); // parse the combinatorics setup
100  bool ParseParams(TString params); // parse the analysis parameters
101  bool CCInvariant(std::vector<int> &vpdg); // is FS its own charged conjugate?
102  bool CCInvariant(int pdg) { return (pdg == AntiPdg(pdg)); } // is pdg = pdg of anti-particle
103  int AntiPdg(int pdg); // pdg of anti-particle
104  StringList GenerateDecayList(TString decfile); // generate list of decay definitions from EvtGen decay file
105  StringList FixDecayList(StringList dec, StrStrMap mAliasName = {}); // fix order of decay definitions and add (simple) missing decays
106 
107  PndAnalysis *fAnalysis;
108  TString fDecay;
109  TString fGlobParams;
110  int fNLists;
111  RhoCandList fList[MAXLISTS];
112  int fVerbose;
113  double fEmin;
114  double fPmin;
115  double fEcm;
116 
119 
120  std::map<int, int> fPdgIdxMap;
121  std::map<int, int> fIdxPdgMap;
122 
123  std::map<int, TString> fIdxListNameMap;
124  std::map<int, TString> fIdxPidCritMap;
125  std::map<int, TString> fIdxPidAlgoMap;
126 
127  std::vector<SCDecayInfo> fDecayInfoArray;
128 };
129 
130 #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)