NAIA  1.1.1
NtpSelector.h
Go to the documentation of this file.
1 #ifndef NAIA_NtpSelector_h
2 #define NAIA_NtpSelector_h
3 
4 // c++ headers
5 #include <string>
6 
7 // dependencies headers
8 #include "spdlog/sinks/stdout_color_sinks.h"
9 #include "spdlog/spdlog.h"
10 
11 // AMS headers
12 #include "root.h"
13 #include "root_setup.h"
14 
15 // NAIA headers
16 #include "Chain/NAIAChain.h"
17 
19 
20 namespace NAIA {
21 class NtpSelector : public AMSEventR {
22 public:
23  NtpSelector(bool is_mc) : isMC{is_mc}, m_logger{spdlog::stdout_color_st("NtpSelector")}, m_benchmark{} {};
24 
26  bool isMC = false;
28  unsigned long long firstentry = 0;
30  unsigned long long lastentry = 0;
32  bool useGetMCBeta = false;
33 
34  void ReprocessRTI(bool reprocess) { m_reprocess_rti = reprocess; }
35  void SetOutputFilename(std::string outFilename) { m_outputFilename = std::move(outFilename); }
36 
37  // AMS TSelector hooks
38  virtual void UBegin() override;
39  virtual bool UProcessCut() override;
40  virtual void UProcessFill() override;
41  virtual void UTerminate() override;
42 
43  virtual void Init(TTree *tree) override {
44  m_tree = tree;
45  AMSEventR::Init(tree);
46  }
47  virtual bool Notify() override;
48 
49  void ProcessFileInfo();
50 
51 private:
52  void DefineStandAlone();
53 
54  // Reprocess only RTIInfo tree
55  bool m_reprocess_rti = false;
56 
57  // pointer to currently open input tree
58  TTree *m_tree;
59 
60  // output file
61  std::string m_outputFilename;
62  std::unique_ptr<TFile> m_outputFile;
63 
64  // trees
65  std::unique_ptr<NAIAChain> m_chain;
66 
67  // standalone quantities
68  BetaHR *m_betahStPtr;
69  TrdTrackR *m_trdTrackStPtr;
70  AMSSetupR::RTI m_rti;
71 
72  // logging and benchmarking
74  std::shared_ptr<spdlog::logger> m_logger;
75 };
76 } // namespace NAIA
77 #endif
NAIA::NtpSelector::UTerminate
virtual void UTerminate() override
Save.
Definition: NtpSelector.cpp:479
NAIA::NtpSelector::Notify
virtual bool Notify() override
Called every time a new file is loaded in the chain.
Definition: NtpSelector.cpp:34
NAIAChain.h
NAIAChain class description.
NAIA::NtpSelector::Init
virtual void Init(TTree *tree) override
Definition: NtpSelector.h:43
NAIA::NtpSelector::ProcessFileInfo
void ProcessFileInfo()
Definition: NtpSelector.cpp:48
NAIA::NtpSelector::UProcessCut
virtual bool UProcessCut() override
Cut, select and prescale.
Definition: NtpSelector.cpp:101
NAIA::NtpSelector::useGetMCBeta
bool useGetMCBeta
set if old GetMCBeta is used
Definition: NtpSelector.h:32
NAIA::NtpSelector::m_outputFilename
std::string m_outputFilename
Definition: NtpSelector.h:61
NAIA::NtpSelector::DefineStandAlone
void DefineStandAlone()
Select standalone objects.
Definition: NtpSelector.cpp:504
NAIA::NtpSelector::lastentry
unsigned long long lastentry
last entry to be processed
Definition: NtpSelector.h:30
NAIA
Definition: Event.h:13
NAIA::NtpSelector::UBegin
virtual void UBegin() override
Init output.
Definition: NtpSelector.cpp:11
NAIA::NtpSelector::firstentry
unsigned long long firstentry
first entry to be processed
Definition: NtpSelector.h:28
NAIA::NtpSelector::m_rti
AMSSetupR::RTI m_rti
Definition: NtpSelector.h:70
NAIA::NtpSelector::m_outputFile
std::unique_ptr< TFile > m_outputFile
Definition: NtpSelector.h:62
NAIA::NtpSelector::m_betahStPtr
BetaHR * m_betahStPtr
Definition: NtpSelector.h:68
NAIA::NtpSelector::UProcessFill
virtual void UProcessFill() override
Fill ntuple.
Definition: NtpSelector.cpp:477
NAIA::NtpSelector::isMC
bool isMC
is simulation?
Definition: NtpSelector.h:26
NAIA::NtpSelector::m_chain
std::unique_ptr< NAIAChain > m_chain
Definition: NtpSelector.h:65
Benchmark.h
NAIA::NtpSelector::m_reprocess_rti
bool m_reprocess_rti
Definition: NtpSelector.h:55
NAIA::NtpSelector::ReprocessRTI
void ReprocessRTI(bool reprocess)
Definition: NtpSelector.h:34
NAIA::NtpSelector
Definition: NtpSelector.h:21
NAIA::NtpSelector::SetOutputFilename
void SetOutputFilename(std::string outFilename)
Definition: NtpSelector.h:35
NAIA::NtpSelector::NtpSelector
NtpSelector(bool is_mc)
Definition: NtpSelector.h:23
NAIA::NtpSelector::m_benchmark
Benchmark m_benchmark
Definition: NtpSelector.h:73
NAIA::NtpSelector::m_trdTrackStPtr
TrdTrackR * m_trdTrackStPtr
Definition: NtpSelector.h:69
NAIA::NtpSelector::m_tree
TTree * m_tree
Definition: NtpSelector.h:58
NAIA::NtpSelector::m_logger
std::shared_ptr< spdlog::logger > m_logger
Definition: NtpSelector.h:74
NAIA::Benchmark
Definition: Benchmark.h:17