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