1 |
lethuill |
1.14 |
#include "../interface/TotoAnalyzer.h"
|
2 |
mlethuil |
1.1 |
|
3 |
|
|
using namespace std;
|
4 |
|
|
using namespace reco;
|
5 |
|
|
using namespace edm;
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
TotoAnalyzer::TotoAnalyzer(const edm::ParameterSet& iConfig)
|
9 |
|
|
{
|
10 |
lethuill |
1.32 |
myConfig_ = iConfig.getParameter<ParameterSet>("myConfig");
|
11 |
|
|
dataType_ = myConfig_.getUntrackedParameter<string>("dataType","unknown");
|
12 |
|
|
cout << "dataType: " << dataType_ << endl;
|
13 |
|
|
if( dataType_=="RECO" ) producersNames_ = iConfig.getParameter<ParameterSet>("producersNamesRECO");
|
14 |
|
|
else if( dataType_=="PAT" ) producersNames_ = iConfig.getParameter<ParameterSet>("producersNamesPAT");
|
15 |
|
|
else { cout << "TotoAnalyzer::TotoAnalyzer... dataType is unknown... exiting..." << endl; exit(1); }
|
16 |
|
|
|
17 |
|
|
runInfos_ = 0;
|
18 |
|
|
rootEvent_ = 0;
|
19 |
|
|
hltAnalyzer_ = 0;
|
20 |
|
|
rootMCParticles_ = 0;
|
21 |
|
|
rootGenJets_ = 0;
|
22 |
|
|
rootGenMETs_ = 0;
|
23 |
|
|
rootMuMuGammaEvent_ = 0;
|
24 |
|
|
rootMCTopTop_ = 0;
|
25 |
|
|
rootMCPhotons_ = 0;
|
26 |
|
|
rootBeamSpot_ = 0;
|
27 |
|
|
rootVertices_ = 0;
|
28 |
|
|
rootTracks_ = 0;
|
29 |
|
|
rootJets_ = 0;
|
30 |
|
|
rootMuons_ = 0;
|
31 |
|
|
rootElectrons_ = 0;
|
32 |
|
|
rootPhotons_ = 0;
|
33 |
|
|
rootBasicClusters_ = 0;
|
34 |
|
|
rootSuperClusters_ = 0;
|
35 |
|
|
rootConversionTracks_ = 0;
|
36 |
|
|
rootMETs_ = 0;
|
37 |
mlethuil |
1.1 |
}
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
TotoAnalyzer::~TotoAnalyzer()
|
41 |
lethuill |
1.11 |
{
|
42 |
|
|
}
|
43 |
mlethuil |
1.1 |
|
44 |
|
|
|
45 |
|
|
// ------------ method called once each job just before starting event loop ------------
|
46 |
|
|
void TotoAnalyzer::beginJob(const edm::EventSetup&)
|
47 |
|
|
{
|
48 |
lethuill |
1.32 |
|
49 |
|
|
// Load Config parameters
|
50 |
|
|
verbosity_ = myConfig_.getUntrackedParameter<int>("verbosity", 0);
|
51 |
|
|
allowMissingCollection_ = producersNames_.getUntrackedParameter<bool>("allowMissingCollection", false);
|
52 |
|
|
rootFileName_ = myConfig_.getUntrackedParameter<string>("RootFileName","noname.root");
|
53 |
|
|
datasetXsection_ = myConfig_.getUntrackedParameter<double>("xsection");
|
54 |
|
|
datasetDesciption_ = myConfig_.getUntrackedParameter<string>("description","Pas de description");
|
55 |
|
|
doHLT_ = myConfig_.getUntrackedParameter<bool>("doHLT",false);
|
56 |
|
|
doMC_ = myConfig_.getUntrackedParameter<bool>("doMC",false);
|
57 |
|
|
doJetMC_ = myConfig_.getUntrackedParameter<bool>("doJetMC",false);
|
58 |
|
|
doMETMC_ = myConfig_.getUntrackedParameter<bool>("doMETMC",false);
|
59 |
|
|
doPDFInfo_ = myConfig_.getUntrackedParameter<bool>("doPDFInfo",false);
|
60 |
|
|
doSignalMuMuGamma_ = myConfig_.getUntrackedParameter<bool>("doSignalMuMuGamma",false);
|
61 |
|
|
doSignalTopTop_ = myConfig_.getUntrackedParameter<bool>("doSignalTopTop",false);
|
62 |
|
|
doPhotonConversionMC_ = myConfig_.getUntrackedParameter<bool>("doPhotonConversionMC",false);
|
63 |
|
|
drawMCTree_ = myConfig_.getUntrackedParameter<bool>("drawMCTree",false);
|
64 |
|
|
doBeamSpot_ = myConfig_.getUntrackedParameter<bool>("doBeamSpot",false);
|
65 |
|
|
doPrimaryVertex_ = myConfig_.getUntrackedParameter<bool>("doPrimaryVertex",false);
|
66 |
|
|
doTrack_ = myConfig_.getUntrackedParameter<bool>("doTrack",false);
|
67 |
|
|
doJet_ = myConfig_.getUntrackedParameter<bool>("doJet",false);
|
68 |
|
|
doMuon_ = myConfig_.getUntrackedParameter<bool>("doMuon",false);
|
69 |
|
|
doElectron_ = myConfig_.getUntrackedParameter<bool>("doElectron",false);
|
70 |
|
|
doPhoton_ = myConfig_.getUntrackedParameter<bool>("doPhoton",false);
|
71 |
|
|
doCluster_ = myConfig_.getUntrackedParameter<bool>("doCluster",false);
|
72 |
|
|
doPhotonConversion_ = myConfig_.getUntrackedParameter<bool>("doPhotonConversion",false);
|
73 |
|
|
doPhotonIsolation_ = myConfig_.getUntrackedParameter<bool>("doPhotonIsolation",false);
|
74 |
|
|
doMET_ = myConfig_.getUntrackedParameter<bool>("doMET",false);
|
75 |
|
|
|
76 |
|
|
nTotEvt_ = 0;
|
77 |
|
|
|
78 |
|
|
// initialize root output file
|
79 |
|
|
if(verbosity_>0) cout << "New RootFile " << rootFileName_.c_str() << " is created" << endl;
|
80 |
|
|
rootFile_ = new TFile(rootFileName_.c_str(), "recreate");
|
81 |
|
|
rootFile_->cd();
|
82 |
|
|
|
83 |
|
|
runInfos_ = new TRootRun();
|
84 |
|
|
runTree_ = new TTree("runTree", "Global Run Infos");
|
85 |
|
|
runTree_->Branch ("runInfos", "TRootRun", &runInfos_);
|
86 |
|
|
runInfos_->setXsection(datasetXsection_);
|
87 |
|
|
runInfos_->setDescription(datasetDesciption_);
|
88 |
|
|
|
89 |
|
|
rootEvent_ = 0;
|
90 |
|
|
eventTree_ = new TTree("eventTree", "Event Infos");
|
91 |
|
|
eventTree_->Branch ("Event", "TRootEvent", &rootEvent_);
|
92 |
|
|
|
93 |
|
|
if(doHLT_)
|
94 |
|
|
{
|
95 |
|
|
hltAnalyzer_ = new HLTAnalyzer(producersNames_, verbosity_);
|
96 |
|
|
}
|
97 |
|
|
|
98 |
|
|
if(doMC_)
|
99 |
|
|
{
|
100 |
|
|
if(verbosity_>0) cout << "MC Particles info will be added to rootuple" << endl;
|
101 |
|
|
rootMCParticles_ = new TClonesArray("TRootMCParticle", 1000);
|
102 |
|
|
eventTree_->Branch ("MCParticles", "TClonesArray", &rootMCParticles_);
|
103 |
|
|
}
|
104 |
|
|
|
105 |
|
|
if(doJetMC_)
|
106 |
|
|
{
|
107 |
|
|
if(verbosity_>0) cout << "genJets info will be added to rootuple" << endl;
|
108 |
|
|
rootGenJets_ = new TClonesArray("TRootParticle", 1000);
|
109 |
|
|
eventTree_->Branch ("genJets", "TClonesArray", &rootGenJets_);
|
110 |
|
|
}
|
111 |
|
|
|
112 |
|
|
if(doMETMC_)
|
113 |
|
|
{
|
114 |
|
|
if(verbosity_>0) cout << "genMETs info will be added to rootuple" << endl;
|
115 |
|
|
rootGenMETs_ = new TClonesArray("TRootParticle", 1000);
|
116 |
|
|
eventTree_->Branch ("genMETs", "TClonesArray", &rootGenMETs_);
|
117 |
|
|
}
|
118 |
|
|
|
119 |
|
|
if(doSignalMuMuGamma_)
|
120 |
|
|
{
|
121 |
|
|
if(verbosity_>0) cout << "MC info for Z -> mu mu gamma will be added to rootuple" << endl;
|
122 |
|
|
eventTree_->Branch ("MuMuGamma", "TRootSignalEvent", &rootMuMuGammaEvent_);
|
123 |
|
|
}
|
124 |
|
|
|
125 |
|
|
if(doSignalTopTop_)
|
126 |
|
|
{
|
127 |
|
|
if(verbosity_>0) cout << "MC info for Top Top will be added to rootuple" << endl;
|
128 |
|
|
rootMCTopTop_ = new TClonesArray("TRootTopTop", 1000);
|
129 |
|
|
eventTree_->Branch ("rootMCTopTop", "TClonesArray", &rootMCTopTop_);
|
130 |
|
|
}
|
131 |
|
|
|
132 |
|
|
if(doPhotonConversionMC_)
|
133 |
|
|
{
|
134 |
|
|
if(verbosity_>0) cout << "Converted MC Photons info will be added to rootuple" << endl;
|
135 |
|
|
rootMCPhotons_ = new TClonesArray("TRootMCPhoton", 1000);
|
136 |
|
|
eventTree_->Branch ("MCPhotons", "TClonesArray", &rootMCPhotons_);
|
137 |
|
|
}
|
138 |
|
|
|
139 |
|
|
if(doBeamSpot_)
|
140 |
|
|
{
|
141 |
|
|
if(verbosity_>0) cout << "BeamSpot info will be added to rootuple" << endl;
|
142 |
|
|
rootBeamSpot_ = new TRootBeamSpot();
|
143 |
|
|
eventTree_->Branch ("BeamSpot", "TRootBeamSpot", &rootBeamSpot_);
|
144 |
|
|
}
|
145 |
|
|
|
146 |
|
|
if(doPrimaryVertex_)
|
147 |
|
|
{
|
148 |
|
|
if(verbosity_>0) cout << "Vertices info will be added to rootuple" << endl;
|
149 |
|
|
rootVertices_ = new TClonesArray("TRootVertex", 1000);
|
150 |
|
|
eventTree_->Branch ("Vertices", "TClonesArray", &rootVertices_);
|
151 |
|
|
}
|
152 |
|
|
|
153 |
|
|
if(doTrack_)
|
154 |
|
|
{
|
155 |
|
|
if(verbosity_>0) cout << "Tracks info will be added to rootuple" << endl;
|
156 |
|
|
rootTracks_ = new TClonesArray("TRootTrack", 1000);
|
157 |
|
|
eventTree_->Branch ("Tracks", "TClonesArray", &rootTracks_);
|
158 |
|
|
}
|
159 |
|
|
|
160 |
|
|
if(doJet_)
|
161 |
|
|
{
|
162 |
|
|
if(verbosity_>0) cout << "Jets info will be added to rootuple" << endl;
|
163 |
|
|
rootJets_ = new TClonesArray("TRootJet", 1000);
|
164 |
|
|
eventTree_->Branch ("Jets", "TClonesArray", &rootJets_);
|
165 |
|
|
}
|
166 |
|
|
|
167 |
|
|
if(doMuon_)
|
168 |
|
|
{
|
169 |
|
|
if(verbosity_>0) cout << "Muons info will be added to rootuple" << endl;
|
170 |
|
|
rootMuons_ = new TClonesArray("TRootMuon", 1000);
|
171 |
|
|
eventTree_->Branch ("Muons", "TClonesArray", &rootMuons_);
|
172 |
|
|
}
|
173 |
|
|
|
174 |
|
|
if(doElectron_)
|
175 |
|
|
{
|
176 |
|
|
if(verbosity_>0) cout << "Electrons info will be added to rootuple" << endl;
|
177 |
|
|
rootElectrons_ = new TClonesArray("TRootElectron", 1000);
|
178 |
|
|
eventTree_->Branch ("Electrons", "TClonesArray", &rootElectrons_);
|
179 |
|
|
}
|
180 |
|
|
|
181 |
|
|
if(doPhoton_)
|
182 |
|
|
{
|
183 |
|
|
if(verbosity_>0) cout << "Photons info will be added to rootuple" << endl;
|
184 |
|
|
rootPhotons_ = new TClonesArray("TRootPhoton", 1000);
|
185 |
|
|
eventTree_->Branch ("Photons", "TClonesArray", &rootPhotons_);
|
186 |
|
|
}
|
187 |
|
|
|
188 |
|
|
if(doCluster_)
|
189 |
|
|
{
|
190 |
|
|
if(verbosity_>0) cout << "ECAL Clusters info will be added to rootuple" << endl;
|
191 |
|
|
rootBasicClusters_ = new TClonesArray("TRootCluster", 1000);
|
192 |
|
|
eventTree_->Branch ("BasicClusters", "TClonesArray", &rootBasicClusters_);
|
193 |
|
|
rootSuperClusters_ = new TClonesArray("TRootSuperCluster", 1000);
|
194 |
|
|
eventTree_->Branch ("SuperClusters", "TClonesArray", &rootSuperClusters_);
|
195 |
|
|
}
|
196 |
|
|
|
197 |
|
|
if(doPhotonConversion_)
|
198 |
|
|
{
|
199 |
|
|
if(verbosity_>0) cout << "Conversion Tracks info will be added to rootuple" << endl;
|
200 |
|
|
rootConversionTracks_ = new TClonesArray("TRootTrack", 1000);
|
201 |
|
|
eventTree_->Branch ("ConversionTracks", "TClonesArray", &rootConversionTracks_);
|
202 |
|
|
|
203 |
|
|
conversionLikelihoodCalculator_ = new ConversionLikelihoodCalculator();
|
204 |
|
|
std::string weightsString = myConfig_.getUntrackedParameter<string>("conversionLikelihoodWeightsFile","RecoEgamma/EgammaTools/data/TMVAnalysis_Likelihood.weights.txt");
|
205 |
|
|
edm::FileInPath weightsFile(weightsString.c_str() );
|
206 |
|
|
conversionLikelihoodCalculator_->setWeightsFile(weightsFile.fullPath().c_str());
|
207 |
|
|
}
|
208 |
|
|
|
209 |
|
|
if(doMET_)
|
210 |
|
|
{
|
211 |
|
|
if(verbosity_>0) cout << "MET info will be added to rootuple" << endl;
|
212 |
|
|
rootMETs_ = new TClonesArray("TRootMET", 1000);
|
213 |
|
|
eventTree_->Branch ("MET", "TClonesArray", &rootMETs_);
|
214 |
|
|
}
|
215 |
|
|
|
216 |
mlethuil |
1.1 |
}
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
// ------------ method called once each job just after ending the event loop ------------
|
220 |
|
|
void TotoAnalyzer::endJob()
|
221 |
|
|
{
|
222 |
lethuill |
1.32 |
// Trigger Summary Tables
|
223 |
|
|
if(doHLT_)
|
224 |
|
|
{
|
225 |
|
|
cout << "Trigger Summary Tables" << endl;
|
226 |
|
|
hltAnalyzer_ ->copySummary(runInfos_);
|
227 |
|
|
hltAnalyzer_->printStats();
|
228 |
|
|
}
|
229 |
|
|
|
230 |
|
|
runTree_->Fill();
|
231 |
|
|
|
232 |
|
|
std::cout << "Total number of events: " << nTotEvt_ << std::endl;
|
233 |
|
|
std::cout << "Closing rootfile " << rootFile_->GetName() << std::endl;
|
234 |
|
|
rootFile_->Write();
|
235 |
|
|
rootFile_->Close();
|
236 |
|
|
|
237 |
|
|
if(doPhotonConversion_) delete conversionLikelihoodCalculator_;
|
238 |
|
|
if(doHLT_) delete hltAnalyzer_;
|
239 |
mlethuil |
1.1 |
}
|
240 |
|
|
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
// ------------ method called to for each event ------------
|
244 |
|
|
void TotoAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
|
245 |
|
|
{
|
246 |
lethuill |
1.32 |
|
247 |
|
|
rootFile_->cd();
|
248 |
|
|
nTotEvt_++;
|
249 |
|
|
if( (verbosity_>1) || (verbosity_>0 && nTotEvt_%10==0 && nTotEvt_<=100) || (verbosity_>0 && nTotEvt_%100==0 && nTotEvt_>100) )
|
250 |
|
|
cout << endl << endl
|
251 |
|
|
<< "####### TotoAnalyzer - Cumulated Events " << nTotEvt_
|
252 |
|
|
<< " - Run " << iEvent.id().run()
|
253 |
|
|
<< " - Event " << iEvent.id().event()
|
254 |
|
|
<< " #######" << endl;
|
255 |
|
|
|
256 |
|
|
|
257 |
|
|
// Global Event Infos
|
258 |
|
|
rootEvent_ = new TRootEvent();
|
259 |
|
|
rootEvent_->setNb(nTotEvt_);
|
260 |
|
|
rootEvent_->setEventId(iEvent.id().event());
|
261 |
|
|
rootEvent_->setRunId(iEvent.id().run());
|
262 |
|
|
|
263 |
|
|
|
264 |
|
|
// Trigger
|
265 |
|
|
rootEvent_->setGlobalHLT(true);
|
266 |
|
|
if(doHLT_)
|
267 |
|
|
{
|
268 |
|
|
if(verbosity_>1) cout << endl << "Get TriggerResults..." << endl;
|
269 |
|
|
if (nTotEvt_==1) hltAnalyzer_->init(iEvent, rootEvent_);
|
270 |
|
|
hltAnalyzer_->process(iEvent, rootEvent_);
|
271 |
|
|
}
|
272 |
|
|
//if ( ! rootEvent_->passGlobalHLT() ) return;
|
273 |
|
|
|
274 |
|
|
|
275 |
|
|
// MC Info
|
276 |
|
|
if(doMC_)
|
277 |
|
|
{
|
278 |
|
|
if(verbosity_>1) cout << endl << "Analysing MC info..." << endl;
|
279 |
|
|
MCAnalyzer* myMCAnalyzer = new MCAnalyzer(myConfig_, producersNames_);
|
280 |
|
|
myMCAnalyzer->setVerbosity(verbosity_);
|
281 |
|
|
if (drawMCTree_) myMCAnalyzer->drawMCTree(iEvent, iSetup, myConfig_, producersNames_);
|
282 |
|
|
if ( doPDFInfo_ ) myMCAnalyzer->pdfInfo(iEvent, rootEvent_);
|
283 |
|
|
myMCAnalyzer->processMCParticle(iEvent, rootMCParticles_);
|
284 |
|
|
if(doJetMC_) myMCAnalyzer->processGenJets(iEvent, rootGenJets_);
|
285 |
|
|
if(doMETMC_) myMCAnalyzer->processGenMETs(iEvent, rootGenMETs_);
|
286 |
|
|
if (doSignalMuMuGamma_)
|
287 |
|
|
{
|
288 |
|
|
rootMuMuGammaEvent_ = new TRootSignalEvent();
|
289 |
|
|
myMCAnalyzer->processMuMuGammaEvent(iEvent, rootMuMuGammaEvent_);
|
290 |
|
|
}
|
291 |
|
|
if (doSignalTopTop_) myMCAnalyzer->processTopTopEvent(iEvent, rootMCTopTop_);
|
292 |
|
|
if (doPhotonConversionMC_) myMCAnalyzer->processConvertedPhoton(iEvent, rootMCPhotons_);
|
293 |
|
|
delete myMCAnalyzer;
|
294 |
|
|
}
|
295 |
|
|
|
296 |
|
|
|
297 |
|
|
// Get Primary Vertices and Beam Spot
|
298 |
|
|
if(doPrimaryVertex_)
|
299 |
|
|
{
|
300 |
|
|
if(verbosity_>1) cout << endl << "Analysing beam spot and primary vertices collection..." << endl;
|
301 |
|
|
VertexAnalyzer* myVertexAnalyzer = new VertexAnalyzer(producersNames_, verbosity_);
|
302 |
|
|
if(doBeamSpot_) myVertexAnalyzer->getBeamSpot(iEvent, rootBeamSpot_);
|
303 |
|
|
myVertexAnalyzer->getVertices(iEvent, rootVertices_);
|
304 |
|
|
myVertexAnalyzer->selectPrimary(rootEvent_, rootVertices_);
|
305 |
|
|
delete myVertexAnalyzer;
|
306 |
|
|
}
|
307 |
|
|
|
308 |
|
|
|
309 |
|
|
// Tracks
|
310 |
|
|
if(doTrack_)
|
311 |
|
|
{
|
312 |
|
|
if(verbosity_>1) cout << endl << "Analysing tracks collection..." << endl;
|
313 |
|
|
TrackAnalyzer* myTrackAnalyzer = new TrackAnalyzer(producersNames_, verbosity_);
|
314 |
|
|
myTrackAnalyzer->process(iEvent, rootTracks_);
|
315 |
|
|
delete myTrackAnalyzer;
|
316 |
|
|
}
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
// Calo Jet
|
320 |
|
|
if(doJet_)
|
321 |
|
|
{
|
322 |
|
|
if(verbosity_>1) cout << endl << "Analysing jets collection..." << endl;
|
323 |
|
|
JetAnalyzer* myJetAnalyzer = new JetAnalyzer(producersNames_, myConfig_, verbosity_);
|
324 |
|
|
myJetAnalyzer->process(iEvent, rootJets_);
|
325 |
|
|
delete myJetAnalyzer;
|
326 |
|
|
}
|
327 |
|
|
|
328 |
|
|
|
329 |
|
|
// Muons
|
330 |
|
|
if(doMuon_)
|
331 |
|
|
{
|
332 |
|
|
if(verbosity_>1) cout << endl << "Analysing muons collection..." << endl;
|
333 |
|
|
MuonAnalyzer* myMuonAnalyzer = new MuonAnalyzer(producersNames_, myConfig_, verbosity_);
|
334 |
|
|
if(doPrimaryVertex_) myMuonAnalyzer->initIPCalculator(iEvent, iSetup, rootEvent_, rootBeamSpot_);
|
335 |
|
|
myMuonAnalyzer->process(iEvent, rootBeamSpot_, rootMuons_);
|
336 |
|
|
delete myMuonAnalyzer;
|
337 |
|
|
}
|
338 |
|
|
|
339 |
|
|
|
340 |
|
|
// Lazy Tools to calculate Cluster shape variables
|
341 |
|
|
EcalClusterLazyTools* lazyTools = 0;
|
342 |
|
|
if( doElectron_ || doPhoton_ || doCluster_ )
|
343 |
|
|
{
|
344 |
|
|
if(verbosity_>1) cout << endl << "Loading egamma LazyTools..." << endl;
|
345 |
|
|
edm::InputTag reducedBarrelEcalRecHitCollection_ = producersNames_.getParameter<edm::InputTag>("reducedBarrelEcalRecHitCollection");
|
346 |
|
|
edm::InputTag reducedEndcapEcalRecHitCollection_ = producersNames_.getParameter<edm::InputTag>("reducedEndcapEcalRecHitCollection");
|
347 |
|
|
try
|
348 |
|
|
{
|
349 |
|
|
lazyTools = new EcalClusterLazyTools( iEvent, iSetup, reducedBarrelEcalRecHitCollection_, reducedEndcapEcalRecHitCollection_ );
|
350 |
|
|
}
|
351 |
|
|
catch (cms::Exception& exception)
|
352 |
|
|
{
|
353 |
|
|
if ( !allowMissingCollection_ )
|
354 |
|
|
{
|
355 |
|
|
cout << " ##### ERROR IN TotoAnalyzer::analyze => CaloGeometryRecord, CaloGeometryRecord or EcalRecHitCollection are missing #####"<<endl;
|
356 |
|
|
throw exception;
|
357 |
|
|
}
|
358 |
|
|
if(verbosity_>1) cout << " ===> CaloGeometryRecord, CaloGeometryRecord or EcalRecHitCollection are missing, skip calculation of cluster shape variables" << endl;
|
359 |
|
|
lazyTools = 0; // FIXME - delete authorized after an exception ?
|
360 |
|
|
}
|
361 |
|
|
}
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
// Electrons
|
365 |
|
|
if(doElectron_)
|
366 |
|
|
{
|
367 |
|
|
if(verbosity_>1) cout << endl << "Analysing electrons collection..." << endl;
|
368 |
|
|
ElectronAnalyzer* myElectronAnalyzer = new ElectronAnalyzer(producersNames_, myConfig_, verbosity_);
|
369 |
|
|
if(doPrimaryVertex_) myElectronAnalyzer->initIPCalculator(iEvent, iSetup, rootEvent_, rootBeamSpot_);
|
370 |
|
|
myElectronAnalyzer->process(iEvent, rootBeamSpot_, rootElectrons_, lazyTools);
|
371 |
|
|
delete myElectronAnalyzer;
|
372 |
|
|
}
|
373 |
|
|
|
374 |
|
|
|
375 |
|
|
// Photons
|
376 |
|
|
if(doPhoton_)
|
377 |
|
|
{
|
378 |
|
|
if(verbosity_>1) cout << endl << "Analysing photons collection..." << endl;
|
379 |
|
|
PhotonAnalyzer* myPhotonAnalyzer = new PhotonAnalyzer(producersNames_, myConfig_, verbosity_);
|
380 |
|
|
myPhotonAnalyzer->process(iEvent, iSetup, rootEvent_, rootPhotons_, rootConversionTracks_, conversionLikelihoodCalculator_, lazyTools);
|
381 |
|
|
delete myPhotonAnalyzer;
|
382 |
|
|
}
|
383 |
|
|
|
384 |
|
|
|
385 |
|
|
// Ecal Clusters
|
386 |
|
|
if(doCluster_)
|
387 |
|
|
{
|
388 |
|
|
if(verbosity_>1) cout << endl << "Analysing BasicClusters collection..." << endl;
|
389 |
|
|
ClusterAnalyzer* myClusterAnalyzer = new ClusterAnalyzer(producersNames_, verbosity_);
|
390 |
|
|
myClusterAnalyzer->process(iEvent, rootEvent_, lazyTools, rootBasicClusters_, "hybridSuperClusters","hybridBarrelBasicClusters", 210);
|
391 |
|
|
myClusterAnalyzer->process(iEvent, rootEvent_, lazyTools, rootBasicClusters_, "multi5x5BasicClusters", "multi5x5EndcapBasicClusters", 320);
|
392 |
|
|
delete myClusterAnalyzer;
|
393 |
|
|
|
394 |
|
|
if(verbosity_>1) cout << endl << "Analysing SuperClusters collection..." << endl;
|
395 |
|
|
SuperClusterAnalyzer* mySClusterAnalyzer = new SuperClusterAnalyzer(producersNames_, verbosity_);
|
396 |
|
|
mySClusterAnalyzer->process(iEvent, rootEvent_, rootSuperClusters_, "hybridSuperClusters","",210);
|
397 |
|
|
mySClusterAnalyzer->process(iEvent, rootEvent_, rootSuperClusters_, "correctedHybridSuperClusters","",211);
|
398 |
|
|
mySClusterAnalyzer->process(iEvent, rootEvent_, rootSuperClusters_, "multi5x5SuperClusters","multi5x5EndcapSuperClusters",320);
|
399 |
|
|
mySClusterAnalyzer->process(iEvent, rootEvent_, rootSuperClusters_, "multi5x5SuperClustersWithPreshower","",323);
|
400 |
|
|
mySClusterAnalyzer->process(iEvent, rootEvent_, rootSuperClusters_, "correctedMulti5x5SuperClustersWithPreshower","",322);
|
401 |
|
|
delete mySClusterAnalyzer;
|
402 |
|
|
}
|
403 |
|
|
|
404 |
|
|
|
405 |
|
|
if(doCluster_)
|
406 |
|
|
{
|
407 |
|
|
ClusterAssociator* myClusterAssociator = new ClusterAssociator();
|
408 |
|
|
myClusterAssociator->setVerbosity(verbosity_);
|
409 |
|
|
myClusterAssociator->process(rootSuperClusters_, rootBasicClusters_);
|
410 |
|
|
//myClusterAssociator->printSuperClusters(rootSuperClusters_, rootBasicClusters_,0); // 0 to print all types SC
|
411 |
|
|
delete myClusterAssociator;
|
412 |
|
|
}
|
413 |
|
|
|
414 |
|
|
|
415 |
lethuill |
1.33 |
if(doElectron_ && doCluster_)
|
416 |
|
|
{
|
417 |
|
|
ElectronAssociator* myElectronAssociator = new ElectronAssociator();
|
418 |
|
|
myElectronAssociator->setVerbosity(verbosity_);
|
419 |
|
|
myElectronAssociator->associateSuperCluster(rootElectrons_, rootSuperClusters_);
|
420 |
|
|
delete myElectronAssociator;
|
421 |
|
|
}
|
422 |
|
|
|
423 |
|
|
|
424 |
lethuill |
1.32 |
if(doPhoton_ && doCluster_)
|
425 |
|
|
{
|
426 |
|
|
PhotonAssociator* myPhotonAssociator = new PhotonAssociator();
|
427 |
|
|
myPhotonAssociator->setVerbosity(verbosity_);
|
428 |
|
|
myPhotonAssociator->associateSuperCluster(rootPhotons_, rootSuperClusters_);
|
429 |
|
|
delete myPhotonAssociator;
|
430 |
|
|
}
|
431 |
|
|
|
432 |
|
|
|
433 |
|
|
if(doPhoton_ && doPhotonIsolation_)
|
434 |
|
|
{
|
435 |
|
|
if(verbosity_>1) cout << endl << "Calculating Photon isolation..." << endl;
|
436 |
|
|
|
437 |
|
|
Float_t ecalIslandIsolation;
|
438 |
|
|
Float_t ecalDoubleConeIsolation;
|
439 |
|
|
Float_t hcalRecHitIsolation;
|
440 |
|
|
Float_t isoTracks;
|
441 |
|
|
Int_t isoNTracks;
|
442 |
|
|
TRootPhoton* localPhoton;
|
443 |
|
|
|
444 |
|
|
PhotonIsolator* myPhotonIsolator = new PhotonIsolator(&myConfig_, &producersNames_);
|
445 |
|
|
for (int iphoton=0; iphoton<rootPhotons_->GetEntriesFast(); iphoton++)
|
446 |
|
|
{
|
447 |
|
|
localPhoton = (TRootPhoton*)rootPhotons_->At(iphoton);
|
448 |
|
|
|
449 |
|
|
ecalIslandIsolation=-1.;
|
450 |
|
|
if (doCluster_) ecalIslandIsolation = myPhotonIsolator->basicClustersIsolation(localPhoton, rootSuperClusters_, rootBasicClusters_);
|
451 |
|
|
|
452 |
|
|
ecalDoubleConeIsolation=-1.;
|
453 |
|
|
if (doCluster_) ecalDoubleConeIsolation = myPhotonIsolator->basicClustersDoubleConeIsolation(localPhoton, rootSuperClusters_, rootBasicClusters_);
|
454 |
|
|
|
455 |
|
|
hcalRecHitIsolation=-1.;
|
456 |
|
|
if ( myPhotonIsolator->loadHcalRecHits(iEvent, iSetup) ) hcalRecHitIsolation = myPhotonIsolator->hcalRecHitIsolation(localPhoton);
|
457 |
|
|
|
458 |
|
|
isoTracks=-1.;
|
459 |
|
|
isoNTracks=-1;
|
460 |
|
|
if(doTrack_) isoTracks = myPhotonIsolator->trackerIsolation(localPhoton, rootTracks_, isoNTracks);
|
461 |
|
|
|
462 |
|
|
localPhoton->setIsolationPerso(ecalIslandIsolation, ecalDoubleConeIsolation, hcalRecHitIsolation, isoTracks, isoNTracks);
|
463 |
|
|
if(verbosity_>4) cout << " After isolation - ["<< setw(3) << iphoton << "] "; localPhoton->Print(); cout << endl;
|
464 |
|
|
}
|
465 |
|
|
delete myPhotonIsolator;
|
466 |
|
|
}
|
467 |
|
|
|
468 |
|
|
|
469 |
|
|
// Print Photons / SuperClusters / BasicClusters arborescence
|
470 |
|
|
if(doPhoton_)
|
471 |
|
|
{
|
472 |
|
|
PhotonAssociator* myPhotonAssociator = new PhotonAssociator();
|
473 |
|
|
if(verbosity_>2) myPhotonAssociator->fullPrintPhotons(rootPhotons_,rootSuperClusters_,rootBasicClusters_,0);
|
474 |
|
|
delete myPhotonAssociator;
|
475 |
|
|
}
|
476 |
|
|
|
477 |
|
|
|
478 |
|
|
// MET
|
479 |
|
|
if(doMET_)
|
480 |
|
|
{
|
481 |
|
|
if(verbosity_>1) cout << endl << "Analysing Missing Et..." << endl;
|
482 |
|
|
METAnalyzer* myMETAnalyzer = new METAnalyzer(producersNames_, myConfig_, verbosity_);
|
483 |
|
|
myMETAnalyzer->process(iEvent, rootMETs_);
|
484 |
|
|
delete myMETAnalyzer;
|
485 |
|
|
}
|
486 |
|
|
|
487 |
|
|
|
488 |
|
|
// Associate recoParticles to mcParticles
|
489 |
|
|
if(doMC_)
|
490 |
|
|
{
|
491 |
|
|
// TODO - For the moment, only for PAT format
|
492 |
|
|
if ( dataType_=="PAT")
|
493 |
|
|
{
|
494 |
|
|
MCAssociator* myMCAssociator = new MCAssociator(producersNames_, verbosity_);
|
495 |
|
|
myMCAssociator->init(iEvent, rootMCParticles_);
|
496 |
|
|
if(doPhoton_) myMCAssociator->matchGenParticlesTo(rootPhotons_);
|
497 |
|
|
if(doElectron_) myMCAssociator->matchGenParticlesTo(rootElectrons_);
|
498 |
|
|
if(doMuon_) myMCAssociator->matchGenParticlesTo(rootMuons_);
|
499 |
|
|
if(doMET_) myMCAssociator->matchGenParticlesTo(rootMETs_);
|
500 |
|
|
if(doJet_) myMCAssociator->matchGenParticlesTo(rootJets_);
|
501 |
|
|
if(doJet_ && doJetMC_) myMCAssociator->processGenJets(rootGenJets_, rootJets_);
|
502 |
|
|
if(verbosity_>4) cout << endl << "Printing recoParticles / mcParticles associations... " << endl;
|
503 |
|
|
if(verbosity_>4 && doPhoton_) myMCAssociator->printParticleAssociation(rootPhotons_);
|
504 |
|
|
if(verbosity_>4 && doElectron_) myMCAssociator->printParticleAssociation(rootElectrons_);
|
505 |
|
|
if(verbosity_>4 && doMuon_) myMCAssociator->printParticleAssociation(rootMuons_);
|
506 |
|
|
if(verbosity_>4 && doMET_) myMCAssociator->printParticleAssociation(rootMETs_);
|
507 |
|
|
if(verbosity_>4 && doJet_) myMCAssociator->printJetAssociation(rootJets_);
|
508 |
|
|
delete myMCAssociator;
|
509 |
|
|
}
|
510 |
|
|
}
|
511 |
|
|
|
512 |
|
|
|
513 |
|
|
if(verbosity_>1) cout << endl << "Filling rootuple..." << endl;
|
514 |
|
|
eventTree_->Fill();
|
515 |
|
|
if(verbosity_>1) cout << endl << "Start deleting objects..." << endl;
|
516 |
|
|
delete rootEvent_;
|
517 |
|
|
if(doMC_) (*rootMCParticles_).Delete();
|
518 |
|
|
if(doJetMC_) (*rootGenJets_).Delete();
|
519 |
|
|
if(doMETMC_) (*rootGenMETs_).Delete();
|
520 |
|
|
if(doSignalMuMuGamma_) delete rootMuMuGammaEvent_;
|
521 |
|
|
if(doSignalTopTop_) (*rootMCTopTop_).Delete();
|
522 |
|
|
if(doPhotonConversionMC_) (*rootMCPhotons_).Delete();
|
523 |
|
|
if(doBeamSpot_) rootBeamSpot_->clear();
|
524 |
|
|
if(doPrimaryVertex_) (*rootVertices_).Delete();
|
525 |
|
|
if(doTrack_) (*rootTracks_).Delete();
|
526 |
|
|
if(doJet_) (*rootJets_).Delete();
|
527 |
|
|
if(doMuon_) (*rootMuons_).Delete();
|
528 |
|
|
if(doElectron_) (*rootElectrons_).Delete();
|
529 |
|
|
if(doPhoton_) (*rootPhotons_).Delete();
|
530 |
|
|
if(doCluster_) (*rootBasicClusters_).Delete();
|
531 |
|
|
if(doCluster_) (*rootSuperClusters_).Delete();
|
532 |
|
|
if(doPhotonConversion_) (*rootConversionTracks_).Delete();
|
533 |
|
|
if(doMET_) (*rootMETs_).Delete();
|
534 |
|
|
if(verbosity_>1) cout << endl << "Objects deleted" << endl;
|
535 |
|
|
if(verbosity_>0) cout << endl;
|
536 |
mlethuil |
1.1 |
}
|
537 |
|
|
|