ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/src/TotoAnalyzer.cc
Revision: 1.24
Committed: Tue Apr 7 17:09:06 2009 UTC (16 years ago) by lethuill
Content type: text/plain
Branch: MAIN
CVS Tags: pat_2_2_5_02
Changes since 1.23: +57 -16 lines
Log Message:
Cleaning dependencies / Add genMETs and genJets and references to them in reco objects

File Contents

# User Rev Content
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.11 myConfig_ = iConfig.getParameter<ParameterSet>("myConfig");
11 lethuill 1.14 dataType_ = myConfig_.getUntrackedParameter<string>("dataType","unknown");
12     cout << "dataType: " << dataType_ << endl;
13     if( dataType_=="RECO" ) producersNames_ = iConfig.getParameter<ParameterSet>("producersNamesRECO");
14     else if( dataType_=="AOD" ) producersNames_ = iConfig.getParameter<ParameterSet>("producersNamesAOD");
15     else if( dataType_=="PATAOD" ) producersNames_ = iConfig.getParameter<ParameterSet>("producersNamesPATAOD");
16     else if( dataType_=="PAT" ) producersNames_ = iConfig.getParameter<ParameterSet>("producersNamesPAT");
17     else { cout << "TotoAnalyzer::TotoAnalyzer... dataType is unknown... exiting..." << endl; exit(1); }
18 lethuill 1.24
19     hltAnalyzer_ = 0;
20     runInfos_ = 0;
21     rootEvent = 0;
22     rootMuMuGammaEvent = 0;
23     mcParticles = 0;
24     genJets = 0;
25     genMETs = 0;
26     mcPhotons = 0;
27     tracks = 0;
28     jets = 0;
29     muons = 0;
30     electrons = 0;
31     photons = 0;
32     clusters = 0;
33     superClusters = 0;
34     conversionTracks = 0;
35     met = 0;
36     rootMCTopTop = 0;
37 mlethuil 1.1 }
38    
39    
40     TotoAnalyzer::~TotoAnalyzer()
41 lethuill 1.11 {
42     }
43 mlethuil 1.1
44    
45    
46     // ------------ method called once each job just before starting event loop ------------
47     void TotoAnalyzer::beginJob(const edm::EventSetup&)
48     {
49    
50     // Load Config parameters
51 lethuill 1.11 verbosity = myConfig_.getUntrackedParameter<int>("verbosity", 0);
52     rootFileName_ = myConfig_.getUntrackedParameter<string>("RootFileName","noname.root");
53     isCSA07Soup = myConfig_.getUntrackedParameter<bool>("isCSA07Soup",false);
54     doHLT = myConfig_.getUntrackedParameter<bool>("doHLT",false);
55     doMC = myConfig_.getUntrackedParameter<bool>("doMC",false);
56 lethuill 1.24 doJetMC = myConfig_.getUntrackedParameter<bool>("doJetMC",false);
57     doMETMC = myConfig_.getUntrackedParameter<bool>("doMETMC",false);
58 lethuill 1.17 doPDFInfo = myConfig_.getUntrackedParameter<bool>("doPDFInfo",false);
59 lethuill 1.16 doSignalMuMuGamma = myConfig_.getUntrackedParameter<bool>("doSignalMuMuGamma",false);
60     doSignalTopTop = myConfig_.getUntrackedParameter<bool>("doSignalTopTop",false);
61 lethuill 1.15 doPrimaryVertex = myConfig_.getUntrackedParameter<bool>("doPrimaryVertex",false);
62 lethuill 1.11 doTrack = myConfig_.getUntrackedParameter<bool>("doTrack",false);
63     doJet = myConfig_.getUntrackedParameter<bool>("doJet",false);
64     doMuon = myConfig_.getUntrackedParameter<bool>("doMuon",false);
65     doElectron = myConfig_.getUntrackedParameter<bool>("doElectron",false);
66     doPhoton = myConfig_.getUntrackedParameter<bool>("doPhoton",false);
67     doCluster = myConfig_.getUntrackedParameter<bool>("doCluster",false);
68 lethuill 1.13 doMET = myConfig_.getUntrackedParameter<bool>("doMET",false);
69 lethuill 1.11 doPhotonIsolation = myConfig_.getUntrackedParameter<bool>("doPhotonIsolation",false);
70     doPhotonConversion = myConfig_.getUntrackedParameter<bool>("doPhotonConversion",false);
71     doPhotonConversionMC = myConfig_.getUntrackedParameter<bool>("doPhotonConversionMC",false);
72 lethuill 1.13 drawMCTree = myConfig_.getUntrackedParameter<bool>("drawMCTree",false);
73 mlethuil 1.7
74 mlethuil 1.1 nTotEvt_ = 0;
75    
76     // initialize root output file
77     if(verbosity>0) cout << "New RootFile " << rootFileName_.c_str() << " is created" << endl;
78     rootFile_ = new TFile(rootFileName_.c_str(), "recreate");
79     rootFile_->cd();
80 mlethuil 1.5
81     runInfos_ = new TRootRun();
82     runTree_ = new TTree("runTree", "Global Run Infos");
83     runTree_->Branch ("runInfos", "TRootRun", &runInfos_);
84    
85 mlethuil 1.1 rootEvent = 0;
86 mlethuil 1.5 eventTree_ = new TTree("eventTree", "Event Infos");
87     eventTree_->Branch ("Event", "TRootEvent", &rootEvent);
88    
89     if(doHLT)
90     {
91 lethuill 1.13 hltAnalyzer_ = new HLTAnalyzer(producersNames_);
92 mlethuil 1.5 hltAnalyzer_->setVerbosity(verbosity);
93     }
94    
95 mlethuil 1.1 if(doMC)
96     {
97 lethuill 1.12 if(verbosity>0) cout << "MC Particles info will be added to rootuple" << endl;
98 lethuill 1.18 mcParticles = new TClonesArray("TRootMCParticle", 1000);
99 mlethuil 1.5 eventTree_->Branch ("MCParticles", "TClonesArray", &mcParticles);
100 mlethuil 1.1 }
101    
102 lethuill 1.24 if(doJetMC)
103     {
104     if(verbosity>0) cout << "genJets info will be added to rootuple" << endl;
105     genJets = new TClonesArray("TRootParticle", 1000);
106     eventTree_->Branch ("genJets", "TClonesArray", &genJets);
107     }
108    
109     if(doMETMC)
110     {
111     if(verbosity>0) cout << "genMETs info will be added to rootuple" << endl;
112     genMETs = new TClonesArray("TRootParticle", 1000);
113     eventTree_->Branch ("genMETs", "TClonesArray", &genMETs);
114     }
115    
116 lethuill 1.16 if(doSignalMuMuGamma)
117     {
118     if(verbosity>0) cout << "MC info for Z -> mu mu gamma will be added to rootuple" << endl;
119     rootMuMuGammaEvent = 0;
120     cout << "Create MuMuGamma Branch" << endl;
121     eventTree_->Branch ("MuMuGamma", "TRootSignalEvent", &rootMuMuGammaEvent);
122     }
123    
124     if(doSignalTopTop)
125     {
126     if(verbosity>0) cout << "MC info for Top Top will be added to rootuple" << endl;
127     rootMCTopTop = new TClonesArray("TRootTopTop", 1000);
128     eventTree_->Branch ("rootMCTopTop", "TClonesArray", &rootMCTopTop);
129     }
130    
131 mlethuil 1.7 if(doPhotonConversionMC)
132     {
133     if(verbosity>0) cout << "Converted MC Photons info will be added to rootuple" << endl;
134     mcPhotons = new TClonesArray("TRootMCPhoton", 1000);
135     eventTree_->Branch ("MCPhotons", "TClonesArray", &mcPhotons);
136     }
137    
138 mlethuil 1.1 if(doTrack)
139     {
140     if(verbosity>0) cout << "Tracks info will be added to rootuple" << endl;
141 mlethuil 1.4 tracks = new TClonesArray("TRootTrack", 1000);
142 mlethuil 1.5 eventTree_->Branch ("Tracks", "TClonesArray", &tracks);
143 mlethuil 1.1 }
144    
145     if(doJet)
146     {
147     if(verbosity>0) cout << "Jets info will be added to rootuple" << endl;
148     jets = new TClonesArray("TRootJet", 1000);
149 mlethuil 1.5 eventTree_->Branch ("Jets", "TClonesArray", &jets);
150 mlethuil 1.1 }
151    
152     if(doMuon)
153     {
154     if(verbosity>0) cout << "Muons info will be added to rootuple" << endl;
155     muons = new TClonesArray("TRootMuon", 1000);
156 mlethuil 1.5 eventTree_->Branch ("Muons", "TClonesArray", &muons);
157 mlethuil 1.1 }
158    
159     if(doElectron)
160     {
161     if(verbosity>0) cout << "Electrons info will be added to rootuple" << endl;
162     electrons = new TClonesArray("TRootElectron", 1000);
163 mlethuil 1.5 eventTree_->Branch ("Electrons", "TClonesArray", &electrons);
164 mlethuil 1.1 }
165    
166     if(doPhoton)
167     {
168     if(verbosity>0) cout << "Photons info will be added to rootuple" << endl;
169 lethuill 1.11 photons = new TClonesArray("TRootPhoton", 1000);
170     eventTree_->Branch ("Photons", "TClonesArray", &photons);
171 mlethuil 1.1 }
172    
173     if(doCluster)
174     {
175     if(verbosity>0) cout << "ECAL Clusters info will be added to rootuple" << endl;
176     clusters = new TClonesArray("TRootCluster", 1000);
177 mlethuil 1.5 eventTree_->Branch ("BasicClusters", "TClonesArray", &clusters);
178 mlethuil 1.1 superClusters = new TClonesArray("TRootSuperCluster", 1000);
179 mlethuil 1.5 eventTree_->Branch ("SuperClusters", "TClonesArray", &superClusters);
180 mlethuil 1.1 }
181 mlethuil 1.3
182     if(doPhotonConversion)
183     {
184     if(verbosity>0) cout << "Conversion Tracks info will be added to rootuple" << endl;
185 mlethuil 1.8 conversionTracks = new TClonesArray("TRootTrack", 1000);
186 mlethuil 1.5 eventTree_->Branch ("ConversionTracks", "TClonesArray", &conversionTracks);
187 mlethuil 1.9
188     conversionLikelihoodCalculator_ = new ConversionLikelihoodCalculator();
189 lethuill 1.11 std::string weightsString = myConfig_.getUntrackedParameter<string>("conversionLikelihoodWeightsFile","RecoEgamma/EgammaTools/data/TMVAnalysis_Likelihood.weights.txt");
190 mlethuil 1.9 edm::FileInPath weightsFile(weightsString.c_str() );
191     conversionLikelihoodCalculator_->setWeightsFile(weightsFile.fullPath().c_str());
192 lethuill 1.14 }
193 mlethuil 1.9
194 lethuill 1.14 if(doMET)
195     {
196     if(verbosity>0) cout << "MET info will be added to rootuple" << endl;
197     met = new TClonesArray("TRootMET", 1000);
198     eventTree_->Branch ("MET", "TClonesArray", &met);
199 mlethuil 1.3 }
200 lethuill 1.14
201 mlethuil 1.1 }
202    
203    
204     // ------------ method called once each job just after ending the event loop ------------
205     void TotoAnalyzer::endJob()
206     {
207 lethuill 1.23 // Trigger Summary Tables
208     if(doHLT)
209     {
210     cout << "Trigger Summary Tables" << endl;
211     hltAnalyzer_ ->copySummary(runInfos_);
212     hltAnalyzer_->printStats();
213     }
214    
215 mlethuil 1.5 runTree_->Fill();
216    
217 mlethuil 1.1 std::cout << "Total number of events: " << nTotEvt_ << std::endl;
218     std::cout << "Closing rootfile " << rootFile_->GetName() << std::endl;
219     rootFile_->Write();
220     rootFile_->Close();
221 mlethuil 1.5
222 mlethuil 1.9 if(doPhotonConversion) delete conversionLikelihoodCalculator_;
223 mlethuil 1.1 }
224    
225    
226    
227     // ------------ method called to for each event ------------
228     void TotoAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
229     {
230    
231     rootFile_->cd();
232     nTotEvt_++;
233     if( (verbosity>1) || (verbosity>0 && nTotEvt_%10==0 && nTotEvt_<=100) || (verbosity>0 && nTotEvt_%100==0 && nTotEvt_>100) )
234 lethuill 1.10 cout << endl << endl
235     << "####### TotoAnalyzer - Cumulated Events " << nTotEvt_
236     << " - Run " << iEvent.id().run()
237     << " - Event " << iEvent.id().event()
238     << " #######" << endl;
239    
240 mlethuil 1.1 // Global Event Infos
241     rootEvent = new TRootEvent();
242     rootEvent->setNb(nTotEvt_);
243 lethuill 1.20 rootEvent->setEventId(iEvent.id().event());
244     rootEvent->setRunId(iEvent.id().run());
245 mlethuil 1.1
246 lethuill 1.11 /*
247 mlethuil 1.6 // CSA07 Process Id and Event Weight
248     if(isCSA07Soup)
249     {
250     edm::Handle< double> weightHandle;
251     iEvent.getByLabel ("csaweightproducer","weight", weightHandle);
252     double weight = * weightHandle;
253     int processId = csa07::csa07ProcessId(iEvent, 1000., "csaweightproducer");
254     char * pname= csa07::csa07ProcessName(processId);
255     if(verbosity>1) cout << "CSA07 Soup - id=" << processId << " - "<< pname << " - weight=" << weight << endl;
256     rootEvent->setCsa07id(processId);
257     rootEvent->setCsa07weight(weight);
258     rootEvent->setCsa07process(pname);
259     }
260 lethuill 1.13 */
261 mlethuil 1.5
262 mlethuil 1.6
263 mlethuil 1.5 // Trigger
264 lethuill 1.13 rootEvent->setGlobalHLT(true);
265 mlethuil 1.5 if(doHLT)
266     {
267 lethuill 1.13 cout << endl << "Get TriggerResults..." << endl;
268 mlethuil 1.5 if (nTotEvt_==1) hltAnalyzer_->init(iEvent, rootEvent);
269     hltAnalyzer_->process(iEvent, rootEvent);
270     }
271 lethuill 1.10 //if ( ! rootEvent->passGlobalHLT() ) return;
272 mlethuil 1.5
273    
274 mlethuil 1.1 // MC Info
275     if(doMC)
276     {
277 lethuill 1.13 if(verbosity>1) cout << endl << "Analysing MC info..." << endl;
278     MCAnalyzer* myMCAnalyzer = new MCAnalyzer(myConfig_, producersNames_);
279     myMCAnalyzer->SetVerbosity(verbosity);
280     if (drawMCTree) myMCAnalyzer->DrawMCTree(iEvent, iSetup, myConfig_, producersNames_);
281 lethuill 1.17 if ( dataType_=="RECO" && doPDFInfo ) myMCAnalyzer->PDFInfo(iEvent, rootEvent);
282 lethuill 1.16 myMCAnalyzer->ProcessMCParticle(iEvent, mcParticles);
283 lethuill 1.24 if(doJetMC) myMCAnalyzer->ProcessGenJets(iEvent, genJets);
284     if(doMETMC) myMCAnalyzer->ProcessGenMETs(iEvent, genMETs);
285 lethuill 1.16 if (doSignalMuMuGamma)
286 lethuill 1.14 {
287 lethuill 1.16 rootMuMuGammaEvent = new TRootSignalEvent();
288     myMCAnalyzer->ProcessMuMuGammaEvent(iEvent, rootMuMuGammaEvent);
289 lethuill 1.14 }
290 lethuill 1.16 if (doSignalTopTop) myMCAnalyzer->ProcessTopTopEvent(iEvent, rootMCTopTop);
291 lethuill 1.13 if (doPhotonConversionMC) myMCAnalyzer->ProcessConvertedPhoton(iEvent, mcPhotons);
292 mlethuil 1.1 delete myMCAnalyzer;
293     }
294 lethuill 1.12
295 mlethuil 1.1
296     // Get Primary Vertices
297 lethuill 1.15 if(doPrimaryVertex)
298     {
299     if(verbosity>1) cout << endl << "Analysing primary vertices collection..." << endl;
300     VertexAnalyzer* myVertexAnalyzer = new VertexAnalyzer(producersNames_, verbosity);
301     myVertexAnalyzer->Process(iEvent, rootEvent);
302     delete myVertexAnalyzer;
303     }
304 lethuill 1.11
305 mlethuil 1.1 // Tracks
306     if(doTrack)
307     {
308 lethuill 1.11 if(verbosity>1) cout << endl << "Analysing tracks collection..." << endl;
309 lethuill 1.13 TrackAnalyzer* myTrackAnalyzer = new TrackAnalyzer(producersNames_, verbosity);
310     myTrackAnalyzer->Process(iEvent, tracks);
311     delete myTrackAnalyzer;
312 mlethuil 1.1 }
313    
314 lethuill 1.11
315 mlethuil 1.1 // Calo Jet
316     if(doJet)
317     {
318 lethuill 1.11 if(verbosity>1) cout << endl << "Analysing jets collection..." << endl;
319 lethuill 1.16 JetAnalyzer* myJetAnalyzer = new JetAnalyzer(producersNames_, myConfig_, verbosity);
320 lethuill 1.13 myJetAnalyzer->Process(iEvent, jets);
321     delete myJetAnalyzer;
322 mlethuil 1.1 }
323    
324    
325     // Muons
326     if(doMuon)
327     {
328 lethuill 1.11 if(verbosity>1) cout << endl << "Analysing muons collection..." << endl;
329 lethuill 1.16 MuonAnalyzer* myMuonAnalyzer = new MuonAnalyzer(producersNames_, myConfig_, verbosity);
330 lethuill 1.13 myMuonAnalyzer->Process(iEvent, muons);
331     delete myMuonAnalyzer;
332 mlethuil 1.1 }
333 lethuill 1.14
334 mlethuil 1.1
335 lethuill 1.14 // Lazy Tools to calculate Cluster shape variables
336     EcalClusterLazyTools* lazyTools = 0;
337 lethuill 1.16 if( (dataType_=="RECO" || dataType_=="AOD" || dataType_=="PATAOD") && ( doElectron || doPhoton || doCluster) )
338 lethuill 1.14 {
339     if(verbosity>1) cout << endl << "Loading egamma LazyTools..." << endl;
340     edm::InputTag reducedBarrelEcalRecHitCollection_ = producersNames_.getParameter<edm::InputTag>("reducedBarrelEcalRecHitCollection");
341     edm::InputTag reducedEndcapEcalRecHitCollection_ = producersNames_.getParameter<edm::InputTag>("reducedEndcapEcalRecHitCollection");
342 lethuill 1.16 // FIXME - Test availability of reducedEcalRecHits...
343 lethuill 1.14 lazyTools = new EcalClusterLazyTools( iEvent, iSetup, reducedBarrelEcalRecHitCollection_, reducedEndcapEcalRecHitCollection_ );
344     }
345 lethuill 1.16
346 mlethuil 1.1 // Electrons
347     if(doElectron)
348     {
349 lethuill 1.11 if(verbosity>1) cout << endl << "Analysing electrons collection..." << endl;
350 lethuill 1.16 ElectronAnalyzer* myElectronAnalyzer = new ElectronAnalyzer(producersNames_, myConfig_, verbosity);
351 lethuill 1.14 myElectronAnalyzer->Process(iEvent, electrons, *lazyTools);
352 lethuill 1.13 delete myElectronAnalyzer;
353 mlethuil 1.1 }
354 lethuill 1.22
355 lethuill 1.11
356 mlethuil 1.1 // Photons
357     if(doPhoton)
358     {
359 lethuill 1.11 if(verbosity>1) cout << endl << "Analysing photons collection..." << endl;
360 lethuill 1.21 PhotonAnalyzer* myPhotonAnalyzer = new PhotonAnalyzer(producersNames_, myConfig_, verbosity);
361     // FIXME - conversionTracks may not be present...
362 lethuill 1.22 myPhotonAnalyzer->Process(iEvent, iSetup, rootEvent, photons, conversionTracks, conversionLikelihoodCalculator_, *lazyTools);
363 mlethuil 1.1 delete myPhotonAnalyzer;
364     }
365 lethuill 1.11
366    
367 mlethuil 1.1 // Ecal Clusters
368     if(doCluster)
369     {
370 lethuill 1.11 if(verbosity>1) cout << endl << "Analysing BasicClusters collection..." << endl;
371 lethuill 1.24 ClusterAnalyzer* myClusterAnalyzer = new ClusterAnalyzer(producersNames_, verbosity);
372     //myClusterAnalyzer->SetVerbosity(verbosity);
373 lethuill 1.14 myClusterAnalyzer->Process(iEvent, rootEvent, *lazyTools, clusters, "hybridSuperClusters","hybridBarrelBasicClusters", 110);
374     myClusterAnalyzer->Process(iEvent, rootEvent, *lazyTools, clusters, "multi5x5BasicClusters", "multi5x5EndcapBasicClusters", 320);
375 mlethuil 1.1 delete myClusterAnalyzer;
376 lethuill 1.11
377     if(verbosity>1) cout << endl << "Analysing SuperClusters collection..." << endl;
378 lethuill 1.24 SuperClusterAnalyzer* mySClusterAnalyzer = new SuperClusterAnalyzer(producersNames_, verbosity);
379     //mySClusterAnalyzer->SetVerbosity(verbosity);
380 mlethuil 1.1 mySClusterAnalyzer->Process(iEvent, rootEvent, superClusters, "hybridSuperClusters","",210);
381     mySClusterAnalyzer->Process(iEvent, rootEvent, superClusters, "correctedHybridSuperClusters","",211);
382 lethuill 1.11 mySClusterAnalyzer->Process(iEvent, rootEvent, superClusters, "multi5x5SuperClusters","multi5x5EndcapSuperClusters",320);
383     mySClusterAnalyzer->Process(iEvent, rootEvent, superClusters, "multi5x5SuperClustersWithPreshower","",323);
384     mySClusterAnalyzer->Process(iEvent, rootEvent, superClusters, "correctedMulti5x5SuperClustersWithPreshower","",322);
385 mlethuil 1.1 delete mySClusterAnalyzer;
386     }
387    
388    
389     if(doCluster)
390     {
391     ClusterAssociator* myClusterAssociator = new ClusterAssociator();
392     myClusterAssociator->SetVerbosity(verbosity);
393     myClusterAssociator->Process(superClusters, clusters);
394     //myClusterAssociator->PrintSuperClusters(superClusters, clusters,0); // 0 to print all types SC
395     delete myClusterAssociator;
396     }
397 lethuill 1.11
398    
399 mlethuil 1.1 if(doPhoton && doCluster)
400     {
401     PhotonAssociator* myPhotonAssociator = new PhotonAssociator();
402     myPhotonAssociator->SetVerbosity(verbosity);
403 lethuill 1.11 myPhotonAssociator->AssociateSuperCluster(photons, superClusters);
404     // Obsolete... converted photon now contained in reco::Photon object. Done in PhotonAnalyzer
405     //if(doPhotonConversion) myPhotonAssociator->AssociateConversion(iEvent, photons, superClusters, conversionTracks, conversionLikelihoodCalculator_);
406 mlethuil 1.1 delete myPhotonAssociator;
407     }
408    
409    
410 lethuill 1.11 if(doPhoton && doPhotonIsolation)
411 mlethuil 1.1 {
412 lethuill 1.11 if(verbosity>1) cout << endl << "Calculating Photon isolation..." << endl;
413 mlethuil 1.1
414     Float_t ecalIslandIsolation;
415     Float_t ecalDoubleConeIsolation;
416     Float_t hcalRecHitIsolation;
417 mlethuil 1.4 Float_t isoTracks;
418     Int_t isoNTracks;
419     TRootPhoton* localPhoton;
420    
421 lethuill 1.11 PhotonIsolator* myPhotonIsolator = new PhotonIsolator(&myConfig_, &producersNames_);
422     for (int iphoton=0; iphoton<photons->GetEntriesFast(); iphoton++)
423 mlethuil 1.1 {
424 lethuill 1.11 localPhoton = (TRootPhoton*)photons->At(iphoton);
425 mlethuil 1.4
426 mlethuil 1.1 ecalIslandIsolation=-1.;
427 mlethuil 1.4 if (doCluster) ecalIslandIsolation = myPhotonIsolator->EcalIslandIsolation(localPhoton, superClusters, clusters);
428    
429 mlethuil 1.1 ecalDoubleConeIsolation=-1.;
430 mlethuil 1.4 if (doCluster) ecalDoubleConeIsolation = myPhotonIsolator->EcalDoubleConeIsolation(localPhoton, superClusters, clusters);
431    
432     hcalRecHitIsolation=-1.;
433 lethuill 1.11 //FIXME - Test HCAL rechits availability - LoadHcalRecHits() returning bool
434     myPhotonIsolator->LoadHcalRecHits(iEvent, iSetup);
435     hcalRecHitIsolation = myPhotonIsolator->HcalRecHitIsolation(localPhoton);
436 mlethuil 1.4
437     isoTracks=-1.;
438     isoNTracks=-1;
439     if(doTrack) isoTracks = myPhotonIsolator->TrackerIsolation(localPhoton, tracks, isoNTracks);
440    
441     localPhoton->setIsolation(ecalIslandIsolation, ecalDoubleConeIsolation, hcalRecHitIsolation, isoTracks, isoNTracks);
442 lethuill 1.11 if(verbosity>4) cout << " After isolation - ["<< setw(3) << iphoton << "] " << *localPhoton << endl;
443 mlethuil 1.1 }
444     delete myPhotonIsolator;
445     }
446 lethuill 1.24
447    
448 lethuill 1.11 // Print Photons / SuperClusters / BasicClusters arborescence
449     if(doPhoton)
450     {
451     PhotonAssociator* myPhotonAssociator = new PhotonAssociator();
452     if(verbosity>2) myPhotonAssociator->FullPrintPhotons(photons,superClusters,clusters,0);
453     delete myPhotonAssociator;
454     }
455 lethuill 1.13
456    
457     // MET
458     if(doMET)
459     {
460     if(verbosity>1) cout << endl << "Analysing Missing Et..." << endl;
461 lethuill 1.16 METAnalyzer* myMETAnalyzer = new METAnalyzer(producersNames_, myConfig_, verbosity);
462 lethuill 1.14 myMETAnalyzer->Process(iEvent, met);
463 lethuill 1.13 delete myMETAnalyzer;
464     }
465 lethuill 1.24
466    
467 lethuill 1.18 // Associate recoParticles to mcParticles
468     if(doMC)
469     {
470 lethuill 1.19 MCAssociator* myMCAssociator = new MCAssociator(producersNames_, verbosity);
471     myMCAssociator->init(iEvent, mcParticles);
472 lethuill 1.24 if(doPhoton) myMCAssociator->matchGenParticlesTo(photons);
473     if(doElectron) myMCAssociator->matchGenParticlesTo(electrons);
474     if(doMuon) myMCAssociator->matchGenParticlesTo(muons);
475     if(doMET) myMCAssociator->matchGenParticlesTo(met);
476     if(doJet) myMCAssociator->matchGenParticlesTo(jets);
477     if(doJet && doJetMC) myMCAssociator->processGenJets(genJets, jets);
478     if(verbosity>4) cout << endl << "Printing recoParticles / mcParticles associations... " << endl;
479     if(verbosity>4 && doPhoton) myMCAssociator->printParticleAssociation(photons);
480     if(verbosity>4 && doElectron) myMCAssociator->printParticleAssociation(electrons);
481     if(verbosity>4 && doMuon) myMCAssociator->printParticleAssociation(muons);
482     if(verbosity>4 && doMET) myMCAssociator->printParticleAssociation(met);
483     if(verbosity>4 && doJet) myMCAssociator->printJetAssociation(jets);
484 lethuill 1.19 delete myMCAssociator;
485 lethuill 1.18 }
486    
487    
488 lethuill 1.11 if(verbosity>1) cout << endl << "Filling rootuple..." << endl;
489 mlethuil 1.5 eventTree_->Fill();
490 lethuill 1.11 if(verbosity>1) cout << endl << "Deleting objects..." << endl;
491 mlethuil 1.1 delete rootEvent;
492 lethuill 1.12 if(doMC) (*mcParticles).Delete();
493 lethuill 1.16 if(doSignalMuMuGamma) delete rootMuMuGammaEvent;
494     if(doSignalTopTop) (*rootMCTopTop).Delete();
495 lethuill 1.14 if(doPhotonConversionMC) (*mcPhotons).Delete();
496 mlethuil 1.1 if(doTrack) (*tracks).Delete();
497     if(doJet) (*jets).Delete();
498     if(doMuon) (*muons).Delete();
499     if(doElectron) (*electrons).Delete();
500 lethuill 1.11 if(doPhoton) (*photons).Delete();
501 mlethuil 1.1 if(doCluster) (*clusters).Delete();
502     if(doCluster) (*superClusters).Delete();
503 lethuill 1.14 if(doPhotonConversion) (*conversionTracks).Delete();
504     if(doMET) (*met).Delete();
505 lethuill 1.11 if(verbosity>0) cout << endl;
506 mlethuil 1.1 }
507