24 declareInterface<IMaterialMapper>(
this);
34 for ( ; volTreeIter != endVolTreeIter;
delete (volTreeIter->second), ++volTreeIter) {}
41 for ( ; layTreeIter != endLayTreeIter;
delete (layTreeIter->second), ++layTreeIter) {}
45 for ( ; layTreeIter != endLayTreeIter;
delete (layTreeIter->second), ++layTreeIter) {}
52 for ( ; surfTreeIter != endSurfTreeIter;
delete (surfTreeIter->second), ++surfTreeIter) {}
70 return StatusCode::SUCCESS;
77 return StatusCode::SUCCESS;
93 ATH_MSG_WARNING(
"Could not associate TrackingVolume to material step!");
108 if(amhit.
A() != 0.0) {
109 (*volTreeObj).pathZARho += (amhit.
Z()/amhit.
A())*amhit.
rho()*amhit.
steplength();
129 if(amhit.
A() != 0.0) {
174 for ( ; volTreeIter != endVolTreeIter; ++volTreeIter ) {
178 if (!volTreeObj)
continue;
180 if ((*volTreeObj).path > 0.) {
185 (*volTreeObj).tree->Fill();
188 (*volTreeObj).
eta = 0.;
189 (*volTreeObj).phi = 0.;
190 (*volTreeObj).path = 0.;
191 (*volTreeObj).pathInX0 = 0.;
192 (*volTreeObj).pathInL0 = 0.;
193 (*volTreeObj).pathZARho = 0.;
216 double posX = pos.x();
217 double posY = pos.y();
218 double posZ = pos.z();
219 double posR = pos.perp();
220 double posEta = pos.eta();
223 (*layTreeObj).hitPositionX[(*layTreeObj).layerHits] = posX;
224 (*layTreeObj).hitPositionY[(*layTreeObj).layerHits] = posY;
225 (*layTreeObj).hitPositionZ[(*layTreeObj).layerHits] = posZ;
226 (*layTreeObj).hitPositionR[(*layTreeObj).layerHits] = posR;
227 (*layTreeObj).hitPositionEta[(*layTreeObj).layerHits] = posEta;
230 ++(*layTreeObj).layerHits;
231 ++(*layTreeObj).densedHits;
234 (*layTreeObj).densedHitX += posX;
235 (*layTreeObj).densedHitY += posY;
236 (*layTreeObj).densedHitZ += posZ;
237 (*layTreeObj).densedHitR += posR;
238 (*layTreeObj).densedHitPhi += pos.phi();
239 (*layTreeObj).densedHitTheta += pos.theta();
259 for (
size_t iltm = 0; iltm < 2; ++iltm) {
264 for ( ; layObjIter != endIter; ++layObjIter ) {
268 if (!layTreeObj)
continue;
271 int hits = (*layTreeObj).densedHits;
273 if ((*layTreeObj).pathInX0 > 0.) {
275 (*layTreeObj).densedHitX /= hits;
276 (*layTreeObj).densedHitY /= hits;
277 (*layTreeObj).densedHitZ /= hits;
278 (*layTreeObj).densedHitR /= hits;
279 (*layTreeObj).densedHitPhi /= hits;
280 (*layTreeObj).densedHitTheta /= hits;
281 (*layTreeObj).correctionFactor /= hits;
282 (*layTreeObj).A /= (*layTreeObj).rho;
283 (*layTreeObj).Z /= (*layTreeObj).rho;
284 (*layTreeObj).rho /= (*layTreeObj).path;
287 (*layTreeObj).tree->Fill();
290 (*layTreeObj).layerHits = 0;
291 (*layTreeObj).path = 0.;
292 (*layTreeObj).pathInX0 = 0.;
293 (*layTreeObj).pathInL0 = 0.;
294 (*layTreeObj).densedHits = 0;
295 (*layTreeObj).densedHitX = 0.;
296 (*layTreeObj).densedHitY = 0.;
297 (*layTreeObj).densedHitZ = 0.;
298 (*layTreeObj).densedHitR = 0.;
299 (*layTreeObj).densedHitPhi = 0.;
300 (*layTreeObj).densedHitTheta = 0.;
301 (*layTreeObj).correctionFactor = 0.;
302 (*layTreeObj).A = 0.;
303 (*layTreeObj).Z = 0.;
304 (*layTreeObj).rho = 0.;
323 (*surfTreeObj).loc1 += locpos[0];
324 (*surfTreeObj).loc2 += locpos[1];
334 ++(*surfTreeObj).surfaceHits;
350 for ( ; surfObjIter != endIter; ++surfObjIter ) {
353 int hits = (*surfTreeObj).surfaceHits;
355 if ((*surfTreeObj).pathInX0 > 0.) {
357 (*surfTreeObj).loc1 /= hits;
358 (*surfTreeObj).loc2 /= hits;
359 (*surfTreeObj).eta /= hits;
360 (*surfTreeObj).correctionFactor /= hits;
361 (*surfTreeObj).A /= hits;
362 (*surfTreeObj).Z /= hits;
363 (*surfTreeObj).rho /= hits;
366 (*surfTreeObj).tree->Fill();
369 (*surfTreeObj).loc1 = 0.;
370 (*surfTreeObj).loc2 = 0.;
371 (*surfTreeObj).eta = 0.;
373 (*surfTreeObj).correctionFactor = 0.;
374 (*surfTreeObj).path = 0.;
375 (*surfTreeObj).pathInX0 = 0.;
376 (*surfTreeObj).pathInL0 = 0.;
377 (*surfTreeObj).rho = 0.;
379 (*surfTreeObj).surfaceHits = 0;
395 if (findIter == endIter) {
398 tvolName.ReplaceAll(
"::",
"_");
400 TString treeName = tvolName;
403 if (!lay) treeName +=
"_UNMAPPED";
405 TString treeTitle =
"TrackingVolume : ";
406 treeTitle += tvolName;
407 if (!lay) treeTitle +=
" - UNMAPPED";
409 TString treeRegName =
"/val/";
410 treeRegName += treeName;
413 ATH_MSG_INFO(
" -> Booking it now with register name : " << treeRegName.Data() );
422 if (
m_histSvc->regTree(treeRegName.Data(), (*tvolTreeObj).tree).isFailure()) {
423 ATH_MSG_ERROR(
"initialize() Could not register the validation Tree -> Switching Tree output for this volume off !" );
424 delete tvolTreeObj; tvolTreeObj =
nullptr;
428 tvolTreeObj = findIter->second;
459 ATH_MSG_INFO(
"MaterialLayer from BoundarySurface detected.");
462 TString tvolName = (enclosingVolume) ? enclosingVolume->
volumeName() :
"BoundaryLayers";
463 tvolName.ReplaceAll(
"::",
"_");
465 TString treeName = tvolName;
470 "CylinderLayer_" :
"DiscLayer_";
471 if (full) treeName +=
"full_";
472 treeName += layerType;
473 if (mLayer) treeName +=
"boundary_";
476 TString treeTitle =
"TrackingVolume :";
477 treeTitle += tvolName;
479 TString treeRegName =
"/val/";
480 treeRegName += treeName;
483 ATH_MSG_INFO(
" -> Booking it now with register name : " << treeRegName.Data() );
487 else m_layerTrees.insert(std::make_pair(&lay,layTreeObj));
490 if (
m_histSvc->regTree(treeRegName.Data(), (*layTreeObj).tree).isFailure()) {
491 ATH_MSG_ERROR(
"initialize() Could not register the validation Tree -> Switching Tree output for this layer off !" );
492 delete layTreeObj; layTreeObj =
nullptr;
510 if (findIter == endIter) {
513 TString volumeName = (enclosingVolume) ? enclosingVolume->
volumeName() :
"Unknown";
518 TString treeTitle =
"TrackingVolume :";
519 treeTitle += volumeName;
521 TString treeRegName =
"/val/";
522 treeRegName += treeName;
525 <<
" in Volume '" << volumeName <<
"'." );
526 ATH_MSG_INFO(
" -> Booking it now with register name : " << treeRegName.Data() );
532 if (
m_histSvc->regTree(treeRegName.Data(), (*surfTreeObj).tree).isFailure()) {
533 ATH_MSG_INFO(
"initialize() Could not register the validation Tree -> Switching Tree output for this surface off !" );
534 delete surfTreeObj; surfTreeObj =
nullptr;
538 surfTreeObj = findIter->second;
616 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
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.
Gaudi::Property< bool > m_layerValidation
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.
Gaudi::Property< std::string > m_volumeTreePrefix
float m_averageEta
average eta
float m_mappedPath
total mapped path
std::map< const Trk::Layer *, LayerTreeObject * > m_layerFullTrees
Gaudi::Property< std::string > m_surfaceTreePrefix
std::map< const Trk::TrackingVolume *, VolumeTreeObject * > m_volumeTrees
float m_averagePhi
average ogu
void finalizeLayerHits() const
Finalize the SingleLayer Steps.
Gaudi::Property< std::string > m_validationTreeName
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
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.
int m_mapped[TRKDETDESCRTOOLS_MAXSTEPS]
mapped or not mapped
Gaudi::Property< std::string > m_validationTreeFolder
float m_materialStepRho[TRKDETDESCRTOOLS_MAXSTEPS]
step rho
std::map< const Trk::TrackingVolume *, VolumeTreeObject * > m_volumeTreesUnmapped
Gaudi::Property< bool > m_volumeValidation
float m_materialAccumPathZARho[TRKDETDESCRTOOLS_MAXSTEPS]
accumulated path length times (Z/A)*rho
int m_materialSteps
number of update positions
Gaudi::Property< unsigned int > m_maxMappingEvents
Gaudi::Property< bool > m_surfaceValidation
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
Gaudi::Property< std::string > m_validationTreeDescription
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
Gaudi::Property< std::string > m_layerTreePrefix
float m_mappedPathInX0
total mapped path in X0
float m_materialStepL0[TRKDETDESCRTOOLS_MAXSTEPS]
step l0
void recordMaterialHit(const AssociatedMaterial &amhit, const Amg::Vector3D &projectedPosition) const
Record material hit along the recording.
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
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.
-> simple helper struct for filling the Volume objects