StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
St2011pubSpinMaker.cxx
1 // $Id: St2011pubSpinMaker.cxx,v 1.14 2013/09/13 19:33:13 stevens4 Exp $
2 //
3 //*-- Author : Jan Balewski, MIT
4 //
5 
6 #include "St2011WMaker.h"
7 
8 #include "St2011pubSpinMaker.h"
9 
10 ClassImp(St2011pubSpinMaker)
11 
12 //_____________________________________________________________________________
13 //
14  St2011pubSpinMaker::St2011pubSpinMaker(const char *name, const char *etaName):StMaker(name){
15  wMK=0;HList=0;
16  core=name;
17  coreTitle=etaName;
18 
19  par_QET2PTcut = true;
20 
21  par_leptonEta1=-1.; par_leptonEta2=1.;
22  par_useNoEEMC=0;
23 
24  parE_leptonEta1=0.7; parE_leptonEta2=2.5;
25 
26  }
27 
28 
29 //_____________________________________________________________________________
30 //
31 Int_t
32 St2011pubSpinMaker::Init(){
33  assert(wMK);
34  assert(HList);
35  initHistos();
36  return StMaker::Init();
37 }
38 
39 
40 //_____________________________________________________________________________
41 //
42 Int_t
43 St2011pubSpinMaker::FinishRun (int runNo){
44  return kStOK;
45 }
46 
47 //_____________________________________________________________________________
48 //
49 Int_t
50 St2011pubSpinMaker::InitRun (int runNo){
51 
52  LOG_INFO<<Form("::InitRun(%d) done, W-spin sorting params: exclude |Q*ET/PT| < %.2f OR |Q*ET/PT| > %.2f, for AL use leptonEta in[%.1f,%.1f] useNoEEMC=%d", runNo,
53  wMK->par_QET2PTlow,wMK->par_QET2PThigh,par_leptonEta1, par_leptonEta2,par_useNoEEMC
54  )<<endm;
55  return kStOK;
56 }
57 
58 //_____________________________________________________________________________
59 //
60 Int_t
62 
63  bXingSort();
64  bXingSortEndcap();
65  return kStOK;
66 }
67 
68 //_____________________________________________________________________________
69 //
70 void
71 St2011pubSpinMaker::bXingSort(){
72  //has access to whole W-algo-maker data via pointer 'wMK'
73 
74  int nIsW=0;
75 
76  hA[0]->Fill("inp",1.);
77 
78  if((wMK->wEve->l2bitRnd || wMK->wEve->l2bitET)==0) return;
79  if(wMK->wEve->vertex.size()<=0) return;
80  //......... require: L2BW-trig (ET or rnd) & vertex is reasonable .......
81 
82  int bx48=wMK->wEve->bx48;
83  int bx7=wMK->wEve->bx7;
84  int bxStar48=wMK->wEve->bxStar48;
85  int bxStar7=wMK->wEve->bxStar7;
86 
87  if(bxStar48!=bxStar7) {
88  printf("BAD bx7=%d bx48=%d del=%d\n",bx7,bx48,bxStar48-bxStar7);
89  hA[0]->Fill("badBx48",1.);
90  return; // both counters must be in sync
91  }
92 
93  //remove events tagged as Zs
94  if(wMK->wEve->zTag) return;
95  hA[0]->Fill("noZ",1.);
96 
97  hA[1]->Fill(bx48);
98  hA[2]->Fill(bx7);
99 
100  hA[3]->Fill(bxStar48);
101  hA[4]->Fill(bxStar7);
102 
103  int spin4=wMK->wEve->spin4;
104  hA[5]->Fill(bxStar7,spin4);
105 
106  float par_maxDsmThr=58;
107  float par_myET=25; // monitoring cut
108  if( wMK->wEve->l2bitRnd) { // lumi monitor BHT3-random
109  // avoid too much energy - can be W-events (1/milion :)
110  if(wMK-> wEve->bemc.maxHtDsm<par_maxDsmThr) {
111  hA[6]->Fill(spin4); hA[0]->Fill("BG1",1.);}
112  //removed veto of random bits here in previous version JS
113  }
114 
115  if( wMK->wEve->l2bitET==0) return;
116  //..... it is guaranteed ..... L2W-ET>13 did fired ......
117 
118 
119  // search for Ws ............
120  for(unsigned int iv=0;iv<wMK->wEve->vertex.size();iv++) {
121  WeveVertex &V=wMK->wEve->vertex[iv];
122  for(unsigned int it=0;it<V.eleTrack.size();it++) {
123  WeveEleTrack &T=V.eleTrack[it];
124  if(T.pointTower.id<=0) continue; //skip endcap towers
125 
126  /* Collect QCD background for lumi monitors */
127  float frac24=T.cluster.ET/(T.cl4x4.ET);
128  if(iv==0 && it==0 && frac24<wMK->par_clustFrac24) {
129  hA[31]->Fill(T.cluster.ET);
130  if( T.cluster.ET <20. ) { hA[7]->Fill(spin4); hA[0]->Fill("BG2",1.);}
131  }
132 
133  int iQ=0; // plus
134  float p_Q=T.prMuTrack->charge();
135  if( p_Q<0 ) iQ=1;// minus
136  float ET=T.cluster.ET;
137 
138  // high-pT QCD condition here
139  if( frac24 < wMK->par_clustFrac24 && T.cluster.ET/T.nearTotET < wMK->par_nearTotEtFrac && T.sPtBalance2 < wMK->par_ptBalance) //not isolated && doesn't pass sPtBal
140  {
141  hA[22+iQ]->Fill(spin4,ET);
142  if(T.prMuTrack->eta()>par_leptonEta1 && T.prMuTrack->eta()<par_leptonEta2 && ET>25 && ET<50)//kinematic conditions
143  hA[20+iQ]->Fill(spin4);
144  }
145 
146  if(T.isMatch2Cl==false) continue;
147  assert(T.cluster.nTower>0); // internal logical error
148  assert(T.nearTotET>0); // internal logical error
149 
150  //put final W cut here
151  bool isW= T.cluster.ET /T.nearTotET> wMK->par_nearTotEtFrac; // near cone
152  if(par_useNoEEMC)
153  isW=isW && T.sPtBalance_noEEMC2>wMK->par_ptBalance; // awayET
154  else
155  isW=isW && T.sPtBalance2>wMK->par_ptBalance; // awayET
156 
157  if(!isW) { // AL(QCD)
158  if(ET>15 &&ET<20 ) hA[16+iQ]->Fill(spin4);
159  continue;
160  }
161 
162  hA[0]->Fill("Wcut",1.);
163 
164  // allows spin specific cuts on eta
165  if(T.prMuTrack->eta()<par_leptonEta1) continue;
166  if(T.prMuTrack->eta()>par_leptonEta2) continue;
167  hA[0]->Fill("eta",1.);
168 
169  //::::::::::::::::::::::::::::::::::::::::::::::::
170  //:::::accepted W events for x-section :::::::::::
171  //::::::::::::::::::::::::::::::::::::::::::::::::
172 
173  if(ET>par_myET) hA[0]->Fill("W25",1.);
174  float q2pt=T.prMuTrack->charge()/T.prMuTrack->pt();
175  if(ET>par_myET) {
176  hA[8]->Fill(q2pt);
177  hA[32]->Fill(q2pt,T.prMuTrack->nHitsFit());
178  hA[33]->Fill(q2pt,1.*T.prMuTrack->nHitsFit()/T.prMuTrack->nHitsPoss());
179  hA[34]->Fill(T.prMuTrack->nHitsFit(),1.*T.prMuTrack->nHitsFit()/T.prMuTrack->nHitsPoss());
180  }
181  hA[9]->Fill(ET,q2pt);
182 
183  // new charge rejection Q*ET/PT
184  float hypCorr = q2pt*(T.cluster.ET);
185  if(par_QET2PTcut) { // ability to skip all Q/PT cuts
186  if( fabs(hypCorr) < wMK->par_QET2PTlow) continue;
187  if(ET>par_myET) hA[0]->Fill("Qlow",1.);
188  if( fabs(hypCorr) > wMK->par_QET2PThigh) continue;
189  }
190 
191  if(ET>par_myET) {
192  hA[0]->Fill("Qhigh",1.);
193  if(p_Q>0) hA[0]->Fill("Q +",1.);
194  else hA[0]->Fill("Q -",1.);
195  }
196 
197 
198  hA[10+iQ]->Fill(ET);
199  if(ET>25 && ET<50 ) {
200  hA[12+iQ]->Fill(spin4);
201  hA[29+iQ]->Fill(T.prMuTrack->eta());
202  nIsW++;
203  }
204  if(ET>32 &&ET<44 ) hA[14+iQ]->Fill(spin4);
205 
206  hA[18+iQ]->Fill(spin4,ET);
207 
208  } // end of loop over tracks
209  }// end of loop ove vertices
210 
211  if(nIsW>1) hA[0]->Fill("multiW",1.);
212 
213 }
214 
215 //_____________________________________________________________________________
216 //
217 void
218 St2011pubSpinMaker::bXingSortEndcap(){
219  //has access to whole W-algo-maker data via pointer 'wMK'
220 
221  int nIsW=0;
222 
223  hE[0]->Fill("inp",1.);
224 
225  if((wMK->wEve->l2EbitRnd || wMK->wEve->l2EbitET)==0) return;
226  if(wMK->wEve->vertex.size()<=0) return;
227  //......... require: L2EW-trig (ET or rnd) & vertex is reasonable .......
228 
229  int bx48=wMK->wEve->bx48;
230  int bx7=wMK->wEve->bx7;
231  int bxStar48=wMK->wEve->bxStar48;
232  int bxStar7=wMK->wEve->bxStar7;
233 
234  if(bxStar48!=bxStar7) {
235  printf("BAD bx7=%d bx48=%d del=%d\n",bx7,bx48,bxStar48-bxStar7);
236  hE[0]->Fill("badBx48",1.);
237  return; // both counters must be in sync
238  }
239 
240  //remove events tagged as Zs
241  if(wMK->wEve->zTag) return;
242  hE[0]->Fill("noZ",1.);
243 
244  hE[1]->Fill(bx48);
245  hE[2]->Fill(bx7);
246 
247  hE[3]->Fill(bxStar48);
248  hE[4]->Fill(bxStar7);
249 
250  int spin4=wMK->wEve->spin4;
251  hE[5]->Fill(bxStar7,spin4);
252 
253  float par_maxDsmThr=58;
254  float par_myET=25; // monitoring cut
255  if( wMK->wEve->l2EbitRnd) { // lumi monitor BHT3-random
256  // avoid too much energy - can be W-events (1/milion :)
257  if(wMK-> wEve->etow.maxHtDsm<par_maxDsmThr) {
258  hE[6]->Fill(spin4); hE[0]->Fill("BG1",1.);}
259  }
260 
261  if( wMK->wEve->l2EbitET==0) return;
262 
263  // search for Ws ............
264  for(unsigned int iv=0;iv<wMK->wEve->vertex.size();iv++) {
265  WeveVertex &V=wMK->wEve->vertex[iv];
266  for(unsigned int it=0;it<V.eleTrack.size();it++) {
267  WeveEleTrack &T=V.eleTrack[it];
268  if(T.pointTower.id>=0) continue; //skip barrel towers
269 
270  /* Collect QCD background for lumi monitors */
271  float frac24=T.cluster.ET/(T.cl4x4.ET);
272  if(iv==0 && it==0 && frac24<wMK->parE_clustFrac24) {
273  hE[31]->Fill(T.cluster.ET);
274  if( T.cluster.ET <20. ) { hE[7]->Fill(spin4); hE[0]->Fill("BG2",1.);}
275  }
276 
277  if(T.isMatch2Cl==false) continue;
278  assert(T.cluster.nTower>0); // internal logical error
279  assert(T.nearTotET>0); // internal logical error
280 
281  int iQ=0; // plus
282  float p_Q=T.prMuTrack->charge();
283  if( p_Q<0 ) iQ=1;// minus
284  float ET=T.cluster.ET;
285 
286  //put final W cut here
287  bool isW= T.cluster.ET/T.nearTotET > wMK->parE_nearTotEtFrac; // near cone
288  isW=isW && ((T.esmdPeakSumE[0]+T.esmdPeakSumE[1])/(T.esmdE[0]+T.esmdE[1]) > wMK->parE_smdRatio); // smdRatio
289  isW=isW && T.sPtBalance2>wMK->parE_ptBalance; // awayET
290 
291  if(!isW) { // !!!! This is not all QCD for the endcap !!!!
292  if(ET>15 && ET<20 ) hE[16+iQ]->Fill(spin4);
293  continue;
294  }
295 
296  hE[0]->Fill("Wcut",1.);
297 
298  // allows spin specific cuts on eta
299  if(T.prMuTrack->eta()<parE_leptonEta1) continue;
300  if(T.prMuTrack->eta()>parE_leptonEta2) continue;
301  hE[0]->Fill("eta",1.);
302 
303  //::::::::::::::::::::::::::::::::::::::::::::::::
304  //:::::accepted W events for x-section :::::::::::
305  //::::::::::::::::::::::::::::::::::::::::::::::::
306 
307  if(ET>par_myET) hE[0]->Fill("W25",1.);
308  float q2pt=T.prMuTrack->charge()/T.prMuTrack->pt();
309  if(ET>par_myET){
310  hE[8]->Fill(q2pt);
311  hE[32]->Fill(q2pt,T.prMuTrack->nHitsFit());
312  hE[33]->Fill(q2pt,1.*T.prMuTrack->nHitsFit()/T.prMuTrack->nHitsPoss());
313  hE[34]->Fill(T.prMuTrack->nHitsFit(),1.*T.prMuTrack->nHitsFit()/T.prMuTrack->nHitsPoss());
314  }
315  hE[9]->Fill(ET,q2pt);
316 
317  // new charge rejection Q*ET/PT
318  float hypCorr = q2pt*(T.cluster.ET);
319  if(par_QET2PTcut) { // ability to skip all Q/PT cuts
320  if( fabs(hypCorr) < wMK->parE_QET2PTlow) continue;
321  if(ET>par_myET) hE[0]->Fill("Qlow",1.);
322  if( fabs(hypCorr) > wMK->parE_QET2PThigh) continue;
323  }
324 
325  if(ET>par_myET) {
326  hE[0]->Fill("Qhigh",1.);
327  if(p_Q>0) hE[0]->Fill("Q +",1.);
328  else hE[0]->Fill("Q -",1.);
329  }
330 
331  hE[10+iQ]->Fill(ET);
332  if(ET>25 && ET<50 ) {
333  hE[12+iQ]->Fill(spin4);
334  hE[29+iQ]->Fill(T.prMuTrack->eta());
335  nIsW++;
336  }
337  if(ET>32 &&ET<44 ) hE[14+iQ]->Fill(spin4);
338 
339  hE[18+iQ]->Fill(spin4,ET);
340 
341  } // end of loop over tracks
342  }// end of loop ove vertices
343 
344  if(nIsW>1) hE[0]->Fill("multiW",1.);
345 
346 }
347 
348 // $Log: St2011pubSpinMaker.cxx,v $
349 // Revision 1.14 2013/09/13 19:33:13 stevens4
350 // Updates to code for combined 2011+2012 result presented to spin PWG 9.12.13
351 //
352 // Revision 1.13 2013/06/14 21:08:51 jlzhang
353 // add histo Q/pT vs. nHitsFit and Q/pT vs. nHitsPos
354 //
355 // Revision 1.12 2012/09/26 14:20:59 stevens4
356 // use PtBal cos(phi) for WB and WE algos and use Q*ET/PT for barrel charge sign
357 //
358 // Revision 1.11 2012/09/26 01:10:51 stevens4
359 // apply R_ESMD cut using maximum of sliding window
360 //
361 // Revision 1.10 2012/09/18 21:10:08 stevens4
362 // Include all rank>0 vertex again (new jet format coming next), and remove rank<0 endcap vertices.
363 //
364 // Revision 1.9 2012/09/17 22:05:50 stevens4
365 // exclude not-highest rank vertex until jet issue is resolved
366 //
367 // Revision 1.8 2012/09/17 03:29:30 stevens4
368 // Updates to Endcap algo and Q*ET/PT charge separation
369 //
370 // Revision 1.7 2012/08/31 20:10:52 stevens4
371 // switch to second EEMC background using both isolation and sPt-Bal (for mirror symmetry (also adjust eta binning)
372 //
373 // Revision 1.6 2012/08/28 14:28:27 stevens4
374 // add histos for barrel and endcap algos
375 //
376 // Revision 1.5 2012/08/21 21:28:22 stevens4
377 // Add spin sorting for endcap Ws
378 //
379 // Revision 1.4 2012/08/07 21:06:38 stevens4
380 // update to tree analysis to produce independent histos in a TDirectory for each eta-bin
381 //
382 // Revision 1.3 2012/07/12 20:49:21 balewski
383 // added spin info(star: bx48, bx7, spin4) and maxHtDSM & BTOW to Wtree
384 // removed dependence of spinSortingMaker from muDst
385 // Now Wtree can be spin-sorted w/o DB
386 // rdMu.C & readWtree.C macros modified
387 // tested so far on real data run 11
388 // lot of misc. code shuffling
389 //
390 // Revision 1.2 2012/06/18 18:28:01 stevens4
391 // Updates for Run 9+11+12 AL analysis
392 //
393 // Revision 1.1 2011/02/10 20:33:25 balewski
394 // start
395 //
Double_t pt() const
Returns pT at point of dca to primary vertex.
Definition: StMuTrack.h:256
spin sorting of W&#39;s
UShort_t nHitsFit() const
Return total number of hits used in fit.
Definition: StMuTrack.h:239
Short_t charge() const
Returns charge.
Definition: StMuTrack.h:255
Double_t eta() const
Returns pseudo rapidity at point of dca to primary vertex.
Definition: StMuTrack.h:257
UShort_t nHitsPoss() const
Return number of possible hits on track.
Definition: StMuTrack.cxx:242
Definition: Stypes.h:40