StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
St2011WMaker.cxx
1 // $Id: St2011WMaker.cxx,v 1.21 2013/10/14 13:07:31 stevens4 Exp $
2 //
3 //*-- Author : Jan Balewski, MIT
4 //*-- Author for Endcap: Justin Stevens, IUCF
5 //*-- Author for JetFinder/JetReader interface: Ilya Selyuzhenkov, IUCF
6 
7 #include <TH1.h>
8 #include <TH2.h>
9 #include <TTree.h>
10 #include <TString.h>
11 #include <StMessMgr.h>
12 #include <StThreeVectorF.hh>
13 
14 //MuDst
15 #include <StMuDSTMaker/COMMON/StMuDstMaker.h>
16 #include <StMuDSTMaker/COMMON/StMuDst.h>
17 #include <StMuDSTMaker/COMMON/StMuEvent.h>
18 
19 #include "StEmcUtil/database/StBemcTables.h"
20 #include "StEmcUtil/geometry/StEmcGeom.h"
21 
22 #include "StEEmcUtil/database/StEEmcDb.h"
23 #include "StEEmcUtil/database/EEmcDbItem.h"
24 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
25 #include "StEEmcUtil/StEEmcSmd/EEmcSmdGeom.h"
26 
27 //new jet tree format
28 #include "StSpinPool/StJetEvent/StJetEvent.h"
29 #include "StSpinPool/StJetEvent/StJetVertex.h"
30 #include "StSpinPool/StJetEvent/StJetCandidate.h"
31 
32 #include "StSpinPool/StSpinDbMaker/StSpinDbMaker.h"
33 #include "WeventDisplay.h"
34 #include "St2011WMaker.h"
35 
36 ClassImp(St2011WMaker)
37 
38 //_____________________________________________________________________________
39 //
40 St2011WMaker::St2011WMaker(const char *name):StMaker(name){
41  char muDstMakerName[]="MuDst";
42  mMuDstMaker=(StMuDstMaker*)GetMaker(muDstMakerName);
43  coreTitle=name;
44 
45  if(!mMuDstMaker) { //load tree if no MuDst
46  mTreeChain=new TChain("mWtree","W candidate events");
47  index=0;
48  }
49 
50  //must have either MuDst or W tree
51  assert(mMuDstMaker || mTreeChain);
52 
53  mJetTreeChain=new TChain("jet","Jet Tree");
54  indexJet=0;
55  mJetEvent = 0;
56  mJetEvent_noEEMC = 0;
57 
58  if(!mJetTreeChain)
59  LOG_WARN<<GetName()<<Form("::constructor() NO JETS , W-algo is not working properly, continue")<<endm;
60 
61  // preset or clear some params
62  par_l2bwTrgID=parE_l2ewTrgID=0;
63 
64  setHList(0);
65  setHListTpc(0);
66  setMC(0);
67  nInpEve= nTrigEve= nAccEve=0;
68 
69  //... MC trigger simulator
70  par_l0emulAdcThresh=30;
71  par_l2emulSeedThresh=5.0;
72  par_l2emulClusterThresh=12.0;
73 
74  //.. vertex
75  par_minPileupVert=3; // to reject events w/o TPC, lower it for MC
76  par_vertexZ=100; // (cm)
77 
78  //... towers
79  par_kSigPed=3; // rawADC-ped cut off
80  par_AdcThres=8; // ADC threshold to avoid correlated noise
81  par_maxADC=200.; // (adc chan) on the highest tower in events
82 
83  //... Barrel Algo
84  par_clustET=14.; // (GeV/c) 2x2 cluster ET
85  par_clustFrac24=0.95; // ET ratio 2x2/4x4 cluster
86  par_nearTotEtFrac=0.88; // ratio 2x2/near Tot ET
87  par_delR3D=7.; // cm, dist between projected track and center of cluster
88  par_leptonEtaLow=-1.5; // bracket acceptance
89  par_leptonEtaHigh=1.5; // bracket acceptance
90  par_ptBalance=14.; // (GeV), ele cluster vector + jet sum vector
91  //... track
92  par_nFitPts=15; // hits on the track
93  par_nHitFrac=0.51;
94  par_trackRin=90; par_trackRout=160; // cm
95  par_trackPt=10.;//GeV
96  par_highET=25.; // (GeV), cut-off for final Barrel W-cluster
97  par_QET2PTlow = 0.4; // low cut on |Q*ET/PT|
98  par_QET2PThigh = 1.8; // high cut on |W*ET/PT|
99 
100  //... Endcap Algo
101  parE_trackEtaMin=0.7; // avoid bad extrapolation to ESMD
102  parE_clustET=14.; // (GeV/c) 2x2 cluster ET
103  parE_clustFrac24=0.90; // ET ratio 2x2/4x4 cluster
104  parE_nearTotEtFrac=0.85; // ratio 2x2/near Tot ET
105  parE_delR3D=10.; // cm, dist between projected track and center of cluster
106  parE_leptonEtaLow=0.7; // bracket acceptance
107  parE_leptonEtaHigh=2.5; // bracket acceptance
108  parE_ptBalance=14.; // (GeV), ele cluster vector + jet sum vector
109  //... track
110  parE_nFitPts=5; // hits on the track
111  parE_nHitFrac=0.51;
112  parE_trackRin=120; parE_trackRout=70; // cm
113  parE_trackPt=7.;//GeV
114  parE_nSmdStrip=20;
115  parE_esmdGL=3; // 2N+1=7 size of the integration gate len
116  parE_esmdWL=7; // 2N+1=15 size of the allowed window len
117 
118  parE_smdRatio=0.6;
119  parE_highET=25.; // (GeV), cut-off for final Endcap W-cluster
120  parE_QET2PTlow = 0.4; // low cut on |Q*ET/PT|
121  parE_QET2PThigh = 1.8; // high cut on |W*ET/PT|
122 
123  assert(2*parE_nSmdStrip+1==41);// as hardcoded in Wtree for esmdShower[mxEsmdPlane][], it should be solved by using <vector> or TArray - left for next year to be fixed
124  assert(parE_esmdGL<=parE_esmdWL); // if equal then peak adjusting is disabled
125  assert(parE_esmdWL<parE_nSmdStrip);
126 
127 
128  //... search for W's
129  par_nearDeltaR=0.7; //(~rad) near-cone size
130  par_awayDeltaPhi=0.7; // (rad) away-'cone' size
131 
132  setEtowScale(1.0);
133  setBtowScale(1.0);
134 
135  mRunNo=0;
136  nRun=0;
137  hbxIdeal=0;
138 
139  // irrelevant for W analysis
140  par_DsmThres=31; // only for monitoring
141  parE_DsmThres=31; // only for monitoring
142  par_maxDisplEve=1; // # of displayed selected events
143 
144 }
145 
146 
147 //_____________________________________________________________________________
148 //
149 Int_t
150 St2011WMaker::Init(){
151  assert(HList);
152  initHistos();
153  initEHistos();
154 
155  // init TPC histos
156  if(mMuDstMaker) {
157  for(int isec=0;isec<mxTpcSec;isec++) {
158  int sec=isec+1;
159  float Rin=par_trackRin,Rout=par_trackRout;
160  float RinE=parE_trackRin,RoutE=parE_trackRout;
161 
162  mTpcFilter[isec].setCuts(par_nFitPts,par_nHitFrac,Rin,Rout);
163  mTpcFilterE[isec].setCuts(parE_nFitPts,parE_nHitFrac,RinE,RoutE);
164 
165  mTpcFilter[isec].init("sec",sec,HListTpc,true);
166  mTpcFilterE[isec].init("secEemcTr",sec,HListTpc,false);
167  }
168  }
169 
170  mJetTreeChain->SetBranchAddress(mJetTreeBranch,&mJetEvent);
171  mJetTreeChain->SetBranchAddress(mJetTreeBranch_noEEMC,&mJetEvent_noEEMC);
172 
173  if(mMuDstMaker) {
174  //only need DB tables for MuDst analysis
175  mBarrelTables = new StBemcTables();
176  mDbE = (StEEmcDb*)GetDataSet("StEEmcDb");
177  assert(mDbE);
178  }
179  else {
180  //setup for reading in tree
181  wEve=new Wevent2011();
182  mTreeChain-> SetBranchAddress("wEve",&wEve);
183  }
184 
185  mBtowGeom = StEmcGeom::instance("bemc");
186  mBSmdGeom[kBSE] = StEmcGeom::instance("bsmde");
187  mBSmdGeom[kBSP] = StEmcGeom::instance("bsmdp");
188  geomE= new EEmcGeomSimple();
189  geoSmd= EEmcSmdGeom::instance();
190  initGeom();
191 
192  wDisaply= new WeventDisplay(this,par_maxDisplEve);
193 
194  if(isMC) par_minPileupVert=1;
195 
196  //tree only written during MuDst analysis
197  if(mMuDstMaker) {
198  mTreeFile=new TFile(mTreeName,"recreate");
199  mTreeFile->cd();
200 
201  wEve=new Wevent2011();
202  mWtree=new TTree("mWtree","W candidate Events");
203  mWtree->Branch("wEve","Wevent2011",&wEve);
204  }
205 
206  return StMaker::Init();
207 }
208 
209 //________________________________________________
210 //________________________________________________
211 Int_t
212 St2011WMaker::InitRun(int runNo){
213  LOG_INFO<<Form("::InitRun(%d) start",runNo)<<endm;
214  if(!isMC) assert(mRunNo==0); // to prevent run merging - it was not tested
215  if(mMuDstMaker) {
216  mBarrelTables->loadTables(this );
217  mRunNo=runNo;
218  }
219  else {
220  mRunNo=wEve->runNo;
221  }
222 
223  //barrel algo params
224  LOG_INFO<<Form("::InitRun(%d) %s done\n Barrel W-algo params: trigID L2BW=%d isMC=%d\n TPC: nPileupVert>%d, vertex |Z|<%.1fcm, primEleTrack: nFit>%d, hitFrac>%.2f Rin<%.1fcm, Rout>%.1fcm, PT>%.1fGeV/c\n BTOW ADC: kSigPed=%d AdcThr>%d maxAdc>%.0f clustET>%.1f GeV ET2x2/ET4x4>%0.2f ET2x2/nearTotET>%0.2f\n dist(track-clust)<%.1fcm, nearDelR<%.1f\n W selection highET>%.1f awayDelPhi<%.1frad ptBalance>%.1fGeV %.1f<leptonEta<%.1f ",
225  mRunNo, coreTitle.Data(), par_l2bwTrgID,isMC,
226  par_minPileupVert,par_vertexZ,
227  par_nFitPts,par_nHitFrac, par_trackRin, par_trackRout, par_trackPt,
228  par_kSigPed, par_AdcThres,par_maxADC,par_clustET,par_clustFrac24,par_nearTotEtFrac,
229  par_delR3D,par_nearDeltaR,
230  par_highET,par_awayDeltaPhi,par_ptBalance,par_leptonEtaLow,par_leptonEtaHigh
231  )<<endm;
232  //endcap algo params
233  cout<<Form("\n Endcap W-algo params: trigID: L2EW=%d isMC=%d\n TPC: nPileupVert>%d, vertex |Z|<%.1fcm, primEleTrack: nFit>%d, hitFrac>%.2f Rin<%.1fcm, Rout>%.1fcm, PT>%.1fGeV/c\n ETOW ADC: kSigPed=%d AdcThr>%d maxAdc>%.0f clustET>%.1f GeV ET2x1/ET4x4>%0.2f ET2x1/nearTotET>%0.2f\n dist(track-clust)<%.1fcm, nearDelR<%.1f\n W selection highET>%.1f awayDelPhi<%.1frad ptBalance>%.1fGeV , \n ESMD: nSmdStrip=%d, gateL=%d windowL=%d smdRatio=%.2f",
234  parE_l2ewTrgID,isMC,
235  par_minPileupVert,par_vertexZ,
236  parE_nFitPts,parE_nHitFrac,parE_trackRin,parE_trackRout,parE_trackPt,
237  par_kSigPed,par_AdcThres,par_maxADC,parE_clustET,parE_clustFrac24,parE_nearTotEtFrac,
238  parE_delR3D,par_nearDeltaR,
239  par_highET,par_awayDeltaPhi,parE_ptBalance, parE_nSmdStrip, parE_esmdGL, parE_esmdWL, parE_smdRatio
240  )<<endl;
241  cout<<Form("\n EtowScaleFact=%.2f BtowScaleFacor=%.2f" ,par_etowScale, par_btowScale)<<endl;
242 
243  if(mMuDstMaker) {
244  // initialization of TPC cuts is run dependent (only MuDst analysis)
245  for(int isec=0;isec<mxTpcSec;isec++) {
246  int sec=isec+1;
247  float Rin=par_trackRin,Rout=par_trackRout;
248  float RinE=parE_trackRin,RoutE=parE_trackRout;
249  //.... Rin ..... changes
250 
251  //Run 9 (final)
252  if(sec==4 && mRunNo>=10090089 && mRunNo<=11000000 ) Rin=125.;
253  if(sec==11 && mRunNo>=10083013 && mRunNo<=11000000 ) Rin=125.;
254  if(sec==15 && mRunNo>=10088096 && mRunNo<=10090112 ) Rin=125.;
255 
256  //Run 11 (only sector 20 which is already excluded)
257 
258  //Run 12 (final) These sectors have dead inner padrows for all of pp510 (run#300+nn is for private MC)
259  if((sec==5 || sec==6 || sec==7 || sec==21) && (mRunNo>=13000000 || mRunNo/100==3) ) Rin=125.;
260 
261  //.... Rout ..... changes
262 
263  //Run 9 (final)
264  if(sec==5 && mRunNo>=10098029 && mRunNo<=11000000) Rout=140.;
265  if(sec==6 && mRunNo<=11000000 ) Rout=140.;
266  if(sec==20 && mRunNo>=10095120 && mRunNo<=10099078 ) Rout=140.;
267 
268  //Run 11 (only sector 20 which is already excluded)
269 
270  //Run 12 (final) No sectors with outer padrow issues
271 
272  // initialize cuts for each run individually
273  mTpcFilter[isec].setCuts(par_nFitPts,par_nHitFrac,Rin,Rout);
274  mTpcFilterE[isec].setCuts(parE_nFitPts,parE_nHitFrac,RinE,RoutE);
275  }
276  }
277 
278  //.... spinDB monitoring
279  if(mMuDstMaker && spinDb)
280  { char txt[1000],txt0[100];
281  sprintf(txt0,"bxIdeal%d",nRun);
282  sprintf(txt,"intended fill pattern R%d-%d vs. bXing; %s", runNo,nRun,spinDb->getV124comment());
283  nRun++;
284  Tfirst=int(2e9); Tlast=-Tfirst;
285  hbxIdeal=new TH1F(txt0,txt,128,-0.5,127.5);
286  hbxIdeal->SetFillColor(kYellow);
287  HList->Add(hbxIdeal);
288 
289  spinDb->print(0); // 0=short, 1=huge
290  for(int bx=0;bx<120;bx++){
291  if(spinDb->isBXfilledUsingInternalBX(bx)) hbxIdeal->Fill(bx);
292  }
293 
294  }
295 
296  return kStOK;
297 }
298 
299 //________________________________________________
300 //________________________________________________
301 Int_t
303  if(mMuDstMaker){
304  LOG_INFO<<endl<<"Output tree file "<<mTreeName<<endl<<endl;
305  mTreeFile->Write();
306  mTreeFile->Close();
307 
308  if(hbxIdeal) {
309  char txt[1000];
310  sprintf(txt,"events T= %d %d",Tfirst,Tlast);
311  printf("Finish run=%d , events time range %s\n",mRunNo,txt);
312  hbxIdeal->GetYaxis()->SetTitle(txt);
313  }
314  }
315  return StMaker::Finish();
316 }
317 
318 //________________________________________________
319 //________________________________________________
320 Int_t
321 St2011WMaker::FinishRun(int runNo){
322  LOG_INFO<<Form("::FinishRun(%d)",runNo)<<endm;
323 return kStOK;
324 }
325 
326 //________________________________________________
327 //________________________________________________
328 void
329 St2011WMaker::Clear(const Option_t*){
330  wEve->clear();
331 }
332 
333 //--------------------------------------
334 //--------------------------------------
335 Int_t
337  nInpEve++;
338 
339  if(mMuDstMaker){ //standard MuDst analysis
340  wEve->id=mMuDstMaker->muDst()->event()->eventId();
341  wEve->runNo=mMuDstMaker->muDst()->event()->runId();
342  wEve->time=mMuDstMaker->muDst()->event()->eventInfo().time();
343  wEve->zdcRate=mMuDstMaker->muDst()->event()->runInfo().zdcCoincidenceRate();
344  int T=wEve->time;
345  if(Tlast<T) Tlast=T;
346  if(Tfirst>T) Tfirst=T;
347 
348  hA[13]->Fill(wEve->zdcRate);
349 
350  // get next event from jet tree
351  mJetTreeChain->GetEntry(indexJet++);
352 
353  const char *afile = mMuDstMaker->GetFile();
354  //printf("inpEve=%d eveID=%d daqFile=%s\n",nInpEve, wEve->id,afile);
355  if(nInpEve%200==1) printf("\n-----in---- %s, muDst nEve: inp=%d trig=%d accpt=%d daqFile=%s\n", GetName(),nInpEve,nTrigEve, nAccEve,afile);
356 
357  hA[0]->Fill("inp",1.);
358  hE[0]->Fill("inp",1.);
359 
360  int btowStat=accessBTOW(); // get energy in BTOW
361  int etowStat=accessETOW(); // get energy in ETOW
362 
363  int btrig=accessBarrelTrig();
364  int etrig=accessEndcapTrig();
365 
366  if( btrig && etrig ) {mWtree->Fill(); return kStOK;} //skip event w/o valid trig ID
367 
368  nTrigEve++;
369 
370  if(accessVertex()) {
371  mWtree->Fill();
372  return kStOK; //skip event w/o ~any reasonable vertex
373  }
374 
375  if( accessTracks()) {mWtree->Fill(); return kStOK;} //skip event w/o ~any highPt track
376 
377  accessBSMD();// get energy in BSMD
378  accessESMD();// get energy in ESMD
379  accessEPRS();// get energy in EPRS
380 
381  mWtree->Fill(); //write all events w/ pt>10 track to tree
382 
383  if(wEve->l2bitET && wEve->bemc.tileIn[0]==1) hA[0]->Fill("B-in",1.0);
384  if(wEve->l2EbitET && wEve->etow.etowIn==1) hE[0]->Fill("E-in",1.0);
385  if(wEve->l2bitET && !btowStat) hA[0]->Fill("B200",1.0);
386  if(wEve->l2EbitET && !etowStat) hE[0]->Fill("E200",1.0);
387 
388  if( btowStat && etowStat ) return kStOK; //skip event w/o energy in BTOW && ETOW
389 
390  if(mJetTreeChain) {// just QA plots for jets
391  getJetEvent(); //get input jet info (new jet format)
392  for (int i_jet=0; i_jet<mJetEvent->vertex()->numberOfJets(); ++i_jet){ //just first vertex
393  StJetCandidate* jet = mJetEvent->vertex()->jet(i_jet);
394  float jet_pt = jet->pt();
395  float jet_eta = jet->eta();
396  float jet_phi = jet->phi();
397  hA[117]->Fill(jet_eta,jet_phi);
398  hA[118]->Fill(jet_pt);
399  }
400  }
401  }
402  else { //analysis of W tree
403  if(getEvent(index++,indexJet++)==kStEOF) return kStEOF; //get next event from W and jet tree
404 
405  hA[13]->Fill(wEve->zdcRate);
406 
407  //allow for manual scale adjustment of BTOW energy (careful!)
408  for(int i=0; i<4800; i++) wEve->bemc.eneTile[0][i]*=par_btowScale;
409 
410  if(nInpEve%200==1) printf("\n-----in---- %s, W-Tree nEve: inp=%d \n", GetName(),nInpEve);//,nTrigEve, nAccEve,afile);
411 
412  //fill some bins in muStatEve histos for checks
413  hA[0]->Fill("inp",1.);
414  hE[0]->Fill("inp",1.);
415 
416  //fill trigger bins for counter histos
417  if(wEve->l2bitET) hA[0]->Fill("L2bwET",1.);
418  if(wEve->l2bitRnd) hA[0]->Fill("L2bwRnd",1.);
419  if(wEve->l2EbitET) hE[0]->Fill("L2ewET",1.);
420  if(wEve->l2EbitRnd) hE[0]->Fill("L2ewRnd",1.);
421 
422  if(!wEve->l2bitET && !wEve->l2EbitET) return kStOK; //skip event w/o valid trig ID
423  nTrigEve++;
424 
425  //fill tpc bins
426  int nVerR=0; int nTrOK=0;
427  for(unsigned int iv=0;iv<wEve->vertex.size();iv++) {
428  if(wEve->vertex[iv].rank > 0) nVerR++;
429  if(wEve->vertex[iv].eleTrack.size() > 0) nTrOK++;
430  }
431  if(wEve->l2bitET && nVerR>0) hA[0]->Fill("vertZ",1.);
432  if(wEve->l2EbitET && wEve->vertex.size()>0) hE[0]->Fill("vertZ",1.);
433  if(wEve->l2bitET && nTrOK>0) hA[0]->Fill("Pt10",1.);
434  if(wEve->l2EbitET && nTrOK>0) hE[0]->Fill("Pt10",1.);
435 
436  if(nTrOK<=0) return kStOK;
437 
438  //fill some B/ETOW bins
439  if(wEve->l2bitET && wEve->bemc.tileIn[0]==1) hA[0]->Fill("B-in",1.0);
440  if(wEve->l2EbitET && wEve->etow.etowIn==1) hE[0]->Fill("E-in",1.0);
441  if(wEve->l2bitET && wEve->bemc.maxAdc>par_maxADC) hA[0]->Fill("B200",1.0);
442  if(wEve->l2EbitET && wEve->etow.maxAdc>par_maxADC) hE[0]->Fill("E200",1.0);
443 
444  if(wEve->bemc.maxAdc<par_maxADC && wEve->etow.maxAdc<par_maxADC) return kStOK; //skip event w/o energy in BTOW && ETOW
445 
446  if(mJetTreeChain) {// just QA plots for jets
447  getJetEvent(); //get input jet info (new jet format)
448  for (int i_jet=0; i_jet<mJetEvent->vertex()->numberOfJets(); ++i_jet){
449  StJetCandidate* jet = mJetEvent->vertex()->jet(i_jet);
450  float jet_pt = jet->pt();
451  float jet_eta = jet->eta();
452  float jet_phi = jet->phi();
453  hA[117]->Fill(jet_eta,jet_phi);
454  hA[118]->Fill(jet_pt);
455  }
456  }
457  }
458 
459  //find barrel candidates
460  extendTrack2Barrel();
461  int bmatch=matchTrack2BtowCluster();
462 
463  //find endcap candidates
464  extendTrack2Endcap();
465  int ematch=matchTrack2EtowCluster();
466 
467  if(bmatch && ematch) return kStOK; //no matched BTOW or ETOW clusters
468 
469  nAccEve++;
470 
471  /* now it starts to get interesting, process every track
472  on the list till the end. */
473  findNearJet();
474  findAwayJet();
475 
476  if(mJetTreeChain) {
477  findPtBalance();
478  if(!bmatch) tag_Z_boson();
479  }
480 
481  //endcap specific analysis
482  if(!ematch) {
483  analyzeESMD();
484  analyzeEPRS();
485  }
486 
487  if(!bmatch) find_W_boson();
488  if(!ematch) findEndcap_W_boson();
489  if(nAccEve<2 ||nAccEve%1000==1 ) wEve->print(0x0,isMC);
490 
491  return kStOK;
492 }
493 
494 
495 //--------------------------------------
496 //--------------------------------------
497 void
498 St2011WMaker::initGeom(){
499 
500  //...... BTOW ...........
501  memset(mapBtowIJ2ID,0,sizeof(mapBtowIJ2ID));
502  for(int softID=1; softID<=mxBtow; softID++) {
503  //........... querry BTOW geom
504  int m,e,s;
505  mBtowGeom->getBin(softID,m,e,s);
506  float etaF,phiF;
507  mBtowGeom->getEta(m,e,etaF);
508  mBtowGeom->getPhi(m,s,phiF); // -pi <= phi < pi
509 
510  int iEta, iPhi;
511  assert(L2algoEtaPhi2IJ(etaF,phiF,iEta, iPhi)==0); // tower must be localized at the known position
512  int IJ=iEta+ iPhi*mxBTetaBin;
513  assert(mapBtowIJ2ID[IJ ]==0); // avoid overlaping mapping
514  mapBtowIJ2ID[IJ ]=softID;
515 
516  Float_t x,y,z;
517  assert( mBtowGeom->getXYZ(softID,x,y,z)==0);
518  positionBtow[softID-1]=TVector3(x,y,z);
519  }// end of loop over towers
520 
521  //...... BSMD-E, -P ...........
522  for(int iep=0;iep<mxBSmd;iep++) {
523  for(int softID=1; softID<=mxBStrips; softID++) {
524  Float_t x,y,z;
525  assert( mBSmdGeom[iep]->getXYZ(softID,x,y,z)==0);
526  positionBsmd[iep][softID-1]=TVector3(x,y,z);
527  }// end of loop over towers
528  }
529 
530  //...... ETOW .............
531  for(int isec=0;isec<mxEtowSec;isec++){
532  for(int isub=0;isub<mxEtowSub;isub++){
533  for(int ieta=0;ieta<mxEtowEta;ieta++){
534  positionEtow[isec*mxEtowSub+isub][ieta]=geomE->getTowerCenter(isec,isub,ieta);
535  }
536  }
537  }
538 
539 }
540 
541 
542 //--------------------------------------
543 //--------------------------------------
544 int // returns error code
545 St2011WMaker::L2algoEtaPhi2IJ(float etaF,float phiF,int &iEta, int &iPhi) {
546  if( phiF<0) phiF+=2*C_PI; // I want phi in [0,2Pi]
547  if(fabs(etaF)>=0.99) return -1;
548  int kEta=1+(int)((etaF+1.)/0.05);
549  iPhi=24-(int)( phiF/C_PI*60.);
550  if(iPhi<0) iPhi+=120;
551  // convention: iPhi=[0,119], kEta=[1,40]
552  iEta=kEta-1;
553  //printf("IJ=%d %d\n",iEta,iPhi);
554  if(iEta<0 || iEta>=mxBTetaBin) return -2;
555  if(iPhi<0 || iPhi>=mxBTphiBin) return -3;
556  return 0;
557 }
558 
559 
560 //________________________________________________
561 //________________________________________________
562 void
563 St2011WMaker::getJetEvent(){
564  if(mJetTreeChain==0)
565  return;
566 
567  // if jets are out of sink for some reason find matching event
568  while(mJetEvent->eventId()!=wEve->id || mJetEvent->runId()!=wEve->runNo) {
569  mJetTreeChain->GetEntry(indexJet++);
570  }
571 
572  assert(mJetEvent->eventId()==wEve->id);
573  assert(mJetEvent->runId()==wEve->runNo);
574  assert(mJetEvent_noEEMC->eventId()==wEve->id);
575  assert(mJetEvent_noEEMC->runId()==wEve->runNo);
576  return;
577 
578 }
579 
580 
581 // ----------------------------------------------------------------------------
582 Int_t St2011WMaker::getEvent(Int_t i, Int_t ijet)
583 {
584  Int_t stat=mTreeChain->GetEntry(i);
585  Int_t statJet=mJetTreeChain->GetEntry(ijet);
586  if (!stat && !statJet) return kStEOF;
587  return kStOK;
588 }
589 
590 // ----------------------------------------------------------------------------
591 void St2011WMaker::chainFile( const Char_t *file )
592 {
593 
594  TString fname=file;
595  cout<<"Chain W tree files"<<endl;
596  if ( !fname.Contains("tree.root") ) return;
597  cout << "+ " << fname << endl;
598  mTreeChain->Add(fname);
599 }
600 
601 // ----------------------------------------------------------------------------
602 void St2011WMaker::chainJetFile( const Char_t *file )
603 {
604 
605  TString fname=file;
606  cout<<"Chain jet tree files"<<endl;
607  if ( !fname.Contains("jets_") ) return;
608  cout << "+ " << fname << endl;
609  mJetTreeChain->Add(fname);
610 }
611 
612 // $Log: St2011WMaker.cxx,v $
613 // Revision 1.21 2013/10/14 13:07:31 stevens4
614 // Move initialization of TPC QA histos from Init() to InitRun()
615 //
616 // Revision 1.20 2013/09/13 19:33:13 stevens4
617 // Updates to code for combined 2011+2012 result presented to spin PWG 9.12.13
618 //
619 // Revision 1.19 2012/09/26 14:20:59 stevens4
620 // use PtBal cos(phi) for WB and WE algos and use Q*ET/PT for barrel charge sign
621 //
622 // Revision 1.18 2012/09/21 16:59:09 balewski
623 // added ESMD peak adjustement - partialy finished
624 //
625 // Revision 1.17 2012/09/18 22:30:16 stevens4
626 // change to new jet tree format with access to all rank>0 vertices
627 //
628 // Revision 1.16 2012/09/17 03:29:29 stevens4
629 // Updates to Endcap algo and Q*ET/PT charge separation
630 //
631 // Revision 1.15 2012/08/21 18:29:16 stevens4
632 // Updates to endcap W selection using ESMD strip ratio
633 //
634 // Revision 1.14 2012/08/21 17:40:09 stevens4
635 // Revert to previous version
636 //
637 // Revision 1.12 2012/08/07 21:06:38 stevens4
638 // update to tree analysis to produce independent histos in a TDirectory for each eta-bin
639 //
640 // Revision 1.11 2012/07/13 20:53:16 stevens4
641 // Add filling of empty events in W tree
642 // Minor modifications to histograms
643 //
644 // Revision 1.10 2012/07/13 16:11:44 balewski
645 // minor clenup, prevent crash in Finish if zero input events, now it runs on M-C events as well
646 //
647 // Revision 1.9 2012/07/12 20:49:21 balewski
648 // added spin info(star: bx48, bx7, spin4) and maxHtDSM & BTOW to Wtree
649 // removed dependence of spinSortingMaker from muDst
650 // Now Wtree can be spin-sorted w/o DB
651 // rdMu.C & readWtree.C macros modified
652 // tested so far on real data run 11
653 // lot of misc. code shuffling
654 //
655 // Revision 1.8 2012/07/06 17:47:02 stevens4
656 // Updates for tree reader
657 //
658 // Revision 1.7 2012/06/25 20:53:15 stevens4
659 // algo and histo cleanup
660 //
661 // Revision 1.6 2012/06/22 20:45:58 balewski
662 // change Rin for M-C matched to 2012 data
663 //
664 // Revision 1.5 2012/06/18 18:28:00 stevens4
665 // Updates for Run 9+11+12 AL analysis
666 //
667 // Revision 1.4 2011/02/25 06:03:32 stevens4
668 // addes some histos and enabled running on MC
669 //
670 // Revision 1.3 2011/02/17 04:16:14 stevens4
671 // move sector dependent track QA cuts before track pt>10 cut and lower par_clustET and par_ptBalance thresholds to 14 GeV
672 //
673 // Revision 1.2 2011/02/14 02:35:21 stevens4
674 // change back to 10 GeV track pt and 15 GeV cluster ET as default for both B + E algos
675 //
676 // Revision 1.1 2011/02/10 20:33:22 balewski
677 // start
678 //
TVector3 getTowerCenter(const UInt_t sec, const UInt_t sub, const UInt_t etabin) const
bool isBXfilledUsingInternalBX(int bx)
defined only for 2005 run by CAD , based on first 4 filled bunches in both rings. Note...
StMuDst * muDst()
Definition: StMuDstMaker.h:425
virtual Int_t Make()
virtual const char * GetFile() const
Returns name of current input or output file, depending on mode (GetFileName does the same...
void loadTables(StMaker *anyMaker)
load tables.
void print(int level=0)
vs. STAR==yellow bXing
Definition: Stypes.h:43
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320
virtual const char * GetName() const
special overload
Definition: StMaker.cxx:237
EEMC simple geometry.
Definition: Stypes.h:40
muDst based extraction of W-signal from pp500 data from 2011
Definition: St2011WMaker.h:49
virtual Int_t Finish()
Definition: StMaker.cxx:776
Int_t getBin(const Float_t phi, const Float_t eta, Int_t &m, Int_t &e, Int_t &s) const
Definition: StEmcGeom.h:321
virtual Int_t Finish()