NAIA  1.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
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 isMC) : m_isMC{isMC}, m_logger{spdlog::stdout_color_st("NtpSelector")}, m_benchmark{} {};
24 
26  bool m_isMC = false;
28  unsigned long long firstentry = 0;
30  unsigned long long lastentry = 0;
31 
32  void ReprocessRTI(bool reprocess) { m_reprocess_rti = reprocess; }
33  void SetOutputFilename(std::string outFilename) { m_outputFilename = std::move(outFilename); }
34 
35  // AMS TSelector hooks
36  virtual void UBegin() override;
37  virtual bool UProcessCut() override;
38  virtual void UProcessFill() override;
39  virtual void UTerminate() override;
40 
41  virtual void Init(TTree *tree) override {
42  m_tree = tree;
43  AMSEventR::Init(tree);
44  }
45  virtual bool Notify() override;
46 
47  void ProcessFileInfo();
48 
49 private:
50  void DefineStandAlone();
51 
52  // Reprocess only RTIInfo tree
53  bool m_reprocess_rti = false;
54 
55  // pointer to currently open input tree
56  TTree *m_tree;
57 
58  // output file
59  std::string m_outputFilename;
60  std::unique_ptr<TFile> m_outputFile;
61 
62  // trees
63  std::unique_ptr<NAIAChain> m_chain;
64 
65  // standalone quantities
66  BetaHR *m_betahStPtr;
67  TrdTrackR *m_trdTrackStPtr;
68  AMSSetupR::RTI m_rti;
69 
70  // logging and benchmarking
72  std::shared_ptr<spdlog::logger> m_logger;
73 };
74 } // namespace NAIA
75 #endif
NAIAChain class description.
virtual void UProcessFill() override
Fill ntuple.
unsigned long long firstentry
first entry to be processed
Definition: NtpSelector.h:28
TrdTrackR * m_trdTrackStPtr
Definition: NtpSelector.h:67
bool m_isMC
is simulation?
Definition: NtpSelector.h:26
virtual void UBegin() override
Init output.
Definition: NtpSelector.cpp:11
NtpSelector(bool isMC)
Definition: NtpSelector.h:23
Benchmark m_benchmark
Definition: NtpSelector.h:71
std::shared_ptr< spdlog::logger > m_logger
Definition: NtpSelector.h:72
void ReprocessRTI(bool reprocess)
Definition: NtpSelector.h:32
std::unique_ptr< TFile > m_outputFile
Definition: NtpSelector.h:60
BetaHR * m_betahStPtr
Definition: NtpSelector.h:66
virtual bool UProcessCut() override
Cut, select and prescale.
virtual void UTerminate() override
Save.
void SetOutputFilename(std::string outFilename)
Definition: NtpSelector.h:33
virtual void Init(TTree *tree) override
Definition: NtpSelector.h:41
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
void DefineStandAlone()
Select standalone objects.
std::unique_ptr< NAIAChain > m_chain
Definition: NtpSelector.h:63
unsigned long long lastentry
last entry to be processed
Definition: NtpSelector.h:30