ATLAS Offline Software
Loading...
Searching...
No Matches
SingleTrackValidation Class Reference

#include <SingleTrackValidation.h>

Inheritance diagram for SingleTrackValidation:
Collaboration diagram for SingleTrackValidation:

Classes

class  Clockwork

Public Member Functions

 SingleTrackValidation (const std::string &name, ISvcLocator *pSvcLocator)
 ~SingleTrackValidation ()
StatusCode initialize () override
StatusCode execute (const EventContext &ctx) override
 Execute method.
StatusCode finalize () override
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

virtual bool isReEntrant () const override final
 Legacy algorithms are not thread-safe.
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

 SingleTrackValidation (const SingleTrackValidation &)
SingleTrackValidationoperator= (const SingleTrackValidation &)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< McEventCollectionm_truthKey { this, "TruthKey", "TruthEvent" }
SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObjm_fieldCacheCondObjInputKey
ServiceHandle< ITHistSvc > m_histSvc { this, "THistSvc", "THistSvc", "Histogramming svc" }
Clockworkm_c
TH1F * m_histos [162] {}
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 19 of file SingleTrackValidation.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ SingleTrackValidation() [1/2]

SingleTrackValidation::SingleTrackValidation ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 107 of file SingleTrackValidation.cxx.

107 :
108 AthAlgorithm(name,pSvcLocator),m_c(new Clockwork())
109{
110 for (unsigned int i=0;i<162;++i) m_histos[i] = nullptr;
111}
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.

◆ ~SingleTrackValidation()

SingleTrackValidation::~SingleTrackValidation ( )

Definition at line 113 of file SingleTrackValidation.cxx.

113 {
114 if (m_c!=nullptr){ delete m_c; m_c=nullptr; }
115}

◆ SingleTrackValidation() [2/2]

SingleTrackValidation::SingleTrackValidation ( const SingleTrackValidation & )
private

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode SingleTrackValidation::execute ( const EventContext & ctx)
overridevirtual

Execute method.

Implements AthAlgorithm.

Definition at line 254 of file SingleTrackValidation.cxx.

