FairRoot/PandaRoot
Functions
pid_check.C File Reference

Go to the source code of this file.

Functions

int pid_check ()
 

Function Documentation

int pid_check ( )

Definition at line 1 of file pid_check.C.

References PndPidCandidate::GetCharge(), PndPidCandidate::GetDrcIndex(), PndPidCandidate::GetDrcThetaC(), PndPidProbability::GetElectronPidProb(), PndPidProbability::GetIndex(), PndPidProbability::GetKaonPidProb(), PndPidCandidate::GetMomentum(), PndPidProbability::GetMuonPidProb(), PndPidCandidate::GetMvdDEDX(), PndPidCandidate::GetMvdHits(), PndPidProbability::GetPionPidProb(), PndPidProbability::GetProtonPidProb(), inFile, inSimFile, out, rootlogon(), tree, and TString.

2 {
3  gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
4  rootlogon();
5 
6  TString inPidFile = "pid_sttcombi.root";
7  TString inSimFile = "points_sttcombi.root";
8 
9  TFile *inFile = TFile::Open(inSimFile,"READ");
10 
11  TTree *tree=(TTree *) inFile->Get("pndsim") ;
12  tree->AddFriend("pndsim",inPidFile);
13 
14  TClonesArray* cand_array=new TClonesArray("PndPidCandidate");
15  tree->SetBranchAddress("PidChargedCand", &cand_array);
16 
17  TClonesArray* drc_array=new TClonesArray("PndPidProbability");
18  tree->SetBranchAddress("PidAlgoDrc", &drc_array);
19  TClonesArray* mvd_array=new TClonesArray("PndPidProbability");
20  tree->SetBranchAddress("PidAlgoMvd", &mvd_array);
21 
22  TFile *out = TFile::Open("out.root","RECREATE");
23 
24  TNtuple *ntDrc = new TNtuple("ntDrc","ntDrc","mom:theta:q:drc:thetac:mvd:dedx:e:mu:pi:k:p:ec:muc:pic:kc:pc");
25  TNtuple *ntMvd = new TNtuple("ntMvd","ntMvd","mom:theta:q:drc:thetac:mvd:dedx:e:mu:pi:k:p:ec:muc:pic:kc:pc");
26  TNtuple *ntCom = new TNtuple("ntCom","ntCom","mom:theta:q:drc:thetac:mvd:dedx:e:mu:pi:k:p:ec:muc:pic:kc:pc");
27 
28  PndPidProbability *flux = new PndPidProbability(239+237,114+101,2282+2375,35+42,517+1052);
29 
30  for (Int_t j=0; j< tree->GetEntriesFast(); j++){
31  tree->GetEntry(j);
32  if (cand_array->GetEntriesFast()==0) continue;
33 
34  cout << "processing event " << j << "\n";
35 
36  for (Int_t ii=0; ii<cand_array->GetEntriesFast(); ii++) // Loop over pid candidates
37  {
38  PndPidCandidate *cand= (PndPidCandidate *) cand_array->At(ii);
39  if (cand->GetMomentum().Mag()>5.) continue;
40 
41  PndPidProbability *drc = (PndPidProbability *)drc_array->At(ii);
42  PndPidProbability *mvd = (PndPidProbability *)mvd_array->At(ii);
43  PndPidProbability *combo = (*drc) * (*mvd);
44  if (drc->GetIndex()!=ii) cout << "DRC mismatch!!!" << endl;
45  if (mvd->GetIndex()!=ii) cout << "MVD mismatch!!!" << endl;
46 
47  if (cand->GetDrcIndex()>-1)
48  {
49  Float_t ntuple_drc[] = {cand->GetMomentum().Mag(),cand->GetMomentum().Theta()*TMath::RadToDeg(),cand->GetCharge(),
50  cand->GetDrcIndex(),cand->GetDrcThetaC(),cand->GetMvdHits(),cand->GetMvdDEDX(),
51  drc->GetElectronPidProb(),
52  drc->GetMuonPidProb(),
53  drc->GetPionPidProb(),
54  drc->GetKaonPidProb(),
55  drc->GetProtonPidProb(),
56  drc->GetElectronPidProb(flux),
57  drc->GetMuonPidProb(flux),
58  drc->GetPionPidProb(flux),
59  drc->GetKaonPidProb(flux),
60  drc->GetProtonPidProb(flux)
61  };
62  ntDrc->Fill(ntuple_drc);
63  }
64 
65  if (cand->GetMvdHits()>0)
66  {
67  Float_t ntuple_mvd[] = {cand->GetMomentum().Mag(),cand->GetMomentum().Theta()*TMath::RadToDeg(),cand->GetCharge(),
68  cand->GetDrcIndex(),cand->GetDrcThetaC(),cand->GetMvdHits(),cand->GetMvdDEDX(),
69  mvd->GetElectronPidProb(),
70  mvd->GetMuonPidProb(),
71  mvd->GetPionPidProb(),
72  mvd->GetKaonPidProb(),
73  mvd->GetProtonPidProb(),
74  mvd->GetElectronPidProb(flux),
75  mvd->GetMuonPidProb(flux),
76  mvd->GetPionPidProb(flux),
77  mvd->GetKaonPidProb(flux),
78  mvd->GetProtonPidProb(flux)
79  };
80  ntMvd->Fill(ntuple_mvd);
81  }
82 
83  if (cand->GetMvdHits()>0&&cand->GetDrcIndex()>-1)
84  {
85  Float_t ntuple_combo[] = {cand->GetMomentum().Mag(),cand->GetMomentum().Theta()*TMath::RadToDeg(),cand->GetCharge(),
86  cand->GetDrcIndex(),cand->GetDrcThetaC(),cand->GetMvdHits(),cand->GetMvdDEDX(),
87  combo->GetElectronPidProb(),
88  combo->GetMuonPidProb(),
89  combo->GetPionPidProb(),
90  combo->GetKaonPidProb(),
91  combo->GetProtonPidProb(),
92  combo->GetElectronPidProb(flux),
93  combo->GetMuonPidProb(flux),
94  combo->GetPionPidProb(flux),
95  combo->GetKaonPidProb(flux),
96  combo->GetProtonPidProb(flux)
97  };
98 
99  ntCom->Fill(ntuple_combo);
100  }
101 
102  } // end of cand loop
103 
104  } // end of event loop
105 
106 
107  out->cd();
108 
109  ntDrc->Write();
110  ntMvd->Write();
111  ntCom->Write();
112  out->Save();
113 
114 
115  return 0;
116 }
Int_t GetCharge() const
Double_t GetProtonPidProb(PndPidProbability *flux=NULL) const
Double_t GetKaonPidProb(PndPidProbability *flux=NULL) const
TTree * tree
Definition: plot_dirc.C:12
Float_t GetDrcThetaC() const
Int_t GetIndex() const
TString inFile
Definition: hit_dirc.C:8
TString inSimFile
Double_t GetMuonPidProb(PndPidProbability *flux=NULL) const
Float_t GetMvdDEDX() const
TFile * out
Definition: reco_muo.C:20
Int_t GetMvdHits() const
Int_t GetDrcIndex() const
TVector3 GetMomentum() const
Double_t GetElectronPidProb(PndPidProbability *flux=NULL) const
Double_t GetPionPidProb(PndPidProbability *flux=NULL) const