001
002
003
004
005
006
007 #include <algorithm>
008 #include <math.h>
009 #include <functional>
010
011
012 #include "GaudiKernel/MsgStream.h"
013 #include "GaudiKernel/AlgFactory.h"
014 #include "GaudiKernel/IToolSvc.h"
015
016 #include "StoreGate/StoreGateSvc.h"
017 #include "StoreGate/DataHandle.h"
018
019 #include "HepMC/GenEvent.h"
020 #include "HepMC/GenVertex.h"
021 #include "HepMC/GenParticle.h"
022 #include "HepMC/SimpleVector.h"
023
024 #include "HepPDT/ParticleDataTable.hh"
025 #include "HepPDT/ParticleData.hh"
026 #include "HepPDT/TableBuilder.hh"
027
028 #include "GaudiKernel/IIncidentSvc.h"
029 #include "GaudiKernel/Incident.h"
030 #include "GaudiKernel/IPartPropSvc.h"
031
032 #include "McParticleKernel/ITruthParticleCnvTool.h"
033 #include "McParticleKernel/ITruthParticleFilterTool.h"
034
035 #include "McParticleEvent/TruthParticle.h"
036 #include "McParticleEvent/TruthParticleContainer.h"
037
038
039 #include "GeneratorObjects/McEventCollection.h"
040 #include "TruthHelper/IsGenStable.h"
041 #include "TruthHelper/IsGenNonInteracting.h"
042
043 #include "MissingETEvent/MissingEtTruth.h"
044
045 #include "GeneratorsRTT/WenuNp4_006954_AlpgenJimmy_Validation.h"
046
047 #include "EventInfo/EventInfo.h"
048 #include "EventInfo/EventID.h"
049 #include "EventInfo/EventType.h"
050
051 #include "KtJet/KtUtil.h"
052 #include "KtJet/KtEvent.h"
053 #include "KtJet/KtLorentzVector.h"
054 #include "KtJet/KtJetTable.h"
055 #include "KtJet/KtDistance.h"
056 #include "KtJet/KtDistanceInterface.h"
057 #include "KtJet/KtRecom.h"
058 #include "KtJet/KtRecomInterface.h"
059
060
061
062
063 WenuNp4_006954_AlpgenJimmy_Validation::WenuNp4_006954_AlpgenJimmy_Validation(const std::string& name,
064 ISvcLocator* pSvcLocator) :
065 Algorithm(name, pSvcLocator),
066 m_storeGate( "StoreGateSvc", name ),
067 m_cnvTool( ),
068 m_filterTool(0)
069 {
070
071 const HepPDT::ParticleDataTable m_particleTable("PDG Table");
072
073
074
075 declareProperty("TruthParticles", m_truthParticlesName = "GEN_EVENT");
076 declareProperty("ConvertFromESD", m_fromESD = false );
077 declareProperty("DoAODLikeSlimming", m_AODslim = false );
078
079 declareProperty( "CnvTool",
080 m_cnvTool = CnvTool_t( "TruthParticleCnvTool/CnvTool",
081 this ),
082 "Handle to the tool converting a McEventCollection into a "
083 "TruthParticleContainer" );
084 declareProperty( "FilterTool",
085 m_filterTool = FilterTool_t( "EtaPtFilterTool",
086 this ),
087 "AOD like filter");
088
089 }
090
091
092
093
094
095
096
097 WenuNp4_006954_AlpgenJimmy_Validation::~WenuNp4_006954_AlpgenJimmy_Validation() {}
098
099
100
101
102
103 StatusCode WenuNp4_006954_AlpgenJimmy_Validation::initialize()
104 {
105
106 MsgStream msg( messageService(), name() );
107
108 msg << MSG::INFO
109 << "Initializing WenuNp4_006954_AlpgenJimmy_Validation"
110 << endreq;
111
112
113 if ( !m_storeGate.retrieve().isSuccess() ) {
114 msg << MSG::ERROR
115 << "Unable to retrieve pointer to StoreGateSvc"
116 << endreq;
117 return StatusCode::FAILURE;
118 }
119
120
121 if ( !m_cnvTool.retrieve().isSuccess() ) {
122 msg << MSG::ERROR
123 << "Could not retrieve the truth particle converter tool !!"
124 << endreq;
125 return StatusCode::FAILURE;
126 }
127
128
129 StatusCode sc = service("THistSvc", m_thistSvc);
130 if(sc.isFailure() ){
131 msg << MSG::ERROR
132 << "Unable to retrieve pointer to THistSvc"
133 << endreq;
134 return sc;
135 }
136
137
138
139 IPartPropSvc* p_PartPropSvc = 0;
140 static const bool CREATEIFNOTTHERE(true);
141 StatusCode PartPropStatus = service("PartPropSvc", p_PartPropSvc, CREATEIFNOTTHERE);
142 if(!PartPropStatus.isSuccess() ||0==p_PartPropSvc){
143 msg<< MSG::ERROR << "Could not initialize Particle Properties service" << endreq;
144 return PartPropStatus;
145 }
146
147
148 m_particleTable=p_PartPropSvc->PDT();
149
150
151 h_McElectronsN = new TH1D("h_McElectronsN"," MC N electrons (pT>10GeV) ",5,-0.5, 4.5);
152 h_McElectronsPt = new TH1D("h_McElectronsPt"," MC electrons pT (GeV)",50, 0.0, 200.);
153 h_McElectronsEta = new TH1D("h_McElectronsEta"," MC electrons Eta (pT>10GeV)",40, -5.0, 5.0);
154 h_McElectronsPhi = new TH1D("h_McElectronsPhi"," MC electrons Phi (pT>10GeV)",40, -3.14159, 3.14159);
155
156 h_McMuonsN = new TH1D("h_McMuonsN"," MC N muons (pT>10GeV) ",5,-0.5, 4.5);
157 h_McMuonsPt = new TH1D("h_McMuonsPt"," MC muons pT (GeV)",50, 0.0, 200.);
158 h_McMuonsEta = new TH1D("h_McMuonsEta"," MC muons Eta (pT>10GeV)",40, -5.0, 5.0);
159 h_McMuonsPhi = new TH1D("h_McMuonsPhi"," MC muons Phi (pT>10GeV)",40, -3.14159, 3.14159);
160
161 h_McTausN = new TH1D("h_McTausN"," MC N taus (pT>10GeV) ",5,-0.5, 4.5);
162 h_McTausPt = new TH1D("h_McTausPt"," MC taus pT (GeV)",50, 0.0, 200.);
163 h_McTausEta = new TH1D("h_McTausEta"," MC taus Eta (pT>10GeV)",40, -5.0, 5.0);
164 h_McTausPhi = new TH1D("h_McTausPhi"," MC taus Phi (pT>10GeV)",40, -3.14159, 3.14159);
165
166 h_McPhotonsN = new TH1D("h_McPhotonsN"," MC N photons (pT>10GeV) ",5,-0.5, 4.5);
167 h_McPhotonsPt = new TH1D("h_McPhotonsPt"," MC photons PT (GeV)",50, 0.0, 200.);
168 h_McPhotonsEta = new TH1D("h_McPhotonsEta"," MC photons Eta (pT>10GeV)",40, -5.0, 5.0);
169 h_McPhotonsPhi = new TH1D("h_McPhotonsPhi"," MC photons Phi (pT>10GeV)",40, -3.14159, 3.14159);
170
171 h_McBottomsN = new TH1D("h_McBottomsN"," MC N bottoms (pT>10GeV) ",5,-0.5, 4.5);
172 h_McBottomsPt = new TH1D("h_McBottomsPt"," MC bottoms pT (GeV)",50, 0.0, 200.);
173 h_McBottomsEta = new TH1D("h_McBottomsEta"," MC bottoms Eta (pT>10GeV)",40, -5.0, 5.0);
174 h_McBottomsPhi = new TH1D("h_McBottomsPhi"," MC bottoms Phi (pT>10GeV)",40, -3.14159, 3.14159);
175
176
177
178
179
180
181
182
183
184
185
186
187
188 h_McWPt = new TH1D("h_McWPt" ," MC W pT (GeV)",50, 0.0, 600.);
189 h_McWy = new TH1D("h_McWy" ," MC W rapidity (pT>10GeV)",40, -5.0, 5.0);
190 h_McWEta = new TH1D("h_McWEta"," MC W eta (pT>10GeV)",40, -5.0, 5.0);
191 h_McWPhi = new TH1D("h_McWPhi"," MC W Phi (pT>10GeV)",40, -3.14159, 3.14159);
192
193
194
195
196
197
198
199
200 h_pdgId = new TH1D("h_pdgId","PDG ID (<50)", 100, -50, 50.);
201 h_pdgIdmid = new TH1D("h_pdgIdmid","PDG ID (<1000)", 100, -1000, 1000.);
202 h_pdgIdwid = new TH1D("h_pdgIdwid","PDG ID (<5000)", 100, -5000, 5000.);
203 h_barcode = new TH1D("h_barcode","Barcode", 1000, 0., 10000.);
204
205 h_stablep_n = new TH1D("h_stablep_n", "Number of stable particles/event", 100, 0., 2000.);
206 h_stablec_n = new TH1D("h_stablec_n", "Number of stable charged particles/event", 100, 0., 2000.);
207 h_stablep_pt = new TH1D("h_stablep_pt", "pT (GeV) of stable particles", 150, 0., 30.);
208 h_stablec_pt = new TH1D("h_stablec_pt", "pT (GeV) of stable charged particles", 150, 0., 30.);
209
210 h_stablep_totpx = new TH1D("h_stablep_totpx", "sum pX (GeV) of stalbe particles / event", 80, -10., 10.);
211 h_stablep_totpy = new TH1D("h_stablep_totpy", "sum pY (GeV) of stalbe particles / event", 80, -10., 10.);
212 h_stablep_totpz = new TH1D("h_stablep_totpz", "sum pZ (GeV) of stalbe particles / event", 80, -100., 100.);
213
214
215 h_jets_deltaR12 = new TH1D("h_jets_deltaR12", " dR of jets 1-2", 25, 0.0, 5.0);
216 h_jets_deltaR23 = new TH1D("h_jets_deltaR23", " dR of jets 2-3", 25, 0.0, 5.0);
217 h_jets_deltaR34 = new TH1D("h_jets_deltaR34", " dR of jets 3-4", 25, 0.0, 5.0);
218
219 h_jets_d1 = new TH1D("h_jets_d1", " d_1 spectrum", 25, 0.5, 2.5);
220 h_jets_d2 = new TH1D("h_jets_d2", " d_2 spectrum", 25, 0.5, 2.5);
221 h_jets_d3 = new TH1D("h_jets_d3", " d_3 spectrum", 25, 0.5, 2.5);
222 h_jets_d4 = new TH1D("h_jets_d4", " d_4 spectrum", 25, 0.5, 2.5);
223 h_jets_d5 = new TH1D("h_jets_d5", " d_5 spectrum", 25, 0.5, 2.5);
224
225
226
227 h_MET_Int = new TH1D("h_MET_Int","Truth MET (GeV) (Int |eta|<5)", 50, 0., 1000.);
228 h_SumET_Int = new TH1D("h_SumET_Int","Truth SumET (GeV) (Int |eta|<5)", 100, 0., 3000.);
229
230 h_MET_NonInt = new TH1D("h_MET_NonInt","Truth MET (GeV) (NonInt all eta)", 50, 0., 1000.);
231 h_SumET_NonInt = new TH1D("h_SumET_NonInt","Truth SumET (GeV) (NonInt all eta)", 100, 0., 2000.);
232
233 h_MET_IntCentral = new TH1D("h_MET_IntCentral","Truth MET (GeV) (IntCentral |eta|<3)", 50, 0., 1000.);
234 h_SumET_IntCentral = new TH1D("h_SumET_IntCentral","Truth SumET (GeV) (IntCentral |eta|<3)", 100, 0., 3000.);
235
236 h_MET_IntFwd = new TH1D("h_MET_IntFwd","Truth MET (GeV) (IntFwd 3<|eta|<5)", 50, 0., 500.);
237 h_SumET_IntFwd = new TH1D("h_SumET_IntFwd","Truth SumET (GeV) (IntFwd 3<|eta|<5)", 100, 0., 1000.);
238
239 h_MET_IntOutCover = new TH1D("h_MET_IntOutCover","Truth MET (GeV) (IntOutCover |eta|>5)", 50, 0., 200.);
240 h_SumET_IntOutCover = new TH1D("h_SumET_IntOutCover","Truth SumET (GeV) (IntOutCover |eta|>5)", 50, 0., 500.);
241
242 h_MET_Muons= new TH1D("h_MET_Muons","Truth MET (GeV) (Muons components)", 50, 0., 500.);
243 h_SumET_Muons = new TH1D("h_SumET_Muons","Truth SumET (GeV) (Muons components)", 50, 0., 500.);
244
245 char hname[100], htitle[100];
246
247 h_McC4JetN = new TH1D("h_McC4JetN"," MC N C4Jet (pT>20GeV) ",20,-0.5, 19.5);
248 for (int i=0; i<5; ++i) {
249 char m_message_pt[50];
250 char m_message[50];
251 if (i==0) {
252 sprintf(m_message_pt, "inclusive all jets");
253 sprintf(m_message, "inclusive all jets (pT>20GeV)");
254 } else {
255 sprintf(m_message_pt, "%d-th jet", i);
256 sprintf(m_message, "%d-th jet", i);
257 }
258 sprintf(hname, "h_McC4JetPt_%d",i);
259 sprintf(htitle, "MC C4Jet pT (GeV) %s", m_message_pt);
260 h_McC4JetPt[i] = new TH1D(hname, htitle, 100, 0.0, 500.);
261
262 sprintf(hname, "h_McC4JetEta_%d",i);
263 sprintf(htitle, "MC C4Jet Eta %s", m_message);
264 h_McC4JetEta[i] = new TH1D(hname, htitle, 40, -6.0, 6.0);
265
266 sprintf(hname, "h_McC4JetPhi_%d",i);
267 sprintf(htitle, "MC C4Jet Phi %s", m_message);
268 h_McC4JetPhi[i] = new TH1D(hname, htitle, 40, -3.14159, 3.14159);
269 }
270
271
272 h_McKt4JetN = new TH1D("h_McKt4JetN"," MC N Kt4Jet (20GeV) ",20,-0.5, 19.5);
273 for (int i=0; i<5; ++i) {
274 char m_message_pt[50];
275 char m_message[50];
276 if (i==0) {
277 sprintf(m_message_pt, "inclusive all jets");
278 sprintf(m_message, "inclusive all jets (pT>20GeV)");
279 } else {
280 sprintf(m_message_pt, "%d-th jet", i);
281 sprintf(m_message, "%d-th jet", i);
282 }
283 sprintf(hname, "h_McKt4JetPt_%d",i);
284 sprintf(htitle, "MC Kt4Jet pT (GeV) %s", m_message_pt);
285 h_McKt4JetPt[i] = new TH1D(hname, htitle, 100, 0.0, 500.);
286
287 sprintf(hname, "h_McKt4JetEta_%d",i);
288 sprintf(htitle, "MC Kt4Jet Eta %s", m_message);
289 h_McKt4JetEta[i] = new TH1D(hname, htitle, 40, -6.0, 6.0);
290
291 sprintf(hname, "h_McKt4JetPhi_%d",i);
292 sprintf(htitle, "MC Kt4Jet Phi %s", m_message);
293 h_McKt4JetPhi[i] = new TH1D(hname, htitle, 40, -3.15149, 3.14159);
294 }
295
296 sc = m_thistSvc->regHist("/AANT/MC/h_McElectronsN", h_McElectronsN);
297 sc = m_thistSvc->regHist("/AANT/MC/h_McElectronsPt", h_McElectronsPt);
298 sc = m_thistSvc->regHist("/AANT/MC/h_McElectronsEta", h_McElectronsEta);
299 sc = m_thistSvc->regHist("/AANT/MC/h_McElectronsPhi", h_McElectronsPhi);
300
301 sc = m_thistSvc->regHist("/AANT/MC/h_McMuonsN", h_McMuonsN);
302 sc = m_thistSvc->regHist("/AANT/MC/h_McMuonsPt", h_McMuonsPt);
303 sc = m_thistSvc->regHist("/AANT/MC/h_McMuonsEta", h_McMuonsEta);
304 sc = m_thistSvc->regHist("/AANT/MC/h_McMuonsPhi", h_McMuonsPhi);
305
306 sc = m_thistSvc->regHist("/AANT/MC/h_McTausN", h_McTausN);
307 sc = m_thistSvc->regHist("/AANT/MC/h_McTausPt", h_McTausPt);
308 sc = m_thistSvc->regHist("/AANT/MC/h_McTausEta", h_McTausEta);
309 sc = m_thistSvc->regHist("/AANT/MC/h_McTausPhi", h_McTausPhi);
310
311 sc = m_thistSvc->regHist("/AANT/MC/h_McPhotonsN", h_McPhotonsN);
312 sc = m_thistSvc->regHist("/AANT/MC/h_McPhotonsPt", h_McPhotonsPt);
313 sc = m_thistSvc->regHist("/AANT/MC/h_McPhotonsEta", h_McPhotonsEta);
314 sc = m_thistSvc->regHist("/AANT/MC/h_McPhotonsPhi", h_McPhotonsPhi);
315
316 sc = m_thistSvc->regHist("/AANT/MC/h_McBottomsN", h_McBottomsN);
317 sc = m_thistSvc->regHist("/AANT/MC/h_McBottomsPt", h_McBottomsPt);
318 sc = m_thistSvc->regHist("/AANT/MC/h_McBottomsEta", h_McBottomsEta);
319 sc = m_thistSvc->regHist("/AANT/MC/h_McBottomsPhi", h_McBottomsPhi);
320
321
322
323
324
325
326
327
328
329
330
331 sc = m_thistSvc->regHist("/AANT/MC/h_McWPt", h_McWPt);
332 sc = m_thistSvc->regHist("/AANT/MC/h_McWy", h_McWy);
333 sc = m_thistSvc->regHist("/AANT/MC/h_McWPhi", h_McWPhi);
334 sc = m_thistSvc->regHist("/AANT/MC/h_McWEta", h_McWEta);
335
336
337
338
339
340
341 sc = m_thistSvc->regHist("/AANT/MC/h_pdgId", h_pdgId);
342 sc = m_thistSvc->regHist("/AANT/MC/h_pdgIdmid", h_pdgIdmid);
343 sc = m_thistSvc->regHist("/AANT/MC/h_pdgIdwid", h_pdgIdwid);
344 sc = m_thistSvc->regHist("/AANT/MC/h_barcode", h_barcode);
345
346 sc = m_thistSvc->regHist("/AANT/MC/h_stablep_n", h_stablep_n);
347 sc = m_thistSvc->regHist("/AANT/MC/h_stablec_n", h_stablec_n);
348 sc = m_thistSvc->regHist("/AANT/MC/h_stablep_pt", h_stablep_pt);
349 sc = m_thistSvc->regHist("/AANT/MC/h_stablec_pt", h_stablec_pt);
350
351 sc = m_thistSvc->regHist("/AANT/MC/h_stablep_totpx", h_stablep_totpx);
352 sc = m_thistSvc->regHist("/AANT/MC/h_stablep_totpy", h_stablep_totpy);
353 sc = m_thistSvc->regHist("/AANT/MC/h_stablep_totpz", h_stablep_totpz);
354
355 sc = m_thistSvc->regHist("/AANT/MC/h_jets_deltaR12", h_jets_deltaR12);
356 sc = m_thistSvc->regHist("/AANT/MC/h_jets_deltaR23", h_jets_deltaR23);
357 sc = m_thistSvc->regHist("/AANT/MC/h_jets_deltaR34", h_jets_deltaR34);
358
359 sc = m_thistSvc->regHist("/AANT/MC/h_jets_d1", h_jets_d1);
360 sc = m_thistSvc->regHist("/AANT/MC/h_jets_d2", h_jets_d2);
361 sc = m_thistSvc->regHist("/AANT/MC/h_jets_d3", h_jets_d3);
362 sc = m_thistSvc->regHist("/AANT/MC/h_jets_d4", h_jets_d4);
363 sc = m_thistSvc->regHist("/AANT/MC/h_jets_d5", h_jets_d5);
364
365 sc = m_thistSvc->regHist("/AANT/MC/h_MET_Int", h_MET_Int);
366 sc = m_thistSvc->regHist("/AANT/MC/h_MET_NonInt", h_MET_NonInt);
367 sc = m_thistSvc->regHist("/AANT/MC/h_MET_IntCentral", h_MET_IntCentral);
368 sc = m_thistSvc->regHist("/AANT/MC/h_MET_IntFwd", h_MET_IntFwd);
369 sc = m_thistSvc->regHist("/AANT/MC/h_MET_IntOutCover", h_MET_IntOutCover);
370 sc = m_thistSvc->regHist("/AANT/MC/h_MET_Muons", h_MET_Muons);
371
372 sc = m_thistSvc->regHist("/AANT/MC/h_SumET_Int", h_SumET_Int);
373 sc = m_thistSvc->regHist("/AANT/MC/h_SumET_NonInt", h_SumET_NonInt);
374 sc = m_thistSvc->regHist("/AANT/MC/h_SumET_IntCentral", h_SumET_IntCentral);
375 sc = m_thistSvc->regHist("/AANT/MC/h_SumET_IntFwd", h_SumET_IntFwd);
376 sc = m_thistSvc->regHist("/AANT/MC/h_SumET_IntOutCover", h_SumET_IntOutCover);
377 sc = m_thistSvc->regHist("/AANT/MC/h_SumET_Muons", h_SumET_Muons);
378
379 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetN", h_McC4JetN);
380 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetPt_0", h_McC4JetPt[0]);
381 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetEta_0", h_McC4JetEta[0]);
382 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetPhi_0", h_McC4JetPhi[0]);
383 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetPt_1", h_McC4JetPt[1]);
384 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetEta_1", h_McC4JetEta[1]);
385 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetPhi_1", h_McC4JetPhi[1]);
386 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetPt_2", h_McC4JetPt[2]);
387 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetEta_2", h_McC4JetEta[2]);
388 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetPhi_2", h_McC4JetPhi[2]);
389 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetPt_3", h_McC4JetPt[3]);
390 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetEta_3", h_McC4JetEta[3]);
391 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetPhi_3", h_McC4JetPhi[3]);
392 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetPt_4", h_McC4JetPt[4]);
393 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetEta_4", h_McC4JetEta[4]);
394 sc = m_thistSvc->regHist("/AANT/MC/h_McC4JetPhi_4", h_McC4JetPhi[4]);
395
396 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetN", h_McKt4JetN);
397 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetPt_0", h_McKt4JetPt[0]);
398 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetEta_0", h_McKt4JetEta[0]);
399 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetPhi_0", h_McKt4JetPhi[0]);
400 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetPt_1", h_McKt4JetPt[1]);
401 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetEta_1", h_McKt4JetEta[1]);
402 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetPhi_1", h_McKt4JetPhi[1]);
403 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetPt_2", h_McKt4JetPt[2]);
404 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetEta_2", h_McKt4JetEta[2]);
405 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetPhi_2", h_McKt4JetPhi[2]);
406 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetPt_3", h_McKt4JetPt[3]);
407 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetEta_3", h_McKt4JetEta[3]);
408 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetPhi_3", h_McKt4JetPhi[3]);
409 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetPt_4", h_McKt4JetPt[4]);
410 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetEta_4", h_McKt4JetEta[4]);
411 sc = m_thistSvc->regHist("/AANT/MC/h_McKt4JetPhi_4", h_McKt4JetPhi[4]);
412
413
414
415
416
417 setupFilterTool( m_AODslim );
418
419
420
421 m_elecEta = 0.;
422 m_elecPhi = 0.;
423 m_elecPt = 0.;
424
425
426 return StatusCode::SUCCESS;
427 }
428
429
430
431
432 StatusCode WenuNp4_006954_AlpgenJimmy_Validation::finalize()
433 {
434 MsgStream msg( messageService(), name() );
435
436 return StatusCode::SUCCESS;
437
438 }
439
440
441
442
443 StatusCode WenuNp4_006954_AlpgenJimmy_Validation::execute()
444 {
445 MsgStream msg( messageService(), name() );
446 StatusCode sc = StatusCode::SUCCESS;
447
448 msg << MSG::DEBUG << "execute()" << endreq;
449
450
451 if ( m_fromESD ) {
452 if ( m_cnvTool->execute().isFailure() ) {
453 msg << MSG::WARNING
454 << "Could not convert the McEventCollection into "
455 << "a TruthParticleContainer !"
456 << endreq;
457 return StatusCode::SUCCESS;
458 }
459 }
460
461
462
463 if ( m_AODslim && !m_filterTool->execute().isSuccess() ) {
464 msg << MSG::WARNING
465 << "Could not build the AOD McEventCollection ! [algtool="
466 << m_filterTool.type() << "]"
467 << endreq;
468 return StatusCode::SUCCESS;
469 }
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488 const EventInfo * evInfo =0;
489 sc = m_storeGate->retrieve( evInfo, "McEventInfo");
490 if (sc.isFailure()) {
491 msg << MSG::ERROR << "Cannot get EventInfo" << endreq;
492 return StatusCode::FAILURE;
493 }
494
495
496
497
498
499
500
501
502
503
504 const DataHandle<EventInfo> eventInfo, eventInfoE;
505 sc = m_storeGate->retrieve(eventInfo,eventInfoE);
506 double evtWeightA1 = (eventInfo->event_type())->mc_event_weight();
507
508
509 const McEventCollection * mcCol = 0;
510 sc = m_storeGate->retrieve( mcCol, m_truthParticlesName);
511 if (sc.isFailure() || mcCol==0) {
512 msg << MSG::ERROR << "Cannot get McEventCollection" << endreq;
513 return StatusCode::FAILURE;
514 }
515
516 TruthHelper::IsGenNonInteracting isInvis;
517 TruthHelper::IsGenStable isStable;
518
519 McEventCollection::const_iterator itEvt;
520 HepMC::GenEvent::particle_iterator itPar;
521
522 HepMC::GenEvent *genEvt;
523 for (itEvt = mcCol->begin(); itEvt != mcCol->end(); ++itEvt) {
524
525 genEvt = (*itEvt);
526
527
528
529 HepMC::WeightContainer weights = genEvt->weights();
530 double evtWeightB1 = weights.front();
531 double evtWeightB2 = weights.back();
532 double evtWeightSize = weights.size();
533 msg << MSG::INFO << " EV WEIGHT "
534 << " (A1): " << evtWeightA1
535
536 << " (B1): " << evtWeightB1
537 << " (B2): " << evtWeightB2
538 << " (Bsize): " << evtWeightSize
539 << endreq;
540
541 unsigned pIndex=0;
542
543 int N_electrons = 0;
544 int N_muons = 0;
545 int N_taus = 0;
546 int N_photons = 0;
547 int N_bottoms = 0;
548 int N_stablep = 0;
549 int N_stablec = 0;
550 double Total_px = 0;
551 double Total_py = 0;
552 double Total_pz = 0;
553
554 for(itPar=genEvt->particles_begin(); itPar!=genEvt->particles_end(); ++itPar, ++pIndex ){
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580 const HepMC::GenParticle * mcp = (*itPar);
581 int apdgid = abs(mcp->pdg_id());
582 int bcode = (int)mcp->barcode();
583
584
585
586
587
588
589
590 h_barcode -> Fill((double)bcode);
591
592 if ( apdgid< 50. && mcp->status()==1 && !mcp->end_vertex()) {
593 h_pdgId -> Fill((float)mcp->pdg_id());
594 h_pdgIdmid -> Fill((float)mcp->pdg_id());
595 h_pdgIdwid -> Fill((float)mcp->pdg_id());
596 }
597
598 if (mcp->status()==1 && !mcp->end_vertex()) {
599
600 const HepPDT::ParticleData* pData = m_particleTable->particle(HepPDT::ParticleID( apdgid ));
601
602 double pCharge = 0;
603 if (pData) { pCharge = pData->charge(); }
604
605 N_stablep ++;
606 if (pCharge!=0) N_stablec ++;
607 Total_px += mcp->momentum().px()/GeV;
608 Total_py += mcp->momentum().py()/GeV;
609 Total_pz += mcp->momentum().pz()/GeV;
610 h_stablep_pt -> Fill(mcp->momentum().perp()/GeV);
611 if (pCharge!=0) h_stablec_pt -> Fill(mcp->momentum().perp()/GeV);
612 }
613
614
615
616 if (apdgid == 11 && mcp->status()==1 && !mcp->end_vertex()) {
617 h_McElectronsPt -> Fill(mcp->momentum().perp()/GeV);
618 if (mcp->momentum().perp()/GeV > 10.0) {
619 N_electrons++;
620 h_McElectronsEta -> Fill(mcp->momentum().eta());
621 h_McElectronsPhi -> Fill(mcp->momentum().phi());
622 }
623 }
624
625
626 if (apdgid == 13 && mcp->status()==1 && !mcp->end_vertex()) {
627 h_McMuonsPt -> Fill(mcp->momentum().perp()/GeV);
628 if (mcp->momentum().perp()/GeV > 10.0) {
629 N_muons++;
630 h_McMuonsEta -> Fill(mcp->momentum().eta());
631 h_McMuonsPhi -> Fill(mcp->momentum().phi());
632 }
633 }
634
635
636 if (apdgid == 15) {
637 HepLorentzVector pvis(0,0,0,0);
638
639
640 HepMC::GenVertex *tauDvertex = mcp->end_vertex();
641 if (!tauDvertex) {
642 msg << MSG::INFO << "non decayed taus barcode: " << mcp->barcode() << endreq;
643 continue;
644 } else {
645 msg << MSG::INFO << "found decayed taus barcode: " << mcp->barcode() << endreq;
646 }
647
648 HepMC::GenVertex::particle_iterator curD, firstD, lastD;
649
650 firstD = mcp->end_vertex()->particles_begin(HepMC::children);
651 lastD = mcp->end_vertex()->particles_end(HepMC::children);
652
653 for (curD=firstD; curD!=lastD; ++curD) {
654 int jid = abs((*curD)->pdg_id() );
655
656 if( jid!=12 && jid!=14 && jid!=16 ) {
657 HepLorentzVector tauV;
658 HepMC::FourVector tauV4 = (*curD)->momentum();
659 tauV.setPx(tauV4.px());
660 tauV.setPy(tauV4.py());
661 tauV.setPz(tauV4.pz());
662 tauV.setE(tauV4.e());
663
664 pvis += tauV;
665
666 h_McTausPt -> Fill(pvis.perp()/GeV);
667 if (pvis.perp()/GeV > 10.0) {
668 N_taus++;
669 h_McTausEta -> Fill(pvis.pseudoRapidity());
670 h_McTausPhi -> Fill(pvis.phi());
671 }
672 }
673 }
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690 }
691
692
693 if (apdgid == 22 && mcp->status()==1 && !mcp->end_vertex()) {
694 h_McPhotonsPt -> Fill(mcp->momentum().perp()/GeV);
695 if (mcp->momentum().perp()/GeV > 10.0) {
696 N_photons++;
697 h_McPhotonsEta -> Fill(mcp->momentum().eta());
698 h_McPhotonsPhi -> Fill(mcp->momentum().phi());
699 }
700 }
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784 if (apdgid == 5 && mcp->status()==155){
785
786 h_McBottomsPt -> Fill(mcp->momentum().perp()/GeV);
787 if (mcp->momentum().perp()/GeV > 10.0) {
788 N_bottoms++;
789 h_McBottomsEta -> Fill(mcp->momentum().eta());
790 h_McBottomsPhi -> Fill(mcp->momentum().phi());
791 }
792 }
793
794
795 if (apdgid == 24 && (mcp->status()==195||mcp->status()==155||mcp->status()==2)) {
796
797 h_McWPt -> Fill(mcp->momentum().perp()/GeV);
798 if (mcp->momentum().perp()/GeV > 10.) {
799 double myWE = mcp->momentum().e();
800 double myWPz= mcp->momentum().pz();
801 h_McWy -> Fill(0.5*log((myWE+myWPz)/(myWE-myWPz)));
802 h_McWPhi -> Fill(mcp->momentum().phi());
803 h_McWEta -> Fill(mcp->momentum().eta());
804 }
805
806
807 const HepMC::GenVertex * w_decayVtx = mcp->end_vertex();
808
809 HepMC::GenVertex::particles_out_const_iterator l_mcpartItr = w_decayVtx->particles_out_const_begin();
810 HepMC::GenVertex::particles_out_const_iterator l_mcpartItrE = w_decayVtx->particles_out_const_end();
811
812 for (; l_mcpartItr != l_mcpartItrE; ++l_mcpartItr) {
813 HepMC::GenParticle *lep_mcpart = (*l_mcpartItr);
814 if (fabs(lep_mcpart->pdg_id()) == 11) {
815 const HepMC::GenVertex *e_decayVtx = lep_mcpart->end_vertex();
816 while (e_decayVtx) {
817 HepMC::GenVertex::particles_out_const_iterator ll_mcpartItr = e_decayVtx->particles_out_const_begin();
818 HepMC::GenVertex::particles_out_const_iterator ll_mcpartItrE = e_decayVtx->particles_out_const_end();
819 for (; ll_mcpartItr != ll_mcpartItrE; ++ll_mcpartItr) {
820 if (fabs((*ll_mcpartItr)->pdg_id()) == 11) {
821 e_decayVtx = (*ll_mcpartItr)->end_vertex();
822 lep_mcpart = (*ll_mcpartItr);
823 }
824 }
825 }
826
827 m_elecEta = lep_mcpart->momentum().eta();
828 m_elecPhi = lep_mcpart->momentum().phi();
829 m_elecPt = lep_mcpart->momentum().perp();
830
831
832
833
834
835 break;
836 }
837 }
838
839 }
840
841
842
843
844
845
846
847
848
849
850
851
852 }
853
854 h_McElectronsN -> Fill(N_electrons);
855 h_McMuonsN -> Fill(N_muons);
856 h_McTausN -> Fill(N_taus);
857 h_McPhotonsN -> Fill(N_photons);
858 h_McBottomsN -> Fill(N_bottoms);
859
860 h_stablep_n -> Fill(N_stablep);
861 h_stablec_n -> Fill(N_stablec);
862
863 h_stablep_totpx -> Fill(Total_px);
864 h_stablep_totpy -> Fill(Total_py);
865 h_stablep_totpz -> Fill(Total_pz);
866
867 }
868
869
870
871
872
873 int N_C4jets = 0;
874 int N_Kt4jets = 0;
875
876
877 const JetCollection* mcC4TES;
878 IParticleContainer* mcC4NEW = new IParticleContainer(SG::VIEW_ELEMENTS);
879 mcC4NEW->clear();
880 sc=m_storeGate->retrieve( mcC4TES, "Cone4TruthJets");
881 if( sc.isFailure() || !mcC4TES ) {
882 msg << MSG::WARNING
883 << "No Cone4TruthJets container found in TDS"
884 << endreq;
885 return StatusCode::SUCCESS;
886 }
887
888
889 JetCollection::const_iterator mcC4jetItr = (*mcC4TES).begin();
890 JetCollection::const_iterator mcC4jetItrE = (*mcC4TES).end();
891 int mcC4index = 0;
892 for(; mcC4jetItr != mcC4jetItrE; ++mcC4jetItr) {
893 double ptj = (*mcC4jetItr)->pt();
894 double etaj = (*mcC4jetItr)->eta();
895 double phij = (*mcC4jetItr)->phi();
896
897
898
899
900
901
902
903 if (sqrt(pow(etaj-m_elecEta, 2)+pow(phij-m_elecPhi, 2))<0.2) {
904 msg << MSG::INFO << " C4 Jet - elec matching found " << endreq;
905 continue;
906 }
907
908 h_McC4JetPt[0] -> Fill(ptj/GeV);
909
910 if(ptj > 20*GeV) {
911 N_C4jets++;
912 h_McC4JetEta[0] -> Fill(etaj);
913 h_McC4JetPhi[0] -> Fill(phij);
914 }
915
916 if (mcC4index < 4) {
917 h_McC4JetPt[mcC4index+1] -> Fill(ptj/GeV);
918 h_McC4JetEta[mcC4index+1] -> Fill(etaj);
919 h_McC4JetPhi[mcC4index+1] -> Fill(phij);
920 }
921 mcC4index++;
922 mcC4NEW->push_back(*mcC4jetItr);
923 }
924
925 h_McC4JetN -> Fill(N_C4jets);
926 msg << MSG::INFO
927 << " MC cone4 jet : " << mcC4index
928 << " Size : " << (*mcC4TES).size()
929 << endreq;
930
931
932
933 for (unsigned int i=0; i<3; ++i) {
934 if ((*mcC4NEW).size() == i+1) break;
935 HepLorentzVector j_i = (*mcC4NEW).at(i)->hlv();
936 HepLorentzVector j_j = (*mcC4NEW).at(i+1)->hlv();
937 double deltaEta = j_i.eta()-j_j.eta();
938 double deltaPhi = j_i.vect().deltaPhi( j_j.vect());
939 double dR = sqrt(pow(deltaEta,2)+pow(deltaPhi,2));
940 if (i==0) h_jets_deltaR12 -> Fill(dR);
941 if (i==1) h_jets_deltaR23 -> Fill(dR);
942 if (i==2) h_jets_deltaR34 -> Fill(dR);
943 }
944
945
946
947 std::vector<KtJet::KtLorentzVector> ktLVList;
948
949
950 IParticleContainer::const_iterator firstJet = (*mcC4NEW).begin();
951 IParticleContainer::const_iterator lastJet = (*mcC4NEW).end();
952 for ( ; firstJet != lastJet; firstJet++ ){
953 KtJet::KtLorentzVector ktLV((*firstJet)->hlv());
954 ktLVList.push_back(ktLV);
955 }
956
957 typedef std::string flag_name;
958 typedef std::map<flag_name,unsigned int> flag_store;
959
960 KtJet::KtEvent * ktBuilder;
961 flag_store m_beamTypeFlags;
962 flag_store m_distSchemeFlags;
963 flag_store m_recombSchemeFlags;
964
965
966
967 ktBuilder = new KtJet::KtEvent(ktLVList, 4, 2, 2);
968
969
970
971
972
973
974
975 h_jets_d1->Fill(log10(sqrt(ktBuilder->getDMerge(0))/GeV));
976 h_jets_d2->Fill(log10(sqrt(ktBuilder->getDMerge(1))/GeV));
977 h_jets_d3->Fill(log10(sqrt(ktBuilder->getDMerge(2))/GeV));
978 h_jets_d4->Fill(log10(sqrt(ktBuilder->getDMerge(3))/GeV));
979 h_jets_d5->Fill(log10(sqrt(ktBuilder->getDMerge(4))/GeV));
980
981
982 const JetCollection* mcKt4TES;
983
984
985 sc=m_storeGate->retrieve( mcKt4TES, "Kt4TruthJets");
986 if( sc.isFailure() || !mcKt4TES ) {
987 msg << MSG::WARNING
988 << "No Kt4TruthJets container found in TDS"
989 << endreq;
990 return StatusCode::SUCCESS;
991 }
992
993 JetCollection::const_iterator mcKt4jetItr = (*mcKt4TES).begin();
994 JetCollection::const_iterator mcKt4jetItrE = (*mcKt4TES).end();
995 int mcKt4index = 0;
996 for(; mcKt4jetItr != mcKt4jetItrE; ++mcKt4jetItr) {
997 double ptj = (*mcKt4jetItr)->pt();
998 double etaj = (*mcKt4jetItr)->eta();
999 double phij = (*mcKt4jetItr)->phi();
1000
1001
1002 if (sqrt(pow(etaj-m_elecEta, 2)+pow(phij-m_elecPhi, 2))<0.2) {
1003 msg << MSG::INFO << " C4 Jet - elec matching found " << endreq;
1004 continue;
1005 }
1006
1007
1008 h_McKt4JetPt[0] -> Fill(ptj/GeV);
1009 if(ptj > 20*GeV) {
1010 N_Kt4jets++;
1011 h_McKt4JetEta[0] -> Fill(etaj);
1012 h_McKt4JetPhi[0] -> Fill(phij);
1013 }
1014
1015 if (mcKt4index < 4) {
1016 h_McKt4JetPt[mcKt4index+1] -> Fill(ptj/GeV);
1017 h_McKt4JetEta[mcKt4index+1] -> Fill(etaj);
1018 h_McKt4JetPhi[mcKt4index+1] -> Fill(phij);
1019 }
1020 mcKt4index++;
1021
1022 }
1023 h_McKt4JetN -> Fill(N_Kt4jets);
1024
1025
1026
1027
1028 const MissingEtTruth *missEtTruth;
1029 if ( (m_storeGate->retrieve(missEtTruth, "MET_Truth")).isFailure()) {
1030 msg << MSG::ERROR
1031 << "Could not retrieve Truth MissingET"
1032 << endreq;
1033 }
1034
1035 double m_mex[6],m_mey[6],m_sumet[6];
1036
1037 MissingEtTruth::TruthIndex theTruth[6] = {
1038 MissingEtTruth::Int,
1039 MissingEtTruth::NonInt,
1040 MissingEtTruth::IntCentral,
1041 MissingEtTruth::IntFwd,
1042 MissingEtTruth::IntOutCover,
1043 MissingEtTruth::Muons,
1044 };
1045
1046 for (int i=0; i<6;++i) {
1047 m_mex[i] = missEtTruth -> exTruth(theTruth[i])/GeV;
1048 m_mey[i] = missEtTruth -> eyTruth(theTruth[i])/GeV;
1049 m_sumet[i] = missEtTruth -> etSumTruth(theTruth[i])/GeV;
1050 }
1051
1052 h_MET_Int -> Fill(sqrt(pow(m_mex[0],2)+pow(m_mey[0],2)));
1053 h_MET_NonInt -> Fill(sqrt(pow(m_mex[1],2)+pow(m_mey[1],2)));
1054 h_MET_IntCentral -> Fill(sqrt(pow(m_mex[2],2)+pow(m_mey[2],2)));
1055 h_MET_IntFwd -> Fill(sqrt(pow(m_mex[3],2)+pow(m_mey[3],2)));
1056 h_MET_IntOutCover-> Fill(sqrt(pow(m_mex[4],2)+pow(m_mey[4],2)));
1057 h_MET_Muons -> Fill(sqrt(pow(m_mex[5],2)+pow(m_mey[5],2)));
1058
1059 h_SumET_Int -> Fill(m_sumet[0]);
1060 h_SumET_NonInt -> Fill(m_sumet[1]);
1061 h_SumET_IntCentral -> Fill(m_sumet[2]);
1062 h_SumET_IntFwd -> Fill(m_sumet[3]);
1063 h_SumET_IntOutCover-> Fill(m_sumet[4]);
1064 h_SumET_Muons -> Fill(m_sumet[5]);
1065
1066 msg << MSG::DEBUG << "EtMiss() succeeded" << endreq;
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097 return StatusCode::SUCCESS;
1098 }
1099
1100 void WenuNp4_006954_AlpgenJimmy_Validation::setupFilterTool( Property& )
1101 {
1102 MsgStream m_msg( messageService(), name() );
1103
1104 if ( m_AODslim ) {
1105
1106 if ( !m_filterTool.retrieve().isSuccess() ) {
1107 m_msg << MSG::ERROR
1108 << "Could not retrieve algTool ITruthParticleFilterTool ["
1109 << m_filterTool.type() << "/"
1110
1111 << "] !!"
1112 << endreq;
1113 throw std::runtime_error("Could not setup FilterTool property !");
1114 } else {
1115
1116 m_msg << MSG::INFO << "Retrieved and configured algTool ["
1117 << m_filterTool.type() << "/"
1118
1119 << "]"
1120 << endreq;
1121 }
1122 } else {
1123 if ( !m_filterTool.release().isSuccess() ) {
1124 m_msg << MSG::WARNING
1125 << "Could not release algTool ITruthParticleFilterTool ["
1126 << m_filterTool.type() << "/"
1127
1128 << "] !!"
1129 << endreq
1130 << "Memory won't be freed until ::finalize()..."
1131 << endreq;
1132 } else {
1133 m_msg << MSG::DEBUG << "Released algTool ["
1134 << m_filterTool.type() << "/"
1135
1136 << "]"
1137 << endreq;
1138 }
1139 }
1140
1141 return;
1142 }
Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
This page was automatically generated by the
LXR engine.
|
|