StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
St2009pubWanaMaker.cxx
1 // $Id: St2009pubWanaMaker.cxx,v 1.4 2010/03/14 22:50:31 balewski Exp $
2 //
3 //*-- Author : Jan Balewski, MIT
4 //
5 #include <StEmcUtil/database/StEmcDecoder.h>
6 
7 #include "St2009WMaker.h"
8 #include "St2009pubWanaMaker.h"
9 
10 ClassImp(St2009pubWanaMaker)
11 
12 //_____________________________________________________________________________
13 //
14 St2009pubWanaMaker::St2009pubWanaMaker(const char *name):StMaker(name){
15  wMK=0;HList=0;
16  par_highET=20; // GeV
17  mMappB=0;
18 }
19 
20 
21 //_____________________________________________________________________________
22 //
23 Int_t St2009pubWanaMaker::Init(){
24  assert(wMK);
25  assert(HList);
26  initHistos();
27  return StMaker::Init();
28 }
29 
30 //_____________________________________________________________________________
31 //
32 Int_t
33 St2009pubWanaMaker::InitRun(int runNo){
34  int yyyymmdd = this->GetDBTime().GetDate();
35  int hhmmss = this->GetDBTime().GetTime();
36  // this is how BTOW mapping is accesible
37  // assert( mMappB==0) ; // do not know how to destroy previous instance,JB
38  mMappB = new StEmcDecoder(yyyymmdd,hhmmss);
39  return kStOK;
40 }
41 //_____________________________________________________________________________
42 //
43 Int_t
45  // printf("in %s\n", GetName());
46  hA[0]->Fill("inp",1.);
47 
48  evalWeleTrackSign();
49  scanCrateRate();
50  varyCuts4backgStudy();
51 
52  return kStOK;
53 }
54 
55 //_____________________________________________________________________________
56 //
57 void
58 St2009pubWanaMaker::evalWeleTrackSign(){
59  //has access to whole W-algo-maker data via pointer 'wMK'
60 
61 
62  // search for Ws ............
63  for(unsigned int iv=0;iv<wMK->wEve.vertex.size();iv++) {
64  WeveVertex &V=wMK->wEve.vertex[iv];
65  for(unsigned int it=0;it<V.eleTrack.size();it++) {
66  WeveEleTrack &T=V.eleTrack[it];
67  if(T.isMatch2Cl==false) continue;
68  assert(T.cluster.nTower>0); // internal logical error
69  assert(T.nearTotET>0); // internal logical error
70 
71  // work with W-track
72  float ET=T.cluster.ET;
73  const StMuTrack *glTr=T.glMuTrack; assert(glTr);
74  const StMuTrack *prTr=T.prMuTrack; assert(prTr);
75  float PT=glTr->pt();
76  float g_chrg=glTr->charge();
77  float p_chrg=prTr->charge();
78  //printf("aaa %f %f %f\n",ET,PT,chrg);
79  int g_ipn=0, p_ipn=0; // plus
80  if( g_chrg<0 ) g_ipn=1;// minus
81  if( p_chrg<0 ) p_ipn=1;// minus
82 
83  //make cut on lepton |eta| for cross section
84  if(fabs(T.primP.Eta()) > 1) continue;
85 
86  float absEta=fabs(T.primP.Eta());
87  if(T.cluster.ET/T.nearTotET_noEEMC>wMK->par_nearTotEtFrac){
88  if(T.sPtBalance_noEEMC>wMK->par_ptBalance){//signal w/o endcap in veto
89  //charge sorted
90  if(p_ipn==0)
91  hA[43]->Fill(T.cluster.ET);
92  else
93  hA[46]->Fill(T.cluster.ET);
94  //eta sorted
95  if(absEta > 0.6 && absEta < 1)
96  hA[38]->Fill(T.cluster.ET);
97  if(absEta > 0.3 && absEta < 0.6)
98  hA[39]->Fill(T.cluster.ET);
99  if(absEta > 0.0 && absEta < 0.3)
100  hA[40]->Fill(T.cluster.ET);
101  }
102  }
103 
104  if(T.cluster.ET /T.nearTotET< wMK->par_nearTotEtFrac) continue; // too large nearET
105 
106  //xSec binned
107  if(T.sPtBalance>wMK->par_ptBalance ){//signal
108  //charge sorted
109  if(p_ipn==0)
110  hA[41]->Fill(T.cluster.ET);
111  else
112  hA[44]->Fill(T.cluster.ET);
113  //eta sorted
114  if(absEta > 0.6 && absEta < 1)
115  hA[32]->Fill(T.cluster.ET);
116  if(absEta > 0.3 && absEta < 0.6)
117  hA[33]->Fill(T.cluster.ET);
118  if(absEta > 0.0 && absEta < 0.3)
119  hA[34]->Fill(T.cluster.ET);
120  }
121  else {//background
122  //charge sorted
123  if(p_ipn==0)
124  hA[42]->Fill(T.cluster.ET);
125  else
126  hA[45]->Fill(T.cluster.ET);
127  //eta sorted
128  if(absEta > 0.6 && absEta < 1)
129  hA[35]->Fill(T.cluster.ET);
130  if(absEta > 0.3 && absEta < 0.6)
131  hA[36]->Fill(T.cluster.ET);
132  if(absEta > 0.0 && absEta < 0.3)
133  hA[37]->Fill(T.cluster.ET);
134  }
135 
136  if(T.sPtBalance<wMK->par_ptBalance ) continue;
137 
138  hA[0]->Fill("acc",1.);
139 
140  hA[5]->Fill(ET);
141  hA[10+g_ipn]->Fill(ET);
142  hA[12+p_ipn]->Fill(ET);
143  if(g_chrg* p_chrg <-0.5) hA[14+p_ipn]->Fill(ET); // charge flip
144  hA[6]->Fill(ET,g_chrg/PT);
145 
146  //Change in pT from global to primary
147  float primPT=prTr->pt();
148  float globPT=glTr->pt();
149  hA[28]->Fill(primPT,globPT);
150  hA[29]->Fill(globPT-primPT);
151  if(fabs(globPT-primPT)>1) hA[30]->Fill(ET);
152  if(g_chrg* p_chrg <-0.5) hA[31]->Fill(globPT-primPT);
153 
154  // work with prim component
155  hA[7]->Fill(ET,p_chrg/prTr->pt());
156  if(ET<par_highET) continue;
157  hA[0]->Fill("W",1.);
158  hA[16+p_ipn]->Fill(prTr->eta());
159 
160 
161  }
162  }
163 
164 }
165 
166 //_____________________________________________________________________________
167 //
168 void
169 St2009pubWanaMaker::scanCrateRate(){
170  //has access to whole W-algo-maker data via pointer 'wMK'
171  // printf("crateScan: eveID=%d\n",wMK->wEve.id);
172 
173  // search for Ws ............
174  for(unsigned int iv=0;iv<wMK->wEve.vertex.size();iv++) {
175  WeveVertex &V=wMK->wEve.vertex[iv];
176  for(unsigned int it=0;it<V.eleTrack.size();it++) {
177  WeveEleTrack &T=V.eleTrack[it];
178  // T.pointTower.print();
179  int softID=T.pointTower.id;
180  if(softID<=0) continue;
181  if(wMK->wEve.bemc.statTile[kBTow][softID-1]) continue; // skip masked towers
182 
183  int RDO, CR,CHAN;
184  assert(mMappB->GetDaqIdFromTowerId(softID,RDO)==1);// is good range
185  assert(mMappB->GetTowerCrateFromDaqId(RDO,CR,CHAN)==1);
186 
187  float adc=wMK->wEve.bemc.adcTile[kBTow][softID-1];
188  hA[1]->Fill(adc,CR);
189  // printf("soft=%d DRO=%d CR=%d CHAN=%d adc=%.0f\n",softID,RDO,CR,CHAN,adc);
190  }
191  }
192 }
193 
194 
195 
196 //_____________________________________________________________________________
197 //
198 void
199 St2009pubWanaMaker::varyCuts4backgStudy(){
200 
201  for(unsigned int iv=0;iv<wMK->wEve.vertex.size();iv++) {
202  WeveVertex &V=wMK->wEve.vertex[iv];
203  for(unsigned int it=0;it<V.eleTrack.size();it++) {
204  WeveEleTrack &T=V.eleTrack[it];
205  if(T.isMatch2Cl==false) continue;
206  assert(T.cluster.nTower>0); // internal logical error
207  assert(T.nearTotET>0); // internal logical error
208 
209  float nearR=T.cluster.ET /T.nearTotET;
210  float awayET=T.awayTotET;
211  float ET= T.cluster.ET;
212 
213  // .... logic of histos .....
214  if(nearR >0.9) {
215  hA[27] -> Fill(ET, awayET);
216  if(awayET<8.) {
217  hA[20]->Fill(ET);
218  } else {
219  hA[21]->Fill(ET);
220  }
221  }
222 
223  if(nearR >0.8 && nearR <0.9) {
224  if(awayET<8.) {
225  hA[22]->Fill(ET);
226  } else {
227  hA[23]->Fill(ET);
228  }
229  }
230 
231  if(nearR >0. && nearR <0.8) {
232  if(awayET<8.) {
233  hA[24]->Fill(ET);
234  } else {
235  hA[25]->Fill(ET);
236  }
237  }
238 
239  if(awayET<8.) {
240  hA[26]->Fill(nearR);
241  }
242 
243  } // end of loop over tracks
244  }
245 }
246 
247 // $Log: St2009pubWanaMaker.cxx,v $
248 // Revision 1.4 2010/03/14 22:50:31 balewski
249 // *** empty log message ***
250 //
251 // Revision 1.3 2010/01/23 02:35:38 stevens4
252 // add ability to scale jet et and use real btow peds for rcf mc
253 //
254 // Revision 1.2 2010/01/21 17:54:31 stevens4
255 // add effic histos and charge seperated background plots
256 //
257 // Revision 1.1 2009/11/23 23:00:18 balewski
258 // code moved spin-pool
259 //
260 // Revision 1.1 2009/11/23 21:11:18 balewski
261 // start
262 //
Double_t pt() const
Returns pT at point of dca to primary vertex.
Definition: StMuTrack.h:256
my own maker to do analysis outside of W selection
int GetTowerCrateFromDaqId(int RDO, int &crate, int &sequence) const
Get crate number from Daq Id for towers.
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
Definition: Stypes.h:40
int GetDaqIdFromTowerId(int softId, int &RDO) const
Get Daq Id from Software Id for towers.