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