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/FillerBeamSpot.h" |
12 |
|
#include "MitProd/TreeFiller/interface/FillerTracks.h" |
13 |
< |
#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" |
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 |
+ |
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. |
42 |
< |
|
42 |
> |
|
43 |
|
if (!configure(cfg)) { |
44 |
|
throw edm::Exception(edm::errors::Configuration, "FillMitTree::FillMitTree()\n") |
45 |
|
<< "Could not configure fillers." << "\n"; |
53 |
|
} |
54 |
|
|
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 |
|
{ |
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 |
< |
|
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 |
|
} |
121 |
|
{ |
122 |
|
// Configure our fillers. |
123 |
|
|
124 |
< |
FillerMetaInfos *fillerMetaInfos = new FillerMetaInfos(cfg); |
125 |
< |
if (fillerMetaInfos->Active()) |
86 |
< |
fillers_.push_back(fillerMetaInfos); |
87 |
< |
else { |
88 |
< |
delete fillerMetaInfos; |
89 |
< |
fillerMetaInfos = 0; |
90 |
< |
} |
124 |
> |
FillerMetaInfos *fillerMetaInfos = new FillerMetaInfos(cfg,defactive_); |
125 |
> |
addActiveFiller(fillerMetaInfos); |
126 |
|
|
127 |
|
FillerMCParticles *fillerMCParticles = new FillerMCParticles(cfg,"MCParticles",defactive_); |
128 |
< |
const GenParticleMap* genParticleMap = 0; |
129 |
< |
const SimParticleMap *simParticleMap = 0; |
130 |
< |
if (fillerMCParticles->Active()) { |
131 |
< |
fillers_.push_back(fillerMCParticles); |
132 |
< |
genParticleMap = fillerMCParticles->GetGenParticleMap(); |
133 |
< |
simParticleMap = fillerMCParticles->GetSimParticleMap(); |
134 |
< |
} |
135 |
< |
else { |
136 |
< |
delete fillerMCParticles; |
137 |
< |
fillerMCParticles = 0; |
138 |
< |
} |
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 |
< |
if (fillerCaloJets->Active()) { |
167 |
< |
fillers_.push_back(fillerCaloJets); |
168 |
< |
} |
169 |
< |
else { |
170 |
< |
delete fillerCaloJets; |
171 |
< |
fillerCaloJets = 0; |
172 |
< |
} |
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 |
< |
if (fillerCaloMet->Active()) { |
116 |
< |
fillers_.push_back(fillerCaloMet); |
117 |
< |
} |
118 |
< |
else { |
119 |
< |
delete fillerCaloMet; |
120 |
< |
fillerCaloMet = 0; |
121 |
< |
} |
187 |
> |
addActiveFiller(fillerCaloMet); |
188 |
|
|
189 |
< |
FillerTracks *fillerGeneralTracks = |
190 |
< |
new FillerTracks(cfg,"GeneralTracks",defactive_,simParticleMap); |
191 |
< |
const TrackMap *generalTrackMap=0; |
192 |
< |
if (fillerGeneralTracks->Active()) { |
193 |
< |
fillers_.push_back(fillerGeneralTracks); |
194 |
< |
generalTrackMap = fillerGeneralTracks->GetTrackMap(); |
195 |
< |
} |
196 |
< |
else { |
197 |
< |
delete fillerGeneralTracks; |
198 |
< |
fillerGeneralTracks = 0; |
199 |
< |
} |
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 |
< |
const TrackMap *standaloneMuonTrackMap=0; |
138 |
< |
if (fillerStandaloneMuonTracks->Active()) { |
139 |
< |
fillers_.push_back(fillerStandaloneMuonTracks); |
140 |
< |
standaloneMuonTrackMap = fillerStandaloneMuonTracks->GetTrackMap(); |
141 |
< |
} |
142 |
< |
else { |
143 |
< |
delete fillerStandaloneMuonTracks; |
144 |
< |
fillerStandaloneMuonTracks = 0; |
145 |
< |
} |
225 |
> |
addActiveFiller(fillerStandaloneMuonTracks); |
226 |
|
|
227 |
|
FillerTracks *fillerStandaloneMuonTracksVtx = |
228 |
|
new FillerTracks(cfg,"StandaloneMuonTracksWVtxConstraint",defactive_); |
229 |
< |
const TrackMap *standaloneMuonTrackVtxMap=0; |
150 |
< |
if (fillerStandaloneMuonTracksVtx->Active()) { |
151 |
< |
fillers_.push_back(fillerStandaloneMuonTracksVtx); |
152 |
< |
standaloneMuonTrackVtxMap = fillerStandaloneMuonTracksVtx->GetTrackMap(); |
153 |
< |
} |
154 |
< |
else { |
155 |
< |
delete fillerStandaloneMuonTracksVtx; |
156 |
< |
fillerStandaloneMuonTracksVtx = 0; |
157 |
< |
} |
229 |
> |
addActiveFiller(fillerStandaloneMuonTracksVtx); |
230 |
|
|
231 |
|
FillerTracks *fillerGlobalMuonTracks = new FillerTracks(cfg,"GlobalMuonTracks",defactive_); |
232 |
< |
const TrackMap *globalMuonTrackMap=0; |
161 |
< |
if (fillerGlobalMuonTracks->Active()) { |
162 |
< |
fillers_.push_back(fillerGlobalMuonTracks); |
163 |
< |
globalMuonTrackMap = fillerGlobalMuonTracks->GetTrackMap(); |
164 |
< |
} |
165 |
< |
else { |
166 |
< |
delete fillerGlobalMuonTracks; |
167 |
< |
fillerGlobalMuonTracks = 0; |
168 |
< |
} |
232 |
> |
addActiveFiller(fillerGlobalMuonTracks); |
233 |
|
|
234 |
|
FillerTracks *fillerConversionInOutTracks = |
235 |
< |
new FillerTracks(cfg,"ConversionInOutTracks",defactive_,simParticleMap); |
236 |
< |
const TrackMap *conversionInOutTrackMap=0; |
173 |
< |
const TrackCol *conversionInOutTracks=0; |
174 |
< |
if (fillerConversionInOutTracks->Active()) { |
175 |
< |
fillers_.push_back(fillerConversionInOutTracks); |
176 |
< |
conversionInOutTrackMap = fillerConversionInOutTracks->GetTrackMap(); |
177 |
< |
conversionInOutTracks = fillerConversionInOutTracks->GetTrackCol(); |
178 |
< |
} |
179 |
< |
else { |
180 |
< |
delete fillerConversionInOutTracks; |
181 |
< |
fillerConversionInOutTracks = 0; |
182 |
< |
} |
235 |
> |
new FillerTracks(cfg,"ConversionInOutTracks",defactive_); |
236 |
> |
addActiveFiller(fillerConversionInOutTracks); |
237 |
|
|
238 |
|
FillerTracks *fillerConversionOutInTracks = |
239 |
< |
new FillerTracks(cfg,"ConversionOutInTracks",defactive_,simParticleMap); |
240 |
< |
const TrackMap *conversionOutInTrackMap=0; |
187 |
< |
const TrackCol *conversionOutInTracks=0; |
188 |
< |
if (fillerConversionOutInTracks->Active()) { |
189 |
< |
fillers_.push_back(fillerConversionOutInTracks); |
190 |
< |
conversionOutInTrackMap = fillerConversionOutInTracks->GetTrackMap(); |
191 |
< |
conversionOutInTracks = fillerConversionOutInTracks->GetTrackCol(); |
192 |
< |
} |
193 |
< |
else { |
194 |
< |
delete fillerConversionOutInTracks; |
195 |
< |
fillerConversionOutInTracks = 0; |
196 |
< |
} |
239 |
> |
new FillerTracks(cfg,"ConversionOutInTracks",defactive_); |
240 |
> |
addActiveFiller(fillerConversionOutInTracks); |
241 |
|
|
242 |
< |
FillerGsfTracks *fillerGsfTracks = |
243 |
< |
new FillerGsfTracks(cfg,"GsfTracks",defactive_,simParticleMap); |
200 |
< |
const GsfTrackMap *gsfTrackMap=0; |
201 |
< |
if (fillerGsfTracks->Active()) { |
202 |
< |
fillers_.push_back(fillerGsfTracks); |
203 |
< |
gsfTrackMap = (GsfTrackMap*)fillerGsfTracks->GetTrackMap(); |
204 |
< |
} |
205 |
< |
else { |
206 |
< |
delete fillerGsfTracks; |
207 |
< |
fillerGsfTracks = 0; |
208 |
< |
} |
209 |
< |
|
210 |
< |
FillerMuons *fillerMuons = |
211 |
< |
new FillerMuons(cfg,defactive_,globalMuonTrackMap,standaloneMuonTrackMap, |
212 |
< |
standaloneMuonTrackVtxMap,generalTrackMap); |
213 |
< |
if (fillerMuons->Active()) |
214 |
< |
fillers_.push_back(fillerMuons); |
215 |
< |
else { |
216 |
< |
delete fillerMuons; |
217 |
< |
fillerMuons = 0; |
218 |
< |
} |
242 |
> |
FillerTracks *fillerGsfTracks = new FillerTracks(cfg,"GsfTracks",defactive_); |
243 |
> |
addActiveFiller(fillerGsfTracks); |
244 |
|
|
245 |
< |
FillerElectrons *fillerElectrons = |
246 |
< |
new FillerElectrons(cfg,defactive_,gsfTrackMap,generalTrackMap); |
247 |
< |
if (fillerElectrons->Active()) |
248 |
< |
fillers_.push_back(fillerElectrons); |
249 |
< |
else { |
225 |
< |
delete fillerElectrons; |
226 |
< |
fillerElectrons = 0; |
227 |
< |
} |
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_, conversionInOutTracks, conversionOutInTracks, |
253 |
< |
conversionInOutTrackMap, conversionOutInTrackMap); |
232 |
< |
const ConversionElectronMap *convElectronMap=0; |
233 |
< |
if (fillerConversionElectrons->Active()) { |
234 |
< |
fillers_.push_back(fillerConversionElectrons); |
235 |
< |
convElectronMap = fillerConversionElectrons->GetConversionElectronMap(); |
236 |
< |
} |
237 |
< |
else { |
238 |
< |
delete fillerConversionElectrons; |
239 |
< |
fillerConversionElectrons = 0; |
240 |
< |
} |
252 |
> |
new FillerConversionElectrons(cfg,defactive_); |
253 |
> |
addActiveFiller(fillerConversionElectrons); |
254 |
|
|
255 |
< |
FillerConversions *fillerConversions = new FillerConversions(cfg, defactive_, convElectronMap); |
256 |
< |
const ConversionMap *conversionMap=0; |
244 |
< |
if (fillerConversions->Active()) { |
245 |
< |
fillers_.push_back(fillerConversions); |
246 |
< |
conversionMap = fillerConversions->GetConversionMap(); |
247 |
< |
} |
248 |
< |
else { |
249 |
< |
delete fillerConversions; |
250 |
< |
fillerConversions = 0; |
251 |
< |
} |
255 |
> |
FillerConversions *fillerConversions = new FillerConversions(cfg,defactive_); |
256 |
> |
addActiveFiller(fillerConversions); |
257 |
|
|
258 |
< |
FillerPhotons *fillerPhotons = new FillerPhotons(cfg, defactive_, conversionMap); |
259 |
< |
if (fillerPhotons->Active()) |
260 |
< |
fillers_.push_back(fillerPhotons); |
261 |
< |
else { |
262 |
< |
delete fillerPhotons; |
263 |
< |
fillerPhotons = 0; |
264 |
< |
} |
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 |
|
} |