6 #include "StEmcUtil/geometry/StEmcGeom.h"
7 #include "WeventDisplay.h"
8 #include "StSpinPool/StJets/StJet.h"
9 #include "StSpinPool/StJets/TowerToJetIndex.h"
12 #include <StMuDSTMaker/COMMON/StMuDstMaker.h>
13 #include <StMuDSTMaker/COMMON/StMuDst.h>
14 #include <StMuDSTMaker/COMMON/StMuEvent.h>
16 #include "St2009WMaker.h"
21 St2009WMaker::find_W_boson(){
29 for(
unsigned int iv=0;iv<wEve.vertex.size();iv++) {
31 for(
unsigned int it=0;it<V.eleTrack.size();it++) {
33 if(T.isMatch2Cl==
false)
continue;
34 assert(T.cluster.nTower>0);
35 assert(T.nearTotET>0);
38 if(fabs(T.primP.Eta()) > par_leptonEta)
continue;
39 hA[0]->Fill(
"eta1",1.);
42 if(T.cluster.ET/T.nearTotET_noEEMC>par_nearTotEtFrac){
43 if(T.awayTotET_noEEMC < 8)
44 hA[141]->Fill(T.cluster.ET);
45 if(T.sPtBalance_noEEMC>par_ptBalance ) {
46 hA[140]->Fill(T.cluster.ET);
47 if (T.prMuTrack->
charge() < 0) {
48 hA[184+3]->Fill(T.cluster.ET);
49 hA[200+3]->Fill(T.primP.Eta(),T.cluster.ET);
50 hA[280+3]->Fill(abs(T.primP.Eta()),T.cluster.ET);
51 }
else if (T.prMuTrack->
charge() > 0) {
52 hA[184+4]->Fill(T.cluster.ET);
53 hA[200+4]->Fill(T.primP.Eta(),T.cluster.ET);
54 hA[280+4]->Fill(abs(T.primP.Eta()),T.cluster.ET);
59 if(T.cluster.ET /T.nearTotET< par_nearTotEtFrac)
continue;
61 hA[20]->Fill(
"noNear",1.);
62 hA[113]->Fill( T.cluster.ET);
63 hA[50]->Fill(T.awayTpcPT);
64 hA[51]->Fill(T.awayBtowET);
65 hA[54]->Fill(T.awayTotET);
66 hA[52]->Fill(T.cluster.ET,T.awayTotET);
67 hA[53]->Fill(T.cluster.ET,T.awayEmcET);
68 hA[55]->Fill(T.awayEtowET);
69 hA[60]->Fill(T.cluster.ET,T.awayTpcPT);
71 hA[132]->Fill(T.cluster.ET,T.ptBalance.Perp());
72 hA[133]->Fill(T.awayTotET,T.ptBalance.Perp());
73 hA[134]->Fill(T.cluster.ET,T.sPtBalance);
74 hA[135]->Fill(T.awayTotET,T.sPtBalance);
78 for (
int j=0; j<=20; j++) {
79 float pTBal_cut = 5.+((float) j);
80 if (T.sPtBalance<pTBal_cut) {
81 if (T.prMuTrack->
charge() < 0) {
82 hA[142+i]->Fill(T.cluster.ET,j);
83 hA[210+j]->Fill(T.primP.Eta(),T.cluster.ET);
84 hA[290+j]->Fill(abs(T.primP.Eta()),T.cluster.ET);
85 }
else if (T.prMuTrack->
charge() > 0) {
86 hA[163+i]->Fill(T.cluster.ET,j);
87 hA[231+j]->Fill(T.primP.Eta(),T.cluster.ET);
88 hA[311+j]->Fill(abs(T.primP.Eta()),T.cluster.ET);
94 if(T.sPtBalance>par_ptBalance ) {
95 hA[136]->Fill(T.cluster.ET);
96 hA[62]->Fill(T.pointTower.iEta ,T.cluster.energy);
97 if (T.prMuTrack->
charge() < 0) {
98 hA[184+1]->Fill(T.cluster.ET);
99 hA[200+1]->Fill(T.primP.Eta(),T.cluster.ET);
100 hA[280+1]->Fill(abs(T.primP.Eta()),T.cluster.ET);
101 }
else if (T.prMuTrack->
charge() > 0) {
102 hA[184+2]->Fill(T.cluster.ET);
103 hA[200+2]->Fill(T.primP.Eta(),T.cluster.ET);
104 hA[280+2]->Fill(abs(T.primP.Eta()),T.cluster.ET);
107 hA[137]->Fill(T.cluster.ET);
108 if (T.prMuTrack->
charge() < 0) {
109 hA[184+5]->Fill(T.cluster.ET);
110 hA[200+5]->Fill(T.primP.Eta(),T.cluster.ET);
111 hA[280+5]->Fill(abs(T.primP.Eta()),T.cluster.ET);
112 }
else if (T.prMuTrack->
charge() > 0) {
113 hA[184+6]->Fill(T.cluster.ET);
114 hA[200+6]->Fill(T.primP.Eta(),T.cluster.ET);
115 hA[280+6]->Fill(abs(T.primP.Eta()),T.cluster.ET);
121 hA[138]->Fill(T.cluster.ET);
123 hA[139]->Fill(T.cluster.ET);
126 printf(
"\n WWWWWWWWWWWWWWWWWWWWW\n");
127 wDisaply->exportEvent(
"W", V, T);
133 if(T.sPtBalance<par_ptBalance)
continue;
139 hA[20]->Fill(
"noAway",1.0);
140 hA[114]->Fill( T.cluster.ET);
142 hA[90]->Fill( T.cluster.ET);
143 hA[92]->Fill( T.cluster.ET,T.glMuTrack->
dEdx()*1e6);
144 hA[93]->Fill( T.cluster.ET,T.glMuTrack->
dca().mag());
145 int k=0;
if(T.prMuTrack->
charge()<0) k=1;
146 hA[94+k]->Fill( T.cluster.ET,T.glMuTrack->
dcaD());
150 if(T.cluster.ET<par_highET)
continue;
151 hA[91]->Fill(T.cluster.position.PseudoRapidity(),T.cluster.position.Phi());
153 hA[97]->Fill(V.funnyRank);
155 hA[99]->Fill( T.prMuTrack->
eta());
156 hA[20]->Fill(
"goldW",1.);
160 float zdcRate=mMuDstMaker->
muDst()->
event()->runInfo().zdcCoincidenceRate();
161 hA[260]->Fill(zdcRate,wEve.bx7);
162 hA[261]->Fill(zdcRate,wEve.vertex.size());
163 hA[262]->Fill(zdcRate,T.prMuTrack->
nHitsFit());
165 hA[263]->Fill(zdcRate,hitFrac);
168 hA[266]->Fill(zdcRate,T.prMuTrack->
pt());
170 hA[268]->Fill(zdcRate,1./T.prMuTrack->
pt());
171 hA[269]->Fill(zdcRate,T.glMuTrack->
dca().mag());
172 hA[270]->Fill(zdcRate,T.glMuTrack->
dcaD());
173 hA[271]->Fill(zdcRate,T.glMuTrack->
dcaZ());
176 hA[272]->Fill(zdcRate,T.glMuTrack->
pt());
177 hA[273]->Fill(zdcRate,1./T.glMuTrack->
pt());
183 hA[0]->Fill(
"goldW",1.);
191 St2009WMaker::tag_Z_boson(){
194 float lowMass=70.;
float highMass=140.;
195 mJets = getJets(
"ConeJets12_100");
198 for(
unsigned int iv=0;iv<wEve.vertex.size();iv++) {
200 for(
unsigned int it=0;it<V.eleTrack.size();it++) {
202 if(T1.isMatch2Cl==
false)
continue;
203 assert(T1.cluster.nTower>0);
204 assert(T1.nearTotET>0);
205 if(T1.cluster.ET/T1.nearTotET< par_nearTotEtFrac)
continue;
208 TLorentzVector jetVec;
209 for (
int i_jet=0; i_jet< nJets; i_jet++){
210 jetVec = *((
StJet*)mJets->At(i_jet));
211 if(jetVec.Pt()<par_jetPt)
continue;
214 StJet* jet = getJet(i_jet);
float maxCluster=0.;
216 for(
int itow=0;itow<totTowers;itow++){
217 if(jet->tower(itow)->detectorId()==13)
220 int softId=jet->tower(itow)->towerId();
222 TVector3 pos=positionBtow[softId-1];
int iEta,iPhi;
223 if( L2algoEtaPhi2IJ(pos.Eta(),pos.Phi(),iEta,iPhi))
225 float cluster=maxBtow2x2(iEta,iPhi,jet->
zVertex).ET;
226 if(cluster>maxCluster) maxCluster=cluster;
229 TVector3 jetVec3(jetVec.X(),jetVec.Y(),jetVec.Z());
230 if(jetVec3.DeltaR(T1.primP)<par_nearDeltaR)
234 float e1=T1.cluster.energy;
235 TVector3 p1=T1.primP; p1.SetMag(e1);
236 TLorentzVector ele1(p1,e1);
237 TLorentzVector sum=ele1+jetVec;
238 float invM=sqrt(sum*sum);
239 if(maxCluster/jet->
jetPt < 0.5)
continue;
240 if(invM > lowMass && invM < highMass)
251 St2009WMaker::findPtBalance(){
253 for(
unsigned int iv=0;iv<wEve.vertex.size();iv++) {
255 for(
unsigned int it=0;it<V.eleTrack.size();it++) {
257 if(T.isMatch2Cl==
false)
continue;
260 mJets = getJets(mJetTreeBranch);
262 for (
int i_jet=0; i_jet< nJetsWE; i_jet++){
263 StJet* jet = getJet(i_jet);
266 float neutral=jet->neutralFraction()*jet->Pt();
267 float charged=jet->chargedFraction()*jet->Pt();
268 neutral=neutral*par_mcJetNeutScale;
269 charged=charged*par_mcJetChrgScale;
270 float sum=neutral+charged;
271 jetVec.SetPtEtaPhi(sum,jet->Eta(),jet->Phi());
272 if(jetVec.DeltaR(T.primP) > par_nearDeltaR)
275 TVector3 clustPt(T.primP.X(),T.primP.Y(),0);
276 clustPt.SetMag(T.cluster.ET);
277 T.ptBalance+=clustPt;
278 T.sPtBalance = T.ptBalance.Perp();
279 if(T.ptBalance.Dot(clustPt)<0) T.sPtBalance *=-1.;
282 mJets = getJets(mJetTreeBranch_noEEMC);
285 for (
int i_jet=0; i_jet< nJetsNE; i_jet++){
286 StJet* jet = getJet(i_jet);
289 float neutral=jet->neutralFraction()*jet->Pt();
290 float charged=jet->chargedFraction()*jet->Pt();
291 neutral=neutral*par_mcJetNeutScale;
292 charged=charged*par_mcJetChrgScale;
293 float sum=neutral+charged;
294 jetVec.SetPtEtaPhi(sum,jet->Eta(),jet->Phi());
295 if(jetVec.DeltaR(T.primP) > par_nearDeltaR)
296 T.ptBalance_noEEMC+=jetVec;
298 T.ptBalance_noEEMC+=clustPt;
299 T.sPtBalance_noEEMC = T.ptBalance_noEEMC.Perp();
300 if(T.ptBalance_noEEMC.Dot(clustPt)<0) T.sPtBalance_noEEMC *=-1.;
311 St2009WMaker::findAwayJet(){
314 for(
unsigned int iv=0;iv<wEve.vertex.size();iv++) {
316 for(
unsigned int it=0;it<V.eleTrack.size();it++) {
318 if(T.isMatch2Cl==
false)
continue;
321 T.awayBtowET=sumBtowCone(V.z,-T.primP,1,T.awayNTow);
322 T.awayEmcET=T.awayBtowET;
323 T.awayEtowET=sumEtowCone(V.z,-T.primP,1,T.awayNTow);
324 if(par_useEtow >= 2) T.awayEmcET+=T.awayEtowET;
327 T.awayTpcPT=sumTpcCone(V.id,-T.primP,1,T.awayNTr);
328 T.awayTotET=T.awayEmcET+T.awayTpcPT;
329 T.awayTotET_noEEMC=T.awayBtowET+T.awayTpcPT;
338 St2009WMaker::findNearJet(){
341 for(
unsigned int iv=0;iv<wEve.vertex.size();iv++) {
343 for(
unsigned int it=0;it<V.eleTrack.size();it++) {
345 if(T.isMatch2Cl==
false)
continue;
348 T.nearBtowET=sumBtowCone(V.z,T.primP,2,T.nearNTow);
349 T.nearEmcET+=T.nearBtowET;
350 T.nearEtowET=sumEtowCone(V.z,T.primP,2,T.nearNTow);
351 if(par_useEtow >= 3) T.nearEmcET+=T.nearEtowET;
353 T.nearTpcPT=sumTpcCone(V.id,T.primP,2,T.nearNTr);
354 hA[47]->Fill(T.nearTpcPT);
355 hA[48]->Fill(T.nearEmcET,T.nearTpcPT);
356 float nearSum=T.nearEmcET+T.nearTpcPT;
360 if(T.primP.Pt()>par_trackPt) nearSum-=par_trackPt;
361 else nearSum-=T.primP.Pt();
363 T.nearTotET_noEEMC=nearSum-T.nearEtowET;
365 hA[49]->Fill(nearSum);
368 hA[40]->Fill( T.nearEmcET);
369 hA[41]->Fill( T.cluster.ET,T.nearEmcET-T.cluster.ET);
370 float nearTotETfrac=T.cluster.ET/ T.nearTotET;
371 hA[42]->Fill(nearTotETfrac);
372 hA[192]->Fill(T.cluster.ET,nearTotETfrac);
384 St2009WMaker::matchTrack2Cluster(){
388 float Rcylinder= mBtowGeom->Radius();
389 for(
unsigned int iv=0;iv<wEve.vertex.size();iv++) {
392 for(
unsigned int it=0;it<V.eleTrack.size();it++) {
395 if(T.pointTower.id==0)
continue;
397 float trackPT=T.prMuTrack->
momentum().perp();
398 T.cluster=maxBtow2x2( T.pointTower.iEta, T.pointTower.iPhi,zVert);
399 hA[33]->Fill( T.cluster.ET);
400 hA[34]->Fill(T.cluster.adcSum,trackPT);
401 hA[110]->Fill( T.cluster.ET);
402 if (T.cluster.ET <par_clustET)
continue;
403 hA[20]->Fill(
"CL",1.);
406 TVector3 D=T.pointTower.R-T.cluster.position;
407 hA[43]->Fill( T.cluster.energy,D.Mag());
408 hA[44]->Fill( T.cluster.position.z(),D.z());
409 float delPhi=T.pointTower.R.DeltaPhi(T.cluster.position);
411 hA[45]->Fill( T.cluster.energy,Rcylinder*delPhi);
412 hA[46]->Fill( D.Mag());
414 if(D.Mag()>par_delR3D)
continue;
415 hA[20]->Fill(
"#Delta R",1.);
416 hA[111]->Fill( T.cluster.ET);
419 int iEta=T.cluster.iEta;
420 int iPhi=T.cluster.iPhi;
421 T.cl4x4=sumBtowPatch(iEta-1,iPhi-1,4,4,zVert);
422 hA[37]->Fill( T.cl4x4.ET);
423 hA[38]->Fill(T.cluster.energy, T.cl4x4.energy-T.cluster.energy);
426 T.smallNearTpcPT=sumTpcCone(V.id,T.primP,3,T.smallNearNTr);
427 hA[56]->Fill(T.smallNearTpcPT);
428 T.smallNearTpcPT-=par_trackPt;
430 float frac24=T.cluster.ET/(T.cl4x4.ET);
431 hA[39]->Fill(frac24);
432 hA[191]->Fill(T.cluster.ET,frac24);
433 if(frac24<par_clustFrac24)
continue;
436 hA[20]->Fill(
"fr24",1.);
437 hA[112]->Fill( T.cluster.ET);
443 if(nTr<=0)
return -1;
444 hA[0]->Fill(
"Tr2Cl",1.0);
452 St2009WMaker::maxBtow2x2(
int iEta,
int iPhi,
float zVert){
461 for(
int I=I0;I<=I0+1;I++){
462 for(
int J=J0;J<=J0+1;J++) {
464 if(maxET>CL.ET)
continue;
478 St2009WMaker::sumBtowPatch(
int iEta,
int iPhi,
int Leta,
int Lphi,
float zVert){
485 float Rcylinder= mBtowGeom->Radius(), Rcylinder2=Rcylinder*Rcylinder;
486 for(
int i=iEta; i<iEta+Leta;i++){
488 if(i>=mxBTetaBin)
continue;
489 for(
int j=iPhi;j<iPhi+Lphi;j++) {
490 int jj=(j+mxBTphiBin)%mxBTphiBin;
492 int softID= mapBtowIJ2ID[ i+ jj*mxBTetaBin];
493 float ene= wEve.bemc.eneTile[kBTow][softID-1];
495 float adc= wEve.bemc.adcTile[kBTow][softID-1];
496 float delZ=positionBtow[softID-1].z()-zVert;
497 float e2et=Rcylinder/sqrt(Rcylinder2+delZ*delZ);
499 float logET=log10(ET+0.5);
505 R+=logET*positionBtow[softID-1];
512 CL.position=1./sumW*R;
514 CL.position=TVector3(0,0,999);
523 St2009WMaker::extendTrack2Barrel(){
527 for(
unsigned int iv=0;iv<wEve.vertex.size();iv++) {
529 for(
unsigned int it=0;it<V.eleTrack.size();it++) {
533 float Rcylinder= mBtowGeom->Radius();
540 if(d2.first>=0 || d2.second<=0) {
541 LOG_WARN<< Form(
"MatchTrk , unexpected solution for track crossing CTB\n d2.firts=%f, second=%f, swap them", d2.first, d2.second)<<endm;
551 float etaF=posR.pseudoRapidity();
552 float phiF=posR.phi();
554 if( L2algoEtaPhi2IJ(etaF, phiF,iEta,iPhi))
continue;
556 hA[20]->Fill(
"@B",1.);
558 int twID= mapBtowIJ2ID[ iEta+ iPhi*mxBTetaBin];
561 T.pointTower.id=twID;
562 T.pointTower.R=TVector3(posR.x(),posR.y(),posR.z());
563 T.pointTower.iEta=iEta;
564 T.pointTower.iPhi=iPhi;
568 if(nTrB<=0)
return -1;
569 hA[0]->Fill(
"TrB",1.0);
579 St2009WMaker::sumBtowCone(
float zVert, TVector3 refAxis,
int flag,
int &nTow){
581 assert(flag==1 || flag==2);
585 for(
int i=0;i< mxBtow;i++) {
586 float ene=wEve.bemc.eneTile[kBTow][i];
588 TVector3 primP=positionBtow[i]-TVector3(0,0,zVert);
591 float deltaPhi=refAxis.DeltaPhi(primP);
592 if(fabs(deltaPhi)> par_awayDeltaPhi)
continue;
595 float deltaR=refAxis.DeltaR(primP);
596 if(deltaR> par_nearDeltaR)
continue;
598 if(primP.Perp()>par_countTowEt) nTow++;
609 St2009WMaker::sumEtowCone(
float zVert, TVector3 refAxis,
int flag,
int &nTow){
611 assert(flag==1 || flag==2);
616 for(
int iphi=0; iphi<mxEtowPhiBin; iphi++){
617 for(
int ieta=0; ieta<mxEtowEta; ieta++){
618 float ene=wEve.etow.ene[iphi][ieta];
620 TVector3 primP=positionEtow[iphi][ieta]-TVector3(0,0,zVert);
623 float deltaPhi=refAxis.DeltaPhi(primP);
624 if(fabs(deltaPhi)> par_awayDeltaPhi)
continue;
627 float deltaR=refAxis.DeltaR(primP);
628 if(deltaR> par_nearDeltaR)
continue;
630 if(primP.Perp()>par_countTowEt) nTow++;
Double_t pt() const
Returns pT at point of dca to primary vertex.
Float_t dcaZ(Int_t vtx_id=-1) const
Z component of global DCA.
Double_t chi2() const
Returns chi2 of fit.
float jetPt
Pt (stored for convenience when drawing TTree)
float zVertex
position of vertex used to reconstruct jet
pair< double, double > pathLength(double r) const
path length at given r (cylindrical r)
UShort_t nHitsFit() const
Return total number of hits used in fit.
int nBtowers
The number of Barrel towers in this jet.
Short_t charge() const
Returns charge.
Double_t eta() const
Returns pseudo rapidity at point of dca to primary vertex.
const StThreeVectorF & firstPoint() const
Returns positions of first measured point.
UShort_t nHitsPoss() const
Return number of possible hits on track.
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
const StThreeVectorF & momentum() const
Returns 3-momentum at dca to primary vertex.
StThreeVectorF dca(Int_t vtx_id=-1) const
Returns 3D distance of closest approach to primary vertex.
const StThreeVectorF & lastPoint() const
Returns positions of last measured point.
Double_t dEdx() const
Returns measured dE/dx value.
Float_t dcaD(Int_t vtx_id=-1) const
Signed radial component of global DCA (projected)
int nEtowers
The number of Endcap towers in this jet.
const StMuTrack * globalTrack() const
Returns pointer to associated global track. Null pointer if no global track available.
StPhysicalHelixD outerHelix() const
Returns outer helix (last measured point)