FairRoot/PandaRoot
PndJpsi2PiAna.cxx
Go to the documentation of this file.
1 /******************************************************
2 
3 JPsi->e+e-
4 Reads the TPC tracks and reconstruct the InvariantMass
5 of J/Psi: Dipak
6 *******************************************************/
7 
8 #include "PndJpsi2PiAna.h"
9 
10 // Fair
11 #include "FairRootManager.h"
12 
13 // Rho
14 #include "RhoCandidate.h"
15 #include "RhoCandList.h"
16 #include "PndPidCandidate.h"
17 
18 #include "Fitter/Rho4CFitter.h"
20 
21 // Root
22 #include "TH1F.h"
23 
24 // general
25 #include <string>
26 #include <iostream>
27 
28 
29 using std::cout;
30 using std::endl;
31 
32 
33 // ----- Default constructor -------------------------------------------
35 {
36 
37 }
38 // -------------------------------------------------------------------------
39 
40 // ----- Destructor ----------------------------------------------------
42 {
43 }
44 
45 // -------------------------------------------------------------------------
46 
47 InitStatus PndJpsi2PiAna::Init()
48 {
49  std::cout << "-I- PndJpsi2PiAna: Initialization" << std::endl;
50 
51  InitArrays();
52 
53 
54  jpsimass=new TH1F("mjpsi","jpsi",200,0,3.5);
55  jpsimassf=new TH1F("mjpsif","jpsi fit",200,0,3.5);
56 
57  ppmass=new TH1F("mpp","mpp",200,0,4.5);
58  ppmassf=new TH1F("mppf","mpp",200,0,4.5);
59 
60  mcmass=new TH1F("mmc","mmc",200,0,4.0);
61 
62  jpsiMSel=new RhoMassParticleSelector("jpsi",3.1,0.2);
63 
64  fEvtCount=0;
65 
66  return kSUCCESS;
67 }
68 
69 // -------------------------------------------------------------------------
70 
71 void PndJpsi2PiAna::Exec(Option_t*)
72 {
73  if (0==(++fEvtCount)%100) cout <<"evt "<<fEvtCount<<endl;
74 
75  int i,j;
76 
77  GetEvent();
78 
79  RhoCandList ep, em, pip, pim, jpsi, pp, mc;
80 
81  FillList(ep,"ElectronVeryLoosePlus");
82  FillList(em,"ElectronVeryLooseMinus");
83  FillList(pip,"PionVeryLoosePlus");
84  FillList(pim,"PionVeryLooseMinus");
85 
86  FillList(mc,"McTruth");
87 
88  TLorentzVector ini(0, 0, 6.231711, 7.240222);
89 
90 /* cout<<" e+:" <<ep.GetLength();
91  cout<<" e-:" <<em.GetLength();
92  cout<<" pi+:" <<pip.GetLength();
93  cout<<" pi-:" <<pim.GetLength();
94  cout <<endl;*/
95 
96  jpsi.Combine(ep,em);
97 
98 /* cout <<jpsi.GetLength();*/
99 
100  for (j=0;j<jpsi.GetLength();++j) jpsimass->Fill(jpsi[j]->M());
101  //jpsi.Select(jpsiMSel);
102 
103  for (j=0;j<mc.GetLength();++j) mcmass->Fill(mc[j]->M());
104 
105  pp.Combine(jpsi,pip,pim);
106 
107  for (j=0;j<pp.GetLength();++j)
108  {
109  ppmass->Fill(pp[j]->M());
110 
111  //do the 4C fit on the pbar p System
112  Rho4CFitter fitter(pp[j],ini);
113 
114  fitter.FitConserveMasses();
115 
116  RhoCandidate *ppfit=pp[j]->GetFit();
117  ppmassf->Fill(ppfit->M());
118 
119  RhoCandidate *epfit=(pp[j]->Daughter(0)->Daughter(0))->GetFit();
120  RhoCandidate *emfit=(pp[j]->Daughter(0)->Daughter(1))->GetFit();
121 
122  TLorentzVector sum=epfit->P4()+emfit->P4();
123 
124  jpsimassf->Fill(sum.Mag());
125 
126  }
127 
128 
129 }
130 
131 // -------------------------------------------------------------------------
132 
134 {
135  jpsimass->Write();
136  jpsimassf->Write();
137  ppmass->Write();
138  ppmassf->Write();
139  mcmass->Write();
140 }
141 
RhoMassParticleSelector * jpsiMSel
Definition: PndJpsi2PiAna.h:36
void InitArrays()
Definition: PndAnaTask.cxx:59
Int_t i
Definition: run_full.C:25
Bool_t FitConserveMasses()
Definition: Rho4CFitter.cxx:64
Int_t GetLength() const
Definition: RhoCandList.h:46
int GetEvent()
Definition: PndAnaTask.cxx:81
TH1F * jpsimassf
Definition: PndJpsi2PiAna.h:40
void Combine(RhoCandList &l1, RhoCandList &l2)
TLorentzVector P4() const
Definition: RhoCandidate.h:195
virtual void Finish()
Double_t M() const
virtual InitStatus Init()
virtual void Exec(Option_t *opt)
UInt_t fEvtCount
Definition: PndJpsi2PiAna.h:46
bool FillList(RhoCandList &l, std::string listkey="All")
Definition: PndAnaTask.cxx:93