NAIA
 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 SetOutputFilename(std::string outFilename) { m_outputFilename = std::move(outFilename); }
33 
34  // AMS TSelector hooks
35  virtual void UBegin() override;
36  virtual bool UProcessCut() override;
37  virtual void UProcessFill() override;
38  virtual void UTerminate() override;
39 
40  virtual void Init(TTree *tree) override {
41  m_tree = tree;
42  AMSEventR::Init(tree);
43  }
44  virtual bool Notify() override;
45 
46  void ProcessFileInfo();
47 
48  void SetLoggingLevel(spdlog::level::level_enum logLevel) { m_logger->set_level(logLevel); }
49 
50 private:
51  void DefineStandAlone();
52 
53  // pointer to currently open input tree
54  TTree *m_tree;
55 
56  // output file
57  std::string m_outputFilename;
58  std::unique_ptr<TFile> m_outputFile;
59 
60  // trees
61  std::unique_ptr<NAIAChain> m_chain;
62 
63  // standalone quantities
64  BetaHR *m_betahStPtr;
65  TrdTrackR *m_trdTrackStPtr;
66  AMSSetupR::RTI m_rti;
67 
68  // logging and benchmarking
70  std::shared_ptr<spdlog::logger> m_logger;
71 };
72 } // namespace NAIA
73 #endif
void SetLoggingLevel(spdlog::level::level_enum logLevel)
Definition: NtpSelector.h:48
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:65
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:69
std::shared_ptr< spdlog::logger > m_logger
Definition: NtpSelector.h:70
std::unique_ptr< TFile > m_outputFile
Definition: NtpSelector.h:58
BetaHR * m_betahStPtr
Definition: NtpSelector.h:64
virtual bool UProcessCut() override
Cut, select and prescale.
Definition: NtpSelector.cpp:94
virtual void UTerminate() override
Save.
void SetOutputFilename(std::string outFilename)
Definition: NtpSelector.h:32
virtual void Init(TTree *tree) override
Definition: NtpSelector.h:40
AMSSetupR::RTI m_rti
Definition: NtpSelector.h:66
virtual bool Notify() override
Called every time a new file is loaded in the chain.
Definition: NtpSelector.cpp:27
std::string m_outputFilename
Definition: NtpSelector.h:57
void DefineStandAlone()
Select standalone objects.
std::unique_ptr< NAIAChain > m_chain
Definition: NtpSelector.h:61
unsigned long long lastentry
last entry to be processed
Definition: NtpSelector.h:30