ATLAS Offline Software
Loading...
Searching...
No Matches
AnalysisConfig_Ntuple.h
Go to the documentation of this file.
1/* emacs: this is -*- c++ -*- */
10
11
12#ifndef TrigInDetAnalysisExample_AnalysisConfig_Ntuple_H
13#define TrigInDetAnalysisExample_AnalysisConfig_Ntuple_H
14
18
20
23
24// #include "AthenaMonitoring/AthMonitorAlgorithm.h"
26
27#include "TTree.h"
28#include "TFile.h"
29
30#define endmsg endmsg
31
32class AnalysisConfig_Ntuple : public T_AnalysisConfig<AthReentrantAlgorithm> {
33
34public:
35
36 // Full constructor: test/reference/selection
37 // - analysisInstanceName: the name of the analysis chain being created
38 // - xxxChainName: the name of the chain to be used as test/reference/selection; must be "StoreGate" in case of direct access to SG containers
39 // - xxxType: the type of tracks to be retrieved from the test/reference/selection chain or container
40 // - xxxKey: the key for tracks to be retrieved from the test/reference/selection chain or container
41 // - all standard operations are performed in loops over 0=test 1=reference 2=selection
42
43 AnalysisConfig_Ntuple(const std::vector<std::string>& chainNames, const std::string& outputFileName="TrkNtuple.root",
44 double tauEtCutOffline=0.0, int TruthPdgId = 0, bool keepAllEvents=false, int parentTruthPdgId = 0) :
46 "", "", "",
47 "", "", "",
48 "", "", "",
49 0, 0, 0,
50 0,
51 0 ),
52 m_useBeamCondSvc(false),
53 m_event(0),
54 m_File(0),
55 m_Tree(0),
56 m_Dir(0),
57 m_doOffline(false),
58 m_doVertices(false),
59 m_doMuons(false),
60 m_doMuonsSP(false),
61 m_muonType(),
66 m_tauType(),
69 m_doBjets(false),
70 m_hasTruthMap(false),
71 m_tauEtCutOffline(tauEtCutOffline),
72 m_TruthPdgId(TruthPdgId),
73 m_finalised(true),
74 m_printInfo(true),
75 m_ptmin(0),
76 m_parentTruthPdgId(parentTruthPdgId)
77 {
80
82
83 for ( unsigned i=0 ; i<chainNames.size() ; i++ ) {
84
85 if ( chainNames[i].empty() ) continue;
86
87 ChainString chain(chainNames[i]);
88
89 std::string cs = chain.head();
90
91 if ( cs=="Offline" ) m_doOffline = true;
92 else if ( cs=="Truth" ) m_mcTruth = true;
93 else if ( cs=="Vertex" ) {
94 m_vertexType.push_back(chain.tail());
95 m_doVertices = true;
96 }
97 else if ( cs=="MuonsSP" ) m_doMuonsSP = true;
98 else if ( cs=="Muons" ){
99 m_muonType.push_back(chain.tail());
100 if (chain.roi() == "LRT") m_muonIsLRT.push_back(true);
101 else m_muonIsLRT.push_back(false);
102 }
103 else if ( cs=="Electrons" ) {
104 m_electronType.push_back(chain.tail());
105 m_rawElectrons.push_back(chain.roi());
106
107 if (chain.roi() == "LRT") m_electronIsLRT.push_back(true); // more abuse
108 else m_electronIsLRT.push_back(false);
109 }
110 else if ( cs=="Taus" ) {
111 m_tauType.push_back(chain.tail());
112 m_tauProngs.push_back(chain.roi());
113 }
114 else if ( cs=="Bjets" ) m_doBjets = true;
115 else {
116
117 if ( cs!="" && cs.find("HLT")==std::string::npos ) {
119 // if ( m_provider ) m_provider->msg(MSG::WARNING) << "Unknown chain type: " << cs << endmsg;
120 // else std::cout << "Unknown chain type: " << cs << std::endl;
121 continue;
122 }
123
124 m_chainNames.push_back( chain );
125
126 }
127 }
128
129 m_event = new TIDA::Event();
131
132 }
133
134 // non-copyable
137
141 if ( !m_finalised ) finalize();
142 delete m_event;
143 }
144
145 void set_ptmin( double d=0 ) { m_ptmin=d; }
146
148 std::vector<TrackTrigObject>& objects, const std::string& key="" );
149
150protected:
151
152 virtual void loop();
153
154 virtual void book();
155
156 virtual void finalize();
157
159
161
162 TFile* m_File;
163 TTree* m_Tree;
164 TDirectory* m_Dir;
165
166 std::vector<ChainString> m_chainNames;
167
172
173 std::vector<std::string> m_muonType;
174 std::vector<bool> m_muonIsLRT;
175
176 std::vector<std::string> m_electronType;
177 std::vector<std::string> m_rawElectrons;
178 std::vector<bool> m_electronIsLRT;
179
180 std::vector<std::string> m_tauType;
181 std::vector<std::string> m_tauProngs;
182
183 std::vector<std::string> m_vertexType;
184
188
189 std::string m_outputFileName;
190
192
194
195 // bool m_keepAllEvents; // nw in base class
196
198
199 double m_ptmin;
200
202
203};
204
205
206
207#endif // TrigInDetAnalysisExample_AnalysisConfig_Ntuple_H
208
static const std::string outputFileName
Basic event class to contain a vector of chains for trigger analysis.
static const Attributes_t empty
std::vector< std::string > m_tauType
std::vector< std::string > m_muonType
size_t get_jets(Trig::FeatureContainer::combination_const_iterator citr, std::vector< TrackTrigObject > &objects, const std::string &key="")
retrieve the jets from the Roi
std::vector< std::string > m_tauProngs
std::vector< ChainString > m_chainNames
std::vector< std::string > m_electronType
virtual void finalize()
finalise the analysis - take ratios for efficiencies etc
std::vector< std::string > m_rawElectrons
std::vector< bool > m_electronIsLRT
AnalysisConfig_Ntuple(const AnalysisConfig_Ntuple &)
AnalysisConfig_Ntuple & operator=(const AnalysisConfig_Ntuple &)
virtual void book()
setup the analysis the analysis, retrieve the tools etc
std::vector< bool > m_muonIsLRT
AnalysisConfig_Ntuple(const std::vector< std::string > &chainNames, const std::string &outputFileName="TrkNtuple.root", double tauEtCutOffline=0.0, int TruthPdgId=0, bool keepAllEvents=false, int parentTruthPdgId=0)
std::vector< std::string > m_vertexType
An algorithm that can be simultaneously executed in multiple threads.
T_AnalysisConfig(const std::string &analysisInstanceName, const std::string &testChainName, const std::string &testType, const std::string &testKey, const std::string &referenceChainName, const std::string &referenceType, const std::string &referenceKey, const std::string &selectionChainName, const std::string &selectionType, const std::string &selectionKey, TrackFilter *testFilter, TrackFilter *referenceFilter, TrackFilter *selectionFilter, TrackAssociator *associator, TrackAnalysis *analysis)
std::vector< Combination >::const_iterator combination_const_iterator