FairRoot/PandaRoot
Functions
thailand2017/tut_ana_fast.C File Reference
#include "auxtut.C"

Go to the source code of this file.

Functions

int SelectTruePid (PndAnalysis *ana, RhoCandList &l)
 
void tut_ana_fast (int nevts=0, TString prefix="signal")
 

Function Documentation

int SelectTruePid ( PndAnalysis ana,
RhoCandList l 
)

Definition at line 18 of file thailand2017/tut_ana_fast.C.

References RhoCandList::GetLength(), PndAnalysis::McTruthMatch(), and RhoCandList::Remove().

19 {
20  int removed = 0;
21 
22  for (int ii=l.GetLength()-1;ii>=0;--ii)
23  {
24  if ( !(ana->McTruthMatch(l[ii])) )
25  {
26  l.Remove(l[ii]);
27  removed++;
28  }
29  }
30 
31  return removed;
32 }
Int_t GetLength() const
Definition: RhoCandList.h:46
Int_t Remove(RhoCandidate *)
Bool_t McTruthMatch(RhoCandidate *cand, Int_t level=2, bool verbose=false)
void tut_ana_fast ( int  nevts = 0,
TString  prefix = "signal" 
)

Definition at line 35 of file thailand2017/tut_ana_fast.C.

References RhoCalculationTools::ForceConstantBz(), fRun, PndAnalysis::GetEntries(), PndAnalysis::GetEvent(), i, out, plotmyhistos(), PndAnalysis::PndAnalysis(), TString, and writemyhistos().

36 {
37  // *** some variables
38  int i=0,j=0, k=0, l=0;
39  gStyle->SetOptFit(1011);
40 
41  // *** the output file for FairRunAna
42  TString OutFile="out_dummy.root";
43 
44  // *** the files coming from the simulation
45  TString inPidFile = prefix+"_fast.root"; // this file contains the PndPidCandidates and McTruth
46 
47  // *** PID table with selection thresholds; can be modified by the user
48  TString pidParFile = TString(gSystem->Getenv("VMCWORKDIR"))+"/macro/params/all.par";
49 
50  // *** initialization
51  FairRunAna* fRun = new FairRunAna();
52  fRun->SetSource(new FairFileSource(inPidFile));
53  fRun->SetOutputFile(OutFile);
54 
55  // *** take constant field; needed for PocaVtx
57 
58  fRun->Init();
59 
60  // *** create an output file for all histograms
61  TFile *out = TFile::Open(prefix+"_ana_fast.root","RECREATE");
62 
63  // ------------------------------
64  // Now the analysis stuff comes...
65  // ------------------------------
66 
67  // *** the data reader object
68  PndAnalysis* theAnalysis = new PndAnalysis();
69  if (nevts==0) nevts= theAnalysis->GetEntries();
70 
71  // ---------------------------------------------------------------------
72  // ---------------------------------------------------------------------
73  // ---------------------------------------------------------------------
74  // This macro combines all tasks (combinatorics, MC truth, PID, fitting)
75  // try to complete everything, perhaps for a different decay mode
76  // ---------------------------------------------------------------------
77  // ---------------------------------------------------------------------
78  // ---------------------------------------------------------------------
79 
80  // #### EXERCISE: create all necessary histograms
81  // ...
82 
83  // #### EXERCISE: create RhoCandLists for the analysis, mass selector, etc...
84 
85  // ***
86  // the event loop
87  // ***
88  while (theAnalysis->GetEvent() && i++<nevts)
89  {
90  // BE AWARE : The pid algos are named differently for FastSim, so simply take this one
91  TString pidalgo = "PidChargedProbability";
92 
93  // #### EXERCISE
94  // (1) combinatorics with desired PID algorithms (for FastSim use 'PidChargedProbability') and tightness, and PDG set for truth match
95  // (2) select rought mass window for resonances
96  // (3) do vertex fitting for resonances to charged particles
97  // (4) fill final histograms, with and without truth match
98  }
99 
100  // *** change to directory where histograms are created
101  out->cd();
102 
103  // *** plot all histos
104  plotmyhistos();
105 
106  // *** write out all the histos to file
107  int nhist = writemyhistos();
108  cout<<"Writing "<<nhist<<" histograms to file"<<endl;
109  out->Save();
110 
111  // *** temporaty fix to avoid error on macro exit
112  //RemoveGeoManager();
113 }
Int_t GetEntries()
Int_t i
Definition: run_full.C:25
static void ForceConstantBz(Double_t bz=0.)
Force a constant B field value for all positions.
FairRunAna * fRun
Definition: hit_dirc.C:58
TFile * out
Definition: reco_muo.C:20
Int_t GetEvent(Int_t n=-1)
int writemyhistos(int maxy=800, double asp=1.1)
Definition: QA/auxi.C:121
void plotmyhistos(std::vector< TH1 * > h, int maxy=700, double asp=1.1)
Definition: QA/auxi.C:62