StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTofrNtupleMaker.cxx
1 /*******************************************************************
2  *
3  * $Id: StTofrNtupleMaker.cxx,v 1.13 2018/02/26 23:26:51 smirnovd Exp $
4  *
5  * Author: Xin Dong
6  *****************************************************************
7  *
8  * Description: example maker to get the matched TOFr cells and fill
9  * into TOFr tree.
10  *
11  *******************************************************************/
12 #include <iostream>
13 #include <math.h>
14 #include <vector>
15 #include <stdlib.h>
16 #include <stdio.h>
17 #include <algorithm>
18 #include <iterator>
19 
20 #include "StEventTypes.h"
21 #include "Stypes.h"
22 #include "StThreeVectorF.hh"
23 #include "StMeasuredPoint.h"
24 #include "StDedxPidTraits.h"
25 #include "StTrackPidTraits.h"
26 #include "StarClassLibrary/StParticleTypes.hh"
27 #include "StarClassLibrary/StParticleDefinition.hh"
28 #include "StMuDSTMaker/COMMON/StMuUtilities.h"
29 #include "StMuDSTMaker/COMMON/StMuPrimaryVertex.h"
30 #include "StHelix.hh"
31 #include "StTrackGeometry.h"
32 #include "StParticleTypes.hh"
33 #include "StTpcDedxPidAlgorithm.h"
34 #include "StHit.h"
35 #include "StAssociationMaker/StTrackPairInfo.hh"
36 #include "StEventUtilities/StuRefMult.hh"
37 #include "PhysicalConstants.h"
38 #include "StPhysicalHelixD.hh"
39 #include "TTree.h"
40 #include "TFile.h"
41 #include "StMemoryInfo.hh"
42 #include "StMessMgr.h"
43 #include "StTimer.hh"
44 #include "tables/St_pvpdStrobeDef_Table.h"
45 #include "tables/St_g2t_vertex_Table.h" // tmp for Dz(vertex)
46 #include "tables/St_vertexSeed_Table.h" //
47 
48 #include "StTofUtil/tofPathLength.hh"
49 #include "StTofUtil/StTofrGeometry.h"
50 #include "StTofUtil/StTofrDaqMap.h"
51 #include "StTofUtil/StTofCellCollection.h"
52 #include "StTofUtil/StTofHitCollection.h"
53 #include "StTofrNtupleMaker.h"
54 
55 
56 
57 //---------------------------------------------------------------------------
59 StTofrNtupleMaker::StTofrNtupleMaker(const Char_t *name="tofrNtuple", const Char_t *outname="tofntuple.root") : StMaker(name) {
60  mTupleFileName=outname;
61 
62  doPrintMemoryInfo = kFALSE;
63  doPrintCpuInfo = kFALSE;
64 }
65 
68 
69 //---------------------------------------------------------------------------
72 
73  if (mTupleFileName!="") bookNtuples();
74 
75  mAcceptedEvents = 0;
76  mPvpdEntries = 0;
77  mTofrEvents = 0;
78  mTofrEntries = 0;
79 
80  return kStOK;
81 }
82 
83 
84 Int_t StTofrNtupleMaker::InitRun(int runnumber) {
85 
86  if(mInitGeomFromOther) {
87  TDataSet *geom = GetDataSet("tofrGeometry");
88  mTofrGeom = (StTofrGeometry *)geom->GetObject();
89  } else {
90  mTofrGeom = new StTofrGeometry("tofrGeoNtuple","tofGeo in NtupleMaker");
91  if(!mTofrGeom->IsInitDone()) {
92  gMessMgr->Info("TofrGemetry initialization..." ,"OS");
93  TVolume *starHall = (TVolume *)GetDataSet("HALL");
94  mTofrGeom->Init(starHall);
95  }
96  }
97 
98  gMessMgr->Info(" -- retrieving run parameters from Calibrations_tof","OS");
99  TDataSet *mDbDataSet = GetDataBase("Calibrations/tof/pvpdStrobeDef");
100  if (!mDbDataSet){
101  gMessMgr->Error("unable to get TOF run parameters","OS");
102  assert(mDbDataSet);
103  }
104  St_pvpdStrobeDef* pvpdStrobeDef = static_cast<St_pvpdStrobeDef*>(mDbDataSet->Find("pvpdStrobeDef"));
105  if (!pvpdStrobeDef){
106  gMessMgr->Error("unable to find TOF run param table","OS");
107  assert(pvpdStrobeDef);
108  }
109  pvpdStrobeDef_st *strobeDef = static_cast<pvpdStrobeDef_st*>(pvpdStrobeDef->GetArray());
110  int numRows = pvpdStrobeDef->GetNRows();
111  if (mNPVPD != numRows) gMessMgr->Warning("#tubes inconsistency in dbase");
112  for (int i=0;i<mNPVPD;i++){
113  int ii = strobeDef[i].id - 1;
114  mStrobeTdcMin[ii] = strobeDef[i].strobeTdcMin;
115  mStrobeTdcMax[ii] = strobeDef[i].strobeTdcMax;
116  if (Debug())
117  LOG_INFO << "tube " << strobeDef[i].id << " min:"<< strobeDef[i].strobeTdcMin
118  <<" max:"<< strobeDef[i].strobeTdcMax<< endm;
119  }
120 
121  //========== Set Beam Line =====================
122  double x0 = 0.;
123  double y0 = 0.;
124  double dxdz = 0.;
125  double dydz = 0.;
126 
127  // Get Current Beam Line Constraint from database
128  /*TDataSet* dbDataSet = this->GetDataBase("Calibrations/rhic");
129 
130  if (dbDataSet) {
131  vertexSeed_st* vSeed = ((St_vertexSeed*) (dbDataSet->FindObject("vertexSeed")))->GetTable();
132 
133  x0 = vSeed->x0;
134  y0 = vSeed->y0;
135  dxdz = vSeed->dxdz;
136  dydz = vSeed->dydz;
137  }
138  else {
139  LOG_INFO << "StGenericVertexMaker -- No Database for beamline" << endm;
140  }
141  */
142  LOG_INFO<< " beamline is set by hand "<<endl;
143 
144  LOG_INFO << "BeamLine Constraint: " << endm;
145  LOG_INFO << "x(z) = " << x0 << " + " << dxdz << " * z" << endm;
146  LOG_INFO << "y(z) = " << y0 << " + " << dydz << " * z" << endm;
147 
148  //beam line not be calibrated yet
149  //x0 shift by 0.5
150  //x0 = 0.5;
151 
152  StThreeVectorD origin(x0,y0,0.0);
153  double pt = 88889999;
154  double nxy=::sqrt(dxdz*dxdz + dydz*dydz);
155  if(nxy<1.e-5){ // beam line _MUST_ be tilted
156  LOG_WARN << "StppLMVVertexFinder:: Beam line must be tilted!" << endm;
157  nxy=dxdz=1.e-5;
158  }
159  double p0=pt/nxy;
160  double px = p0*dxdz;
161  double py = p0*dydz;
162  double pz = p0; // approximation: nx,ny<<0
163  StThreeVectorD MomFstPt(px*GeV, py*GeV, pz*GeV);
164  delete mBeamHelix;
165  mBeamHelix = new StPhysicalHelixD(MomFstPt,origin,0.5*tesla,1.);
166 
167  mBeamX = x0;
168  mBeamY = y0;
169 
170  return kStOK;
171 }
172 
173 Int_t StTofrNtupleMaker::FinishRun(int runnumber)
174 {
175  if(!mInitGeomFromOther) {
176  if(mTofrGeom) delete mTofrGeom;
177  }
178  mTofrGeom = 0;
179  delete mBeamHelix;
180 
181  return kStOK;
182 }
183 
184 
187 
188  if (!(mTupleFileName=="")){
189  mTupleFile->Write();
190  mTupleFile->Close();
191  LOG_INFO << "StTofrNtupleMaker::Finish() ntuple file "
192  << mTupleFileName << " closed." << endm;
193  }
194 
195  //delete mPvpdTuple;
196  //delete mCellTuple;
197  //delete mTupleFile;
198 
199  LOG_INFO << "StTofrNtupleMaker -- statistics" << endm;
200  LOG_INFO << " accepted events : " << mAcceptedEvents << endm;
201  LOG_INFO << " pVPD entries : " << mPvpdEntries << endm;
202  LOG_INFO << " Tofr entries/events : " << mTofrEntries << "/" << mTofrEvents << endm;
203  return kStOK;
204 }
205 
206 
207 //---------------------------------------------------------------------------
210  LOG_INFO << "StTofrNtupleMaker -- welcome" << endm;
211 
212  StEvent *event = (StEvent *) GetInputDS("StEvent");
213 
214  //.........................................................................
215  // event selection ...
216  if (!event ||
218  !event->tofCollection() ||
220  !event->tofCollection()->rawdataPresent()){
221  LOG_INFO << "StTofrNtupleMaker -- nothing to do ... bye-bye"<< endm;
222  return kStOK;
223  }
224 
225  mAcceptedEvents++;
226  StTimer timer;
227  if (doPrintCpuInfo) timer.start();
228  if (doPrintMemoryInfo) StMemoryInfo::instance()->snapshot();
229 
230  // determine TOF configuration from run#
231  mYear2= (event->runId()<4000000);
232  mYear3= (event->runId()>4000000&&event->runId()<5000000);
233  mYear4= (event->runId()>5000000);
234 
235 
236  //.........................................................................
237  // Collect global data for both ntuples
238 
239  //-- Primary vertex & trigger information
240 cout<<"runId: "<<event->runId()<<" runnumber"<<event->id()<<endl;
241  float xvtx = -999.;
242  //xvtx = event->primaryVertex()->position().x();
243  float yvtx = -999.;
244  //yvtx = event->primaryVertex()->position().y();
245  float zvtx = -999.;
246  //zvtx = event->primaryVertex()->position().z();
247 
248  StL0Trigger* pTrigger = event->l0Trigger();
249  unsigned int triggerWord = 0;
250  if (pTrigger) triggerWord = pTrigger->triggerWord();
251 
252  //-------- fill event summary info -----------
253  mCellData.run = event->runId(); // the run number
254  mCellData.evt = event->id(); // the event number
255  mCellData.trgword = triggerWord;
256  mCellData.vertexX = xvtx;
257  mCellData.vertexY = yvtx;
258  mCellData.vertexZ = zvtx;
259 
260  if(Debug()){
261  LOG_INFO << " vertexZ: "<<mCellData.vertexZ<<endm;
262  }
263 
264  //-- read in TOFr info
265  //-- make sure tofSlats are available
266  StTofCollection *theTof = event->tofCollection();
267  if (event->tofCollection()->cellsPresent()){
268 
269  mTofrEvents++;
270  int entriesThisEvent(0);
271 
272  //initialize vpd content
273  for(int i=0;i<19;i++){
274  mCellData.pvpdLeadingEdgeTimeEast[i] = 0;
275  mCellData.pvpdTotEast[i] = 0;
276  mCellData.pvpdLeadingEdgeTimeWest[i] = 0;
277  mCellData.pvpdTotWest[i] = 0;
278  }
279 
280  //-- Loop over the cell container and retrieve the relevant parameters
281  StSPtrVecTofCell& cellTofVec = theTof->tofCells();
282  int ntofhits = 0;
283  float tdcsumeast = 0., tdcsumwest = 0.;
284  unsigned int vpdEast=0, vpdWest=0, nVpdEast=0, nVpdWest=0;
285  for (size_t i = 0; i < cellTofVec.size(); i++) {
286  StTofCell *thisCell = cellTofVec[i];
287  int trayId = thisCell->trayIndex();
288  if(Debug()) LOG_INFO << " tray ID: "<< trayId<<endm;
289  if(trayId==122){ //pvpd east)
290  int tubeId = thisCell->cellIndex()-1;
291  vpdEast += 1<<tubeId;
292  nVpdEast++;
293 
294  mCellData.pvpdLeadingEdgeTimeEast[tubeId] = thisCell->leadingEdgeTime();
295  mCellData.pvpdTotEast[tubeId] = thisCell->tot();
296  cout<<" tray/tube "<< trayId<<"/"<<tubeId<<" letime/tot "<< thisCell->leadingEdgeTime()<<"/"<< thisCell->tot()<<endl;
297  tdcsumeast += thisCell->leadingEdgeTime();
298  mPvpdEntries++;
299  }else if(trayId==121){ //pvpd west
300  int tubeId = thisCell->cellIndex()-1;
301  vpdWest += 1<<tubeId;
302  nVpdWest++;
303  mCellData.pvpdLeadingEdgeTimeWest[tubeId] = thisCell->leadingEdgeTime();
304  mCellData.pvpdTotWest[tubeId] = thisCell->tot();
305 
306  tdcsumwest += thisCell->leadingEdgeTime();
307  mPvpdEntries++;
308  }else if(trayId<=120&&trayId>=0){ //tofr
309 // if(!(thisCell->matchFlag())) continue;
310  mCellData.tray[ntofhits] = trayId;
311  mCellData.module[ntofhits] = thisCell->moduleIndex();
312  mCellData.cell[ntofhits] = thisCell->cellIndex();
313  mCellData.daq[ntofhits] = thisCell->daqIndex();
314  mCellData.leadingEdgeTime[ntofhits] = thisCell->leadingEdgeTime();
315 // mCellData.leadingEdgeTime[ntofhits] = 0.025*thisCell->tdc();//for run5
316  mCellData.tot[ntofhits] = thisCell->tot();
317 // mCellData.tot[ntofhits] = 0.1*thisCell->adc() - 0.025*thisCell->tdc();//for run5
318 
319  //mCellData.matchFlag[ntofhits] = thisCell->matchFlag();
320 
321  //- hit local position
322  if(Debug()) LOG_INFO << " trayID/moduleID/cellID/leadingEdgeTime/tot"<< trayId <<"/"<< mCellData.module[ntofhits]<<"/"<< mCellData.cell[ntofhits] << "/" << mCellData.leadingEdgeTime[ntofhits] << "/"<< mCellData.tot[ntofhits]<<"/"<<endm;
323 
324  StThreeVectorD globalHit = thisCell->position();
325  StTofrGeomSensor* sensor = mTofrGeom->GetGeomSensor(thisCell->moduleIndex(), thisCell->trayIndex());
326  double local[3], globalp[3];
327  globalp[0] = globalHit.x();
328  globalp[1] = globalHit.y();
329  globalp[2] = globalHit.z();
330  sensor->Master2Local(&globalp[0], &local[0]);
331  StThreeVectorD localHit(local[0], local[1], local[2]);
332  float ycenter = (thisCell->cellIndex()-1)*3.45-8.625;
333  delete sensor;
334 
335  cout<<"zHit local = "<<local[2]<<" "<< thisCell->zHit()<<endl;
336  mCellData.xlocal[ntofhits] = (Float_t) localHit.x();
337  mCellData.ylocal[ntofhits] = (Float_t) localHit.y();
338  mCellData.zlocal[ntofhits] = (Float_t) localHit.z();
339  mCellData.deltay[ntofhits] = local[1] - ycenter;
340 
341  if(Debug()){
342  LOG_INFO <<" global:("<<globalp[0]<<", "<<globalp[1]<<", "<<globalp[2]<<")"
343  <<"\n \t local:("<<localHit.x()<<", "<<localHit.y()<<", "<<localHit.z()<<")"<<endm;
344  }
345 
346  //- track information
347  StTrack *thisTrack = thisCell->associatedTrack();
348  //StTrack *globalTrack = thisTrack->node()->track(global);
349 
350  StTrackGeometry *theTrackGeometry = thisTrack->geometry();
351  const StThreeVectorF momentum = theTrackGeometry->momentum();
352  //- dig out from the dedx and rich pid traits
353  float dedx(0.), cherang(0), dedxerror(0);
354  int dedx_np(0), cherang_nph(0);
355  StSPtrVecTrackPidTraits& traits = thisTrack->pidTraits();
356  for (unsigned int it=0;it<traits.size();it++){
357  if (traits[it]->detector() == kTpcId){
358  StDedxPidTraits *pid = dynamic_cast<StDedxPidTraits*>(traits[it]);
359  if (pid && pid->method() ==kTruncatedMeanId){
360  dedx = pid->mean()*1e6;
361  dedx_np = pid->numberOfPoints();
362  dedxerror = pid->errorOnMean()*1e6;
363  }
364  } else if (traits[it]->detector() == kRichId){
365  StRichPidTraits *pid = dynamic_cast<StRichPidTraits*>(traits[it]);
366  if (pid){
367  StRichSpectra* pidinfo = pid->getRichSpectra();
368  if (pidinfo && pidinfo->getCherenkovPhotons()>2){
369  cherang = pidinfo->getCherenkovAngle();
370  cherang_nph = pidinfo->getCherenkovPhotons();
371  }
372  }
373  }
374  }
375 
376  StThreeVector<double> tofPos = theTrackGeometry->helix().at(theTrackGeometry->helix().pathLengths(*mBeamHelix).first);
377  StThreeVector<double> dcatof = tofPos - mBeamHelix->at(theTrackGeometry->helix().pathLengths(*mBeamHelix).second);//real dca
378 
379  float mNSigmaElectron(0.);
380  float mNSigmaPion(0.);
381  float mNSigmaKaon(0.);
382  float mNSigmaProton(0.);
383 
384  static StTpcDedxPidAlgorithm PidAlgorithm;
385  static StElectron* Electron = StElectron::instance();
386  static StPionPlus* Pion = StPionPlus::instance();
387  static StKaonPlus* Kaon = StKaonPlus::instance();
388  static StProton* Proton = StProton::instance();
389  const StParticleDefinition* pd = thisTrack->pidTraits(PidAlgorithm);
390 
391  if (pd) {
392  mNSigmaElectron = fabsMin(PidAlgorithm.numberOfSigma(Electron), __SIGMA_SCALE__);
393  mNSigmaPion = pack2Int( fabsMin(PidAlgorithm.numberOfSigma(Pion),__SIGMA_SCALE__), __SIGMA_SCALE__ );
394  mNSigmaKaon = pack2Int( fabsMin(PidAlgorithm.numberOfSigma(Kaon),__SIGMA_SCALE__), __SIGMA_SCALE__ );
395  mNSigmaProton = pack2Int( fabsMin(PidAlgorithm.numberOfSigma(Proton),__SIGMA_SCALE__), __SIGMA_SCALE__ );
396  }
397 
398  double pathLength = -999.;
399  //tofPathLength(&event->primaryVertex()->position(),
400  // &thisCell->position(),
401  // theTrackGeometry->helix().curvature());
402  pathLength = tofPathLength(&tofPos, &thisCell->position(), theTrackGeometry->helix().curvature());
403  if(Debug()) LOG_INFO << "dca(x,y,z) = (" << dcatof.x() <<", " << dcatof.y()
404  <<", " << dcatof.z() << "), tof pathLength = " << pathLength<<endm;
405  mCellData.trackId[ntofhits] = (Int_t)thisTrack->key();
406  mCellData.charge[ntofhits] = theTrackGeometry->charge();
407  if(thisTrack->detectorInfo()) {
408  mCellData.nHits[ntofhits] = thisTrack->detectorInfo()->numberOfPoints(kTpcId);
409  } else {
410  mCellData.nHits[ntofhits] = 0;
411  }
412  mCellData.nHitsFit[ntofhits] = thisTrack->fitTraits().numberOfFitPoints(kTpcId);
413  mCellData.dcaX[ntofhits] = dcatof.x();
414  mCellData.dcaY[ntofhits] = dcatof.y();
415  mCellData.dcaZ[ntofhits] = tofPos.z();
416  //globalTrack->geometry()->helix().distance(event->primaryVertex()->position());
417  mCellData.length[ntofhits] = (float)fabs(pathLength);
418  mCellData.p[ntofhits] = momentum.mag();
419  mCellData.pt[ntofhits] = momentum.perp();
420  mCellData.px[ntofhits] = momentum.x();
421  mCellData.py[ntofhits] = momentum.y();
422  mCellData.pz[ntofhits] = momentum.z();
423  mCellData.eta[ntofhits] = momentum.pseudoRapidity();
424  mCellData.dedx[ntofhits] = dedx;
425  mCellData.dedxError[ntofhits] = dedxerror;
426  mCellData.nHitsDedx[ntofhits] = dedx_np;
427  mCellData.cherenkovAngle[ntofhits] = cherang;
428  mCellData.cherenkovPhotons[ntofhits] = cherang_nph;
429  mCellData.nSigE[ntofhits] = mNSigmaElectron;
430  mCellData.nSigPi[ntofhits] = mNSigmaPion;
431  mCellData.nSigK[ntofhits] = mNSigmaKaon;
432  mCellData.nSigP[ntofhits] = mNSigmaProton;
433 
434 
435  mCellData.tofcorr[ntofhits] = -999.;
436  mCellData.beta[ntofhits] = -999.;
437  StSPtrVecTofHit& hitTofVec = theTof->tofHits();
438  for(size_t ih=0;ih<hitTofVec.size();ih++) {
439  StTofHit *aHit = (StTofHit *)hitTofVec[ih];
440  if(!aHit) continue;
441  if(aHit->trayIndex() == thisCell->trayIndex() &&
442  aHit->moduleIndex() == thisCell->moduleIndex() &&
443  aHit->cellIndex() == thisCell->cellIndex()) {
444  mCellData.tofcorr[ntofhits] = aHit->timeOfFlight();
445  mCellData.beta[ntofhits] = aHit->beta();
446  }
447 
448  }
449 
450  ntofhits++;
451  }//end of tofr loop
452  }
453  mCellData.vpdEast = vpdEast;
454  mCellData.vpdWest = vpdWest;
455  mCellData.numberOfVpdEast = nVpdEast;
456  mCellData.numberOfVpdWest = nVpdWest;
457  mCellData.tDiff = theTof->tdiff();
458  mCellData.nTofHits = ntofhits;
459  mPvpdTuple->Fill();
460  mCellTuple->Fill();
461  mTofrEntries = ntofhits;
462  entriesThisEvent = ntofhits;
463 
464  if(Debug()){
465  LOG_INFO << " #vpd East: "<<mCellData.numberOfVpdEast
466  << "\n \t #vpd West: "<<mCellData.numberOfVpdWest<<endm;
467  }
468  LOG_INFO << " Tofr update: " << entriesThisEvent << " entries" <<endm;
469  }
470 
471 
472  //- debug info
473  if (doPrintMemoryInfo) {
474  StMemoryInfo::instance()->snapshot();
475  StMemoryInfo::instance()->print();
476  }
477  if (doPrintCpuInfo) {
478  timer.stop();
479  LOG_INFO << "CPU time for StEventMaker::Make(): "
480  << timer.elapsedTime() << " sec\n" << endm;
481  }
482 
483  LOG_INFO << "StTofrNtupleMaker -- bye-bye" << endm;
484  return kStOK;
485 }
486 
487 
488 //---------------------------------------------------------------------------
491  mTupleFile = new TFile(mTupleFileName.c_str(), "RECREATE");
492  LOG_INFO << "StTofrNtupleMaker::bookNtuples() file "
493  << mTupleFileName << " opened" << endm;
494 
495  // pVPD timing
496  mPvpdTuple = new TTree("pvpd","tofr timing");
497  mPvpdTuple->SetAutoSave(1000);
498  mPvpdTuple->Branch("run",&mCellData.run,"run/I");
499  mPvpdTuple->Branch("evt",&mCellData.evt,"evt/I");
500  mPvpdTuple->Branch("trgword",&mCellData.trgword,"trgword/I");
501  mPvpdTuple->Branch("vertexX",&mCellData.vertexX,"vertexX/F");
502  mPvpdTuple->Branch("vertexY",&mCellData.vertexY,"vertexY/F");
503  mPvpdTuple->Branch("vertexZ",&mCellData.vertexZ,"vertexZ/F");
504  mPvpdTuple->Branch("vpdEast",&mCellData.vpdEast,"vpdEast/I");
505  mPvpdTuple->Branch("vpdWest",&mCellData.vpdWest,"vpdWest/I");
506  mPvpdTuple->Branch("numberOfVpdEast",&mCellData.numberOfVpdEast,"numberOfVpdEast/I");
507  mPvpdTuple->Branch("numberOfVpdWest",&mCellData.numberOfVpdWest,"numberOfVpdWest/I");
508  mPvpdTuple->Branch("tDiff",&mCellData.tDiff,"tDiff/F");
509  mPvpdTuple->Branch("pvpdLeadingEdgeTimeEast",&mCellData.pvpdLeadingEdgeTimeEast,"pvpdLeadingEdgeTimeEast[19]/D");
510  mPvpdTuple->Branch("pvpdLeadingEdgeTimeWest",&mCellData.pvpdLeadingEdgeTimeWest,"pvpdLeadingEdgeTimeWest[19]/D");
511  mPvpdTuple->Branch("pvpdTotEast",&mCellData.pvpdTotEast,"pvpdTotEast[19]/D");
512  mPvpdTuple->Branch("pvpdTotWest",&mCellData.pvpdTotWest,"pvpdTotWest[19]/D");
513 
514  // Tofr calibration ntuple
515  mCellTuple = new TTree("tofr","Tofr cell data");
516  mCellTuple->SetAutoSave(1000);
517  mCellTuple->Branch("run",&mCellData.run,"run/I");
518  mCellTuple->Branch("evt",&mCellData.evt,"evt/I");
519  mCellTuple->Branch("trgword",&mCellData.trgword,"trgword/I");
520  mCellTuple->Branch("vertexX",&mCellData.vertexX,"vertexX/F");
521  mCellTuple->Branch("vertexY",&mCellData.vertexY,"vertexY/F");
522  mCellTuple->Branch("vertexZ",&mCellData.vertexZ,"vertexZ/F");
523  mCellTuple->Branch("vpdEast",&mCellData.vpdEast,"vpdEast/I");
524  mCellTuple->Branch("vpdWest",&mCellData.vpdWest,"vpdWest/I");
525  mCellTuple->Branch("numberOfVpdEast",&mCellData.numberOfVpdEast,"numberOfVpdEast/I");
526  mCellTuple->Branch("numberOfVpdWest",&mCellData.numberOfVpdWest,"numberOfVpdWest/I");
527  mCellTuple->Branch("tDiff",&mCellData.tDiff,"tDiff/F");
528  mCellTuple->Branch("pvpdLeadingEdgeTimeEast",&mCellData.pvpdLeadingEdgeTimeEast,"pvpdLeadingEdgeTimeEast[19]/D");
529  mCellTuple->Branch("pvpdLeadingEdgeTimeWest",&mCellData.pvpdLeadingEdgeTimeWest,"pvpdLeadingEdgeTimeWest[19]/D");
530  mCellTuple->Branch("pvpdTotEast",&mCellData.pvpdTotEast,"pvpdTotEast[19]/D");
531  mCellTuple->Branch("pvpdTotWest",&mCellData.pvpdTotWest,"pvpdTotWest[19]/D");
532  mCellTuple->Branch("nTofHits",&mCellData.nTofHits,"nTofHits/I");
533  mCellTuple->Branch("tray",&mCellData.tray,"tray[nTofHits]/I");
534  mCellTuple->Branch("module",&mCellData.module,"module[nTofHits]/I");
535  mCellTuple->Branch("cell",&mCellData.cell,"cell[nTofHits]/I");
536  mCellTuple->Branch("daq",&mCellData.daq,"daq[nTofHits]/I");
537  mCellTuple->Branch("leadingEdgeTime",&mCellData.leadingEdgeTime,"leadingEdgeTime[nTofHits]/D");
538  mCellTuple->Branch("tot",&mCellData.tot,"tot[nTofHits]/D");
539 // mCellTuple->Branch("matchFlag",&mCellData.matchFlag,"matchFlag/I");
540  mCellTuple->Branch("xlocal",&mCellData.xlocal,"xlocal[nTofHits]/F");
541  mCellTuple->Branch("ylocal",&mCellData.ylocal,"ylocal[nTofHits]/F");
542  mCellTuple->Branch("zlocal",&mCellData.zlocal,"zlocal[nTofHits]/F");
543  mCellTuple->Branch("deltay",&mCellData.deltay,"deltay[nTofHits]/F");
544  mCellTuple->Branch("trackId",&mCellData.trackId,"trackId[nTofHits]/I");
545  mCellTuple->Branch("charge",&mCellData.charge,"charge[nTofHits]/I");
546  mCellTuple->Branch("p",&mCellData.p,"p[nTofHits]/F");
547  mCellTuple->Branch("pt",&mCellData.pt,"pt[nTofHits]/F");
548  mCellTuple->Branch("px",&mCellData.px,"px[nTofHits]/F");
549  mCellTuple->Branch("py",&mCellData.py,"py[nTofHits]/F");
550  mCellTuple->Branch("pz",&mCellData.pz,"pz[nTofHits]/F");
551  mCellTuple->Branch("eta",&mCellData.eta,"eta[nTofHits]/F");
552  mCellTuple->Branch("dcaX",&mCellData.dcaX,"dcaX[nTofHits]/F");
553  mCellTuple->Branch("dcaY",&mCellData.dcaY,"dcaY[nTofHits]/F");
554  mCellTuple->Branch("dcaZ",&mCellData.dcaZ,"dcaZ[nTofHits]/F");
555  mCellTuple->Branch("length",&mCellData.length,"length[nTofHits]/F");
556  mCellTuple->Branch("nHits",&mCellData.nHits,"nHits[nTofHits]/I");
557  mCellTuple->Branch("nHitsFit",&mCellData.nHitsFit,"nHitsFit[nTofHits]/I");
558  mCellTuple->Branch("nHitsDedx",&mCellData.nHitsDedx,"nHitsDedx[nTofHits]/I");
559  mCellTuple->Branch("dedx",&mCellData.dedx,"dedx[nTofHits]/F");
560  mCellTuple->Branch("dedxError",&mCellData.dedxError,"dedxError[nTofHits]/F");
561  mCellTuple->Branch("cherenkovAngle",&mCellData.cherenkovAngle,"cherenkovAngle[nTofHits]/F");
562  mCellTuple->Branch("cherenkovPhotons",&mCellData.cherenkovPhotons,"cherenkovPhotons[nTofHits]/I");
563  mCellTuple->Branch("nSigE",&mCellData.nSigE,"nSigE[nTofHits]/F");
564  mCellTuple->Branch("nSigPi",&mCellData.nSigPi,"nSigPi[nTofHits]/F");
565  mCellTuple->Branch("nSigK",&mCellData.nSigK,"nSigK[nTofHits]/F");
566  mCellTuple->Branch("nSigP",&mCellData.nSigP,"nSigP[nTofHits]/F");
567  mCellTuple->Branch("tofcorr",&mCellData.tofcorr,"tofcorr[nTofHits]/F");
568  mCellTuple->Branch("beta",&mCellData.beta,"beta[nTofHits]/F");
569 
570  return;
571 }
572 
573 /*****************************************************************
574  *
575  * $Log: StTofrNtupleMaker.cxx,v $
576  * Revision 1.13 2018/02/26 23:26:51 smirnovd
577  * StTof: Remove outdated ClassImp macro
578  *
579  * Revision 1.12 2018/02/26 23:13:20 smirnovd
580  * Move embedded CVS log messages to the end of file
581  *
582  * Revision 1.11 2016/05/05 16:18:07 geurts
583  * addressed Cppcheck report: fixed uninitialized variables and remove one unused variable.
584  *
585  * Revision 1.10 2012/12/14 06:35:52 geurts
586  * Changed global database calls to direct table access and/or removed deprecated database access code.
587  *
588  * Revision 1.9 2008/06/05 18:33:45 dongx
589  * -added members in tree: tDiff, tofcorr and beta for check
590  * -beamLine read from database
591  *
592  * Revision 1.8 2008/05/08 21:09:37 dongx
593  * Changed precision of time info to double type
594  *
595  * Revision 1.7 2008/05/06 18:42:09 dongx
596  * Updated for Run8 analysis
597  *
598  * Revision 1.5 2007/04/17 23:11:12 dongx
599  * replaced with standard STAR Loggers
600  *
601  * Revision 1.4 2004/04/12 16:17:03 dongx
602  * add AdcLoRes in the ntuple
603  *
604  * Revision 1.3 2004/04/09 16:13:23 dongx
605  * fix a potential bug causing crash
606  *
607  * Revision 1.2 2004/03/29 19:10:56 dongx
608  * correct the pVPD ADC read-out for year2 and year3
609  *
610  * Revision 1.1 2004/03/11 22:39:54 dongx
611  * first release
612  *
613  */
StTofrNtupleMaker(const Char_t *name, const Char_t *outname)
constructor sets default parameters
Int_t Finish()
write and close the ntuple file
pair< double, double > pathLengths(const StHelix &, double minStepSize=10 *micrometer, double minRange=10 *centimeter) const
path lengths at dca between two helices
Definition: StHelix.cc:511
Int_t Make()
get tofr slat, pvpd rawdata and global data from StEvent and store in flat TTrees (ntuples) ...
Int_t Init()
initialize ntuple and daqmap, and reset counters
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
Definition: TDataSet.cxx:428
Definition: Stypes.h:40
~StTofrNtupleMaker()
default empty destructor
void bookNtuples()
create and initialize ntuple and TTrees
virtual TDataSet * Find(const char *path) const
Definition: TDataSet.cxx:362