254 {
255
256 if (m_c->cpuTime==0) {
257 m_c->cpuTime=getCpu();
258 m_c->cpuTime+=1; // Fill the histogram with -1 for the first event
259 }
260 m_c->cpuTime= getCpu()-m_c->cpuTime;
261 m_histos[156]->Fill( m_c->cpuTime/100. , 1. );
262
263 int RunNum=ctx.eventID().run_number();
264 int EvtNum=ctx.eventID().event_number();
265 double RunStr=double(RunNum);
266 double EvtStr=double(EvtNum);
267 m_c->EventNo=EvtStr;
268 m_c->RunNo=RunStr;
269 m_histos[160]->Fill(EvtStr);
270 m_histos[159]->Fill(RunNum);
271
272 MagField::AtlasFieldCache fieldCache;
273 // Get field cache object
274 SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, ctx};
275 const AtlasFieldCacheCondObj* fieldCondObj{*readHandle};
276 if (fieldCondObj == nullptr) {
277 ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key());
278 return StatusCode::FAILURE;
279 }
280 fieldCondObj->getInitializedCache (fieldCache);
281
282 // Get the MC Truth Information
283 SG::ReadHandle<McEventCollection> mcEvent{m_truthKey, ctx};
284 for (const HepMC::GenEvent* e : *mcEvent) {
285
286 // Get just the primary, call it "theParticle"
287 auto theParticle = *HepMC::begin(*e);
288
289 // Get the kinematic variables:
290 HepLorentzVector momentum(theParticle->momentum().px(),
291 theParticle->momentum().py(),
292 theParticle->momentum().pz(),
293 theParticle->momentum().e());
294 Point3D<double> origin(theParticle->production_vertex()->position().x(),
295 theParticle->production_vertex()->position().y(),
296 theParticle->production_vertex()->position().z());
297 double charge = MC::charge(theParticle->pdg_id());
298 // Put Eta and Phi into the Ntuple
299 m_c->phi = theParticle->momentum().phi();
300 m_c->eta = -log(tan(theParticle->momentum().theta()/2));
301 if (!finite(m_c->eta)) m_c->eta=0;
302 m_c->pt = theParticle->momentum().perp();
303 int partID = theParticle->pdg_id();
304 double pID = double(partID);
305 m_c->PDG = pID;
306 m_c->Energy = theParticle->momentum().e();
307 m_histos[2]->Fill( theParticle->momentum().phi() );
308 double myEta = -log(tan(theParticle->momentum().theta()/2));
309 if (!finite(myEta)) m_histos[0]->Fill(0);
310 else m_histos[0]->Fill( myEta );
311 m_histos[158]->Fill( pID );
312 m_histos[1]->Fill( theParticle->momentum().perp()/Units::GeV );
313 m_histos[157]->Fill( m_c->Energy = theParticle->momentum().e()/Units::GeV );
314
315 // Make an extrapolator:
316 const Genfun::AtlasBComponent Bx(0,&fieldCache);
317 const Genfun::AtlasBComponent By(1,&fieldCache);
318 const Genfun::AtlasBComponent Bz(2,&fieldCache);
319 GeoXPEngine extrapolator(Bx, By, Bz, origin, momentum, charge);
320
321 // Extrapolate to the first layer in the barrel:
322 m_c->x = 0;
323 m_c->y = 0;
324 m_c->z = 0;
325 double x=0,y=0,z=0;
326 bool hitsBarrel=false;
327 //bool hitsEndcap=false;
328 for (double t = 0; t< 50; t += 0.1) {
329 x = extrapolator.x()(t);
330 y = extrapolator.y()(t);
331 z = extrapolator.z()(t);
332 double magicZ=3640.0*mm;
333 double magicR=1500.0*mm;
334 if (x*x+y*y > magicR*magicR) {
335 m_c->x = x;
336 m_c->y = y;
337 m_c->z = z;
338 hitsBarrel=true;
339 break;
340 }
341 else if (z*z > magicZ*magicZ) {
342 m_c->x = x;
343 m_c->y = y;
344 m_c->z = z;
345 //hitsEndcap=true;
346 break;
347 }
348 }
349
350 m_histos[3]->Fill( x );
351 m_histos[4]->Fill( y );
352 m_histos[5]->Fill( z );
353
354 // You have an x,y, and z position. Now go and get the Element corresponding to
355 // that hit position. There are four, one for each sampling layer:
356 double radImpact = std::sqrt(x*x+y*y+z*z);
357 double phiImpact = std::atan2(y,x);
358 double thetaImpact = std::acos(z/radImpact);
359 double etaImpact = -std::log(std::tan(thetaImpact/2));
360
361 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey, ctx};
362 ATH_CHECK(caloMgrHandle.isValid());
363 const CaloDetDescrManager* caloMgr = *caloMgrHandle;
364 const CaloDetDescrElement *element[15]={nullptr};
365
366 for (int i=0;i<4;i++) {
367 try {
368 element[i] = caloMgr->get_element(CaloCell_ID::LAREM,i, hitsBarrel, etaImpact, phiImpact);
369 }
370 catch (const LArID_Exception & e) {
371 std::cerr << "SingleTrackValidation EXCEPTION (LAREM)" << e.message() << std::endl;
372 }
373 }
374 for (int i=0;i<4;i++) {
375 try {
376 element[i+4] = caloMgr->get_element(CaloCell_ID::LAREM,i, hitsBarrel, etaImpact, phiImpact);
377 }
378 catch (const LArID_Exception & e) {
379 std::cerr << "SingleTrackValidation EXCEPTION (LAREM)" << e.message() << std::endl;
380 }
381 }
382 for (int i=0;i<4;i++) {
383 try {
384 element[i+8] = caloMgr->get_element(CaloCell_ID::LARHEC,i, hitsBarrel, etaImpact, phiImpact);
385 }
386 catch (const LArID_Exception & e) {
387 std::cerr << "SingleTrackValidation EXCEPTION in (LARHEC)" << e.message() << std::endl;
388 }
389 }
390 for (int i=1;i<4;i++) {
391 try {
392 element[i+11] = caloMgr->get_element(CaloCell_ID::LARFCAL,i, hitsBarrel, etaImpact, phiImpact);
393 }
394 catch (const LArID_Exception & e) {
395 std::cerr << "SingleTrackValidation EXCEPTIONin LARFCAL" << e.message() << std::endl;
396 }
397 }
398
399
400 // Now go and find out how much energy is there:
401 for (int z=0;z<15;z++){
402 m_c->s_c00[z]=0;
403 m_c->s_t00[z]=0;
404 }
405
406 std::string lArKey = hitsBarrel ? "LArHitEMB" : "LArHitEMEC" ;
407
408 double eSum [15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
409 double eEta [15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
410 double eEtaEta [15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
411 double ePhi [15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
412 double ePhiPhi [15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
413 int hit_count [15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
414 double eX [15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
415 double eXX [15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
416 double eY [15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
417 double eYY [15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
418 double c00 [15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
419 double t00 [15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
420 // double width [15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
421 double e_dep = 0;
422
423 for (int i=0;i<4;i++) { // Loop over the four LAr collections
424 if (i==0) {
425 lArKey="LArHitEMB";
426 } else if (i==1) {
427 lArKey="LArHitEMEC";
428 } else if (i==2) {
429 lArKey="LArHitHEC";
430 } else if (i==3) {
431 lArKey="LArHitFCAL";
432 }
433
434 SG::ReadHandle<LArHitContainer> larHitContainer(lArKey, "StoreGateSvc");
435 if (larHitContainer.isValid()) {
436 for (const LArHit* larHit : *larHitContainer) {
437 const CaloDetDescrElement *hitElement = caloMgr->get_element(larHit->cellID());
438 int samplingLayer = m_c->cellId->sampling(larHit->cellID());
439 double energy = larHit->energy();
440
441 for (int j=0;j<15;j++) {
442 if (hitElement==element[j]) {
443 c00[j] += energy;
444 }
445 }
446
447 if (lArKey=="LArHitEMEC") samplingLayer += 4;
448 else if (lArKey=="LArHitHEC") samplingLayer += 8;
449 else if (lArKey=="LArHitFCAL") samplingLayer += 11;
450
451 // Calculate phi of hit w.r.t phiImpact
452 // to avoid problems due to the 2pi modulus of phi
453 // we are thus calculating deltaphi directly, so don't subtract phiImpact again later
454 double hitPhi = hitElement->phi() - phiImpact;
455 if (hitPhi < -pi) hitPhi += twopi;
456 if (hitPhi > pi) hitPhi -= twopi;
457
458 eSum [samplingLayer]+=energy;
459 eEta [samplingLayer]+=energy*hitElement->eta();
460 eEtaEta [samplingLayer]+=energy*hitElement->eta()*hitElement->eta();
461 ePhi [samplingLayer]+=energy*hitPhi;
462 ePhiPhi [samplingLayer]+=energy*hitPhi*hitPhi;
463 eX [samplingLayer]+=energy*hitElement->x();
464 eXX [samplingLayer]+=energy*hitElement->x()*hitElement->x();
465 eY [samplingLayer]+=energy*hitElement->y();
466 eYY [samplingLayer]+=energy*hitElement->y()*hitElement->y();
467 t00 [samplingLayer]+=energy*larHit->time();
468 hit_count[samplingLayer]+=1;
469 }
470 }
471 }
472
473 for (int i=0;i<15;i++) {
474 if (eSum[i]!=0) eEta[i] /= eSum[i];
475 if (eSum[i]!=0) eEtaEta[i] /= eSum[i];
476 if (eSum[i]!=0) ePhi[i] /= eSum[i];
477 if (eSum[i]!=0) ePhiPhi[i] /= eSum[i];
478 if (eSum[i]!=0) eY[i] /= eSum[i];
479 if (eSum[i]!=0) eYY[i] /= eSum[i];
480 if (eSum[i]!=0) eX[i] /= eSum[i];
481 if (eSum[i]!=0) eXX[i] /= eSum[i];
482 if (eSum[i]!=0) t00[i] /= eSum[i];
483 e_dep+=eSum[i];
484 }
485
486 double dThetaDEta = -1.0/cosh(etaImpact);
487
488 //Fill the E Sum, center cell E, hit count fields:
489 m_c->E_Deposit=e_dep;
490 for (int z=0;z<15;z++){
491 m_c->s_sumE[z]=eSum[z];
492 m_c->s_c00[z]=c00[z];
493 m_c->s_t00[z]=t00[z];
494 m_c->s_hits[z]=hit_count[z];
495 if (z<12){
496 m_c->s_deltaPhi[z]=radImpact*std::sin(thetaImpact)*(ePhi[z]);
497 m_c->s_sigmaPhi[z]=radImpact*std::sin(thetaImpact)*std::sqrt(ePhiPhi[z]- ePhi[z]*ePhi[z]);
498 m_c->s_deltaEta[z]=radImpact*dThetaDEta*(eEta[z]-etaImpact);
499 m_c->s_sigmaEta[z]=radImpact*std::fabs(dThetaDEta)*std::sqrt(eEtaEta[z]- eEta[z]*eEta[z]);
500 } else {
501 m_c->s_deltaPhi[z]=(eX[z]-x);
502 m_c->s_sigmaPhi[z]=std::sqrt(eXX[z]- eX[z]*eX[z]);
503 m_c->s_deltaEta[z]=(eY[z]-y);
504 m_c->s_sigmaEta[z]=std::sqrt(eYY[z]-eY[z]*eY[z]);
505 }
506 m_c->s_widthX[z]=std::sqrt(eXX[z]-eX[z]*eX[z]);
507 m_c->s_widthY[z]=std::sqrt(eYY[z]-eY[z]*eY[z]);
508 }
509
510 m_histos[161]->Fill(e_dep/Units::GeV);
511 for (int i=0;i<15;i++){
512 m_histos[6+i]->Fill( c00[i]/Units::GeV );
513 m_histos[21+i]->Fill( hit_count[i] );
514 m_histos[36+i]->Fill( eSum[i]/Units::GeV );
515 m_histos[111+i]->Fill( t00[i] );
516 m_histos[126+i]->Fill( sqrt(eXX[i]-eX[i]*eX[i]) );
517 m_histos[141+i]->Fill( sqrt(eYY[i]-eY[i]*eY[i]) );
518 if (i<8){
519 m_histos[51+i]->Fill( radImpact*std::sin(thetaImpact)*ePhi[i] );
520 m_histos[66+i]->Fill( radImpact*std::sin(thetaImpact)*std::sqrt(ePhiPhi[i]-ePhi[i]*ePhi[i]) );
521 m_histos[81+i]->Fill( radImpact*dThetaDEta*(eEta[i]-etaImpact) );
522 m_histos[96+i]->Fill( radImpact*std::fabs(dThetaDEta)*std::sqrt(eEtaEta[i]-eEta[i]*eEta[i]) );
523 } else {
524 m_histos[51+i]->Fill( eX[i]-x );
525 m_histos[66+i]->Fill( std::sqrt(eXX[i]-eX[i]*eX[i]) );
526 m_histos[81+i]->Fill( eY[i]-y );
527 m_histos[96+i]->Fill( std::sqrt(eYY[i]-eY[i]*eY[i]) );
528 }
529 }
530
531 ATH_CHECK(ntupleSvc()->writeRecord(m_c->nt));
532
533 }
534
535 m_c->cpuTime= getCpu();
536
537 return StatusCode::SUCCESS;
538
539}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
double charge(const T &p)
Definition AtlasPID.h:997
INTupleSvc * ntupleSvc()
int getCpu()
#define pi
#define y
#define x
#define z
constexpr double twopi
void getInitializedCache(MagField::AtlasFieldCache &cache) const
get B field cache for evaluation as a function of 2-d or 3-d position.
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
SG::ReadHandleKey< McEventCollection > m_truthKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
std::vector< HepMC3::GenParticlePtr >::const_iterator begin(HepMC3::GenEvent &e)
Definition GenEvent.h:355
HepMC3::GenEvent GenEvent
Definition GenEvent.h:39
double charge(const T &p)
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ finalize()

StatusCode SingleTrackValidation::finalize ( )
override

Definition at line 541 of file SingleTrackValidation.cxx.

541 {
542 return StatusCode::SUCCESS;
543}

◆ initialize()

StatusCode SingleTrackValidation::initialize ( )
override

Definition at line 117 of file SingleTrackValidation.cxx.

117 {
118 std::string names[162] = { "eta", "pt", "phi", "pos_x", "pos_y", "pos_z",
119 "emb0_cell", "emb1_cell", "emb2_cell", "emb3_cell", "emec0_cell", "emec1_cell", "emec2_cell", "emec3_cell",
120 "hec0_cell", "hec1_cell", "hec2_cell", "hec3_cell", "fc1_cell", "fc2_cell", "fc3_cell",
121 "emb0_hits", "emb1_hits", "emb2_hits", "emb3_hits", "emec0_hits", "emec1_hits", "emec2_hits", "emec3_hits",
122 "hec0_hits", "hec1_hits", "hec2_hits", "hec3_hits", "fc1_hits", "fc2_hits", "fc3_hits",
123 "emb0_sumE", "emb1_sumE", "emb2_sumE", "emb3_sumE", "emec0_sumE", "emec1_sumE", "emec2_sumE", "emec3_sumE",
124 "hec0_sumE", "hec1_sumE", "hec2_sumE", "hec3_sumE", "fc1_sumE", "fc2_sumE", "fc3_sumE",
125 "emb0_dPhi", "emb1_dPhi", "emb2_dPhi", "emb3_dPhi", "emec0_dPhi", "emec1_dPhi", "emec2_dPhi", "emec3_dPhi",
126 "hec0_dPhi", "hec1_dPhi", "hec2_dPhi", "hec3_dPhi", "fc1_dX", "fc2_dX", "fc3_dX",
127 "emb0_sPhi", "emb1_sPhi", "emb2_sPhi", "emb3_sPhi", "emec0_sPhi", "emec1_sPhi", "emec2_sPhi", "emec3_sPhi",
128 "hec0_sPhi", "hec1_sPhi", "hec2_sPhi", "hec3_sPhi", "fc1_sX", "fc2_sX", "fc3_sX",
129 "emb0_dEta", "emb1_dEta", "emb2_dEta", "emb3_dEta", "emec0_dEta", "emec1_dEta", "emec2_dEta", "emec3_dEta",
130 "hec0_dEta", "hec1_dEta", "hec2_dEta", "hec3_dEta", "fc1_dY", "fc2_dY", "fc3_dY",
131 "emb0_sEta", "emb1_sEta", "emb2_sEta", "emb3_sEta", "emec0_sEta", "emec1_sEta", "emec2_sEta", "emec3_sEta",
132 "hec0_sEta", "hec1_sEta", "hec2_sEta", "hec3_sEta", "fc1_sY", "fc2_sY", "fc3_sY",
133 "emb0_time", "emb1_time", "emb2_time", "emb3_time", "emec0_time", "emec1_time", "emec2_time", "emec3_time",
134 "hec0_time", "hec1_time", "hec2_time", "hec3_time", "fc1_time", "fc2_time", "fc3_time",
135 "emb0_widthX", "emb1_widthX", "emb2_widthX", "emb3_widthX", "emec0_widthX", "emec1_widthX", "emec2_widthX", "emec3_widthX",
136 "hec0_widthX", "hec1_widthX", "hec2_widthX", "hec3_widthX", "fc1_widthX", "fc2_widthX", "fc3_widthX",
137 "emb0_widthY", "emb1_widthY", "emb2_widthY", "emb3_widthY", "emec0_widthY", "emec1_widthY", "emec2_widthY", "emec3_widthY",
138 "hec0_widthY", "hec1_widthY", "hec2_widthY", "hec3_widthY", "fc1_widthY", "fc2_widthY", "fc3_widthY",
139 "cpuTime", "Energy", "PDG_ID", "RunNo", "EventNo", "E_Dep" };
140
141 double lim[162][2] = { {0,5}, {0,100}, {-4,4}, {-1600,1600}, {-1600,1600}, {-4000,4000},
142 {0,0.25}, {0,3}, {0,6}, {0,0.1}, {0,0.25}, {0,2}, {0,3}, {0,0.1}, {0,1}, {0,10}, {0,10}, {0,10}, {0,0.1}, {0,0.1}, {0,0.1}, //cell
143 {0,100}, {0,600}, {0,600}, {0,50}, {0,50}, {0,400}, {0,500}, {0,200}, {0,100}, {0,1000}, {0,1000}, {0,100}, {0,150}, {0,50}, {0,10}, //hits
144 {0,0.4}, {0,5}, {0,10}, {0,0.2}, {0,0.1}, {0,3}, {0,5}, {0,0.2}, {0,1}, {0,10}, {0,10}, {0,0.1}, {0,1}, {0,0.1}, {0,0.1}, //sumE
145 {-500,500}, {-100,100}, {-15,15}, {-200,200}, {-3000,3000}, {-60,60}, {-25,25}, {-200,200}, {-50,50}, {-50,50}, {-50,50}, {-50,50}, {-60,60}, {-500,500}, {-200,200}, //dPhi
146 {0,1000}, {0,500}, {0,200}, {0,500}, {0,2000}, {0,250}, {0,300}, {0,500}, {0,200}, {0,200}, {0,200}, {0,200}, {0,100}, {0,100}, {0,50}, //sPhi
147 {-150,150}, {-15,15}, {-20,20}, {-200,200}, {-0,2500}, {-50,20}, {-15,15}, {-150,150}, {-50,50}, {-50,50}, {-50,50}, {-50,50}, {-60,60}, {-500,500}, {-200,200}, //dEta
148 {0,500}, {0,100}, {0,100}, {0,400}, {0,1000}, {0,150}, {0,100}, {0,400}, {0,200}, {0,200}, {0,200}, {0,200}, {0,60}, {0,100}, {0,50}, //sPhi
149 {0,750}, {0,25}, {0,20}, {0,1000}, {0,10000}, {0,40}, {0,30}, {0,1000}, {0,1000}, {0,100}, {0,100}, {0,200}, {0,10}, {0,500}, {0,100}, //time
150 {-150,150}, {-15,15}, {-20,20}, {-200,200}, {-0,2500}, {-50,20}, {-15,15}, {-150,150}, {-50,50}, {-50,50}, {-50,50}, {-50,50}, {-60,60}, {-500,500}, {-200,200}, //widthX
151 {-150,150}, {-15,15}, {-20,20}, {-200,200}, {-0,2500}, {-50,20}, {-15,15}, {-150,150}, {-50,50}, {-50,50}, {-50,50}, {-50,50}, {-60,60}, {-500,500}, {-200,200}, //widthY
152 {0,50}, {0,100}, {-25,25}, {0,10}, {0,1000}, {0,10}};
153
154 //-------------------------------------------------------------------------//
155 // //
156 // Initialize the Particle Property Service. This is necessary in order //
157 // to obtain charge & type & other properties of the primary particle and //
158 // other particles that may turn up in the debris. //
159 // //
160 ATH_CHECK(m_histSvc.retrieve());
161 m_c->histSvc = m_histSvc.get();
162 ATH_CHECK(detStore()->retrieve(m_c->cellId, "CaloCell_ID"));
163 ATH_CHECK(m_truthKey.initialize());
164 ATH_CHECK(m_caloMgrKey.initialize());
166
167 //----------------Now initialize the ntuples ----------------------//
168 // //
169 //==~ ~ ~==//
170 std::string filename="";
171 for (int i=0;i<162;i++){
172 m_histos[i] = new TH1F( names[i].data(), names[i].data(),50,lim[i][0],lim[i][1]);
173 filename = "/file1/Electron/";
174 filename.append(names[i]);
175 if (m_c->histSvc->regHist( filename.data() , m_histos[i] ).isFailure()){
176 ATH_MSG_WARNING( "Failed to register historam " << names[i] << ". Not sure what will happen now..." );
177 }
178 }
179
180
181 NTupleFilePtr file(ntupleSvc(),"/NTUPLES/FILE");
182 if (!file) throw std::runtime_error ("Ntuple MGR not open");
183 NTuple::Directory *col=ntupleSvc()->createDirectory("/NTUPLES/FILE/COL");
184 NTuplePtr nt(ntupleSvc(),"/NTUPLES/FILE/COL/SingleTrackValidation");
185 if (!nt) nt=ntupleSvc()->book(col, 1, CLID_ColumnWiseTuple, "SingleTrackValidation");
186
187 if (nt->addItem("Eta", m_c->eta ).isFailure() ||
188 nt->addItem("Pt", m_c->pt ).isFailure() ||
189 nt->addItem("BarrelX", m_c->x ).isFailure() ||
190 nt->addItem("BarrelY", m_c->y ).isFailure() ||
191 nt->addItem("BarrelZ", m_c->z ).isFailure() ||
192 nt->addItem("Phi", m_c->phi ).isFailure() ){
193 ATH_MSG_WARNING( "Registration of some of the ntuple branches failed. No idea what will happen next..." );
194 }
195
196
197 char title[80];
198
199 // Indices from 0 to 11: 4 EMB, 4 EMEC, and 4 FCAL sampling layers
200 // Handling FCAL layers separately for different titles (could do
201 // something more complicated if we wanted)
202 for (int i=0;i<15;i++){
203 if (i<12) sprintf(title,"S%i_C00",i);
204 else sprintf(title,"FC%i_C00",i-11);
205 if (nt->addItem(title,m_c->s_c00[i]).isFailure()) ATH_MSG_INFO( "Registration of a branch failed in the ntupler..." );
206 if (i<12) sprintf(title,"S%i_SumE",i);
207 else sprintf(title,"FC%i_SumE",i-11);
208 if (nt->addItem(title,m_c->s_sumE[i]).isFailure()) ATH_MSG_INFO( "Registration of a branch failed in the ntupler..." );
209 if (i<12) sprintf(title,"S%i_Hits",i);
210 else sprintf(title,"FC%i_Hits",i-11);
211 if (nt->addItem(title,m_c->s_hits[i]).isFailure()) ATH_MSG_INFO( "Registration of a branch failed in the ntupler..." );
212 if (i<12) sprintf(title,"S%i_DeltaPhi",i);
213 else sprintf(title,"FC%i_DeltaX",i-11);
214 if (nt->addItem(title,m_c->s_deltaPhi[i]).isFailure()) ATH_MSG_INFO( "Registration of a branch failed in the ntupler..." );
215 if (i<12) sprintf(title,"S%i_SigmaPhi",i);
216 else sprintf(title,"FC%i_SigmaX",i-11);
217 if (nt->addItem(title,m_c->s_sigmaPhi[i]).isFailure()) ATH_MSG_INFO( "Registration of a branch failed in the ntupler..." );
218 if (i<12) sprintf(title,"S%i_DeltaEta",i);
219 else sprintf(title,"FC%i_DeltaY",i-11);
220 if (nt->addItem(title,m_c->s_deltaEta[i]).isFailure()) ATH_MSG_INFO( "Registration of a branch failed in the ntupler..." );
221 if (i<12) sprintf(title,"S%i_SigmaEta",i);
222 else sprintf(title,"FC%i_SigmaY",i-11);
223 if (nt->addItem(title,m_c->s_sigmaEta[i]).isFailure()) ATH_MSG_INFO( "Registration of a branch failed in the ntupler..." );
224 if (i<12) sprintf(title,"S%i_Time",i);
225 else sprintf(title,"FC%i_Time",i-11);
226 if (nt->addItem(title,m_c->s_t00[i]).isFailure()) ATH_MSG_INFO( "Registration of a branch failed in the ntupler..." );
227 if (i<12) sprintf(title,"S%i_WidthX",i);
228 else sprintf(title,"FC%i_WidthX",i-11);
229 if (nt->addItem(title,m_c->s_widthX[i]).isFailure()) ATH_MSG_INFO( "Registration of a branch failed in the ntupler..." );
230 if (i<12) sprintf(title,"S%i_WidthY",i);
231 else sprintf(title,"FC%i_WidthY",i-11);
232 if (nt->addItem(title,m_c->s_widthY[i]).isFailure()) ATH_MSG_INFO( "Registration of a branch failed in the ntupler..." );
233 }
234
235 if (nt->addItem("CPU" , m_c->cpuTime ).isFailure() ||
236 nt->addItem("TrackEnergy" , m_c->Energy ).isFailure() ||
237 nt->addItem("ParticleID" , m_c->PDG ).isFailure() ||
238 nt->addItem("Run#" , m_c->RunNo ).isFailure() ||
239 nt->addItem("Event#" , m_c->EventNo ).isFailure() ||
240 nt->addItem("DepositedEnergy", m_c->E_Deposit ).isFailure() ){
241 ATH_MSG_WARNING( "Registration of some of the ntuple branches failed. No idea what will happen next..." );
242 }
243
244 m_c->cpuTime=0.0;
245 m_c->nt = nt;
246
247 //==~ ~ ~==//
248 // //
249 //------------------------Done with initializations------------------------//
250
251 return StatusCode::SUCCESS;
252}
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
const ServiceHandle< StoreGateSvc > & detStore() const
ServiceHandle< ITHistSvc > m_histSvc
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
TFile * file

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ isReEntrant()

virtual bool AthAlgorithm::isReEntrant ( ) const
inlinefinaloverrideprotectedvirtualinherited

Legacy algorithms are not thread-safe.

Definition at line 47 of file AthAlgorithm.h.

47{ return false; }

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ operator=()

SingleTrackValidation & SingleTrackValidation::operator= ( const SingleTrackValidation & )
private

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Reimplemented in AthFilterAlgorithm.

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
virtual StatusCode sysInitialize() override
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_c

Clockwork* SingleTrackValidation::m_c
private

Definition at line 45 of file SingleTrackValidation.h.

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> SingleTrackValidation::m_caloMgrKey
private
Initial value:
{ this
, "CaloDetDescrManager"
, "CaloDetDescrManager"
, "SG Key for CaloDetDescrManager in the Condition Store" }

Definition at line 33 of file SingleTrackValidation.h.

33 { this
34 , "CaloDetDescrManager"
35 , "CaloDetDescrManager"
36 , "SG Key for CaloDetDescrManager in the Condition Store" };

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_fieldCacheCondObjInputKey

SG::ReadCondHandleKey<AtlasFieldCacheCondObj> SingleTrackValidation::m_fieldCacheCondObjInputKey
private
Initial value:
{this
, "AtlasFieldCacheCondObj"
, "fieldCondObj"
, "Name of the Magnetic Field conditions object key"}

Definition at line 39 of file SingleTrackValidation.h.

39 {this
40 , "AtlasFieldCacheCondObj"
41 , "fieldCondObj"
42 , "Name of the Magnetic Field conditions object key"};

◆ m_histos

TH1F* SingleTrackValidation::m_histos[162] {}
private

Definition at line 47 of file SingleTrackValidation.h.

47{};

◆ m_histSvc

ServiceHandle<ITHistSvc> SingleTrackValidation::m_histSvc { this, "THistSvc", "THistSvc", "Histogramming svc" }
private

Definition at line 43 of file SingleTrackValidation.h.

43{ this, "THistSvc", "THistSvc", "Histogramming svc" };

◆ m_truthKey

SG::ReadHandleKey<McEventCollection> SingleTrackValidation::m_truthKey { this, "TruthKey", "TruthEvent" }
private

Definition at line 31 of file SingleTrackValidation.h.

31{ this, "TruthKey", "TruthEvent" };

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: