ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Test_ECCEFastPIDMap.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Test_ECCEFastPIDMap.C
1 // $Id: $
2 
11 #include <eccefastpidreco/ECCEFastPIDReco.h>
12 #include <eccefastpidreco/ECCEdRICHFastPIDMap.h>
13 #include <eccefastpidreco/ECCEhpDIRCFastPIDMap.h>
14 #include <eccefastpidreco/ECCEmRICHFastPIDMap.h>
15 #include <eicpidbase/EICPIDDefs.h>
16 
17 #include <iostream>
18 #include <map>
19 #include <utility>
20 
21 R__LOAD_LIBRARY(libECCEFastPIDReco.so)
22 
23 void Test_ECCEFastPIDMap(const double truth_pid = 211, //
24  const double momentum_GeV = 8, //
25  const double theta_rad = 3, //
26  const double LogLikelihoodCut = 0)
27 {
29 
30  // ECCEhpDIRCFastPIDMap * pidmap = new ECCEhpDIRCFastPIDMap();
31  // pidmap->ReadMap( string(getenv("CALIBRATIONROOT")) + string("/hpDIRC/FastPID/ctr_map_p1_0.95.root") );
32 
33  // ECCEdRICHFastPIDMap *pidmap = new ECCEdRICHFastPIDMap();
34  // pidmap->dualRICH_aerogel(); // pick one
35  // pidmap->dualRICH_C2F6();// pick one
36 
37  pidmap->Verbosity(1);
38 
39  const int n_trial = 1000;
40  int n_electronID = 0;
41  int n_pionID = 0;
42  int n_kaonID = 0;
43  int n_protonID = 0;
44 
45  for (int i = 0; i < n_trial; ++i)
46  {
47  std::map<EICPIDDefs::PIDCandidate, float> ll_map =
48  pidmap->getFastSmearLogLikelihood(truth_pid, momentum_GeV,
49  theta_rad);
50 
51  if (ll_map[EICPIDDefs::PionCandiate] > ll_map[EICPIDDefs::KaonCandiate] + LogLikelihoodCut //
52  and ll_map[EICPIDDefs::PionCandiate] > ll_map[EICPIDDefs::ProtonCandiate] + LogLikelihoodCut) //
53  ++n_pionID;
54  if (ll_map[EICPIDDefs::KaonCandiate] > ll_map[EICPIDDefs::PionCandiate] + LogLikelihoodCut //
55  and ll_map[EICPIDDefs::KaonCandiate] > ll_map[EICPIDDefs::ProtonCandiate] + LogLikelihoodCut) //
56  ++n_kaonID;
57  if (ll_map[EICPIDDefs::ProtonCandiate] > ll_map[EICPIDDefs::PionCandiate] + LogLikelihoodCut //
58  and ll_map[EICPIDDefs::ProtonCandiate] > ll_map[EICPIDDefs::KaonCandiate] + LogLikelihoodCut) //
59  ++n_protonID;
60 
61  // a simple electron ID
62  if (ll_map[EICPIDDefs::ElectronCandiate] > ll_map[EICPIDDefs::PionCandiate] + LogLikelihoodCut) //
63  ++n_electronID;
64  }
65 
66  std::cout << "Probability for truth_pid = " << truth_pid << " to be identified as following candidate with LogLikelihoodCut = " << LogLikelihoodCut << std::endl;
67 
68  std::cout << "\t"
69  << "Pion"
70  << " = " << (double) n_pionID / n_trial << std::endl;
71  std::cout << "\t"
72  << "Kaon"
73  << " = " << (double) n_kaonID / n_trial << std::endl;
74  std::cout << "\t"
75  << "Proton"
76  << " = " << (double) n_protonID / n_trial << std::endl;
77  std::cout << "\t"
78  << "ElectronID"
79  << " = " << (double) n_electronID / n_trial << std::endl;
80 }