Belle II Software  release-06-02-00
HitLevelInfoWriter.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include <framework/gearbox/Const.h>
10 #include <reconstruction/modules/HitLevelInfoWriter/HitLevelInfoWriter.h>
11 #include <reconstruction/dataobjects/DedxConstants.h>
12 #include <mdst/dataobjects/PIDLikelihood.h>
13 
14 using namespace Belle2;
15 using namespace Dedx;
16 
17 REG_MODULE(HitLevelInfoWriter)
18 
20 {
21 
22  setDescription("Extract dE/dx information for calibration development.");
23 
24  addParam("outputBaseName", m_strOutputBaseName, "Suffix for output file name", std::string("HLInfo.root"));
25  addParam("particleLists", m_strParticleList, "Vector of ParticleLists to save", std::vector<std::string>());
26  addParam("enableHitLevel", enableHitLevel, "True or False for Hit level variables", false);
27  addParam("enableExtraVar", enableExtraVar, "True or False for extra track/hit level variables", false);
28  addParam("nodeadwire", nodeadwire, "True or False for deadwire hit variables", true);
29 
30 }
31 
33 
35 {
36 
37  B2INFO("Creating a ROOT file for the hit level information...");
38 
39  // required inputs
40  m_dedxTracks.isRequired();
41  m_tracks.isRequired();
42  m_trackFitResults.isRequired();
43  m_eclClusters.isOptional();
44  m_klmClusters.isOptional();
45 
46  // build a map to relate input strings to the right particle type
47  std::map<std::string, std::string> pdgMap = {{"pi+", "Const::pion.getPDGCode()"}, {"K+", "Const::kaon.getPDGCode()"}, {"mu+", "Const::muon.getPDGCode()"}, {"e+", "Const::electron.getPDGCode()"}, {"p+", "Const::proton.getPDGCode()"}, {"deuteron", "Const::deuteron.getPDGCode()"}};
48 
49  // if no particle lists are given, write out all tracks
50  if (m_strParticleList.size() == 0) bookOutput(m_strOutputBaseName);
51 
52  // create a new output file for each particle list specified
53  for (unsigned int i = 0; i < m_strParticleList.size(); i++) {
54  // strip the name of the particle lists to make this work
55  std::string pdg = pdgMap[m_strParticleList[i].substr(0, m_strParticleList[i].find(":"))];
56  std::string filename = std::string(m_strOutputBaseName + "_PID" + pdg + ".root");
57  bookOutput(filename);
58  }
59 }
60 
62 {
63 
64  int nParticleList = m_strParticleList.size();
65 
66  // **************************************************
67  // LOOP OVER dE/dx measurements for all tracks if
68  // no particle list is specified.
69  // **************************************************
70  if (nParticleList == 0) {
71  for (int idedx = 0; idedx < m_dedxTracks.getEntries(); idedx++) {
72 
73  CDCDedxTrack* dedxTrack = m_dedxTracks[idedx];
74  if (!dedxTrack) {
75  B2WARNING("No dedx related track...");
76  continue;
77  }
78 
79  const Track* track = dedxTrack->getRelatedFrom<Track>();
80  if (!track) {
81  B2WARNING("No related track...");
82  continue;
83  }
84 
85  const TrackFitResult* fitResult = track->getTrackFitResultWithClosestMass(Const::pion);
86  if (!fitResult) {
87  B2WARNING("No related fit for this track...");
88  continue;
89  }
90 
91  if (dedxTrack->size() == 0 || dedxTrack->size() > 200) continue;
92  if (dedxTrack->getCosTheta() < -1.0 || dedxTrack->getCosTheta() > 1.0) continue;
93 
94  // fill the event meta data
95  StoreObjPtr<EventMetaData> evtMetaData;
96  m_expID = evtMetaData->getExperiment();
97  m_runID = evtMetaData->getRun();
98  m_eventID = evtMetaData->getEvent();
99 
100  // fill the E/P
101  const ECLCluster* eclCluster = track->getRelated<ECLCluster>();
102  if (eclCluster and eclCluster->hasHypothesis(ECLCluster::EHypothesisBit::c_nPhotons)) {
103  m_eop = (eclCluster->getEnergy(ECLCluster::EHypothesisBit::c_nPhotons)) / (fitResult->getMomentum().Mag());
105  m_e1_9 = eclCluster->getE1oE9();
106  m_e9_21 = eclCluster->getE9oE21();
107  // fill the muon depth
108  const KLMCluster* klmCluster = eclCluster->getRelated<KLMCluster>();
109  if (klmCluster) m_klmLayers = klmCluster->getLayers();
110  }
111 
112  // fill the TTree with the Track information
113  fillTrack(fitResult);
114 
115  // fill the TTree with the CDCDedxTrack information
116  fillDedx(dedxTrack);
117 
118  // fill the TTree
119  m_tree[0]->Fill();
120  }
121  }
122 
123  // **************************************************
124  //
125  // LOOP OVER particles in the given particle lists
126  //
127  // **************************************************
128 
129  for (int iList = 0; iList < nParticleList; iList++) {
130  // make sure the list exists and is not empty
131  StoreObjPtr<ParticleList> particlelist(m_strParticleList[iList]);
132  if (!particlelist or particlelist->getListSize(true) == 0) {
133  //B2WARNING("ParticleList " << m_strParticleList[iList] << " not found or empty, skipping");
134  continue;
135  }
136 
137  // loop over the particles in the list and follow the links to the
138  // dE/dx information (Particle -> PIDLikelihood -> Track -> CDCDedxTrack)
139  for (unsigned int iPart = 0; iPart < particlelist->getListSize(true); iPart++) {
140  Particle* part = particlelist->getParticle(iPart, true);
141  if (!part) {
142  B2WARNING("No particles...");
143  continue;
144  }
145  PIDLikelihood* pid = part->getRelatedTo<PIDLikelihood>();
146  if (!pid) {
147  B2WARNING("No related PID likelihood...");
148  continue;
149  }
150  Track* track = pid->getRelatedFrom<Track>();
151  if (!track) {
152  B2WARNING("No related track...");
153  continue;
154  }
155  CDCDedxTrack* dedxTrack = track->getRelatedTo<CDCDedxTrack>();
156  if (!dedxTrack) {
157  B2WARNING("No related CDCDedxTrack...");
158  continue;
159  }
160  std::string ptype = m_strParticleList[iList].substr(0, m_strParticleList[iList].find(":"));
161  const TrackFitResult* fitResult = track->getTrackFitResult(Const::pion);
162  if (ptype != "pi+") {
163  if (ptype == "K+") fitResult = track->getTrackFitResultWithClosestMass(Const::kaon);
164  else if (ptype == "p+") fitResult = track->getTrackFitResultWithClosestMass(Const::proton);
165  else if (ptype == "deuteron") fitResult = track->getTrackFitResultWithClosestMass(Const::deuteron);
166  else if (ptype == "mu+") fitResult = track->getTrackFitResultWithClosestMass(Const::muon);
167  else if (ptype == "e+") fitResult = track->getTrackFitResultWithClosestMass(Const::electron);
168  }
169  if (!fitResult) {
170  B2WARNING("No related fit for this track...");
171  continue;
172  }
173 
174  if (dedxTrack->size() == 0 || dedxTrack->size() > 200) continue;
175  //if out CDC (dont add as we dont correct via correctionmodules)
176  if (dedxTrack->getCosTheta() < TMath::Cos(150.0 * TMath::DegToRad()))continue; //-0.866
177  if (dedxTrack->getCosTheta() > TMath::Cos(17.0 * TMath::DegToRad())) continue; //0.95
178 
179  // fill the event meta data
180  StoreObjPtr<EventMetaData> evtMetaData;
181  m_expID = evtMetaData->getExperiment();
182  m_runID = evtMetaData->getRun();
183  m_eventID = evtMetaData->getEvent();
184 
185  // fill the E/P
186  const ECLCluster* eclCluster = track->getRelated<ECLCluster>();
187  if (eclCluster and eclCluster->hasHypothesis(ECLCluster::EHypothesisBit::c_nPhotons)) {
188  m_eop = (eclCluster->getEnergy(ECLCluster::EHypothesisBit::c_nPhotons)) / (fitResult->getMomentum().Mag());
189 
190  // fill the muon depth
191  const KLMCluster* klmCluster = eclCluster->getRelated<KLMCluster>();
192  if (klmCluster) m_klmLayers = klmCluster->getLayers();
193  }
194 
195  // fill the TTree with the Track information
196  fillTrack(fitResult);
197 
198  // fill the TTree with the CDCDedxTrack information
199  fillDedx(dedxTrack);
200 
201  // fill the TTree
202  m_tree[iList]->Fill();
203  }
204  }
205 }
206 
208 {
209 
210  for (unsigned int i = 0; i < m_file.size(); i++) {
211  B2INFO("Done writing out the hit level information...\t" << m_tree[i]->GetEntries() << " tracks");
212 
213  // write the ttree to a root file
214  m_file[i]->cd();
215  m_tree[i]->Write();
216  m_file[i]->Close();
217  }
218 }
219 
220 void
222 {
223  TVector3 trackMom = fitResult->getMomentum();
224  m_p = trackMom.Mag();
225  m_pt = trackMom.Pt();
226  m_phi = trackMom.Phi();
227 
228  m_theta = trackMom.Theta() * 180. / TMath::Pi(); //in degree
229  if (m_theta > 17. && m_theta < 150.)m_inCDC = 1;
230  else m_inCDC = 0;
231 
232  if (fitResult->getChargeSign() < 0) {
233  m_p *= -1;
234  m_pt *= -1;
235  }
236 
237  TVector3 trackPos = fitResult->getPosition();
238  m_vx0 = trackPos.x();
239  m_vy0 = trackPos.y();
240  m_vz0 = trackPos.z();
241 
242  m_d0 = fitResult->getD0();
243  m_z0 = fitResult->getZ0();
244  m_chi2 = fitResult->getPValue();
245  m_tanlambda = fitResult->getTanLambda();
246  m_phi0 = fitResult->getPhi0();
247  m_nCDChits = fitResult->getHitPatternCDC().getNHits();
248 
249  static DBObjPtr<BeamSpot> beamSpotDB;
250  const auto& frame = ReferenceFrame::GetCurrent();
251  UncertainHelix helix = fitResult->getUncertainHelix();
252  helix.passiveMoveBy(beamSpotDB->getIPPosition());
253  m_dr = frame.getVertex(helix.getPerigee()).Perp();
254  m_dphi = frame.getVertex(helix.getPerigee()).Phi();
255  m_dz = frame.getVertex(helix.getPerigee()).Z();
256 }
257 
258 void
260 {
261  // clear the containers first
262  clearEntries();
263 
264  m_trackID = dedxTrack->trackID();
265  m_length = dedxTrack->getLength();
266  m_charge = dedxTrack->getCharge();
267  m_cosTheta = dedxTrack->getCosTheta();
268  m_PDG = dedxTrack->getPDG();
269 
270  m_pCDC = dedxTrack->getMomentum();
271  if (m_charge < 0) {
272  m_pCDC *= -1;
273  }
274 
275  h_nhits = dedxTrack->size();
276  l_nhits = dedxTrack->getNLayerHits();
277  l_nhitsused = dedxTrack->getNLayerHitsUsed();
278 
279  m_mean = dedxTrack->getDedxMean();
280  m_trunc = dedxTrack->getDedx();
281  m_truncNoSat = dedxTrack->getDedxNoSat();
282  m_error = dedxTrack->getDedxError();
283 
284  // Get the calibration constants
285  m_scale = m_DBScaleFactor->getScaleFactor();
286  m_runGain = m_DBRunGain->getRunGain();
287  m_cosCor = m_DBCosineCor->getMean(m_cosTheta);
288 
289  if (m_cosTheta <= -0.850 || m_cosTheta >= 0.950) {
290  m_cosEdgeCor = m_DBCosEdgeCor->getMean(m_cosTheta);
291  } else {
292  m_cosEdgeCor = 1.0;
293  }
294 
295 
296  m_chie = dedxTrack->getChi(0);
297  m_chimu = dedxTrack->getChi(1);
298  m_chipi = dedxTrack->getChi(2);
299  m_chik = dedxTrack->getChi(3);
300  m_chip = dedxTrack->getChi(4);
301  m_chid = dedxTrack->getChi(5);
302 
303  m_pmeane = dedxTrack->getPmean(0);
304  m_pmeanmu = dedxTrack->getPmean(1);
305  m_pmeanpi = dedxTrack->getPmean(2);
306  m_pmeank = dedxTrack->getPmean(3);
307  m_pmeanp = dedxTrack->getPmean(4);
308  m_pmeand = dedxTrack->getPmean(5);
309 
310  m_prese = dedxTrack->getPreso(0);
311  m_presmu = dedxTrack->getPreso(1);
312  m_prespi = dedxTrack->getPreso(2);
313  m_presk = dedxTrack->getPreso(3);
314  m_presp = dedxTrack->getPreso(4);
315  m_presd = dedxTrack->getPreso(5);
316 
317  // Get the vector of dE/dx values for all layers
318  double lout = 0, lin = 0, increment = 0;
319  int lastlayer = 0;
320  for (int il = 0; il < l_nhits; ++il) {
321  l_nhitscombined[il] = dedxTrack->getNHitsCombined(il);
322  l_wirelongesthit[il] = dedxTrack->getWireLongestHit(il);
323  l_layer[il] = dedxTrack->getLayer(il);
324  l_path[il] = dedxTrack->getLayerPath(il);
325  l_dedx[il] = dedxTrack->getLayerDedx(il);
326 
327  if (l_layer[il] > lastlayer) lout++;
328  else if (l_layer[il] < lastlayer) lin++;
329  else continue;
330 
331  lastlayer = l_layer[il];
332  increment++;
333  }
334  m_ioasym = (lout - lin) / increment;
335 
336  // Get the vector of dE/dx values for all hits
337  if (enableHitLevel) {
338  for (int ihit = 0; ihit < h_nhits; ++ihit) {
339 
340  if (nodeadwire && m_DBWireGains->getWireGain(h_wire[ihit]) == 0)continue;
341  h_lwire[ihit] = dedxTrack->getWireInLayer(ihit);
342  h_wire[ihit] = dedxTrack->getWire(ihit);
343  h_layer[ihit] = dedxTrack->getHitLayer(ihit);
344  h_path[ihit] = dedxTrack->getPath(ihit);
345  h_dedx[ihit] = dedxTrack->getDedx(ihit);
346  h_adcraw[ihit] = dedxTrack->getADCBaseCount(ihit);
347  h_adccorr[ihit] = dedxTrack->getADCCount(ihit);
348  h_doca[ihit] = dedxTrack->getDoca(ihit);
349  h_ndoca[ihit] = h_doca[ihit] / dedxTrack->getCellHalfWidth(ihit);
350  h_ndocaRS[ihit] = dedxTrack->getDocaRS(ihit) / dedxTrack->getCellHalfWidth(ihit);
351  h_enta[ihit] = dedxTrack->getEnta(ihit);
352  h_entaRS[ihit] = dedxTrack->getEntaRS(ihit);
353  h_driftT[ihit] = dedxTrack->getDriftT(ihit);
354  h_driftD[ihit] = dedxTrack->getDriftD(ihit);
355 
356  // Get extra variable from tracking
357  if (enableExtraVar) {
358  h_WeightPionHypo[ihit] = dedxTrack->getWeightPionHypo(ihit);
359  h_WeightKaonHypo[ihit] = dedxTrack->getWeightKaonHypo(ihit);
360  h_WeightProtonHypo[ihit] = dedxTrack->getWeightProtonHypo(ihit);
361  h_foundByTrackFinder[ihit] = dedxTrack->getFoundByTrackFinder(ihit);
362  }
363  // Get the calibration constants
364  h_facnladc[ihit] = dedxTrack->getNonLADCCorrection(ihit);
365  h_wireGain[ihit] = m_DBWireGains->getWireGain(h_wire[ihit]);
366  h_twodCor[ihit] = m_DB2DCell->getMean(h_layer[ihit], h_ndocaRS[ihit], h_entaRS[ihit]);
367  h_onedCor[ihit] = m_DB1DCell->getMean(h_layer[ihit], h_entaRS[ihit]);
368  }
369  }
370 }
371 
372 void
374 {
375  for (int il = 0; il < 200; ++il) {
376  l_nhitscombined[il] = 0;
377  l_wirelongesthit[il] = 0;
378  l_layer[il] = 0;
379  l_path[il] = 0;
380  l_dedx[il] = 0;
381  }
382 
383  if (enableHitLevel) {
384  for (int ihit = 0; ihit < 200; ++ihit) {
385  h_lwire[ihit] = 0;
386  h_wire[ihit] = 0;
387  h_layer[ihit] = 0;
388  h_path[ihit] = 0;
389  h_dedx[ihit] = 0;
390  h_adcraw[ihit] = 0;
391  h_adccorr[ihit] = 0;
392  h_doca[ihit] = 0;
393  h_ndoca[ihit] = 0;
394  h_ndocaRS[ihit] = 0;
395  h_enta[ihit] = 0;
396  h_entaRS[ihit] = 0;
397  h_driftT[ihit] = 0;
398  // h_driftD[ihit] = 0;
399  h_facnladc[ihit] = 0;
400  h_wireGain[ihit] = 0;
401  h_twodCor[ihit] = 0;
402  h_onedCor[ihit] = 0;
403  h_WeightPionHypo[ihit] = 0;
404  h_WeightKaonHypo[ihit] = 0;
405  h_WeightProtonHypo[ihit] = 0;
406  h_foundByTrackFinder[ihit] = 0;
407  }
408  }
409 }
410 
411 void
413 {
414  // register output root file
415  m_file.push_back(new TFile(filename.c_str(), "RECREATE"));
416  m_tree.push_back(new TTree("track", "dE/dx information"));
417 
418  int i = m_tree.size() - 1;
419  m_tree[i]->SetDirectory(0);
420 
421  // event level information (from emd)
422  m_tree[i]->Branch("exp", &m_expID, "exp/I");
423  m_tree[i]->Branch("run", &m_runID, "run/I");
424  m_tree[i]->Branch("event", &m_eventID, "event/I");
425 
426  // track level information (from tfr)
427  m_tree[i]->Branch("d0", &m_d0, "d0/D");
428  m_tree[i]->Branch("z0", &m_z0, "z0/D");
429  m_tree[i]->Branch("dz", &m_dz, "dz/D");
430  m_tree[i]->Branch("dr", &m_dr, "dr/D");
431  m_tree[i]->Branch("dphi", &m_dphi, "dphi/D");
432  m_tree[i]->Branch("vx0", &m_vx0, "vx0/D");
433  m_tree[i]->Branch("vy0", &m_vy0, "vy0/D");
434  m_tree[i]->Branch("vz0", &m_vz0, "vz0/D");
435  m_tree[i]->Branch("tanlambda", &m_tanlambda, "tanlambda/D");
436  m_tree[i]->Branch("phi0", &m_phi0, "phi0/D");
437  m_tree[i]->Branch("chi2", &m_chi2, "chi2/D");
438 
439  // track level information (from cdt)
440  m_tree[i]->Branch("nCDChits", &m_nCDChits, "nCDChits/D");
441  m_tree[i]->Branch("inCDC", &m_inCDC, "inCDC/I");
442  m_tree[i]->Branch("track", &m_trackID, "track/I");
443  m_tree[i]->Branch("length", &m_length, "length/D");
444  m_tree[i]->Branch("charge", &m_charge, "charge/I");
445  m_tree[i]->Branch("costh", &m_cosTheta, "costh/D");
446  m_tree[i]->Branch("pF", &m_pCDC, "pF/D");
447  m_tree[i]->Branch("p", &m_p, "p/D");
448  m_tree[i]->Branch("pt", &m_pt, "pt/D");
449  m_tree[i]->Branch("ioasym", &m_ioasym, "ioasym/D");
450  m_tree[i]->Branch("phi", &m_phi, "phi/D");
451  m_tree[i]->Branch("pdg", &m_PDG, "pdg/D");
452  // track level dE/dx measurements
453  m_tree[i]->Branch("mean", &m_mean, "mean/D");
454  m_tree[i]->Branch("dedx", &m_trunc, "dedx/D");
455  m_tree[i]->Branch("dedxnosat", &m_truncNoSat, "dedxnosat/D");
456  m_tree[i]->Branch("dedxerr", &m_error, "dedxerr/D");
457 
458 
459  // other track level information
460  m_tree[i]->Branch("eop", &m_eop, "eop/D");
461  m_tree[i]->Branch("e", &m_e, "e/D");
462  m_tree[i]->Branch("e1_9", &m_e1_9, "e1_9/D");
463  m_tree[i]->Branch("e9_21", &m_e9_21, "e9_21/D");
464  m_tree[i]->Branch("klmLayers", &m_klmLayers, "klmLayers/I");
465 
466  // calibration constants
467  m_tree[i]->Branch("scale", &m_scale, "scale/D");
468  m_tree[i]->Branch("coscor", &m_cosCor, "coscor/D");
469  m_tree[i]->Branch("cosedgecor", &m_cosEdgeCor, "cosedgecor/D");
470  m_tree[i]->Branch("rungain", &m_runGain, "rungain/D");
471 
472  // PID values
473  m_tree[i]->Branch("chiE", &m_chie, "chiE/D");
474  m_tree[i]->Branch("chiMu", &m_chimu, "chiMu/D");
475  m_tree[i]->Branch("chiPi", &m_chipi, "chiPi/D");
476  m_tree[i]->Branch("chiK", &m_chik, "chiK/D");
477  m_tree[i]->Branch("chiP", &m_chip, "chiP/D");
478  m_tree[i]->Branch("chiD", &m_chid, "chiD/D");
479 
480  m_tree[i]->Branch("pmeanE", &m_pmeane, "pmeanE/D");
481  m_tree[i]->Branch("pmeanMu", &m_pmeanmu, "pmeanMu/D");
482  m_tree[i]->Branch("pmeanPi", &m_pmeanpi, "pmeanPi/D");
483  m_tree[i]->Branch("pmeanK", &m_pmeank, "pmeanK/D");
484  m_tree[i]->Branch("pmeanP", &m_pmeanp, "pmeanP/D");
485  m_tree[i]->Branch("pmeanD", &m_pmeand, "pmeanD/D");
486 
487  m_tree[i]->Branch("presE", &m_prese, "presE/D");
488  m_tree[i]->Branch("presMu", &m_presmu, "presMu/D");
489  m_tree[i]->Branch("presPi", &m_prespi, "presPi/D");
490  m_tree[i]->Branch("presK", &m_presk, "presK/D");
491  m_tree[i]->Branch("presP", &m_presp, "presP/D");
492  m_tree[i]->Branch("presD", &m_presd, "presD/D");
493 
494  // layer level information
495  m_tree[i]->Branch("lNHits", &l_nhits, "lNHits/I");
496  m_tree[i]->Branch("lNHitsUsed", &l_nhitsused, "lNHitsUsed/I");
497  m_tree[i]->Branch("lNHitsCombined", l_nhitscombined, "lNHitsCombined[lNHits]/I");
498  m_tree[i]->Branch("lWireLongestHit", l_wirelongesthit, "lWireLongestHit[lNHits]/I");
499  m_tree[i]->Branch("lLayer", l_layer, "lLayer[lNHits]/I");
500  m_tree[i]->Branch("lPath", l_path, "lPath[lNHits]/D");
501  m_tree[i]->Branch("lDedx", l_dedx, "lDedx[lNHits]/D");
502 
503  // hit level information
504  if (enableHitLevel) {
505  m_tree[i]->Branch("hNHits", &h_nhits, "hNHits/I");
506  m_tree[i]->Branch("hLWire", h_lwire, "hLWire[hNHits]/I");
507  m_tree[i]->Branch("hWire", h_wire, "hWire[hNHits]/I");
508  m_tree[i]->Branch("hLayer", h_layer, "hLayer[hNHits]/I");
509  m_tree[i]->Branch("hPath", h_path, "hPath[hNHits]/D");
510  m_tree[i]->Branch("hDedx", h_dedx, "hDedx[hNHits]/D");
511  m_tree[i]->Branch("hADCRaw", h_adcraw, "hADCRaw[hNHits]/D");
512  m_tree[i]->Branch("hADCCorr", h_adccorr, "hADCCorr[hNHits]/D");
513  m_tree[i]->Branch("hDoca", h_doca, "hDoca[hNHits]/D");
514  m_tree[i]->Branch("hNDoca", h_ndoca, "hNDoca[hNHits]/D");
515  m_tree[i]->Branch("hNDocaRS", h_ndocaRS, "hNDocaRS[hNHits]/D");
516  m_tree[i]->Branch("hEnta", h_enta, "hEnta[hNHits]/D");
517  m_tree[i]->Branch("hEntaRS", h_entaRS, "hEntaRS[hNHits]/D");
518  m_tree[i]->Branch("hDriftT", h_driftT, "hDriftT[hNHits]/D");
519  m_tree[i]->Branch("hDriftD", h_driftD, "hDriftD[hNHits]/D");
520  m_tree[i]->Branch("hFacnlADC", h_facnladc, "hFacnlADC[hNHits]/D");
521  m_tree[i]->Branch("hWireGain", h_wireGain, "hWireGain[hNHits]/D");
522  m_tree[i]->Branch("hTwodcor", h_twodCor, "hTwodcor[hNHits]/D");
523  m_tree[i]->Branch("hOnedcor", h_onedCor, "hOnedcor[hNHits]/D");
524 
525  if (enableExtraVar) {
526  m_tree[i]->Branch("hWeightPionHypo", h_WeightPionHypo, "hWeightPionHypo[hNHits]/D");
527  m_tree[i]->Branch("hWeightKaonHypo", h_WeightKaonHypo, "hWeightKaonHypo[hNHits]/D");
528  m_tree[i]->Branch("hWeightProtonHypo", h_WeightProtonHypo, "hWeightProtonHypo[hNHits]/D");
529  m_tree[i]->Branch("hFoundByTrackFinder", h_foundByTrackFinder, "hFoundByTrackFinder[hNHits]/I");
530  }
531  }
532 }
Debug output for CDCDedxPID module.
Definition: CDCDedxTrack.h:25
int getHitLayer(int i) const
Return the (global) layer number for a hit.
Definition: CDCDedxTrack.h:194
int getADCBaseCount(int i) const
Return the base adcCount (no non-linearity) for this hit.
Definition: CDCDedxTrack.h:206
int getADCCount(int i) const
Return the adcCount for this hit.
Definition: CDCDedxTrack.h:203
double getDedxMean() const
Get the dE/dx mean for this track.
Definition: CDCDedxTrack.h:112
double getDriftD(int i) const
Return the drift distance for this hit.
Definition: CDCDedxTrack.h:236
int getLayer(int i) const
Return the (global) layer number for a layer hit.
Definition: CDCDedxTrack.h:171
double getDoca(int i) const
Return the distance of closest approach to the sense wire for this hit.
Definition: CDCDedxTrack.h:212
double getDedx() const
Get dE/dx truncated mean for this track.
Definition: CDCDedxTrack.h:103
double getPath(int i) const
Return the path length through the cell for this hit.
Definition: CDCDedxTrack.h:197
int getWireInLayer(int i) const
Return the sensor ID for this hit: wire number in the layer.
Definition: CDCDedxTrack.h:188
double getPmean(int i) const
Return the PID (predicted mean) value.
Definition: CDCDedxTrack.h:267
int getWireLongestHit(int i) const
Return the wire number of the longest hit per layer.
Definition: CDCDedxTrack.h:168
double getWeightKaonHypo(int i) const
Return the max weights from KalmanFitterInfo using kaon hypothesis.
Definition: CDCDedxTrack.h:258
double getEntaRS(int i) const
Return rescaled enta value for cell height=width assumption.
Definition: CDCDedxTrack.h:221
double getLayerDedx(int i) const
Return the total dE/dx for this layer.
Definition: CDCDedxTrack.h:177
double getCellHalfWidth(int i) const
Return the half-width of the CDC cell.
Definition: CDCDedxTrack.h:233
double getPDG() const
Get the identity of the particle.
Definition: CDCDedxTrack.h:100
double getPreso(int i) const
Return the PID (predicted reso) value.
Definition: CDCDedxTrack.h:270
int getNLayerHits() const
Return the number of layer hits for this track.
Definition: CDCDedxTrack.h:159
int getFoundByTrackFinder(int i) const
Return the TrackFinder which added the given hit to track.
Definition: CDCDedxTrack.h:252
int getDriftT(int i) const
Return the drift time for this hit.
Definition: CDCDedxTrack.h:224
double getCosTheta() const
Return cos(theta) for this track.
Definition: CDCDedxTrack.h:121
int getCharge() const
Return the charge for this track.
Definition: CDCDedxTrack.h:124
double getWeightPionHypo(int i) const
Return the max weights from KalmanFitterInfo using pion hypothesis.
Definition: CDCDedxTrack.h:255
int getWire(int i) const
Return the sensor ID for this hit: wire number for CDC (0-14336)
Definition: CDCDedxTrack.h:191
double getDocaRS(int i) const
Return rescaled doca value for cell height=width assumption.
Definition: CDCDedxTrack.h:218
double getNonLADCCorrection(int i) const
Return the factor introduce for adcCount (non-linearity) correction.
Definition: CDCDedxTrack.h:209
double getDedxError() const
Get the error on the dE/dx truncated mean for this track.
Definition: CDCDedxTrack.h:109
double getWeightProtonHypo(int i) const
Return the max weights from KalmanFitterInfo using proton hypothesis.
Definition: CDCDedxTrack.h:261
double getEnta(int i) const
Return the entrance angle in the CDC cell for this hit.
Definition: CDCDedxTrack.h:215
double trackID() const
Return the track ID.
Definition: CDCDedxTrack.h:97
double getLayerPath(int i) const
Return the distance travelled in this layer.
Definition: CDCDedxTrack.h:174
double getChi(int i) const
Return the PID (chi) value.
Definition: CDCDedxTrack.h:264
double getLength() const
Return the total path length for this track.
Definition: CDCDedxTrack.h:127
int getNHitsCombined(int i) const
Return the number of hits combined per layer.
Definition: CDCDedxTrack.h:165
double getDedxNoSat() const
Get dE/dx truncated mean without the saturation correction for this track.
Definition: CDCDedxTrack.h:106
int size() const
Return the number of hits for this track.
Definition: CDCDedxTrack.h:185
double getNLayerHitsUsed() const
Return the number of hits used to determine the truncated mean.
Definition: CDCDedxTrack.h:162
double getMomentum() const
Return the track momentum valid in the CDC.
Definition: CDCDedxTrack.h:118
static const ChargedStable muon
muon particle
Definition: Const.h:541
static const ChargedStable pion
charged pion particle
Definition: Const.h:542
static const ChargedStable proton
proton particle
Definition: Const.h:544
static const ChargedStable kaon
charged kaon particle
Definition: Const.h:543
static const ChargedStable electron
electron particle
Definition: Const.h:540
static const ChargedStable deuteron
deuteron particle
Definition: Const.h:545
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
ECL cluster data.
Definition: ECLCluster.h:27
bool hasHypothesis(EHypothesisBit bitmask) const
Return if specific hypothesis bit is set.
Definition: ECLCluster.h:348
double getE1oE9() const
Return E1/E9 (shower shape variable).
Definition: ECLCluster.h:274
double getE9oE21() const
Return E9/E21 (shower shape variable).
Definition: ECLCluster.h:277
double getEnergy(EHypothesisBit hypothesis) const
Return Energy (GeV).
Definition: ECLCluster.cc:19
@ c_nPhotons
CR is split into n photons (N1)
Extracts dE/dx information for calibration testing.
virtual ~HitLevelInfoWriterModule()
Destructor.
virtual void initialize() override
Initialize the module.
virtual void event() override
This method is called for each event.
virtual void terminate() override
End of the event processing.
void fillTrack(const TrackFitResult *fitResult)
Fill the TTree with the information from the track fit.
void bookOutput(std::string filename)
Create the output TFiles and TTrees.
void clearEntries()
Clear the arrays before filling an event.
void fillDedx(CDCDedxTrack *dedxTrack)
Fill the TTree with the information from a CDCDedxTrack object.
unsigned short getNHits() const
Get the total Number of CDC hits in the fit.
KLM cluster data.
Definition: KLMCluster.h:28
int getLayers() const
Get number of layers with hits.
Definition: KLMCluster.h:66
Base class for Modules.
Definition: Module.h:72
Class to collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM aimed for output to mdst includes...
Definition: PIDLikelihood.h:26
Class to store reconstructed particles.
Definition: Particle.h:74
static const ReferenceFrame & GetCurrent()
Get current rest frame.
FROM * getRelatedFrom(const std::string &name="", const std::string &namedRelation="") const
Get the object from which this object has a relation.
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:95
Values of the result of a track fit with a given particle hypothesis.
short getChargeSign() const
Return track charge (1 or -1).
double getPValue() const
Getter for Chi2 Probability of the track fit.
TVector3 getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
double getD0() const
Getter for d0.
double getTanLambda() const
Getter for tanLambda.
TVector3 getPosition() const
Getter for vector of position at closest approach of track in r/phi projection.
double getZ0() const
Getter for z0.
HitPatternCDC getHitPatternCDC() const
Getter for the hit pattern in the CDC;.
UncertainHelix getUncertainHelix() const
Conversion to framework Uncertain Helix (i.e., with covariance).
double getPhi0() const
Getter for phi0.
Class that bundles various TrackFitResults.
Definition: Track.h:25
This class represents an ideal helix in perigee parameterization including the covariance matrix of t...
double passiveMoveBy(const TVector3 &by)
Moves origin of the coordinate system (passive transformation) by the given vector.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.