43 declareInterface<IMaterialMapper>(
this);
74 for ( ; volTreeIter != endVolTreeIter;
delete (volTreeIter->second), ++volTreeIter) {}
81 for ( ; layTreeIter != endLayTreeIter;
delete (layTreeIter->second), ++layTreeIter) {}
85 for ( ; layTreeIter != endLayTreeIter;
delete (layTreeIter->second), ++layTreeIter) {}
92 for ( ; surfTreeIter != endSurfTreeIter;
delete (surfTreeIter->second), ++surfTreeIter) {}
110 return StatusCode::SUCCESS;
117 return StatusCode::SUCCESS;
133 ATH_MSG_WARNING(
"Could not associate TrackingVolume to material step!");
148 if(amhit.
A() != 0.0) {
149 (*volTreeObj).pathZARho += (amhit.
Z()/amhit.
A())*amhit.
rho()*amhit.
steplength();
169 if(amhit.
A() != 0.0) {
214 for ( ; volTreeIter != endVolTreeIter; ++volTreeIter ) {
218 if (!volTreeObj)
continue;
220 if ((*volTreeObj).path > 0.) {
225 (*volTreeObj).tree->Fill();
228 (*volTreeObj).
eta = 0.;
229 (*volTreeObj).phi = 0.;
230 (*volTreeObj).path = 0.;
231 (*volTreeObj).pathInX0 = 0.;
232 (*volTreeObj).pathInL0 = 0.;
233 (*volTreeObj).pathZARho = 0.;
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();
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;
270 ++(*layTreeObj).layerHits;
271 ++(*layTreeObj).densedHits;
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();
299 for (
size_t iltm = 0; iltm < 2; ++iltm) {
304 for ( ; layObjIter != endIter; ++layObjIter ) {
308 if (!layTreeObj)
continue;
311 int hits = (*layTreeObj).densedHits;
313 if ((*layTreeObj).pathInX0 > 0.) {
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;
327 (*layTreeObj).tree->Fill();
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.;
363 (*surfTreeObj).loc1 += locpos[0];
364 (*surfTreeObj).loc2 += locpos[1];
374 ++(*surfTreeObj).surfaceHits;
390 for ( ; surfObjIter != endIter; ++surfObjIter ) {
393 int hits = (*surfTreeObj).surfaceHits;
395 if ((*surfTreeObj).pathInX0 > 0.) {
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;
406 (*surfTreeObj).tree->Fill();
409 (*surfTreeObj).loc1 = 0.;
410 (*surfTreeObj).loc2 = 0.;
411 (*surfTreeObj).eta = 0.;
413 (*surfTreeObj).correctionFactor = 0.;
414 (*surfTreeObj).path = 0.;
415 (*surfTreeObj).pathInX0 = 0.;
416 (*surfTreeObj).pathInL0 = 0.;
417 (*surfTreeObj).rho = 0.;
419 (*surfTreeObj).surfaceHits = 0;
435 if (findIter == endIter) {
438 tvolName.ReplaceAll(
"::",
"_");
440 TString treeName = tvolName;
443 if (!lay) treeName +=
"_UNMAPPED";
445 TString treeTitle =
"TrackingVolume : ";
446 treeTitle += tvolName;
447 if (!lay) treeTitle +=
" - UNMAPPED";
449 TString treeRegName =
"/val/";
450 treeRegName += treeName;
453 ATH_MSG_INFO(
" -> Booking it now with register name : " << treeRegName.Data() );
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;
468 tvolTreeObj = findIter->second;
499 ATH_MSG_INFO(
"MaterialLayer from BoundarySurface detected.");
502 TString tvolName = (enclosingVolume) ? enclosingVolume->
volumeName() :
"BoundaryLayers";
503 tvolName.ReplaceAll(
"::",
"_");
505 TString treeName = tvolName;
510 "CylinderLayer_" :
"DiscLayer_";
511 if (full) treeName +=
"full_";
512 treeName += layerType;
513 if (mLayer) treeName +=
"boundary_";
516 TString treeTitle =
"TrackingVolume :";
517 treeTitle += tvolName;
519 TString treeRegName =
"/val/";
520 treeRegName += treeName;
523 ATH_MSG_INFO(
" -> Booking it now with register name : " << treeRegName.Data() );
527 else m_layerTrees.insert(std::make_pair(&lay,layTreeObj));
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;
550 if (findIter == endIter) {
553 TString volumeName = (enclosingVolume) ? enclosingVolume->
volumeName() :
"Unknown";
558 TString treeTitle =
"TrackingVolume :";
559 treeTitle += volumeName;
561 TString treeRegName =
"/val/";
562 treeRegName += treeName;
565 <<
" in Volume '" << volumeName <<
"'." );
566 ATH_MSG_INFO(
" -> Booking it now with register name : " << treeRegName.Data() );
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;
578 surfTreeObj = findIter->second;
656 ATH_MSG_ERROR(
"initialize() Could not register the validation Tree -> Switching ValidationMode Off !" );
Scalar mag() const
mag method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define TRKDETDESCRTOOLS_MAXLAYERHITS
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
Base Class for a Detector Layer in the Tracking realm.
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
int m_materialAssociationType
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
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
-> simple helper struct for filling the Volume objects