16 #include "StEEmcIUPi0Analysis.h"
17 #include "StEEmcIUMixMaker.h"
18 #include "StEEmcIUPointMaker.h"
26 #include "SpinCutsIU.h"
27 #include "StEEmcPool/StEEmcPointMaker/EEmcSectorFit.h"
28 #include "StEEmcUtil/StEEmcSmd/EEmcSmdGeom.h"
29 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
30 #include "StEEmcPool/StRFEmcTrigger/StRFEmcTrigMaker.h"
31 #include "StEEmcPool/StEEmcA2EMaker/StEEmcA2EMaker.h"
32 #include "StMcOutputMaker.h"
40 mTrigSimThreshold = 0;
53 mBackgrounds[ kAny ] =
new SpinIUHistos(
"AnyB",
"combinatoric spectra, unsorted");
54 hPi0Mass=
new TH1F(
"hMass",
"invariant mass in windows [0.08,0.18]Gev and DeltaR<0.04",120,0.,1.2);
55 hPTvsPiNum =
new TH1F(
"ReconPt",
"Recon PT",50,0.,25. );
56 hMcEta =
new TH1F(
"McEta",
"Mc Eta",50,0.,2.5 );
57 hEEmcEta =
new TH1F(
"EEmcEta",
"EEmc Eta",50,0.,2.5 );
58 hMcPhi =
new TH1F(
"McPhi",
"Mc Phi",360,-180.,180. );
59 hMcPt =
new TH1F(
"McPt",
"Mc Pt",50,0.,25. );
60 hMcEnergy=
new TH1F(
"McEnergy",
"Mc energy for recon pi0",80,0.,80.);
61 hREtaPhi=
new TH2F(
"REEmcEtaPhi",
"Reconstructed pi0 track; Recon phi / deg;ReconEta",360,-180.,180,20,1.,2.);
62 hReconEta =
new TH1F(
"ReconEta",
"Reconstructed Eta",50,0.,2.5 );
63 hReconPhi =
new TH1F(
"ReconPhi",
"Recon Phi",360,-180.,180. );
64 hRecoEnergy =
new TH1F(
"ReconEnergy",
"Reconstructed Pi0 Energy",60,0.,60.);
65 hResoEta =
new TH1F(
"ResoEta",
"Resolution of Eta: ReconEta - EEmcEta",10,-1.,1. );
66 hResoPhi =
new TH1F(
"ResoPhi",
"Resolution of Phi: ReconPhi - McPhi",20,-20.,20. );
67 hResoPt =
new TH1F(
"ResoPt",
"Resolution of Pt",160,-4.,4. );
68 hResoEnergy=
new TH1F(
"ResoEnergy",
"Resolution of Energy",200,-10.,10.);
69 hResoPtvsG =
new TH2F(
"ResoPtvsG",
"Resolution of Pt; mcPt-ReconPt;mcPt",80,-4.,4.,250,0.,25.);
70 hResoEnergyvsG =
new TH2F(
"ResoEnergyvsG",
"Resolution of Energy; mcEnergy-ReconEnergy;mcEnergy",200,-10.,10.,80,0.,80.);
71 hRealMcPD=
new TH1F(
"RealMcdistance",
"Distance between real and MC pi0",100,0.,0.5);
72 hRealMcPR=
new TH1F(
"RRealMcdistance",
"Distance between real and MC pi0 in the EEmc detector",100,0.,0.5);
77 EventCounter=
new TH1F(
"EventCounter",
"Event counter",10,0.,10.);
78 hEventCounter=
new TH1F(
"hEventCounter",
"Event counts",10,0.,10.);
85 hPairCounter =
new TH1F(
"hPairCounter",
"Pair counts",10,0.,10.);
86 hPi0Counter =
new TH1F(
"hPi0Counter",
"Pi0 counts",10,0.,10.);
87 hFillPatternI =
new TH1F(
"hFillPatternI",
"Intended fill pattern:bunch X-ing @ STAR IP:n runs",120,0.,120.);
88 hSpin4 =
new TH1F(
"hSpin4",
"Spin 4:spin4 state",11,0.,11.);
89 hSpin4mb =
new TH1F(
"hSpin4mb",
"Spin 4:spin4 state",11,0.,11.);
90 hBx7 =
new TH1F(
"hBx7",
"7-bit bunch crossing:bx7",120,0.,120.);
91 hBx48 =
new TH1F(
"hBx48",
"48-bit bunch crossing:bx48",120,0.,120.);
92 hBx7diffBx48 =
new TH2F(
"hBx7diffBx48",
"bx1=(bx7-off7)%120, bx2=(bx48-off48)%120;bx7;bx1-bx2",120,0.,120.,21,-10.5,10.5);
93 hBxStar =
new TH1F(
"hBxStar",
"Beam x-ing at STAR IP;star bunch x-ing",120,0.,120.);
94 hBxStarPi0 =
new TH1F(
"hBxStarPi0",
"Beam x-ing at STAR IP with pi0 detected;star bunch x-ing",120,0.,120.);
95 hMassBx=
new TH2F(
"hMassBx",
"Beam x-ing vs Mass;M [GeV];STAR bunch xing",120,0.,1.2,120,0.,120.);
96 hZvertBx=
new TH2F(
"hZvertBx",
"Beam x-ing vs Z vertex [0.1,0.18]",150,-150.,150.,120,0.,120.);
97 hZggBx=
new TH2F(
"hZggBx",
"Beam x-ing vs Zgg",100,0.,1.,120,0.,120.);
98 hEtaBx=
new TH2F(
"hEtaBx",
"Beam x-ing vs eta",120,0.8,2.2,120,0.,120.);
99 DEtaMass=
new TH2F(
"DEtaMass",
"Delta Eta of the two points vs Mass of the reconstructed pi0",60,0.,0.6,20,0.,0.1);
100 DPhiMass=
new TH2F(
"DPhiMass",
"Delta Phi of the two points vs Mass of the reconstructed pi0",60,0.,0.6,20,0.,0.1);
101 dUvsdV=
new TH2D(
"dUvsdV",
"Seed distance between smd clusters; dU; dV",10,0,10,10,0,10);
102 dUvsdVGood=
new TH2D(
"dUvsdVGood",
"Good Seed distance between smd clusters; dU; dV",10,0,10,10,0,10);
103 dUvsRatio=
new TH2F(
"dUvsRatio",
"Ucluster ratio along with seed distance;dU;Ratio",20,0.,20.,10,0.,1.);
104 dVvsRatio=
new TH2F(
"dVvsRatio",
"Vcluster ratio along with seed distance;dV;Ratio",20,0.,20.,10,0.,1.);
105 dUvsRatioGood=
new TH2F(
"dUvsRatioGood",
"Good Ucluster ratio along with seed distance;dU;Ratio",20,0.,20.,10,0.,1.);
106 dVvsRatioGood=
new TH2F(
"dVvsRatioGood",
"Good Vcluster ratio along with seed distance;dV;Ratio",20,0.,20.,10,0.,1.);
107 dUVzeroE=
new TH1F(
"dUVzeroE",
"Pi0 energy with dU or dV=0",60,0.,60);
108 dUVzeroEta=
new TH1F(
"dUVzeroEta",
"Pi0 Eta with dU or dV=0",20,1.,2.);
109 GoodPiGeo=
new TH2F(
"GoodPiGeo",
"Pi0 distribution in EEMC with mass range [0.08,0.18]Gev;x;y",120,-240.,240.,120,-240.,240.);
110 GoodPiPt=
new TH1F(
"GoodPiPt",
"Recon PT",50,0.,25.);
113 mRealTree=
new TTree(
"mRealTree",
"Real Events");
114 mRealTree->Branch(
"MixEvent",
"StEEmcIUMixEvent",&mRealEvent);
115 mMixedTree=
new TTree(
"mMixedTree",
"Mixed Events");
116 mMixedTree->Branch(
"MixEvent",
"StEEmcIUMixEvent",&mMixedEvent);
118 AddObj( mRealTree,
".hist" );
119 AddObj( mMixedTree,
".hist" );
121 return StMaker::Init();
128 Info(
"InitRun",
"run number = %d",run);
130 for(
int bx=0;bx<120;bx++){
131 Bool_t isFilled=(spin8bits[bx] & 0x11)==0x11;
137 return StMaker::InitRun(run);
145 EventCounter->Fill(0.,1.);
155 mRealEvent -> setSpin4( spin4 );
157 mMixedEvent -> setSpin4( spin4 );
159 for ( Int_t ii=0;ii<720;ii++ ) {
161 if ( tower.
fail() )
continue;
162 mRealEvent->
mADC[ii]=(60./4096.)*tower.
adc();
163 mRealEvent->mStat[ii]=tower.
stat();
170 EventCounter->Fill(2.,1.);
175 static Int_t mymap[]={0,0,0,0,0,1,2,0,0,3,4};
178 mRealEvent -> mTotalEnergyT =
mEEanalysis -> energy(0);
179 mRealEvent -> mTotalEnergyP =
mEEanalysis -> energy(1);
180 mRealEvent -> mTotalEnergyQ =
mEEanalysis -> energy(2);
181 mRealEvent -> mTotalEnergyR =
mEEanalysis -> energy(3);
182 mRealEvent -> mTotalEnergyU =
mEEanalysis -> energy(4);
183 mRealEvent -> mTotalEnergyV =
mEEanalysis -> energy(5);
197 if ( !
accept( pair ) )
continue;
199 mRealEvent -> addPair( pair );
210 TVector3 point1pos=point1.
position();
211 TVector3 point2pos=point2.
position();
212 float deta=fabs(point1pos.Eta()-point2pos.Eta());
213 float dphi=fabs(point1pos.Phi()-point2pos.Phi());
214 DEtaMass->Fill(pair.
mass(),deta);
215 DPhiMass->Fill(pair.
mass(),dphi);
218 float hHeight=pair.
pt()*(270.0-pair.
vertex().Z())/pair.pz()+Rxy;
219 float etatheta=TMath::ATan(hHeight/270.0);
221 float mideta=tan(etatheta/2.0);
222 float eemceta=-log(mideta);
223 hEEmcEta->Fill(eemceta);
229 float dU=abs(point1.
cluster(0).strip(0).index()-point2.
cluster(0).strip(0).index());
230 float dV=abs(point1.
cluster(1).strip(0).index()-point2.
cluster(1).strip(0).index());
231 if(pair.
mass()<0.06) {
236 dUVzeroE->Fill(pair.
energy());
237 dUVzeroEta->Fill(pair.
momentum().Eta());
241 dVvsRatio->Fill(dV,EsmallV/ElargeV);
245 dUvsRatio->Fill(dU,EsmallU/ElargeU);
248 if(pair.
mass()>=0.08 && pair.
mass()<=0.18){
252 TVector3 pp = (e1*point1pos + e2*point2pos) * ( 1/(e1+e2) );
253 GoodPiGeo->Fill(pp.X(),pp.Y());
254 GoodPiPt->Fill(pair.
pt());
255 dUvsdVGood->Fill(dU,dV);
259 dVvsRatioGood->Fill(dV,EsmallV/ElargeV);
264 dUvsRatioGood->Fill(dU,EsmallU/ElargeU);
278 if(pair.
mass()>=0.08 && pair.
mass()<=0.18)
287 size=mkMc->gTr.size();
291 for ( Int_t j=0;j<size;j++ )
294 float eemceta=mkMc->geemcEta[j];
296 float etaMc=p4.pseudoRapidity();
297 float phiMc=p4.phi();
300 float deltaphi=fabs(rPhi-phiMc);
301 if(deltaphi>=3.14159265)
302 {deltaphi=6.283-deltaphi;}
303 float deltaeta=rEta-etaMc;
304 float Rdeltaeta=rEta-eemceta;
305 float deltad=TMath::Sqrt(deltaphi*deltaphi+deltaeta*deltaeta);
306 float deltaR=TMath::Sqrt(deltaphi*deltaphi+Rdeltaeta*Rdeltaeta);
317 hRealMcPD->Fill(minD);
318 hRealMcPR->Fill(minR);
319 for ( Int_t j=0;j<size;j++ )
322 float eemceta=mkMc->geemcEta[j];
325 float etaMc=p4.pseudoRapidity();
327 float phiMc=p4.phi();
329 float ptMc=p4.perp();
330 float energyMc=p4.e();
332 float deltaphi=fabs(rPhi-phiMc);
333 if(deltaphi>=3.14159265)
334 {deltaphi=6.283-deltaphi;}
335 float deltaeta=rEta-etaMc;
336 float Rdeltaeta=rEta-eemceta;
337 float deltad=TMath::Sqrt(deltaphi*deltaphi+deltaeta*deltaeta);
338 float deltaR=TMath::Sqrt(deltaphi*deltaphi+Rdeltaeta*Rdeltaeta);
345 hPi0Mass->Fill(pair.
mass());
346 hPTvsPiNum->Fill(rPt);
347 hREtaPhi->Fill(rPhi/3.1416*180,rEta);
348 hReconEta->Fill(rEta);
349 hReconPhi->Fill(rPhi/3.1416*180);
350 hRecoEnergy->Fill(rE);
353 hEEmcEta->Fill(eemceta);
354 hMcPhi->Fill(phiMc/3.1416*180);
356 hResoPt->Fill(rPt-ptMc);
357 hResoPtvsG->Fill(rPt-ptMc,ptMc);
358 hResoEta->Fill(rEta-etaMc);
359 hResoPhi->Fill((rPhi-phiMc)/3.1416*180);
360 hMcEnergy->Fill(energyMc);
361 hResoEnergyvsG->Fill(rE-energyMc,energyMc);
362 hResoEnergy->Fill(rE-energyMc);
379 std::cout <<
"Problem detected, spin sorting disabled" << std::endl;
385 if ( mymap[spin4] ) {
390 if ( pair.
mass()>0.1 && pair.
mass() < 0.18 ) {
399 hPi0Counter->Fill(numoacceptedpair);
407 if ( !
accept( pair,
false ) )
continue;
408 mBackgrounds[ kAny ] -> Fill( pair );
409 mMixedEvent -> addPair( pair );
455 static const Int_t maxPerCluster = 4;
456 static const Float_t minTowerFrac = 0.;
460 Bool_t towers[720];
for (Int_t i=0;i<720;i++ ) towers[i]=
false;
468 towers[ t1.
index() ] =
true;
469 towers[ t2.
index() ] =
true;
473 towers[ mytow.
index() ] =
true;
474 Etowers += mytow.
energy();
478 if ( !towers[mytow.
index()] ) Etowers += mytow.
energy();
479 towers[ mytow.
index() ] =
true;
492 Float_t min2=(pe1<=pe2)?pe1:pe2;
500 if ( towers[ t.
index() ] ){
510 Float_t Epoints = pair.
energy();
512 return ( count <= maxPerCluster && Most2E && Epoints > minTowerFrac * Etowers );
525 Bool_t good_trigger =
false;
542 go = l1trig.isTrigger( (*iter) );
554 good_trigger =
mTrigSim -> getEEMCtrigHT( mTrigSimThreshold );
555 good_trigger &=
mTrigSim -> getBBCtrig();
582 if ( !t.
fail() && t.
et() > ht.
et() ) {
584 if ( ht.
et()>=mCuts->tower_et_cut &&
589 if ( ht.
et() < mCuts->tower_et_cut ) {
590 good_trigger =
false;
602 if ( vert.z() < mCuts->z_vertex_min) {
606 if ( vert.z() > mCuts->z_vertex_max ) {
629 TVector3 pointpos1=point1.
position();
630 TVector3 pointpos2=point2.
position();
631 Float_t peta1=pointpos1.Eta();
632 Float_t peta2=pointpos2.Eta();
633 Float_t pphi1=pointpos1.Phi();
634 Float_t pphi2=pointpos2.Phi();
635 Int_t mod_phi1=int(pphi1*180./3.14159265+180.)%6;
636 Int_t mod_phi2=int(pphi2*180./3.14159265+180.)%6;
637 pointpos1=pointpos1.Unit();
638 pointpos2=pointpos2.Unit();
640 Float_t pet1 = (point1.
energy()*pointpos1).Perp();
641 Float_t pet2 = (point2.
energy()*pointpos2).Perp();
644 if(pet1<=1.5 || pet2<=1.5)
return false;
646 if ( tower1.
adc() < mCuts->adc_cut && tower2.
adc() < mCuts->adc_cut )
return false;
657 TVector3 dd1(d1.x(),d1.y(),d1.z()-pair.
vertex().z());
658 TVector3 dd2(d2.x(),d2.y(),d2.z()-pair.
vertex().z());
667 Float_t et11 = (tower1.
energy()*dd1).Perp();
668 Float_t et22 = (tower2.
energy()*dd2).Perp();
671 Float_t ueta1,ueta2,tower_et_cut1=3,tower_et_cut2=3;
672 if(peta1>=1.901 && peta1<=2) ueta1=1.932;
673 if(peta1>=1.807 && peta1<1.901) ueta1=1.845;
674 if(peta1>=1.718 && peta1<1.807) ueta1=1.761;
675 if(peta1>=1.633 && peta1<1.718) ueta1=1.664;
676 if(peta1>=1.552 && peta1<1.633) ueta1=1.585;
677 if(peta1>=1.476 && peta1<1.552) ueta1=1.507;
678 if(peta1>=1.403 && peta1<1.476) ueta1=1.4374;
679 if(peta1>=1.334 && peta1<1.403) ueta1=1.36;
680 if(peta1>=1.268 && peta1<1.334) ueta1=1.294;
681 if(peta1>=1.205 && peta1<1.268) ueta1=1.2315;
682 if(peta1>=1.146 && peta1<1.205) ueta1=1.174;
683 if(peta1>=1.089 && peta1<1.146) ueta1=1.1265;
685 if(peta2>=1.901 && peta2<=2) ueta2=1.932;
686 if(peta2>=1.807 && peta2<1.901) ueta2=1.845;
687 if(peta2>=1.718 && peta2<1.807) ueta2=1.761;
688 if(peta2>=1.633 && peta2<1.718) ueta2=1.664;
689 if(peta2>=1.552 && peta2<1.633) ueta2=1.585;
690 if(peta2>=1.476 && peta2<1.552) ueta2=1.507;
691 if(peta2>=1.403 && peta2<1.476) ueta2=1.4374;
692 if(peta2>=1.334 && peta2<1.403) ueta2=1.36;
693 if(peta2>=1.268 && peta2<1.334) ueta2=1.294;
694 if(peta2>=1.205 && peta2<1.268) ueta2=1.2315;
695 if(peta2>=1.146 && peta2<1.205) ueta2=1.174;
696 if(peta2>=1.089 && peta2<1.146) ueta2=1.1265;
697 float toweretcut=mCuts->tower_et_cut;
698 tower_et_cut1=toweretcut*(exp(-0.5*((peta1-ueta1)*(peta1-ueta1)/pow(0.035,2)+(mod_phi1-0.0)*(mod_phi1-0.0)/pow(2.3,2))));
699 tower_et_cut2=toweretcut*(exp(-0.5*((peta2-ueta2)*(peta2-ueta2)/pow(0.035,2)+(mod_phi2-0.0)*(mod_phi2-0.0)/pow(2.3,2))));
701 if ( et11 < tower_et_cut1 && et22 < tower_et_cut2 )
return false;
710 float hHeight=pair.
pt()*(270.0-pair.
vertex().Z())/pair.pz()+Rxy;
711 float etatheta=TMath::ATan(hHeight/270.0);
713 float mideta=tan(etatheta/2.0);
714 float eta=-log(mideta);
715 if ( eta < mCuts->eta_min || eta > mCuts->eta_max )
return false;
738 Int_t bx48 = trig->bunchCrossingId();
739 Int_t bx7 = trig->bunchCrossingId7bit( mRunNumber );
744 mRealEvent->bx48 = bx48;
745 mRealEvent->bx7 = bx7;
746 mRealEvent->bxStar = bxStar;
748 mMixedEvent->bx48=bx48;
749 mMixedEvent->bx7 =bx7;
750 mMixedEvent->bxStar=bxStar;
754 if ( bx7 == 0 || bx7 == 119 )
return -1;
755 if ( bx7 == 14 || bx7 == 54 )
return -1;
764 if (
mSpinDb -> isMaskedUsingBX48(bx48) )
return -1;
765 if (
mSpinDb->offsetBX48minusBX7(bx48,bx7)!=0 ) std::cout <<
"BUNCH CROSSINGS INCONSISTENT" << std::endl;
770 if (
mSpinDb->offsetBX48minusBX7(bx48,bx7)!=0 )
780 if ( l1trig.isTrigger(96011) )
hSpin4mb -> Fill(spin4);
789 mRealEvent ->
Clear();
790 mMixedEvent ->
Clear();
void spin(const Char_t *name)
specifies the name of the spin db maker
StEEmcIUPointMaker * mEEpoints
pointer to the point maker
void points(const Char_t *name)
specifies the name of the point maker
StEEmcIUPair candidate(Int_t c)
Return a specified candidate pair.
Int_t numberOfNeighbors() const
get the number of neighboring towers
EEmc ADC –> energy maker.
void stat(unsigned s)
Set a status bit for this element.
StEEmcA2EMaker * mEEanalysis
pointer to analysis maker
A class for mixing pi0 candidates.
Int_t numberOfMixedCandidates()
returns the number of mixed-background candidates
Float_t pt()
Returns pt of pair.
StEEmcTower & hittower(Int_t hit, Int_t layer)
StSpinDbMaker * mSpinDb
pointer to the spin database
TVector3 vertex()
Returns vertex of pair.
void neighbor(StEEmcTower *n)
add a tower to list of neighbors
SpinIUHistos * mHistograms[5]
Spin-sorted pi0 histograms.
void energy(Float_t e, Int_t layer=0)
Set the energy of this point.
void analysis(const Char_t *name)
specifies the name of the analysis maker
Bool_t accept(StMuDst *mu)
method to cut events
A maker for creating pi0 histograms \Weihong He The StEEmcIUPi0Analysis takes as input the list of pi...
void position(TVector3 p)
Set the position of this point at the SMD plane.
void mudst(const Char_t *name)
specifies the name of the mudst maker
int spin4usingBX48(int bx48)
8bit spin information
Class for building points from smd clusters.
TH1F * hPairCounter
histogram to keep track of where candidates get cut
Monte Carlo Track class All information on a simulated track is stored in this class: kinematics...
Int_t Make()
processes a single event
Int_t numberOfPoints()
Return number of points.
Int_t InitRun(Int_t)
init run
Int_t numberOfCandidates()
returns the number of candidates
void Clear(Option_t *opts="")
clears the maker
Int_t numberOfHitTowers(Int_t layer) const
Int_t etabin() const
Returns the etabin of this tower, pre- or postshower element.
Int_t getSpinState(StMuDst *mu, Int_t &bxs)
method to retrieve 4bit spin state
void fail(unsigned f)
Set a fail bit for this element.
TH1F * hEventCounter
histogram to keep track of where events get cut
StRFEmcTrigMaker * mTrigSim
Trigger simulation for MC.
void mixer(const Char_t *name)
Int_t subsector() const
Returns subsector of this tower, pre- or postshower element.
StMuDstMaker * mMuDst
pointer to mudst
void cluster(StEEmcIUSmdCluster c, Int_t plane)
Add an smd cluster to this point.
Base class for representing tower, preshower and postshower elements.
Float_t mass()
Returns invariant mass of pair.
void print(int level=0)
vs. STAR==yellow bXing
Int_t sector() const
Returns sector of this tower, pre- or postshower element.
Float_t energy()
Returns energy of pair.
int BXyellowUsingBX48(int bx48)
4bit spin information
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
StEEmcIUPoint point(Int_t ipoint)
Return a specified point.
Base class for representing EEMC points.
StEEmcIUPi0Analysis(const Char_t *name)
constructor
StEEmcIUMixMaker * mEEmixer
Pointer to the pi0 mixer.
void adc(Float_t a)
Set the pedestal-subtracted ADC for this element.
StEEmcIUPoint point(Int_t index)
void tower(StEEmcTower t, Float_t w=1.)
Add a tower with specified weight to the point.
EEmcGeomSimple * mEEgeom
EEMC tower geometry.
StEEmcTower & tower(Int_t index, Int_t layer=0)
const int * getSpin8bits()
experts only
Spin sorted pi0 histograms.
Bool_t twoBodyCut(StEEmcIUPair &p)
StEEmcIUPair mixedCandidate(Int_t m)
Returns the specified mixed candidate pair.
Int_t Init()
initializes the maker
void energy(Float_t e)
Set the energy (adc-ped+0.5)/gain for this element.
TVector3 momentum()
Returns momentum of pair.
Collection of trigger ids as stored in MuDst.
Float_t zgg()
Returns energy-sharing of pair.
std::vector< Int_t > mTriggerList