1 #include <TMultiGraph.h>
12 #include <StEmcPool/StPhotonCommon/MyEvent.h>
13 #include <StEmcPool/StPhotonCommon/MyPoint.h>
16 #include "GainAnalysis.h"
23 gStyle->SetOptDate(0);
24 ps=
new TPostScript(psout,-111);
25 cout<<
"DEFAULT CONSTRUCTOR FOR PI0ANALYSIS!!!!"<<endl;
26 cout<<
"storing ps in: "<<psout<<endl;
28 GainAnalysis::~GainAnalysis()
30 cout<<endl<<
"GainAnalysis destructed!"<<endl<<endl;
32 Int_t GainAnalysis::init(
const char *output)
35 mFileOut=
new TFile(output,
"RECREATE");
36 h_minvPt=
new TH2F(
"h_minvPt",
"invariant mass vs pT",40,0.,10.,200,0.,1.);
37 h_minvId=
new TH2F(
"h_minvId",
"inv. mass vs ID",2400,0.5,2400.5,200,0.,1.);
41 Int_t GainAnalysis::make(Int_t evmax,
const char *input)
43 mFile=
new TFile(input,
"OPEN");
44 myEventTree=(TTree*)mFile->Get(
"mEventTree");
46 myEventTree->SetBranchAddress(
"branch",&ev);
49 while(myEventTree->GetEntry(i)){
51 cout<<
"reached evmax,"<<endl;
52 cout<<
"abort loop!"<<endl;
55 if(i%100000==0) cout<<
"processing "<<input<<
" evt: "<<i<<endl;
57 TVector3 vPos=ev->vertex();
59 if(!(ev->trigger()&1)&&!(ev->trigger()&8)){
64 if(TMath::Abs(vPos.Z())<0.0000001 || TMath::Abs(vPos.Z())>50.){
71 TClonesArray *clA=(TClonesArray*)ev->getPointArray();
72 for(Int_t j=0;j<clA->GetEntries();j++){
74 TVector3 pPos=p->position();
75 TVector3 pMom=pPos - vPos;
76 pMom.SetMag(p->energy());
78 if(!isPointOK(p))
continue;
80 for(Int_t jj=0;jj<clA->GetEntries();jj++){
83 TVector3 ppPos=pp->position();
84 TVector3 ppMom=ppPos - vPos;
85 ppMom.SetMag(pp->energy());
87 if(!isPointOK(pp))
continue;
90 TVector3 pi0Mom=pMom+ppMom;
91 Float_t angle=pMom.Angle(ppMom);
96 Float_t minv=TMath::Sqrt(2.*p->energy()*pp->energy()*(1. - TMath::Cos(angle)));
97 Float_t pTpion=pi0Mom.Pt();
99 if(ev->trigger()&1||ev->trigger()&8){
104 for(Int_t i_id=0;i_id<4;i_id++){
105 if(p->towerClusterEnergy(i_id)>EN){
106 EN=p->towerClusterEnergy(i_id);
107 ID=p-> towerClusterId(i_id);
113 for(Int_t i_id=0;i_id<4;i_id++){
114 if(pp->towerClusterEnergy(i_id)>EN2){
115 EN2=p->towerClusterEnergy(i_id);
116 ID2=p-> towerClusterId(i_id);
122 h_minvPt->Fill(pTpion,minv);
124 h_minvId->Fill(ID,minv);
125 if(ID!=ID2) h_minvId->Fill(ID2,minv);
139 Bool_t GainAnalysis::isPointOK(
MyPoint *p)
142 if(p->nHitsEta()<1 && p->nHitsPhi()<1) ret=kFALSE;
147 Int_t GainAnalysis::finish()