4 |
|
#include "FWCore/MessageLogger/interface/MessageLogger.h" |
5 |
|
#include "FWCore/ServiceRegistry/interface/Service.h" |
6 |
|
#include "MitProd/TreeService/interface/TreeService.h" |
7 |
+ |
#include "MitProd/ObjectService/interface/ObjectService.h" |
8 |
+ |
#include "MitProd/TreeFiller/interface/AssociationMaps.h" |
9 |
|
#include "MitProd/TreeFiller/interface/FillerMetaInfos.h" |
10 |
< |
#include "MitProd/TreeFiller/interface/FillerGlobalMuons.h" |
10 |
> |
#include "MitProd/TreeFiller/interface/FillerVertexes.h" |
11 |
> |
#include "MitProd/TreeFiller/interface/FillerBeamSpot.h" |
12 |
> |
#include "MitProd/TreeFiller/interface/FillerTracks.h" |
13 |
> |
#include "MitProd/TreeFiller/interface/FillerBasicClusters.h" |
14 |
> |
#include "MitProd/TreeFiller/interface/FillerSuperClusters.h" |
15 |
> |
#include "MitProd/TreeFiller/interface/FillerCaloTowers.h" |
16 |
> |
#include "MitProd/TreeFiller/interface/FillerMuons.h" |
17 |
> |
#include "MitProd/TreeFiller/interface/FillerElectrons.h" |
18 |
> |
#include "MitProd/TreeFiller/interface/FillerGenJets.h" |
19 |
> |
#include "MitProd/TreeFiller/interface/FillerCaloJets.h" |
20 |
> |
#include "MitProd/TreeFiller/interface/FillerCaloMet.h" |
21 |
> |
#include "MitProd/TreeFiller/interface/FillerConversions.h" |
22 |
> |
#include "MitProd/TreeFiller/interface/FillerConversionElectrons.h" |
23 |
> |
#include "MitProd/TreeFiller/interface/FillerPhotons.h" |
24 |
> |
#include "MitProd/TreeFiller/interface/FillerMCParticles.h" |
25 |
> |
#include "MitProd/TreeFiller/interface/FillerAODMCParticles.h" |
26 |
> |
#include "MitProd/TreeFiller/interface/FillerDecayParts.h" |
27 |
> |
#include "MitProd/TreeFiller/interface/FillerStableParts.h" |
28 |
> |
#include "MitProd/TreeFiller/interface/FillerPATMuons.h" |
29 |
> |
#include "MitProd/TreeFiller/interface/FillerPATElectrons.h" |
30 |
|
|
31 |
|
using namespace std; |
32 |
|
using namespace edm; |
33 |
|
using namespace mithep; |
34 |
|
|
35 |
< |
//------------------------------------------------------------------------------------------------- |
36 |
< |
FillMitTree::FillMitTree(const edm::ParameterSet &cfg) |
35 |
> |
mithep::ObjectService *mithep::FillMitTree::os_ = 0; |
36 |
> |
|
37 |
> |
//-------------------------------------------------------------------------------------------------- |
38 |
> |
FillMitTree::FillMitTree(const edm::ParameterSet &cfg) : |
39 |
> |
defactive_(cfg.getUntrackedParameter<bool>("defactive",1)) |
40 |
|
{ |
41 |
< |
// Constructor: initialize fillers |
41 |
> |
// Constructor. |
42 |
|
|
43 |
|
if (!configure(cfg)) { |
44 |
|
throw edm::Exception(edm::errors::Configuration, "FillMitTree::FillMitTree()\n") |
46 |
|
} |
47 |
|
} |
48 |
|
|
49 |
< |
//------------------------------------------------------------------------------------------------- |
49 |
> |
//-------------------------------------------------------------------------------------------------- |
50 |
|
FillMitTree::~FillMitTree() |
51 |
|
{ |
52 |
|
// Destructor: nothing to be done here. |
53 |
|
} |
54 |
|
|
55 |
< |
//------------------------------------------------------------------------------------------------- |
55 |
> |
//-------------------------------------------------------------------------------------------------- |
56 |
> |
bool FillMitTree::addActiveFiller(BaseFiller *bf) |
57 |
> |
{ |
58 |
> |
// Check if filler is active and add it to list of fillers. Otherwise delete it. |
59 |
> |
|
60 |
> |
if (bf->Active()) { |
61 |
> |
fillers_.push_back(bf); |
62 |
> |
return 1; |
63 |
> |
} |
64 |
> |
|
65 |
> |
delete bf; |
66 |
> |
bf = 0; |
67 |
> |
return 0; |
68 |
> |
} |
69 |
> |
|
70 |
> |
//-------------------------------------------------------------------------------------------------- |
71 |
|
void FillMitTree::analyze(const edm::Event &event, |
72 |
|
const edm::EventSetup &setup) |
73 |
|
{ |
84 |
|
} |
85 |
|
} |
86 |
|
|
87 |
< |
//------------------------------------------------------------------------------------------------- |
87 |
> |
//-------------------------------------------------------------------------------------------------- |
88 |
|
void FillMitTree::beginJob(const edm::EventSetup &event) |
89 |
|
{ |
90 |
|
// Access the tree and book branches. |
93 |
|
TreeWriter *tws = ts->get(); |
94 |
|
if (! tws) { |
95 |
|
throw edm::Exception(edm::errors::Configuration, "FillMitTree::beginJob()\n") |
96 |
< |
<< "Could not get pointer to tree." << "\n"; |
96 |
> |
<< "Could not get pointer to tree. " |
97 |
> |
<< "Do you have the TreeServie define in your config?" << "\n"; |
98 |
|
return; |
99 |
|
} |
100 |
|
|
101 |
+ |
if (os_==0) { |
102 |
+ |
Service<ObjectService> os; |
103 |
+ |
if (!os.isAvailable()) { |
104 |
+ |
throw edm::Exception(edm::errors::Configuration, "FillMitTree::beginJob()\n") |
105 |
+ |
<< "Could not get object service. " |
106 |
+ |
<< "Do you have the ObjectService defined in your config?" << "\n"; |
107 |
+ |
return; |
108 |
+ |
} |
109 |
+ |
os_ = &(*os); |
110 |
+ |
} |
111 |
+ |
|
112 |
|
// Loop over the various components and book the branches |
113 |
|
for (std::vector<BaseFiller*>::iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) { |
114 |
+ |
edm::LogInfo("FillMitTree::beginJob") << "Booking for " << (*iF)->Name() << endl; |
115 |
|
(*iF)->BookDataBlock(*tws); |
116 |
|
} |
117 |
|
} |
118 |
|
|
119 |
< |
//------------------------------------------------------------------------------------------------- |
119 |
> |
//-------------------------------------------------------------------------------------------------- |
120 |
|
bool FillMitTree::configure(const edm::ParameterSet &cfg) |
121 |
|
{ |
122 |
|
// Configure our fillers. |
123 |
|
|
124 |
+ |
FillerMetaInfos *fillerMetaInfos = new FillerMetaInfos(cfg,defactive_); |
125 |
+ |
addActiveFiller(fillerMetaInfos); |
126 |
|
|
127 |
< |
FillerMetaInfos *fillerMetaInfos = new FillerMetaInfos(cfg); |
128 |
< |
if (fillerMetaInfos->Active()) |
129 |
< |
fillers_.push_back(fillerMetaInfos); |
130 |
< |
else |
131 |
< |
delete fillerMetaInfos; |
132 |
< |
|
133 |
< |
FillerGlobalMuons *fillerGlobalMuons = new FillerGlobalMuons(cfg); |
134 |
< |
if (fillerGlobalMuons->Active()) |
135 |
< |
fillers_.push_back(fillerGlobalMuons); |
136 |
< |
else |
137 |
< |
delete fillerGlobalMuons; |
127 |
> |
FillerMCParticles *fillerMCParticles = new FillerMCParticles(cfg,"MCParticles",defactive_); |
128 |
> |
addActiveFiller(fillerMCParticles); |
129 |
> |
|
130 |
> |
FillerAODMCParticles *fillerAODMCParticles = new FillerAODMCParticles(cfg,"AODMCParticles",false); |
131 |
> |
addActiveFiller(fillerAODMCParticles); |
132 |
> |
|
133 |
> |
FillerBeamSpot *fillerBeamSpot = |
134 |
> |
new FillerBeamSpot(cfg,"BeamSpot", defactive_); |
135 |
> |
addActiveFiller(fillerBeamSpot); |
136 |
> |
|
137 |
> |
FillerVertexes *fillerPrimaryVertexes = |
138 |
> |
new FillerVertexes(cfg,"PrimaryVertexes", defactive_); |
139 |
> |
addActiveFiller(fillerPrimaryVertexes); |
140 |
> |
|
141 |
> |
//primary vertexes with beamspot constraint |
142 |
> |
FillerVertexes *fillerPrimaryVertexesBS = |
143 |
> |
new FillerVertexes(cfg,"PrimaryVertexesBS", defactive_); |
144 |
> |
addActiveFiller(fillerPrimaryVertexesBS); |
145 |
> |
|
146 |
> |
FillerCaloTowers *fillerCaloTowers = |
147 |
> |
new FillerCaloTowers(cfg, "CaloTowers", defactive_); |
148 |
> |
addActiveFiller(fillerCaloTowers); |
149 |
> |
|
150 |
> |
FillerGenJets *fillerIC5GenJets = new FillerGenJets(cfg,"IC5GenJets",defactive_); |
151 |
> |
addActiveFiller(fillerIC5GenJets); |
152 |
> |
|
153 |
> |
FillerGenJets *fillerSC5GenJets = new FillerGenJets(cfg,"SC5GenJets",defactive_); |
154 |
> |
addActiveFiller(fillerSC5GenJets); |
155 |
> |
|
156 |
> |
FillerGenJets *fillerSC7GenJets = new FillerGenJets(cfg,"SC7GenJets",defactive_); |
157 |
> |
addActiveFiller(fillerSC7GenJets); |
158 |
> |
|
159 |
> |
FillerGenJets *fillerKT4GenJets = new FillerGenJets(cfg,"KT4GenJets",defactive_); |
160 |
> |
addActiveFiller(fillerKT4GenJets); |
161 |
> |
|
162 |
> |
FillerGenJets *fillerKT6GenJets = new FillerGenJets(cfg,"KT6GenJets",defactive_); |
163 |
> |
addActiveFiller(fillerKT6GenJets); |
164 |
> |
|
165 |
> |
FillerCaloJets *fillerCaloJets = new FillerCaloJets(cfg,"CaloJets",defactive_); |
166 |
> |
addActiveFiller(fillerCaloJets); |
167 |
> |
|
168 |
> |
FillerCaloJets *fillerItrCone5Jets = new FillerCaloJets(cfg,"ItrCone5Jets",defactive_); |
169 |
> |
addActiveFiller(fillerItrCone5Jets); |
170 |
> |
|
171 |
> |
FillerCaloJets *fillerSisCone5Jets = new FillerCaloJets(cfg,"SisCone5Jets",defactive_); |
172 |
> |
addActiveFiller(fillerSisCone5Jets); |
173 |
> |
|
174 |
> |
FillerCaloJets *fillerSisCone7Jets = new FillerCaloJets(cfg,"SisCone7Jets",defactive_); |
175 |
> |
addActiveFiller(fillerSisCone7Jets); |
176 |
> |
|
177 |
> |
FillerCaloJets *fillerKt4Jets = new FillerCaloJets(cfg,"Kt4Jets",defactive_); |
178 |
> |
addActiveFiller(fillerKt4Jets); |
179 |
> |
|
180 |
> |
FillerCaloJets *fillerKt6Jets = new FillerCaloJets(cfg,"Kt6Jets",defactive_); |
181 |
> |
addActiveFiller(fillerKt6Jets); |
182 |
> |
|
183 |
> |
FillerCaloJets *fillerIC5JetPlusTrack = new FillerCaloJets(cfg,"IC5JetPlusTrack",defactive_); |
184 |
> |
addActiveFiller(fillerIC5JetPlusTrack); |
185 |
> |
|
186 |
> |
FillerCaloMet *fillerCaloMet = new FillerCaloMet(cfg,"CaloMet",defactive_); |
187 |
> |
addActiveFiller(fillerCaloMet); |
188 |
> |
|
189 |
> |
FillerCaloMet *fillerItrCone5Met = new FillerCaloMet(cfg,"ItrCone5Met",defactive_); |
190 |
> |
addActiveFiller(fillerItrCone5Met); |
191 |
> |
|
192 |
> |
FillerCaloMet *fillerSisCone5Met = new FillerCaloMet(cfg,"SisCone5Met",defactive_); |
193 |
> |
addActiveFiller(fillerSisCone5Met); |
194 |
> |
|
195 |
> |
FillerCaloMet *fillerSisCone7Met = new FillerCaloMet(cfg,"SisCone7Met",defactive_); |
196 |
> |
addActiveFiller(fillerSisCone7Met); |
197 |
> |
|
198 |
> |
FillerCaloMet *fillerKt4Met = new FillerCaloMet(cfg,"Kt4Met",defactive_); |
199 |
> |
addActiveFiller(fillerKt4Met); |
200 |
> |
|
201 |
> |
FillerCaloMet *fillerKt6Met = new FillerCaloMet(cfg,"Kt6Met",defactive_); |
202 |
> |
addActiveFiller(fillerKt6Met); |
203 |
> |
|
204 |
> |
FillerBasicClusters *fillerBarrelBasicClusters = |
205 |
> |
new FillerBasicClusters(cfg, "BarrelBasicClusters", defactive_); |
206 |
> |
addActiveFiller(fillerBarrelBasicClusters); |
207 |
> |
|
208 |
> |
FillerSuperClusters *fillerBarrelSuperClusters = |
209 |
> |
new FillerSuperClusters(cfg,"BarrelSuperClusters", defactive_); |
210 |
> |
addActiveFiller(fillerBarrelSuperClusters); |
211 |
> |
|
212 |
> |
FillerBasicClusters *fillerEndcapBasicClusters = |
213 |
> |
new FillerBasicClusters(cfg,"EndcapBasicClusters", defactive_); |
214 |
> |
addActiveFiller(fillerEndcapBasicClusters); |
215 |
> |
|
216 |
> |
FillerSuperClusters *fillerEndcapSuperClusters = |
217 |
> |
new FillerSuperClusters(cfg,"EndcapSuperClusters", defactive_); |
218 |
> |
addActiveFiller(fillerEndcapSuperClusters); |
219 |
> |
|
220 |
> |
FillerTracks *fillerGeneralTracks = new FillerTracks(cfg,"GeneralTracks",defactive_); |
221 |
> |
addActiveFiller(fillerGeneralTracks); |
222 |
> |
|
223 |
> |
FillerTracks *fillerStandaloneMuonTracks = |
224 |
> |
new FillerTracks(cfg,"StandaloneMuonTracks",defactive_); |
225 |
> |
addActiveFiller(fillerStandaloneMuonTracks); |
226 |
> |
|
227 |
> |
FillerTracks *fillerStandaloneMuonTracksVtx = |
228 |
> |
new FillerTracks(cfg,"StandaloneMuonTracksWVtxConstraint",defactive_); |
229 |
> |
addActiveFiller(fillerStandaloneMuonTracksVtx); |
230 |
> |
|
231 |
> |
FillerTracks *fillerGlobalMuonTracks = new FillerTracks(cfg,"GlobalMuonTracks",defactive_); |
232 |
> |
addActiveFiller(fillerGlobalMuonTracks); |
233 |
> |
|
234 |
> |
FillerTracks *fillerConversionInOutTracks = |
235 |
> |
new FillerTracks(cfg,"ConversionInOutTracks",defactive_); |
236 |
> |
addActiveFiller(fillerConversionInOutTracks); |
237 |
> |
|
238 |
> |
FillerTracks *fillerConversionOutInTracks = |
239 |
> |
new FillerTracks(cfg,"ConversionOutInTracks",defactive_); |
240 |
> |
addActiveFiller(fillerConversionOutInTracks); |
241 |
> |
|
242 |
> |
FillerTracks *fillerGsfTracks = new FillerTracks(cfg,"GsfTracks",defactive_); |
243 |
> |
addActiveFiller(fillerGsfTracks); |
244 |
> |
|
245 |
> |
FillerMuons *fillerMuons = new FillerMuons(cfg,defactive_); |
246 |
> |
addActiveFiller(fillerMuons); |
247 |
> |
|
248 |
> |
FillerElectrons *fillerElectrons = new FillerElectrons(cfg,defactive_); |
249 |
> |
addActiveFiller(fillerElectrons); |
250 |
> |
|
251 |
> |
FillerConversionElectrons *fillerConversionElectrons = |
252 |
> |
new FillerConversionElectrons(cfg,defactive_); |
253 |
> |
addActiveFiller(fillerConversionElectrons); |
254 |
> |
|
255 |
> |
FillerConversions *fillerConversions = new FillerConversions(cfg,defactive_); |
256 |
> |
addActiveFiller(fillerConversions); |
257 |
> |
|
258 |
> |
FillerPhotons *fillerPhotons = new FillerPhotons(cfg,defactive_); |
259 |
> |
addActiveFiller(fillerPhotons); |
260 |
> |
|
261 |
> |
FillerStableParts *fillerStableParts = new FillerStableParts(cfg,"StableParts",defactive_); |
262 |
> |
addActiveFiller(fillerStableParts); |
263 |
> |
|
264 |
> |
FillerDecayParts *fillerDecayParts = new FillerDecayParts(cfg,"DecayParts",defactive_); |
265 |
> |
addActiveFiller(fillerDecayParts); |
266 |
|
|
267 |
|
return 1; |
268 |
|
} |
269 |
|
|
270 |
< |
//------------------------------------------------------------------------------------------------- |
270 |
> |
//-------------------------------------------------------------------------------------------------- |
271 |
|
void FillMitTree::endJob() |
272 |
|
{ |
273 |
|
// Delete fillers. |