ATLAS Offline Software
Loading...
Searching...
No Matches
MaterialMapper.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6// MaterialMapper.cxx, (c) ATLAS Detector software
8
9// Trk include
17
18
19// constructor
20Trk::MaterialMapper::MaterialMapper(const std::string& t, const std::string& n, const IInterface* p)
21: AthAlgTool(t,n,p),
22 m_incidentSvc("IncidentSvc", n),
23 m_histSvc("THistSvc", n),
25 m_maxMappingEvents(100000),
27 m_totalMaterialTree("TotalMaterial"),
28 m_validationTree(nullptr),
29 m_validationTreeName("MaterialMapper"),
30 m_validationTreeDescription("Material Effects Updator information"),
31 m_validationTreeFolder("/val/MaterialMapper"),
37 m_volumeTreePrefix("VolumeMaterial"),
39 m_layerTreePrefix("LayerMaterial_"),
41 m_surfaceTreePrefix("SurfaceMaterial_")
42{
43 declareInterface<IMaterialMapper>(this);
44
45 // The maximum mapping events to control the output file size
46 declareProperty("MaximumMappingEvents", m_maxMappingEvents);
47 // specification for the Validation Tree
48 declareProperty("ValidationTreeName", m_validationTreeName);
49 declareProperty("ValidationTreeDescription", m_validationTreeDescription);
50 declareProperty("ValidationTreeFolder", m_validationTreeFolder);
51 // the total material statistics
52 declareProperty("TotalMaterialTreeName", m_totalMaterialTree);
53 // declare the association type
54 declareProperty("MaterialAssociationType", m_materialAssociationType);
55 // the volume validation
56 declareProperty("TrackingVolumeValidation", m_volumeValidation);
57 declareProperty("TrackingVolumeTreePrefix", m_volumeTreePrefix);
58 // the layer Validation
59 declareProperty("DetailedLayerValidation", m_layerValidation);
60 declareProperty("DetailedLayerTreePrefix", m_layerTreePrefix);
61 // the surface Validation
62 declareProperty("DetailedSurfaceValidation", m_surfaceValidation);
63 declareProperty("DetailedSurfaceTreePrefix", m_surfaceTreePrefix);
64
65}
66
67// destructor
69{
70 // memory cleanup
72 auto volTreeIter = m_volumeTrees.begin();
73 auto endVolTreeIter = m_volumeTrees.end();
74 for ( ; volTreeIter != endVolTreeIter; delete (volTreeIter->second), ++volTreeIter) {}
75 }
76
78 // delete the layer hit TTree
79 auto layTreeIter = m_layerTrees.begin();
80 auto endLayTreeIter = m_layerTrees.end();
81 for ( ; layTreeIter != endLayTreeIter; delete (layTreeIter->second), ++layTreeIter) {}
82 // delete the layer per event TTree
83 layTreeIter = m_layerFullTrees.begin();
84 endLayTreeIter = m_layerFullTrees.end();
85 for ( ; layTreeIter != endLayTreeIter; delete (layTreeIter->second), ++layTreeIter) {}
86 }
87
89 // finalize the Hit Tree
90 auto surfTreeIter = m_surfaceTrees.begin();
91 auto endSurfTreeIter = m_surfaceTrees.end();
92 for ( ; surfTreeIter != endSurfTreeIter; delete (surfTreeIter->second), ++surfTreeIter) {}
93 }
94}
95
96// Athena standard methods
97// initialize
99{
100
101 // Athena/Gaudi framework
102 ATH_CHECK( m_incidentSvc.retrieve() );
103 ATH_CHECK( m_histSvc.retrieve() );
104
105 // register to the incident service: EndEvent for histogram filling and reset
106 m_incidentSvc->addListener( this, IncidentType::EndEvent);
107
108 // book the Tree
110 return StatusCode::SUCCESS;
111}
112
113// finalize
115{
116 ATH_MSG_INFO( "finalize() successful" );
117 return StatusCode::SUCCESS;
118}
119
120void Trk::MaterialMapper::recordMaterialHit(const AssociatedMaterial& amhit, const Amg::Vector3D& projectedPosition) const
121{
122
124
125 // ----------------------------------- Recording Hits section --------------------------------
126 const Amg::Vector3D& position = amhit.materialPosition();
127
128 // get the tracking volume
129 const Trk::TrackingVolume* tvol = amhit.associatedTrackingVolume();
130 const Trk::Layer* lay = amhit.associatedLayer();
131
132 if (!tvol) {
133 ATH_MSG_WARNING("Could not associate TrackingVolume to material step!");
134 return;
135 }
136
137 // ----------------------------------- The Material Validation code --------------------------
138 const Trk::TrackingVolume* itvol = tvol;
139 while (itvol) {
140 // get the volume tree object
141 ATH_MSG_VERBOSE( "getting volTreeObj for: " << itvol->volumeName() << " at: " << itvol );
142 Trk::VolumeTreeObject* volTreeObj = volumeTreeObject(lay,itvol);
143 if (volTreeObj) {
144 // add the quantities
145 (*volTreeObj).path += amhit.steplength();
146 (*volTreeObj).pathInX0 += amhit.steplengthInX0();
147 (*volTreeObj).pathInL0 += amhit.steplengthInL0();
148 if(amhit.A() != 0.0) {
149 (*volTreeObj).pathZARho += (amhit.Z()/amhit.A())*amhit.rho()*amhit.steplength();
150 }
151 } else
152 ATH_MSG_WARNING( "Cannot find/create VolumeTreeObject for volume '" << itvol->volumeName() << "'." );
153 itvol = itvol->getMotherVolume();
154 if (itvol) ATH_MSG_VERBOSE( "motherVolume found: " << itvol->volumeName() );
155 }
156
157 // -------------------------------- main tree section -----------------------------------------
158 // eta / phi
159 m_averageEta += position.eta();
160 m_averagePhi += position.phi();
161 // effectively crossed Z/A*rho
162 double steplength = amhit.steplength();
163 // fill the variables for spatial information & event characteristics
164 if (lay) {
165 m_mappedPath += steplength;
168 m_mappedPathRho += amhit.rho()*steplength;
169 if(amhit.A() != 0.0) {
170 m_mappedPathZARho += (amhit.Z()/amhit.A())*amhit.rho()*steplength;
171 }
172 ATH_MSG_VERBOSE("[ MaterialMapper ] Accumulated Path in Rho (*Z/A) = " << m_mappedPathRho << " ( " << m_mappedPathZARho << " )");
173 } else
175
176 // mapping information
177 m_mapped[m_materialSteps] = lay ? lay->layerIndex().value() : 0;
178 // the position & step information
190 m_materialStepPositionR[m_materialSteps] = position.perp();
191 // record the projected position as well
192 m_materialProjPositionX[m_materialSteps] = projectedPosition.x();
193 m_materialProjPositionY[m_materialSteps] = projectedPosition.y();
194 m_materialProjPositionZ[m_materialSteps] = projectedPosition.z();
195 m_materialProjPositionR[m_materialSteps] = projectedPosition.perp();
196 m_materialProjDistance[m_materialSteps] = (position-projectedPosition).mag();
197 // and increase the number of steps
199
200
201 // record the layer hit
203}
204
205
207{
208 ATH_MSG_VERBOSE( "finalizeEvent() on Volume hits " );
209
210 auto volTreeIter = mapped ? m_volumeTrees.begin() : m_volumeTreesUnmapped.begin();
211 auto endVolTreeIter = mapped ? m_volumeTrees.end() : m_volumeTreesUnmapped.end();
212
213 // do the loop
214 for ( ; volTreeIter != endVolTreeIter; ++volTreeIter ) {
215
216 Trk::VolumeTreeObject* volTreeObj = volTreeIter->second;
217
218 if (!volTreeObj) continue;
219
220 if ((*volTreeObj).path > 0.) {
221 // spatial mapping
222 (*volTreeObj).eta = m_averageEta;
223 (*volTreeObj).phi = m_averagePhi;
224 // fill the volume Tree Object
225 (*volTreeObj).tree->Fill();
226 }
227 // reset
228 (*volTreeObj).eta = 0.;
229 (*volTreeObj).phi = 0.;
230 (*volTreeObj).path = 0.;
231 (*volTreeObj).pathInX0 = 0.;
232 (*volTreeObj).pathInL0 = 0.;
233 (*volTreeObj).pathZARho = 0.;
234
235 }
236}
237
238
240{
241
243
244 const Trk::Layer* lay = amhit.associatedLayer();
245 if (m_layerValidation && lay) {
246 // try to find the histogram
247 Trk::LayerTreeObject* layTreeObj = layerTreeObject(*lay,full);
248 if (layTreeObj
250 && amhit.steplengthInX0() > 0.)
251 {
252
253 const Amg::Vector3D& pos = amhit.materialPosition();
254
255 // hit positions
256 double posX = pos.x();
257 double posY = pos.y();
258 double posZ = pos.z();
259 double posR = pos.perp();
260 double posEta = pos.eta();
261
262 // fill the hit position --------------------
263 (*layTreeObj).hitPositionX[(*layTreeObj).layerHits] = posX;
264 (*layTreeObj).hitPositionY[(*layTreeObj).layerHits] = posY;
265 (*layTreeObj).hitPositionZ[(*layTreeObj).layerHits] = posZ;
266 (*layTreeObj).hitPositionR[(*layTreeObj).layerHits] = posR;
267 (*layTreeObj).hitPositionEta[(*layTreeObj).layerHits] = posEta;
268
269 // increase the layer Hits
270 ++(*layTreeObj).layerHits;
271 ++(*layTreeObj).densedHits;
272
273 // fill the densed Hit position ---------------
274 (*layTreeObj).densedHitX += posX;
275 (*layTreeObj).densedHitY += posY;
276 (*layTreeObj).densedHitZ += posZ;
277 (*layTreeObj).densedHitR += posR;
278 (*layTreeObj).densedHitPhi += pos.phi();
279 (*layTreeObj).densedHitTheta += pos.theta();
280
281 // fill the correction factor ------------------
282 (*layTreeObj).correctionFactor += amhit.correctionFactor();
283 (*layTreeObj).path += amhit.steplength();
284 (*layTreeObj).pathInX0 += amhit.steplengthInX0();
285 (*layTreeObj).pathInL0 += amhit.steplengthInL0();
286 (*layTreeObj).A += amhit.A() * amhit.rho() * amhit.steplength();
287 (*layTreeObj).Z += amhit.Z() * amhit.rho() * amhit.steplength();
288 (*layTreeObj).rho += amhit.rho() * amhit.steplength();
289
290 }
291 }
292}
293
295{
296
297 ATH_MSG_VERBOSE( "finalizeEvent() on Layer hits " );
298
299 for (size_t iltm = 0; iltm < 2; ++iltm) {
300 // loop over all layer Tree objects and fill them
301 auto layObjIter = iltm ? m_layerFullTrees.begin() : m_layerTrees.begin();
302 auto endIter = iltm ? m_layerFullTrees.end() : m_layerTrees.end();
303 // do the loop
304 for ( ; layObjIter != endIter; ++layObjIter ) {
305
306 Trk::LayerTreeObject* layTreeObj = layObjIter->second;
307
308 if (!layTreeObj) continue;
309
310 // get the number of single hits
311 int hits = (*layTreeObj).densedHits;
312
313 if ((*layTreeObj).pathInX0 > 0.) {
314 if (hits>1) {
315 (*layTreeObj).densedHitX /= hits;
316 (*layTreeObj).densedHitY /= hits;
317 (*layTreeObj).densedHitZ /= hits;
318 (*layTreeObj).densedHitR /= hits;
319 (*layTreeObj).densedHitPhi /= hits;
320 (*layTreeObj).densedHitTheta /= hits;
321 (*layTreeObj).correctionFactor /= hits;
322 (*layTreeObj).A /= (*layTreeObj).rho;
323 (*layTreeObj).Z /= (*layTreeObj).rho;
324 (*layTreeObj).rho /= (*layTreeObj).path;
325 }
326 // fill the layer Tree Object
327 (*layTreeObj).tree->Fill();
328 }
329 // reset
330 (*layTreeObj).layerHits = 0;
331 (*layTreeObj).path = 0.;
332 (*layTreeObj).pathInX0 = 0.;
333 (*layTreeObj).pathInL0 = 0.;
334 (*layTreeObj).densedHits = 0;
335 (*layTreeObj).densedHitX = 0.;
336 (*layTreeObj).densedHitY = 0.;
337 (*layTreeObj).densedHitZ = 0.;
338 (*layTreeObj).densedHitR = 0.;
339 (*layTreeObj).densedHitPhi = 0.;
340 (*layTreeObj).densedHitTheta = 0.;
341 (*layTreeObj).correctionFactor = 0.;
342 (*layTreeObj).A = 0.;
343 (*layTreeObj).Z = 0.;
344 (*layTreeObj).rho = 0.;
345 }
346 }
347}
348
349
351 const AssociatedMaterial& amhit) const
352{
353
355
356 const Trk::Layer* lay = amhit.associatedLayer();
357 if (m_surfaceValidation && lay) {
358 // try to find the histogram
359 Trk::SurfaceTreeObject* surfTreeObj = surfaceTreeObject(*lay);
360 // now fill
361 if (surfTreeObj) {
362 // fill it
363 (*surfTreeObj).loc1 += locpos[0];
364 (*surfTreeObj).loc2 += locpos[1];
365 (*surfTreeObj).eta += amhit.materialPosition().eta();
366 (*surfTreeObj).correctionFactor += amhit.correctionFactor();
367 (*surfTreeObj).path += amhit.steplength();
368 (*surfTreeObj).pathInX0 += amhit.steplengthInX0();
369 (*surfTreeObj).pathInL0 += amhit.steplengthInL0();
370 (*surfTreeObj).A += amhit.A()*amhit.steplength()*amhit.rho();
371 (*surfTreeObj).Z += amhit.Z()*amhit.steplength()*amhit.rho();
372 (*surfTreeObj).rho += amhit.rho()*amhit.steplength();
373 // increase the surface hits
374 ++(*surfTreeObj).surfaceHits;
375
376 }
377 }
378}
379
380
382{
383
384 ATH_MSG_VERBOSE( "finalizeEvent() on Surface hits " );
385
386 // loop over all layer Tree objects and fill them
387 auto surfObjIter = m_surfaceTrees.begin();
388 auto endIter = m_surfaceTrees.end();
389 // do the loop
390 for ( ; surfObjIter != endIter; ++surfObjIter ) {
391 Trk::SurfaceTreeObject* surfTreeObj = surfObjIter->second;
392 // get the number of single hits
393 int hits = (*surfTreeObj).surfaceHits;
394 // fill only if hits have been there
395 if ((*surfTreeObj).pathInX0 > 0.) {
396 if (hits>1) {
397 (*surfTreeObj).loc1 /= hits;
398 (*surfTreeObj).loc2 /= hits;
399 (*surfTreeObj).eta /= hits;
400 (*surfTreeObj).correctionFactor /= hits;
401 (*surfTreeObj).A /= hits;
402 (*surfTreeObj).Z /= hits;
403 (*surfTreeObj).rho /= hits;
404 }
405 // fill the tree
406 (*surfTreeObj).tree->Fill();
407 }
408 // reset
409 (*surfTreeObj).loc1 = 0.;
410 (*surfTreeObj).loc2 = 0.;
411 (*surfTreeObj).eta = 0.;
412
413 (*surfTreeObj).correctionFactor = 0.;
414 (*surfTreeObj).path = 0.;
415 (*surfTreeObj).pathInX0 = 0.;
416 (*surfTreeObj).pathInL0 = 0.;
417 (*surfTreeObj).rho = 0.;
418
419 (*surfTreeObj).surfaceHits = 0;
420
421 }
422}
423
424
426{
427 // try to find the histogram
428 auto endIter = lay ? m_volumeTrees.end() : m_volumeTreesUnmapped.end();
429 auto findIter = lay ? m_volumeTrees.end() : m_volumeTreesUnmapped.end();
430
431 Trk::VolumeTreeObject* tvolTreeObj = nullptr;
432
433 findIter = lay ? m_volumeTrees.find(tvol) : m_volumeTreesUnmapped.find(tvol);
434
435 if (findIter == endIter) {
436
437 TString tvolName = tvol->volumeName();
438 tvolName.ReplaceAll("::","_");
439
440 TString treeName = tvolName;
441 treeName += "_";
442 treeName += m_volumeTreePrefix;
443 if (!lay) treeName += "_UNMAPPED";
444
445 TString treeTitle = "TrackingVolume : ";
446 treeTitle += tvolName;
447 if (!lay) treeTitle += " - UNMAPPED";
448
449 TString treeRegName = "/val/";
450 treeRegName += treeName;
451
452 ATH_MSG_INFO( "No Tree found for " << treeTitle );
453 ATH_MSG_INFO( " -> Booking it now with register name : " << treeRegName.Data() );
454
455 tvolTreeObj = new Trk::VolumeTreeObject(treeName, treeTitle);
456 if (lay)
457 m_volumeTrees.insert(std::make_pair(tvol,tvolTreeObj));
458 else
459 m_volumeTreesUnmapped.insert(std::make_pair(tvol,tvolTreeObj));
460
461 // now register the Tree
462 if (m_histSvc->regTree(treeRegName.Data(), (*tvolTreeObj).tree).isFailure()) {
463 ATH_MSG_ERROR( "initialize() Could not register the validation Tree -> Switching Tree output for this volume off !" );
464 delete tvolTreeObj; tvolTreeObj = nullptr;
465 }
466
467 } else // a tree is found
468 tvolTreeObj = findIter->second;
469
470 return tvolTreeObj;
471}
472
473
475{
476 if (!lay.layerIndex().value()) return nullptr;
477
478 // try to find the histogram
479
480 Trk::LayerTreeObject* layTreeObj = nullptr;
481
482 if (full) {
483 auto it = m_layerFullTrees.find(&lay);
484 if (it != m_layerFullTrees.end()) {
485 return it->second;
486 }
487 }
488 else {
489 auto it = m_layerTrees.find(&lay);
490 if (it != m_layerTrees.end()) {
491 return it->second;
492 }
493 }
494
495 {
496 // check if it is a boundary MaterialLayer
497 const Trk::MaterialLayer* mLayer = dynamic_cast<const Trk::MaterialLayer*>(&lay);
498 if (mLayer)
499 ATH_MSG_INFO("MaterialLayer from BoundarySurface detected.");
500 // get the TrackingVolume
501 const Trk::TrackingVolume* enclosingVolume = lay.enclosingTrackingVolume();
502 TString tvolName = (enclosingVolume) ? enclosingVolume->volumeName() : "BoundaryLayers";
503 tvolName.ReplaceAll("::","_");
504
505 TString treeName = tvolName;
506 treeName += "_";
507 treeName += m_layerTreePrefix;
508
509 TString layerType = (lay.surfaceRepresentation().type() == Trk::SurfaceType::Cylinder) ?
510 "CylinderLayer_" : "DiscLayer_";
511 if (full) treeName += "full_";
512 treeName += layerType;
513 if (mLayer) treeName += "boundary_";
514 treeName += lay.layerIndex().value();
515
516 TString treeTitle = "TrackingVolume :";
517 treeTitle += tvolName;
518
519 TString treeRegName = "/val/";
520 treeRegName += treeName;
521
522 ATH_MSG_INFO( "No Tree found for Layer " << lay.layerIndex().value() << " in Volume '" << tvolName << "'.");
523 ATH_MSG_INFO( " -> Booking it now with register name : " << treeRegName.Data() );
524
525 layTreeObj = new Trk::LayerTreeObject(treeName, treeTitle);
526 if (full) m_layerFullTrees.insert(std::make_pair(&lay,layTreeObj));
527 else m_layerTrees.insert(std::make_pair(&lay,layTreeObj));
528
529 // now register the Tree
530 if (m_histSvc->regTree(treeRegName.Data(), (*layTreeObj).tree).isFailure()) {
531 ATH_MSG_ERROR( "initialize() Could not register the validation Tree -> Switching Tree output for this layer off !" );
532 delete layTreeObj; layTreeObj = nullptr;
533 }
534
535 }
536
537 return layTreeObj;
538}
539
540
542{
543 // try to find the histogram
544 auto endIter = m_surfaceTrees.end();
545 auto findIter = m_surfaceTrees.end();
546
547 Trk::SurfaceTreeObject* surfTreeObj = nullptr;
548
549 findIter = m_surfaceTrees.find(&lay);
550 if (findIter == endIter) {
551 // get the TrackingVolume
552 const Trk::TrackingVolume* enclosingVolume = lay.enclosingTrackingVolume();
553 TString volumeName = (enclosingVolume) ? enclosingVolume->volumeName() : "Unknown";
554
555 TString treeName = m_surfaceTreePrefix;
556 treeName += lay.layerIndex().value();
557
558 TString treeTitle = "TrackingVolume :";
559 treeTitle += volumeName;
560
561 TString treeRegName = "/val/";
562 treeRegName += treeName;
563
564 ATH_MSG_INFO( "No Tree found for Layer " << lay.layerIndex().value()
565 << " in Volume '" << volumeName << "'." );
566 ATH_MSG_INFO( " -> Booking it now with register name : " << treeRegName.Data() );
567
568 surfTreeObj = new Trk::SurfaceTreeObject(treeName, treeTitle);
569 m_surfaceTrees.insert(std::make_pair(&lay,surfTreeObj));
570
571 // now register the Tree
572 if (m_histSvc->regTree(treeRegName.Data(), (*surfTreeObj).tree).isFailure()) {
573 ATH_MSG_INFO( "initialize() Could not register the validation Tree -> Switching Tree output for this surface off !" );
574 delete surfTreeObj; surfTreeObj = nullptr;
575 }
576
577 } else // a tree is found
578 surfTreeObj = findIter->second;
579 return surfTreeObj;
580}
581
582
583void Trk::MaterialMapper::handle( const Incident& inc ) {
584 // check the incident type
585 if ( inc.type() == IncidentType::EndEvent && m_materialSteps){
586 // check if the hit collection already contains:
587 ATH_MSG_VERBOSE("EndEvent incident caught, finalize histogramns");
588 // average Eta / Phi
591 // (a) the volume validation
592 finalizeVolumeHits(true); // trees with mapped hits
593 finalizeVolumeHits(false); // trees with unmapped hits
594 // (b) the layer validation
596 // (c) the surface validation (reference material)
598 // fill the main TTree & reset
599 m_validationTree->Fill();
600 // initialize the eta/phi
601 m_averageEta = 0.;
602 m_averagePhi = 0.;
603 // initialize the rest
604 m_materialSteps = 0;
605 m_mappedPath = 0.;
606 m_mappedPathInX0 = 0.;
607 m_mappedPathInL0 = 0.;
608 m_mappedPathRho = 0.;
609 m_mappedPathZARho = 0.;
610 // increate counter
612 }
613 }
614
615
617{
618
619 ATH_MSG_INFO( "Booking the Validation Tree ... " );
620
621 // (1) Main MaterialMapper TTree
622 // ------------- validation section ------------------------------------------
624
625 // position coordinates of the update
626 m_validationTree->Branch("Eta", &m_averageEta, "averageEta/F");
627 m_validationTree->Branch("Phi", &m_averagePhi, "averagePhiF");
628 m_validationTree->Branch("Path", &m_mappedPath, "path/F");
629 m_validationTree->Branch("PathInX0", &m_mappedPathInX0, "pathInX0/F");
630 m_validationTree->Branch("PathInL0", &m_mappedPathInL0, "pathInL0/F");
631 m_validationTree->Branch("PathRho", &m_mappedPathRho, "pathRho/F");
632 m_validationTree->Branch("PathZARho", &m_mappedPathZARho, "pathZARho/F");
633 m_validationTree->Branch("UnmappedPathInX0", &m_unmappedPathInX0, "unmappedPathInX0/F");
634 m_validationTree->Branch("MaterialSteps", &m_materialSteps, "steps/I");
635 m_validationTree->Branch("Mapped", m_mapped, "mapped[steps]/I");
636 m_validationTree->Branch("MaterialAccumPathInX0", m_materialAccumPathInX0, "materialAccumPinX0[steps]/F");
637 m_validationTree->Branch("MaterialAccumPathZARho", m_materialAccumPathZARho, "materialAccumPZARho[steps]/F");
638 m_validationTree->Branch("MaterialStepPath", m_materialStepPath, "materialStepPath[steps]/F");
639 m_validationTree->Branch("MaterialStepX0", m_materialStepX0, "materialStepX0[steps]/F");
640 m_validationTree->Branch("MaterialStepL0", m_materialStepL0, "materialStepL0[steps]/F");
641 m_validationTree->Branch("MaterialStepZ", m_materialStepZ, "materialStepZ[steps]/F");
642 m_validationTree->Branch("MaterialStepA", m_materialStepA, "materialStepA[steps]/F");
643 m_validationTree->Branch("MaterialStepRho", m_materialStepRho, "materialStepRho[steps]/F");
644 m_validationTree->Branch("MaterialStepPositionX", m_materialStepPositionX , "materialStepX[steps]/F");
645 m_validationTree->Branch("MaterialStepPositionY", m_materialStepPositionY , "materialStepY[steps]/F");
646 m_validationTree->Branch("MaterialStepPositionZ", m_materialStepPositionZ , "materialStepZ[steps]/F");
647 m_validationTree->Branch("MaterialStepPositionR", m_materialStepPositionR , "materialStepR[steps]/F");
648 m_validationTree->Branch("MaterialProjPositionX", m_materialProjPositionX , "materialProjX[steps]/F");
649 m_validationTree->Branch("MaterialProjPositionY", m_materialProjPositionY , "materialProjY[steps]/F");
650 m_validationTree->Branch("MaterialProjPositionZ", m_materialProjPositionZ , "materialProjZ[steps]/F");
651 m_validationTree->Branch("MaterialProjPositionR", m_materialProjPositionR , "materialProjR[steps]/F");
652 m_validationTree->Branch("MaterialProjDistance", m_materialProjDistance , "materialProjD[steps]/F");
653
654 // now register the Tree
655 if (m_histSvc->regTree(m_validationTreeFolder.c_str(), m_validationTree).isFailure()) {
656 ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !" );
657 delete m_validationTree; m_validationTree = nullptr;
658 return;
659 }
660
661 ATH_MSG_INFO( " ... successful." );
662
663}
664
665
Scalar mag() const
mag method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define TRKDETDESCRTOOLS_MAXLAYERHITS
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
It is used in the Mapping process ( using MaterialSteps ), the validation and recostruction ( using M...
double x0() const
Access method : material X0/A/Z/rho.
const Trk::Layer * associatedLayer() const
Trivial Access methods.
double steplengthInX0() const
Access method : steplength.
double steplength() const
Access method : steplength.
double steplengthInL0() const
Access method : steplength.
const Trk::TrackingVolume * associatedTrackingVolume() const
Trivial Access methods.
const Amg::Vector3D & materialPosition() const
Trivial Access methods.
double correctionFactor() const
Trivial Access methods.
int value() const
layerIndex expressed in an integer
Definition LayerIndex.h:71
Base Class for a Detector Layer in the Tracking realm.
Definition Layer.h:72
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
const LayerIndex & layerIndex() const
get the layerIndex
const TrackingVolume * enclosingTrackingVolume() const
get the confining TrackingVolume
A material layer is a simple helper class to attach material information to a boundary surface.
std::string m_validationTreeFolder
stream/folder to for the TTree to be written out
std::string m_layerTreePrefix
float m_materialProjPositionY[TRKDETDESCRTOOLS_MAXSTEPS]
y position of the material recording when assigned to layer
float m_unmappedPathInX0
total path in x0 in these events lost
float m_materialStepPositionY[TRKDETDESCRTOOLS_MAXSTEPS]
y position of the material recording
void recordSurfaceHit(const Amg::Vector2D &locpos, const AssociatedMaterial &amhit) const
Record material hit on a surface.
void bookValidationTree()
Validation : book the Tree.
StatusCode finalize()
AlgTool finalize method.
float m_averageEta
average eta
float m_mappedPath
total mapped path
std::map< const Trk::Layer *, LayerTreeObject * > m_layerFullTrees
std::string m_surfaceTreePrefix
std::map< const Trk::TrackingVolume *, VolumeTreeObject * > m_volumeTrees
float m_averagePhi
average ogu
void finalizeLayerHits() const
Finalize the SingleLayer Steps.
void recordLayerHit(const AssociatedMaterial &amhit, bool full=false) const
Record material hit - if various hits per uniform layer are recorded, or if you want to record one fu...
float m_mappedPathRho
total mapped path times rho
float m_mappedPathInL0
total mapped path in L0
ServiceHandle< ITHistSvc > m_histSvc
TTree * m_validationTree
The validation tree.
virtual ~MaterialMapper()
Virtual destructor.
float m_materialAccumPathInX0[TRKDETDESCRTOOLS_MAXSTEPS]
accumulated path length in x0
StatusCode initialize()
AlgTool initialize method.
LayerTreeObject * layerTreeObject(const Layer &lay, bool full=false) const
find (&&,||) create the LayerTreeObject
unsigned int m_processedEvents
float m_materialStepX0[TRKDETDESCRTOOLS_MAXSTEPS]
step x0
ServiceHandle< IIncidentSvc > m_incidentSvc
float m_materialProjPositionX[TRKDETDESCRTOOLS_MAXSTEPS]
x position of the material recording when assigned to layer
MaterialMapper(const std::string &, const std::string &, const IInterface *)
AlgTool like constructor.
void finalizeVolumeHits(bool mapped=true) const
Finalize the Volume Steps.
float m_materialStepZ[TRKDETDESCRTOOLS_MAXSTEPS]
step Z
float m_materialStepPositionX[TRKDETDESCRTOOLS_MAXSTEPS]
x position of the material recording
SurfaceTreeObject * surfaceTreeObject(const Layer &lay) const
find (&&,||) create the LayerTreeObject
std::string m_validationTreeDescription
validation tree description - second argument in TTree
float m_materialProjDistance[TRKDETDESCRTOOLS_MAXSTEPS]
the distance to the projected hit
float m_mappedPathZARho
total mapped path times (Z/A)*rho
void finalizeSurfaceHits() const
Finalize the SingleLayer Steps.
void handle(const Incident &inc)
Handle the incident from the incident service.
unsigned int m_maxMappingEvents
int m_mapped[TRKDETDESCRTOOLS_MAXSTEPS]
mapped or not mapped
float m_materialStepRho[TRKDETDESCRTOOLS_MAXSTEPS]
step rho
std::map< const Trk::TrackingVolume *, VolumeTreeObject * > m_volumeTreesUnmapped
float m_materialAccumPathZARho[TRKDETDESCRTOOLS_MAXSTEPS]
accumulated path length times (Z/A)*rho
int m_materialSteps
number of update positions
float m_materialProjPositionR[TRKDETDESCRTOOLS_MAXSTEPS]
r value of the material recording when assigned to layer
float m_materialStepPositionR[TRKDETDESCRTOOLS_MAXSTEPS]
r value of the material recording
float m_materialStepA[TRKDETDESCRTOOLS_MAXSTEPS]
step A
VolumeTreeObject * volumeTreeObject(const Layer *lay=0, const TrackingVolume *tvol=0) const
find (&&,||) create a VolumeTreObject
float m_materialStepPath[TRKDETDESCRTOOLS_MAXSTEPS]
step path
float m_mappedPathInX0
total mapped path in X0
float m_materialStepL0[TRKDETDESCRTOOLS_MAXSTEPS]
step l0
std::string m_validationTreeName
validation tree name - to be accessed by this from root
void recordMaterialHit(const AssociatedMaterial &amhit, const Amg::Vector3D &projectedPosition) const
Record material hit along the recording.
std::string m_volumeTreePrefix
std::string m_totalMaterialTree
float m_materialProjPositionZ[TRKDETDESCRTOOLS_MAXSTEPS]
z position of the material recording when assigned to layer
float m_materialStepPositionZ[TRKDETDESCRTOOLS_MAXSTEPS]
z position of the material recording
std::map< const Trk::Layer *, LayerTreeObject * > m_layerTrees
std::map< const Trk::Layer *, SurfaceTreeObject * > m_surfaceTrees
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
const TrackingVolume * getMotherVolume() const
Return the MotherVolume - if it exists.
const std::string & volumeName() const
Returns the VolumeName - for debug reason, might be depreciated later.
std::vector< std::string > mapped
Definition hcg.cxx:54
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
-> simple helper struct for filling the Volume objects