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