FairRoot/PandaRoot
PndTutThaiTask.cxx
Go to the documentation of this file.
1 // ************************************************************************
2 //
3 // psi(2S) -> J/psi (-> mu+ mu-) pi+ pi- Analysis Example Task
4 //
5 // for the Rho Tutorial, see
6 // http://panda-wiki.gsi.de/cgi-bin/viewauth/Computing/PandaRootRhoTutorial
7 //
8 // K.Goetzen 7/2013
9 // ************************************************************************
10 
11 
12 // The header file
13 #include "PndTutThaiTask.h"
14 
15 // C++ headers
16 #include <string>
17 #include <iostream>
18 
19 // FAIR headers
20 #include "FairRootManager.h"
21 #include "FairRunAna.h"
22 #include "FairRuntimeDb.h"
23 #include "FairRun.h"
24 #include "FairRuntimeDb.h"
25 
26 // ROOT headers
27 #include "TClonesArray.h"
28 #include "TVector3.h"
29 #include "TH1F.h"
30 #include "TH2F.h"
31 
32 // RHO headers
33 #include "RhoCandidate.h"
34 #include "RhoHistogram/RhoTuple.h"
35 #include "RhoFactory.h"
37 
38 // Analysis headers
39 #include "PndAnalysis.h"
40 #include "Rho4CFitter.h"
41 #include "RhoKinVtxFitter.h"
42 #include "RhoKinFitter.h"
43 #include "RhoVtxPoca.h"
44 
45 
46 using std::cout;
47 using std::endl;
48 
49 
50 // ----- Default constructor -------------------------------------------
52  FairTask("Panda Tutorial Analysis Task") {
53 }
54 // -------------------------------------------------------------------------
55 
56 
57 // ----- Destructor ----------------------------------------------------
59 // -------------------------------------------------------------------------
60 
61 
62 // ----- Method to select true PID candidates
64 {
65  int removed = 0;
66 
67  for (int ii=l.GetLength()-1;ii>=0;--ii)
68  {
69  if ( !(ana->McTruthMatch(l[ii])) )
70  {
71  l.Remove(l[ii]);
72  removed++;
73  }
74  }
75 
76  return removed;
77 }
78 // -------------------------------------------------------------------------
79 
80 
81 // ----- Public method Init --------------------------------------------
82 InitStatus PndTutThaiTask::Init()
83 {
84  // initialize analysis object
85  fAnalysis = new PndAnalysis();
86 
87  // reset the event counter
88  fEvtCount = 0;
89 
90  // Mass selector for the jpsi cands
91  fJpsiMassSel=new RhoMassParticleSelector("jpsi",3.096,1.0);
92 
93  // #### EXERCISE: create the histograms
94  hjpsim_all = new TH1F("hjpsim_all","J/#psi mass (all)",200,0,4.5);
95  hpsim_all = new TH1F("hpsim_all","#psi(2S) mass (all)",200,0,5);
96  // ...
97 
98  // *** the lorentz vector of the initial psi(2S)
99  fIni.SetXYZT(0, 0, 6.231552, 7.240065);
100 
101  return kSUCCESS;
102 }
103 
104 // -------------------------------------------------------------------------
105 
107 {
108  // Get run and runtime database
109  FairRun* run = FairRun::Instance();
110  if ( ! run ) Fatal("SetParContainers", "No analysis run");
111 }
112 
113 // -------------------------------------------------------------------------
114 
115 
116 // ----- Public method Exec --------------------------------------------
117 void PndTutThaiTask::Exec(Option_t*)
118 {
119  // *** some variables
120  int j=0;
121 
122  // necessary to read the next event
124 
125  if (!(++fEvtCount%100)) cout << "evt "<<fEvtCount<<endl;
126 
127 
128  // #### EXERCISE
129  // (1) combinatorics with desired PID algorithms and tightness, and PDG set for truth match
130  // (2) select rought mass window for resonances
131  // (3) do vertex fitting for resonances to charged particles
132  // (4) fill final histograms, with and without truth match
133 
134 }
135 
136 
138 {
139  // #### EXERCISE : write all histograms
140  hjpsim_all->Write();
141  hpsim_all->Write();
142  // ...
143 
144 }
145 
virtual void SetParContainers()
Int_t run
Definition: autocutx.C:47
TLorentzVector fIni
Int_t GetLength() const
Definition: RhoCandList.h:46
virtual InitStatus Init()
int SelectTruePid(PndAnalysis *ana, RhoCandList &l)
void GetEventInTask()
virtual void Exec(Option_t *opt)
Int_t Remove(RhoCandidate *)
ClassImp(PndAnaContFact)
RhoMassParticleSelector * fJpsiMassSel
Bool_t McTruthMatch(RhoCandidate *cand, Int_t level=2, bool verbose=false)
PndAnalysis * fAnalysis
virtual void Finish()