NAIA  1.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
NtpSelector.cpp
Go to the documentation of this file.
2 
3 #include "NtpMaker/NtpSelector.h"
4 #include "NtpMaker/NtpTools.h"
5 
6 #include "Tofrec02_ihep.h"
7 #include "tkdcards.h"
8 extern int StopSelector;
9 
10 namespace NAIA {
12  m_logger->info("UBegin =============================================");
13 
14  auto stpw = m_benchmark.MakeStopwatch("NtpSelector::UBegin");
15 
16  m_logger->info("Creating output file {}", m_outputFilename);
17  std::string output_file_option = m_reprocess_rti ? "update" : "recreate";
18  m_outputFile = std::make_unique<TFile>(m_outputFilename.c_str(), output_file_option.c_str());
19  m_outputFile->SetCompressionLevel(7);
20 
21  m_logger->info("Creating NAIA event tree");
22  m_chain = std::make_unique<NAIAChain>(NAIAChain::AccessMode::Write);
23  m_chain->m_event.SetMC(m_isMC);
24  { // propagate MC flag to containers
25  m_chain->m_event.evSummary.SetMC(m_isMC);
26  m_chain->m_event.richPlus.SetMC(m_isMC);
27  m_chain->m_event.tofBase.SetMC(m_isMC);
28  m_chain->m_event.extHitBase.SetMC(m_isMC);
29  }
30  m_chain->SetupBranches(m_isMC);
31  m_logger->info("NAIA branches created");
32 }
33 
35  static bool firstCall = true;
36  if (!firstCall) {
37  m_logger->debug("Switching file in chain: {}", m_tree->GetCurrentFile()->GetName());
38  // reset file info containers
39  m_chain->m_fileInfo.Clear();
40  if (m_isMC)
41  m_chain->m_fileInfoMC.Clear();
42  } else {
43  firstCall = false;
44  }
45  return AMSEventR::Notify();
46 }
47 
49  m_logger->debug("Called NtpSelector::ProcessFileInfo");
50 
51  m_chain->m_fileInfo.Clear();
52  if (m_isMC)
53  m_chain->m_fileInfoMC.Clear();
54 
55  m_chain->m_fileInfo.FileName = m_tree->GetCurrentFile()->GetName();
56 
57  m_chain->m_fileInfo.Run = Run();
58  m_chain->m_fileInfo.EventNo.first = Event();
59  m_chain->m_fileInfo.EventNo.second = Event();
60 
61  m_chain->m_fileInfo.UTCTime.first = fHeader.Time[0];
62  m_chain->m_fileInfo.UTCTime.second = fHeader.Time[0];
63 
64  if (m_isMC) {
65  m_chain->m_fileInfoMC.EventNo.first = Event();
66  m_chain->m_fileInfoMC.EventNo.second = Event();
67  MCEventgR *primary = (nMCEventg() != 0) ? pMCEventg(0) : nullptr;
68  m_chain->m_fileInfoMC.Charge = (primary) ? static_cast<int>(primary->Charge) : 0;
69  m_chain->m_fileInfoMC.Mass = (primary) ? primary->Mass : 0;
70  m_chain->m_fileInfoMC.MomentumRange.first = std::numeric_limits<float>::max();
71  m_chain->m_fileInfoMC.MomentumRange.second = 0;
72  auto *datacard = m_tree->GetCurrentFile()->Get<TObjString>("DataCards");
73  if (!datacard) {
74  m_logger->error("No Datacard Object available!");
75  }
76  m_chain->m_fileInfoMC.DatacardPID = NtpTools::GetDatacardValue<int>(datacard, "PART");
77  m_chain->m_fileInfoMC.DatacardMomentumRange.first = NtpTools::GetDatacardValue<float>(datacard, "PMIN");
78  m_chain->m_fileInfoMC.DatacardMomentumRange.second = NtpTools::GetDatacardValue<float>(datacard, "PMAX");
79  m_chain->m_fileInfoMC.DatacardNGen = NtpTools::GetDatacardValue<unsigned int>(datacard, "TRIG");
80 
81  if (m_chain->m_fileInfo.FileName.find(".l1.") != std::string::npos) {
82  m_chain->m_fileInfoMC.Focus = MCFileInfo::SimFocus::L1;
83  } else if (m_chain->m_fileInfo.FileName.find(".l19.") != std::string::npos) {
84  m_chain->m_fileInfoMC.Focus = MCFileInfo::SimFocus::L19;
85  } else if (m_chain->m_fileInfo.FileName.find(".l1a9.") != std::string::npos) {
86  m_chain->m_fileInfoMC.Focus = MCFileInfo::SimFocus::L19;
87  } else if (m_chain->m_fileInfo.FileName.find(".tb.") != std::string::npos) {
88  m_chain->m_fileInfoMC.Focus = MCFileInfo::SimFocus::TB;
89  }
90  } else {
91  // not MC
92  // [VF] here we reproduce the logic of AMSEventR::IsBadRun. Can't use that since the "reason" parameter is thrown
93  // away and we actually need it
94  if (getsetup())
95  m_chain->m_fileInfo.BadRunTag = getsetup()->IsBadRun(m_chain->m_fileInfo.BadRunReason, UTime(), Run());
96  else
97  m_chain->m_fileInfo.BadRunTag = 2;
98  }
99 }
100 
102  if (StopSelector)
103  Abort("Aborting TSelector Loop\n");
104  if (m_chain->m_fileInfo.Run == 0) {
105  // this happens when a file is first loaded
106  ProcessFileInfo();
107  }
108 
109  // fill FileInfo stuff...
110  m_chain->m_fileInfo.NEvents++;
111  m_chain->m_fileInfo.EventNo.second = Event();
112  m_chain->m_fileInfo.UTCTime.second = fHeader.Time[0];
113 
114  if (m_isMC) {
115  SetDefaultMCTuningParameters();
116  TRCLFFKEY.ClusterCofGOpt = 1;
117  TRFITFFKEY.Zshift = -1;
118 
119  m_chain->m_fileInfoMC.EventNo.first = std::min(Event(), m_chain->m_fileInfoMC.EventNo.first);
120  m_chain->m_fileInfoMC.EventNo.second = std::max(Event(), m_chain->m_fileInfoMC.EventNo.second);
121 
122  MCEventgR *primary = (nMCEventg() != 0) ? pMCEventg(0) : nullptr;
123  float p = (primary) ? primary->Momentum : 0;
124  m_chain->m_fileInfoMC.MomentumRange.first = std::min(p, m_chain->m_fileInfoMC.MomentumRange.first);
125  m_chain->m_fileInfoMC.MomentumRange.second = std::max(p, m_chain->m_fileInfoMC.MomentumRange.second);
126  } else {
127  TrLinearEtaDB::SetLinearCluster();
128  TRFITFFKEY.Zshift = 2;
129  }
130 
131  TRFITFFKEY.ErcHeY = 0;
132 
133  // quickly discard entries we don't care about...
134  if (Entry() < firstentry) {
135  m_logger->trace("Skip entry {} < {}", Entry(), firstentry);
136  return false;
137  } else if (Entry() > lastentry) {
138  // FIXME: check is Paolo's patch to gbatch is accepted upstream. Then set StopSelector
139  // StopSelector = true;
140  m_logger->trace("Skip entry {} > {}", Entry(), lastentry);
141  return false;
142  }
143 
144  static bool got_it = false;
145  if (!got_it) {
146  m_logger->debug("UProcessCut - First event processed - Entry: {}, Run: {}, Event: {}", Entry(), Run(), Event());
147  } else if (Entry() % 10000 == 0) {
148  m_logger->debug("UProcessCut - Event processed - Entry: {}, Run: {}, Event: {}", Entry(), Run(), Event());
149  }
150  got_it = true;
151 
152  m_logger->trace("Entry: {}", Entry());
153 
154  m_chain->Clear();
155 
156  // cut really bad stuff
157  if ((nDaqEvent() < 1) || (nLevel1() < 1)) {
158  return false;
159  }
160 
161  auto stpw = m_benchmark.MakeStopwatch("Event processing");
162 
163  static unsigned long lastSec = 0;
164  // int ibetah_select = -1;
165  ParticleR *particle = nullptr;
166 
167  if (m_isMC) {
168  auto stpw = m_benchmark.MakeStopwatch("MCTruth::Fill");
169  m_chain->m_event.mcTruthBase.Fill(this);
170  m_chain->m_event.mcTruthPlus.Fill(this);
171  }
172 
173  {
174  auto stpw = m_benchmark.MakeStopwatch("(Header+EventSummary)::Fill");
175  m_chain->m_event.header.Fill(this);
176  m_chain->m_event.evSummary.Fill(this);
177  }
178 
179  // RTI
180  if (!m_isMC && lastSec != m_chain->m_event.header.UTCTime) {
181  auto stpw = m_benchmark.MakeStopwatch("RTIInfo::Fill");
182 
183  // don't fill the first time we enter here
184  if (lastSec > 0) {
185  m_chain->m_rtiInfo.FillEventVariables();
186  m_chain->FillRTI();
187  }
188  m_chain->m_rtiInfo.Clear();
189 
191  GetRTI(m_rti);
192  m_chain->m_rtiInfo.Fill(&m_rti, m_chain->m_event.header.RunTag);
194  lastSec = m_chain->m_event.header.UTCTime;
195  }
196 
197  if (!m_isMC) {
198  auto stpw = m_benchmark.MakeStopwatch("RTIInfo::AccumulateEventVariables");
200  m_chain->m_rtiInfo.AccumulateEventVariables(this);
202  }
203 
204  // NOTE: We stop here if we only have to process RTIInfo :)
205  if (m_reprocess_rti)
206  return true;
207 
208  if (pDaqEvent(0)) {
209  auto stpw = m_benchmark.MakeStopwatch("DAQ::Fill");
210  m_chain->m_event.daq.Fill(*pDaqEvent(0));
211  }
212 
213  // temporary! To be reviewed
214  particle = pParticle(0);
215 
216  if (particle) {
217 
218  // TofBase
219  {
220  auto stpw = m_benchmark.MakeStopwatch("TofBase::Fill");
221  bool has_tof = m_chain->m_event.tofBase.Fill(particle->pBeta(), particle->pBetaH());
222  if (has_tof) {
223  m_chain->m_event.header.SetMaskCategory(NAIA::Category::HasTof);
224  }
225  float UTOFCharge = m_chain->m_event.tofBase.Charge[NAIA::Tof::ChargeType::Upper];
226  if (std::fabs(UTOFCharge - 1) < 0.5) {
227  m_chain->m_event.SetMaskCategory(NAIA::Category::Charge1_Tof);
228  } else if (std::fabs(UTOFCharge - 2) < 0.5) {
229  m_chain->m_event.SetMaskCategory(NAIA::Category::Charge2_Tof);
230  } else if (UTOFCharge > 2.5) {
231  m_chain->m_event.SetMaskCategory(NAIA::Category::ChargeGT2_Tof);
232  }
233  }
234  // TofPlus
235  {
236  auto stpw = m_benchmark.MakeStopwatch("TofPlus::Fill");
237  m_chain->m_event.tofPlus.Fill(particle->pBeta(), particle->pBetaH());
238  }
239 
240  if (particle->pTrTrack()) {
241  if (m_isMC)
242  m_chain->m_event.mcTruthPlus.FillTrMCHit(particle->pTrTrack());
243 
244  // TrTrackBase
245  {
246  auto stpw = m_benchmark.MakeStopwatch("TrTrackBase::Fill");
247 
248  m_logger->trace("Track no. = {}", particle->iTrTrack());
249 
250  if (MatchAllBits(m_chain->m_event.header.Mask(), NAIA::Category::HasTof) &&
251  ContainsKeys(m_chain->m_event.tofBase.Beta, NAIA::Tof::BetaType::BetaH)) {
252  m_chain->m_event.trTrackBase.SetBeta(m_chain->m_event.tofBase.Beta[NAIA::Tof::BetaType::BetaH]);
253  }
254 
255  bool has_track = m_chain->m_event.trTrackBase.Fill(particle->pTrTrack());
256  if (has_track) {
257  m_chain->m_event.header.SetMaskCategory(NAIA::Category::HasTrack);
258  }
259 
260  float innerCharge = m_chain->m_event.trTrackBase.InnerCharge[NAIA::TrTrack::ChargeRecoType::STD];
261  if (std::fabs(innerCharge - 1) < 0.5) {
262  m_chain->m_event.SetMaskCategory(NAIA::Category::Charge1_Trk);
263  } else if (std::fabs(innerCharge - 2) < 0.5) {
264  m_chain->m_event.SetMaskCategory(NAIA::Category::Charge2_Trk);
265  } else if (innerCharge > 2.5) {
266  m_chain->m_event.SetMaskCategory(NAIA::Category::ChargeGT2_Trk);
267  }
268  }
269  // TrTrackPlus
270  {
271  auto stpw = m_benchmark.MakeStopwatch("TrTrackPlus::Fill");
272  m_chain->m_event.trTrackPlus.Fill(particle->pTrTrack());
273  }
274  // SecondTrTrackBase
275  if (NTrTrack() > 1) {
276  auto stpw = m_benchmark.MakeStopwatch("SecondTrTrackBase::Fill");
277  TrTrackR *second_track = nullptr;
278  for (TrTrackR &track : TrTrack()) {
279  if (&track == particle->pTrTrack() || track.GetNhits() < 5) {
280  continue;
281  }
282 
283  if (!second_track || second_track->GetRigidity() < track.GetRigidity()) {
284  second_track = &track;
285  }
286  }
287 
288  if (second_track) {
289  m_chain->m_event.secondTrTrackBase.Fill(second_track, TrTrackFillType::SecondTrack);
290  }
291  }
292  // Standalone TrTrack
293  {
294  auto stpw = m_benchmark.MakeStopwatch("TrTrackBaseStandalone::Fill");
295  m_chain->m_event.trTrackBaseSt.Fill(particle->pTrTrack(), TrTrackFillType::Standalone);
296 
297  float innerCharge_St = m_chain->m_event.trTrackBaseSt.InnerCharge[NAIA::TrTrack::ChargeRecoType::STD];
298  if (std::fabs(innerCharge_St - 1) < 0.5) {
299  m_chain->m_event.SetMaskCategory(NAIA::Category::Charge1_Trk_St);
300  } else if (std::fabs(innerCharge_St - 2) < 0.5) {
301  m_chain->m_event.SetMaskCategory(NAIA::Category::Charge2_Trk_St);
302  } else if (innerCharge_St > 2.5) {
303  m_chain->m_event.SetMaskCategory(NAIA::Category::ChargeGT2_Trk_St);
304  }
305  }
306 
307  // TrdKBase
308  {
309  auto stpw = m_benchmark.MakeStopwatch("TrdKBase::Fill");
310 
312  auto trdK = std::make_unique<TrdKCluster>(this, particle->pTrTrack(), 0);
314 
315  if (trdK) {
316  // set beta for TRD filling
317  if (MatchAllBits(m_chain->m_event.header.Mask(), NAIA::Category::HasTof) &&
318  ContainsKeys(m_chain->m_event.tofBase.Beta, NAIA::Tof::BetaType::BetaH)) {
319  m_chain->m_event.trdKBase.SetBeta(m_chain->m_event.tofBase.Beta[NAIA::Tof::BetaType::BetaH]);
320  m_chain->m_event.trdKBase.Type = TrdK::BuildType::TrkTrack;
321  }
322 
323  bool has_trd = m_chain->m_event.trdKBase.Fill(trdK.get(), particle->pTrTrack());
324  if (has_trd) {
325  m_chain->m_event.header.SetMaskCategory(NAIA::Category::HasTrd);
326  }
327  }
328  }
329 
330  // we still need to fill electron-related track fits
331  }
332 
333  if (particle->pEcalShower()) {
334  // EcalBase
335  {
336  auto stpw = m_benchmark.MakeStopwatch("EcalBase::Fill");
337  bool has_ecal = m_chain->m_event.ecalBase.Fill(particle->pEcalShower());
338  if (has_ecal) {
339  m_chain->m_event.header.SetMaskCategory(NAIA::Category::HasEcal);
340  }
341  }
342  // EcalPlus
343  {
344  auto stpw = m_benchmark.MakeStopwatch("EcalPlus::Fill");
345  m_chain->m_event.ecalPlus.Fill(particle->pEcalShower());
346  }
347  }
348 
349  if (particle->pRichRing()) {
350  // RichBase
351  {
352  auto stpw = m_benchmark.MakeStopwatch("RichBase::Fill");
353  bool has_rich = m_chain->m_event.richBase.Fill(particle->pRichRing(), particle->pRichRingB());
354  if (has_rich) {
355  m_chain->m_event.header.SetMaskCategory(NAIA::Category::HasRich);
356  }
357  }
358  // RichPlus
359  {
360  auto stpw = m_benchmark.MakeStopwatch("RichPlus::Fill");
361  m_chain->m_event.richPlus.Fill(this, particle->pRichRing(), particle->pRichRingB(), particle->pTrTrack());
362  }
363  }
364 
365  // fill standalone containers
366  {
367  auto stpw = m_benchmark.MakeStopwatch("DefineStandalone");
369  }
370 
371  if (m_betahStPtr) {
372  // TofBaseStandalone
373  {
374  auto stpw = m_benchmark.MakeStopwatch("TofBaseStandalone::Fill");
375  bool has_tof_standalone = m_chain->m_event.tofBaseSt.Fill(nullptr, m_betahStPtr, true);
376  if (has_tof_standalone) {
377  m_chain->m_event.header.SetMaskCategory(NAIA::Category::HasTofStandalone);
378  }
379 
380  float UTOFCharge_St = m_chain->m_event.tofBaseSt.ChargeNoPL[NAIA::Tof::ChargeType::Upper];
381  if (std::fabs(UTOFCharge_St - 1) < 0.5) {
382  m_chain->m_event.SetMaskCategory(NAIA::Category::Charge1_Tof_St);
383  } else if (std::fabs(UTOFCharge_St - 2) < 0.5) {
384  m_chain->m_event.SetMaskCategory(NAIA::Category::Charge2_Tof_St);
385  } else if (UTOFCharge_St > 2.5) {
386  m_chain->m_event.SetMaskCategory(NAIA::Category::ChargeGT2_Tof_St);
387  }
388  }
389  // TofPlusStandalone
390  {
391  auto stpw = m_benchmark.MakeStopwatch("TofPlusStandalone::Fill");
392  m_chain->m_event.tofPlusSt.Fill(nullptr, m_betahStPtr, true);
393  }
394 
395  // TrdKBaseStandalone
396  {
397  auto stpw = m_benchmark.MakeStopwatch("TrdKBaseStandalone::Fill");
398 
400  auto trdK = std::make_unique<TrdKCluster>();
401  if (m_trdTrackStPtr) {
402  m_logger->trace("Building standalone TRD from TrdTrack");
403  trdK->Build(m_trdTrackStPtr);
404  m_chain->m_event.trdKBaseSt.Type = TrdK::BuildType::TrdTrack;
405  } else {
406  m_logger->trace("Building standalone TRD from BetaH");
407  trdK->Build(m_betahStPtr);
408  m_chain->m_event.trdKBaseSt.Type = TrdK::BuildType::BetaH;
409  }
411 
412  if (trdK) {
413  // set beta for TRD filling
414  if (MatchAllBits(m_chain->m_event.header.Mask(), NAIA::Category::HasTofStandalone) &&
415  ContainsKeys(m_chain->m_event.tofBaseSt.Beta, NAIA::Tof::BetaType::BetaH)) {
416  m_chain->m_event.trdKBaseSt.SetBeta(m_chain->m_event.tofBaseSt.Beta[NAIA::Tof::BetaType::BetaH]);
417  }
418 
419  bool has_trd_standalone = m_chain->m_event.trdKBaseSt.Fill(trdK.get(), nullptr);
420  if (has_trd_standalone) {
421  m_chain->m_event.header.SetMaskCategory(NAIA::Category::HasTrdStandalone);
422  }
423  }
424  }
425  }
426 
427  // unbiased ExtHit
428  if (MatchAllBits(m_chain->m_event.header.Mask(), NAIA::Category::HasTofStandalone)) {
429  auto stpw = m_benchmark.MakeStopwatch("UnbExtHitBase::Fill");
430 
431  bool use_trd = MatchAllBits(m_chain->m_event.header.Mask(), NAIA::Category::HasTrdStandalone);
432 
434  m_chain->m_event.extHitBase.Fill(this, use_trd);
436  }
437 
438  // only at the very end we screw up gbatch's tracker fits internals and fill electron-related variables
439  if (particle->pTrTrack() && MatchAllBits(m_chain->m_event.header.Mask(), Category::HasTrd)) {
440  // condition for Kalman electron fit: ECAL EnergyD > 0.4 GeV
441  bool refitKalman = MatchAllBits(m_chain->m_event.header.Mask(), Category::HasEcal) &&
442  m_chain->m_event.ecalBase.Energy[Ecal::EnergyRecoType::EnergyD] > 0.4;
443  {
444  auto stpw = m_benchmark.MakeStopwatch("TrTrackBase::FillElectronVars");
445  float zEcalCOG = MatchAllBits(m_chain->m_event.header.Mask(), Category::HasEcal)
446  ? static_cast<float>(m_chain->m_event.ecalBase.GetCOG().z())
447  : std::numeric_limits<float>::max();
448  m_chain->m_event.trTrackBase.FillElectronVars(particle->pTrTrack(), zEcalCOG, refitKalman);
449  }
450  {
451  auto stpw = m_benchmark.MakeStopwatch("TrTrackPlus::FillElectronVars");
452  m_chain->m_event.trTrackPlus.FillElectronVars(particle->pTrTrack(), refitKalman);
453  }
454  }
455 
456  m_logger->trace("Event mask: {}", to_string_binary<32>(m_chain->m_event.header.Mask()));
457  } else {
458  // do selection without particle here?
459  }
460 
461  m_chain->Fill();
462 
463  return true;
464 }
465 
466 void NtpSelector::UProcessFill() {}
467 
468 void NtpSelector::UTerminate() {
469  // last call for accumulated info
470  m_chain->FillFileInfo();
471 
472  m_chain->m_rtiInfo.FillEventVariables();
473  m_chain->FillRTI();
474 
475  m_logger->info("UTerminate =============================================");
476  // m_chain->Print();
477 
478  m_outputFile->cd();
479 
480  if (m_reprocess_rti) {
481  m_logger->info("Overwriting RTIInfo tree");
482  m_chain->m_rti.tree->BuildIndex("RTIInfo.UTCTime");
483  m_outputFile->WriteTObject(m_chain->m_rti.tree, "RTI", "Overwrite");
484  } else {
485  m_logger->info("Writing chain to file");
486  NAIA::Version versionHeader;
487  m_outputFile->WriteTObject(&versionHeader, "VersionHeader");
488  m_chain->Write();
489  }
490  m_benchmark.Print(m_logger);
491 }
492 
493 void NtpSelector::DefineStandAlone() {
494  m_betahStPtr = nullptr;
495  m_trdTrackStPtr = nullptr;
496 
497  // Rebuild Tof with standalone reconstruction
498  auto oldOpt = TofRecH::BuildOpt;
499  TofRecH::BuildOpt = 3110;
500  m_logger->trace("Rebuilding Tof with opt {}", TofRecH::BuildOpt);
501  TofRecH::ReBuild();
502  m_logger->trace("{} BetaH objects found", nBetaH());
503 
504  auto getMaxQBetaH = [this](bool matchTrd = true) {
505  int ib = -1;
506  BetaHR *maxQBetaH = nullptr;
507 
508  // dummy variables for gbatch terrible interface
509  int nlayers;
510  float qrms;
511 
512  double prev_tofcharge = 0;
513 
514  for (BetaHR &betah : BetaH()) {
515  ++ib;
516  float temp_tofcharge = betah.GetQ(nlayers, qrms);
517  if (temp_tofcharge <= 0)
518  continue;
519 
520  if (matchTrd) {
521  if (!betah.pTrdTrack())
522  continue;
523  // count TRD track hits
524  // NOTE(vformato): Is this the right thing?
525  unsigned int nTrdHits{0};
526  for (unsigned int i = 0; i < betah.pTrdTrack()->NTrdSegment(); ++i) {
527  nTrdHits += betah.pTrdTrack()->pTrdSegment(i)->NTrdCluster();
528  }
529 
530  if (nTrdHits < 15)
531  continue;
532 
533  m_logger->trace("StAl BetaH n. {} - Charge {} (Chi2C: {} - Chi2T: {}) - TRD hits: {}", ib, temp_tofcharge,
534  betah.GetChi2C(), betah.GetChi2T(), nTrdHits);
535  } else {
536  m_logger->trace("StAl BetaH n. {} - Charge {} (Chi2C: {} - Chi2T: {})", ib, temp_tofcharge, betah.GetChi2C(),
537  betah.GetChi2T());
538  }
539 
540  if (temp_tofcharge > prev_tofcharge) {
541  maxQBetaH = &betah;
542  prev_tofcharge = temp_tofcharge;
543  }
544  }
545 
546  return maxQBetaH;
547  };
548 
549  m_betahStPtr = getMaxQBetaH(false);
550  m_trdTrackStPtr = m_betahStPtr ? m_betahStPtr->pTrdTrack() : nullptr;
551 
552  // just for safety, restore old opt
553  TofRecH::BuildOpt = oldOpt;
554 }
555 
556 } // namespace NAIA
This event is classified as charge 1 according to tracker standalone (0.5 &lt; Q &lt; 1.5)
Tof standalone data is available for this event.
This event is classified as charge 1 according to tof standalone (0.5 &lt; Q &lt; 1.5)
This event is classified as charge 2 according to tof (1.5 &lt; Q &lt; 2.5)
TrTrack data is available for this event.
bool StopSelector
Definition: NtpMaker.cpp:24
This event is classified as charge &gt;2 according to tracker standalone (Q &gt; 2.5)
Rich data is available for this event.
Stopwatch MakeStopwatch(std::string name)
Definition: Benchmark.h:66
This event is classified as charge &gt;2 according to tof (Q &gt; 2.5)
TRD standalone data is available for this event.
unsigned long long firstentry
first entry to be processed
Definition: NtpSelector.h:28
void UnmuteOutput()
Definition: Logging.cpp:36
TrdTrackR * m_trdTrackStPtr
Definition: NtpSelector.h:67
This event is classified as charge 1 according to tracker (0.5 &lt; Q &lt; 1.5)
test beam simulation
Charge estimated using the upper half of the TRD.
Definition: Utils.h:233
bool m_isMC
is simulation?
Definition: NtpSelector.h:26
Event object.
Definition: Event.h:20
virtual void UBegin() override
Init output.
Definition: NtpSelector.cpp:11
This event is classified as charge &gt;2 according to tof standalone (Q &gt; 2.5)
Ecal data is available for this event.
TRD data is available for this event.
std::enable_if< EnableBitMaskOperators< Enum >::enable, bool >::type MatchAllBits(const Enum test, const Enum ones, const Enum zeroes=static_cast< Enum >(0))
Definition: bitmask.h:89
This event is classified as charge 1 according to tof (0.5 &lt; Q &lt; 1.5)
Benchmark m_benchmark
Definition: NtpSelector.h:71
This event is classified as charge 2 according to tracker (1.5 &lt; Q &lt; 2.5)
This event is classified as charge 2 according to tracker standalone (1.5 &lt; Q &lt; 2.5)
IHEP reconstruction.
Definition: Utils.h:349
std::shared_ptr< spdlog::logger > m_logger
Definition: NtpSelector.h:72
std::unique_ptr< TFile > m_outputFile
Definition: NtpSelector.h:60
BetaHR * m_betahStPtr
Definition: NtpSelector.h:66
Total deposited energy in Ecal.
Definition: Utils.h:289
virtual bool UProcessCut() override
Cut, select and prescale.
This event is classified as charge &gt;2 according to tracker (Q &gt; 2.5)
void MuteOutput()
Definition: Logging.cpp:22
particles shot towards Layer 1
std::enable_if< std::is_convertible< Key, size_t >::value, bool >::type ContainsKeys(const std::array< T, N > &container, Key key)
Definition: Utils.hpp:53
AMSSetupR::RTI m_rti
Definition: NtpSelector.h:68
virtual bool Notify() override
Called every time a new file is loaded in the chain.
Definition: NtpSelector.cpp:34
std::string m_outputFilename
Definition: NtpSelector.h:59
This event is classified as charge 2 according to tof standalone (1.5 &lt; Q &lt; 2.5)
Standard tracker charge reconstruction.
Definition: Utils.h:91
void DefineStandAlone()
Select standalone objects.
particles shot towards layer 1 and passing through layer 9
Tof data is available for this event.
std::unique_ptr< NAIAChain > m_chain
Definition: NtpSelector.h:63
unsigned long long lastentry
last entry to be processed
Definition: NtpSelector.h:30