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