StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
St2009ZMaker.cxx
1 // $Id: St2009ZMaker.cxx,v 1.11 2011/09/14 14:23:21 stevens4 Exp $
2 //
3 //*-- Author : Ross Corliss, MIT
4 // changes Jan Balewski, MIT
5 //
6 
7 #include "St2009WMaker.h"
8 #include "WeventDisplay.h"
9 #include "St2009ZMaker.h"
10 
11 //muDst needed for zdcRate
12 #include <StMuDSTMaker/COMMON/StMuDstMaker.h>
13 #include <StMuDSTMaker/COMMON/StMuDst.h>
14 #include <StMuDSTMaker/COMMON/StMuEvent.h>
15 
16 ClassImp(St2009ZMaker)
17 
18 //_____________________________________________________________________________
19 //
20 St2009ZMaker::St2009ZMaker(const char *name):StMaker(name){
21  wMK=0;muMK=0;HList=0;
22 
23 }
24 
25 
26 //_____________________________________________________________________________
27 //
28 Int_t St2009ZMaker::Init(){
29  assert(wMK);
30  assert(HList);
31  initHistos();
32  return StMaker::Init();
33 }
34 
35 
36 //_____________________________________________________________________________
37 //
38 Int_t St2009ZMaker::InitRun (int runumber){
39  LOG_INFO<<Form("::InitRun(%d) done, Z-algo params: nearTotEtFrac=%.2f, clusterEt=%.1f GeV, delPhi12>%.2f rad, Zmass in[%.1f,%.1f]\n",
40  runumber, par_nearTotEtFracZ,par_clusterEtZ,par_delPhi12,par_minMassZ,par_maxMassZ)<<endm;
41  return 0;
42 }
43 
44 //_____________________________________________________________________________
45 //
46 Int_t St2009ZMaker::FinishRun (int runnumber){
47 return 0;
48 }
49 
50 //_____________________________________________________________________________
51 //
52 Int_t
54 
55  //fill various histograms and arrays with event data
56  find_Z_boson();
57 
58  return kStOK;
59 }
60 
61 //============================
62 void
63 St2009ZMaker::printJan(WeveEleTrack *T) {
64  int ibp=kBTow;
65  WevePointTower poiTw=T->pointTower;
66  WeveCluster cl=T->cluster;
67  int id= poiTw.id;
68  float adc= wMK->wEve.bemc.adcTile[ibp][id-1];
69  float frac= adc/4096*60 /cl.ET;
70  printf("Ztower Q=%d pointTw: id=%d ADC=%.0f 2x2ET=%.1f frac=%.2f\n",T->prMuTrack->charge(),id,adc,cl.ET,frac);
71 }
72 
73 
74 
75 //_____________________________________________________________________________
76 //
77 void
78 St2009ZMaker::find_Z_boson(){
79  const float PI=TMath::Pi();
80  Wevent2009 &wEve=wMK->wEve;
81  float zdcRate=wMK->mMuDstMaker->muDst()->event()->runInfo().zdcCoincidenceRate();
82  // printf("========= find_Z_boson() \n");
83 
84  hA[31]->Fill(wEve.vertex.size());
85  hA[0]->Fill("inp",1.);
86 
87  // search for Zs ............
88  for(unsigned int iv=0;iv<wEve.vertex.size();iv++) {
89  hA[0]->Fill("vert",1.);
90  WeveVertex &V=wEve.vertex[iv];
91  hA[32]->Fill(V.eleTrack.size());
92  if(V.eleTrack.size()<2) continue;
93  hA[0]->Fill("TT",1.); // at least 2 tracks exist
94 
95  //fill stack plots before doing full Z algo below
96  for(unsigned int itStack=0;itStack<V.eleTrack.size()-1;itStack++) {
97  WeveEleTrack &stackT1=V.eleTrack[itStack]; //get first track
98 
99  //make plot of mached clusters
100  if(stackT1.pointTower.id==0) continue;
101  for (unsigned int itStack2=itStack+1;itStack2<V.eleTrack.size();itStack2++) {
102  WeveEleTrack &stackT2=V.eleTrack[itStack2]; //get second track
103  if(stackT2.pointTower.id==0) continue;
104  // invariant mass of "matched clusters"
105  if(stackT1.prMuTrack->charge()*stackT2.prMuTrack->charge()<0) hA[40]->Fill(calcMass(stackT1,stackT2)); //opposite-sign
106  else hA[50]->Fill(calcMass(stackT1,stackT2));
107  }
108 
109  //make plot of clusters passing deltaR cut
110  if(stackT1.cluster.ET<par_clusterEtZ) continue;
111  TVector3 stackD1=stackT1.pointTower.R-stackT1.cluster.position;
112  if(stackD1.Mag()>par_delR3DZ) continue;
113  for (unsigned int itStack2=itStack+1;itStack2<V.eleTrack.size();itStack2++) {
114  WeveEleTrack &stackT2=V.eleTrack[itStack2]; //get second track
115  if(stackT2.cluster.ET<par_clusterEtZ) continue;
116  TVector3 stackD2=stackT2.pointTower.R-stackT2.cluster.position;
117  if(stackD2.Mag()>par_delR3DZ) continue;
118  // invariant mass of clusters passing deltaR cut
119  if(stackT1.prMuTrack->charge()*stackT2.prMuTrack->charge()<0) hA[41]->Fill(calcMass(stackT1,stackT2)); //opposite-sign
120  else hA[51]->Fill(calcMass(stackT1,stackT2));
121  }
122 
123  //make plot of clusters passing 2x2/4x4 cut
124  if(stackT1.cluster.ET/stackT1.cl4x4.ET < par_clustFrac24Z) continue;
125  for (unsigned int itStack2=itStack+1;itStack2<V.eleTrack.size();itStack2++) {
126  WeveEleTrack &stackT2=V.eleTrack[itStack2]; //get second track
127  if(stackT2.cluster.ET<par_clusterEtZ) continue;
128  TVector3 stackD2=stackT2.pointTower.R-stackT2.cluster.position;
129  if(stackD2.Mag()>par_delR3DZ) continue;
130  if(stackT2.cluster.ET/stackT2.cl4x4.ET < par_clustFrac24Z) continue;
131  // invariant mass of clusters passing 2x2/4x4 cut
132  if(stackT1.prMuTrack->charge()*stackT2.prMuTrack->charge()<0) hA[42]->Fill(calcMass(stackT1,stackT2)); //opposite-sign
133  else hA[52]->Fill(calcMass(stackT1,stackT2));
134  }
135 
136  //make plot of clusters passing near cone cut
137  if(stackT1.cluster.ET/stackT1.nearTotET < par_nearTotEtFracZ) continue;
138  for (unsigned int itStack2=itStack+1;itStack2<V.eleTrack.size();itStack2++) {
139  WeveEleTrack &stackT2=V.eleTrack[itStack2]; //get second track
140  if(stackT2.cluster.ET<par_clusterEtZ) continue;
141  if(stackT2.cluster.ET/stackT2.cl4x4.ET < par_clustFrac24Z) continue;
142  TVector3 stackD2=stackT2.pointTower.R-stackT2.cluster.position;
143  if(stackD2.Mag()>par_delR3DZ) continue;
144  if(stackT2.cluster.ET/stackT2.nearTotET < par_nearTotEtFracZ) continue;
145  // invariant mass of clusters passing near cone cut
146  if(stackT1.prMuTrack->charge()*stackT2.prMuTrack->charge()<0) hA[43]->Fill(calcMass(stackT1,stackT2)); //opposite-sign
147  else hA[53]->Fill(calcMass(stackT1,stackT2));
148  }
149 
150  }
151 
152  //only one Z can come from a vertex, and it should be the highest-energy object
153  //hence, the two highest-et clusters should correspond to the z. Pick those
154  //eventually, but for now, just try all of them.
155  for(unsigned int it=0;it<V.eleTrack.size()-1;it++) { //.....select first track:
156  WeveEleTrack &T1=V.eleTrack[it];
157  if(T1.isMatch2Cl==false) continue;
158  assert(T1.cluster.nTower>0); // internal logical error
159  assert(T1.nearTotET>0); // internal logical error
160 
161  float isoET1=T1.cluster.ET /T1.cl4x4.ET;
162  hA[29]->Fill(isoET1);
163 
164  hA[23]->Fill(T1.cluster.ET);
165  hA[0]->Fill("tr1",1.);
166  if(T1.cluster.ET<par_clusterEtZ) continue;
167  hA[0]->Fill("et1",1.);
168 
169  float fracET1=T1.cluster.ET /T1.nearTotET;
170  hA[24]->Fill(fracET1);
171  if(fracET1< par_nearTotEtFracZ) continue;
172  hA[0]->Fill("con1",1.);
173 
174  for (unsigned int it2=it+1;it2<V.eleTrack.size();it2++) { //.....select second track:
175  WeveEleTrack &T2=V.eleTrack[it2];
176  if(T2.isMatch2Cl==false) continue;
177  assert(T2.cluster.nTower>0); // internal logical error
178  assert(T2.nearTotET>0); // internal logical error
179 
180  float isoET2=T2.cluster.ET /T2.cl4x4.ET;
181  hA[30]->Fill(isoET2);
182 
183  hA[25]->Fill(T2.cluster.ET);
184  hA[0]->Fill("tr2",1.);
185  if(T2.cluster.ET<par_clusterEtZ) continue;
186  hA[0]->Fill("et2",1.);
187 
188  float fracET2=T2.cluster.ET /T2.nearTotET;
189  hA[26]->Fill(fracET2);
190  if(fracET2< par_nearTotEtFracZ) continue;
191  hA[0]->Fill("con2",1.);
192 
193  float e1=T1.cluster.energy;
194  float e2=T2.cluster.energy;
195  TVector3 p1=T1.primP; p1.SetMag(e1);//cluster.position;
196  TVector3 p2=T2.primP; p2.SetMag(e2);//cluster.position;
197 
198  float del_phi=p1.DeltaPhi(p2);
199  //printf("del Phi=%f\n",del_phi);
200  float xx=del_phi;
201  if(xx<-PI+1) xx+=2*PI;
202  hA[27]->Fill(xx);
203  if(fabs(del_phi)<par_delPhi12) continue;
204  hA[0]->Fill("phi12",1.);
205 
206  TVector3 psum=p1+p2;
207  float mass2=(e1+e2)*(e1+e2)-(psum.Dot(psum));
208  if(mass2<1.) continue; // 9GeV^2) should be param, I'm tired today
209  hA[0]->Fill("m2",1.);
210 
211  float mass=sqrt(mass2);
212  int Q1Q2=T1.prMuTrack->charge()*T2.prMuTrack->charge();
213  if (Q1Q2==1) { //.. same sign , can't be Z-> e+ e-
214  hA[14]->Fill(mass);
215  hA[54]->Fill(calcMass(T1,T2));
216  hA[61]->Fill(zdcRate,calcMass(T1,T2));
217  continue;
218  }
219 
220  //..... now only opposite sign
221  hA[0]->Fill("QQ",1.);
222  hA[15]->Fill(mass);
223  hA[33]->Fill(T1.cluster.ET,T1.prMuTrack->charge()/T1.prMuTrack->pt());
224  hA[33]->Fill(T2.cluster.ET,T2.prMuTrack->charge()/T2.prMuTrack->pt());
225  hA[34]->Fill(T1.pointTower.iEta ,T1.cluster.energy);
226  hA[34]->Fill(T2.pointTower.iEta ,T2.cluster.energy);
227  hA[44]->Fill(calcMass(T1,T2));
228  hA[60]->Fill(zdcRate,calcMass(T1,T2));
229 
230 #if 0
231  printf("RCC: Found Z w/ invmass=%f\n",mass);
232  printJan(&T1);
233  printJan(&T2);
234 
235 
236  if (!wMK->isMC || (wMK->isMC&& wEve.id<500) )
237  { printf("\n ZZZZZZZZZZZZZZZZZZZ\n");
238  if(mass<par_minMassZ)
239  wMK->wDisaply->exportEvent("Zlow",V,T1);
240  else
241  wMK->wDisaply->exportEvent("Zgood",V,T1);
242  printf("RCC: Found Z w/ invmass=%f\n",mass);
243  wEve.print();
244  }
245 
246 #endif
247 
248  if (mass<par_minMassZ) continue; //enforce a lower bound
249  hA[0]->Fill("Zlow",1.);
250 
251  if (mass>par_maxMassZ) continue; //enforce an upper bound
252  hA[0]->Fill("Zhigh",1.);
253 
254  // **** I stoped changes here, Jan
255 
256  float fmax1=T1.cluster.ET/T1.cl4x4.ET;
257  float fmax2=T2.cluster.ET/T2.cl4x4.ET;
258 
259  hA[21]->Fill(fmax1,fmax2);
260  hA[22]->Fill(T1.cluster.ET,T2.cluster.ET);
261 
262  hA[1]->Fill(mass);
263  hA[2]->Fill(T1.prMuTrack->charge(),T2.prMuTrack->charge());
264  hA[3]->Fill(T1.prMuTrack->charge()*T2.prMuTrack->charge());
265  hA[4]->Fill(p1.Phi(),p2.Phi());
266  hA[5]->Fill(del_phi);
267  hA[6]->Fill(mass,T1.prMuTrack->charge()/T1.primP.Perp()*T2.prMuTrack->charge()/T1.primP.Perp());
268  hA[7]->Fill(mass,T1.prMuTrack->charge()*T2.prMuTrack->charge());
269  hA[8]->Fill(T1.cluster.ET);
270  if (T1.prMuTrack->charge()>0)
271  {
272  hA[9]->Fill(p1.Eta(),p1.Phi());
273  hA[10]->Fill(p2.Eta(),p2.Phi());
274  }
275  else
276  {
277  hA[10]->Fill(p1.Eta(),p1.Phi());
278  hA[9]->Fill(p2.Eta(),p2.Phi());
279  }
280 
281  hA[11]->Fill(fmax1,fmax2);
282  hA[12]->Fill(T1.cluster.ET,T2.cluster.ET);
283  hA[13]->Fill(mass,del_phi);
284 
285  }
286 
287 
288 
289  }// loop over first track
290  }// loop over vertices
291 
292 }
293 
294 
295 //_____________________________________________________________________________
296 //
297 float
298 St2009ZMaker::calcMass(WeveEleTrack T1, WeveEleTrack T2){
299  float e1=T1.cluster.energy;
300  float e2=T2.cluster.energy;
301  TVector3 p1=T1.primP; p1.SetMag(e1);//cluster.position;
302  TVector3 p2=T2.primP; p2.SetMag(e2);//cluster.position;
303  TVector3 psum=p1+p2;
304  float mass2=(e1+e2)*(e1+e2)-(psum.Dot(psum));
305  if(mass2<1.) return 0;
306  float mass=sqrt(mass2);
307 
308  return mass;
309 }
310 
311 // $Log: St2009ZMaker.cxx,v $
312 // Revision 1.11 2011/09/14 14:23:21 stevens4
313 // update used for cross section PRD paper
314 //
315 // Revision 1.10 2010/05/01 01:31:44 balewski
316 // added W->JJ code & JES calibration
317 //
318 // Revision 1.9 2010/01/10 03:01:37 balewski
319 // cleanup & nicer histos
320 //
321 // Revision 1.8 2010/01/06 14:11:13 balewski
322 // one Z-plot added
323 //
324 // Revision 1.7 2010/01/06 05:21:57 balewski
325 // cleanup
326 //
327 // Revision 1.6 2010/01/06 04:22:15 balewski
328 // added Q/PT plot for Zs, more cleanup
329 //
330 // Revision 1.5 2010/01/05 03:22:55 balewski
331 // change logic for filling btow status tables, added printout to Z-code
332 //
333 // Revision 1.4 2010/01/04 05:12:00 balewski
334 // added 4x4 cut to Z-algo, cleanup
335 //
336 // Revision 1.3 2010/01/03 04:38:24 balewski
337 // reorganized Z-algo
338 //
339 // Revision 1.2 2009/12/11 20:37:09 rcorliss
340 // Updated Z Maker to use track direction rather than tower direction when computing invariant mass. Added new histograms.
341 //
342 // Revision 1.1 2009/12/07 20:37:56 rcorliss
343 // Start
344 //
virtual Int_t Make()
StMuDst * muDst()
Definition: StMuDstMaker.h:425
Double_t pt() const
Returns pT at point of dca to primary vertex.
Definition: StMuTrack.h:256
uses tree from W-algo to find Zs
Definition: St2009ZMaker.h:26
Short_t charge() const
Returns charge.
Definition: StMuTrack.h:255
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320
Definition: Stypes.h:40