8 #include <tracking/modules/trackFinderVXDTests/StudyMaterialEffectsModule.h>
10 #include <framework/pcore/ProcHandler.h>
11 #include <framework/logging/Logger.h>
13 #include <mdst/dataobjects/MCParticle.h>
14 #include <svd/dataobjects/SVDCluster.h>
16 #include <vxd/geometry/SensorInfoBase.h>
30 setDescription(
"StudyMaterialEffects- should be used with single track pGuns and without magnetic field.");
32 setPropertyFlags(c_ParallelProcessingCertified | c_TerminateInAllProcesses);
36 void StudyMaterialEffectsModule::initialize()
38 m_spacePoints.isRequired(
"spacePoints");
40 m_file =
new TFile(
"materialStudy.root",
"RECREATE");
44 m_tree.registerInDataStore();
45 m_tree.construct(
"materialEffectsStudyTree",
"Raw data of two-hit-combinations for a sectorMap");
47 m_tree->get().Branch(
"ResidualPhiL3L3", &(m_PhiL3L3));
48 m_tree->get().Branch(
"ResidualPhiL3L4", &(m_PhiL3L4));
49 m_tree->get().Branch(
"ResidualPhiL3L6", &(m_PhiL3L6));
50 m_tree->get().Branch(
"ResidualThetaL3L3", &(m_ThetaL3L3));
51 m_tree->get().Branch(
"ResidualThetaL3L4", &(m_ThetaL3L4));
52 m_tree->get().Branch(
"ResidualThetaL3L6", &(m_ThetaL3L6));
53 m_tree->get().Branch(
"ResidualScatterAngleL3L3", &(m_ScatterAngleL3L3));
54 m_tree->get().Branch(
"ResidualScatterAngleL3L4", &(m_ScatterAngleL3L4));
55 m_tree->get().Branch(
"ResidualcatterAngleL3L6", &(m_ScatterAngleL3L6));
56 m_tree->get().Branch(
"ResidualScatterAngleV2GradL3L3", &(m_ScatterAngleGradL3L3));
57 m_tree->get().Branch(
"ResidualScatterAngleV2GradL3L4", &(m_ScatterAngleGradL3L4));
58 m_tree->get().Branch(
"ResidualScatterAngleV2GradL3L6", &(m_ScatterAngleGradL3L6));
59 m_tree->get().Branch(
"ResidualScatterAngleV3GradL3L3", &(m_ScatterAngleV3GradL3L3));
60 m_tree->get().Branch(
"ResidualScatterAngleV3GradL3L4", &(m_ScatterAngleV3GradL3L4));
61 m_tree->get().Branch(
"ResidualScatterAngleV3GradL3L6", &(m_ScatterAngleV3GradL3L6));
62 m_tree->get().Branch(
"ResidualcatterAngleL3L6", &(m_ScatterAngleL3L6));
63 m_tree->get().Branch(
"ResidualXYL3L4", &(m_distXY));
64 m_tree->get().Branch(
"ResidualMomentumL3bL3e", &(m_deltaPL3L3));
65 m_tree->get().Branch(
"ResidualMomentumL3bL4b", &(m_deltaPL3L4));
66 m_tree->get().Branch(
"ResidualMomentumL3bL6e", &(m_deltaPL3L6));
68 B2WARNING(
"StudyMaterialEffectsModule::initialize: nBranches: " << m_tree->get().GetNbranches());
73 void StudyMaterialEffectsModule::event()
85 bool wasFoundL3(
false);
86 bool wasFoundL4(
false);
87 bool wasFoundL6(
false);
90 for (
const auto& aSP : m_spacePoints) {
91 VxdID vxdID = aSP.getVxdID();
93 if (trueHit ==
nullptr)
continue;
95 B2Vector3D entryHitPos = getGlobalPosition(trueHit, vxdID,
true);
96 B2Vector3D exitHitPos = getGlobalPosition(trueHit, vxdID,
false);
97 B2Vector3D entryMomentum = getGlobalMomentumVector(trueHit, vxdID,
true);
98 B2Vector3D exitMomentum = getGlobalMomentumVector(trueHit, vxdID,
false);
100 l3HitPosBegin = entryHitPos;
101 l3HitPosEnd = exitHitPos;
102 l3MomentumBegin = entryMomentum;
103 l3MomentumEnd = exitMomentum;
107 l4HitPosBegin = entryHitPos;
108 l4MomentumBegin = entryMomentum;
112 l6HitPosEnd = exitHitPos;
113 l6MomentumEnd = exitMomentum;
118 if (!wasFoundL3 or !wasFoundL4 or !wasFoundL6)
return;
119 m_COUNTERsuccessfullEvents++;
121 m_PhiL3L3 = l3HitPosBegin.
Phi() - l3HitPosEnd.
Phi();
122 m_PhiL3L4 = l3HitPosBegin.
Phi() - l4HitPosBegin.
Phi();
123 m_PhiL3L6 = l3HitPosBegin.
Phi() - l6HitPosEnd.
Phi();
125 m_ThetaL3L3 = l3HitPosBegin.
Theta() - l3HitPosEnd.
Theta();
126 m_ThetaL3L4 = l3HitPosBegin.
Theta() - l4HitPosBegin.
Theta();
127 m_ThetaL3L6 = l3HitPosBegin.
Theta() - l6HitPosEnd.
Theta();
129 m_ScatterAngleL3L3 = sqrt(pow(m_ThetaL3L3, 2) + pow(m_PhiL3L3, 2));
130 m_ScatterAngleL3L4 = sqrt(pow(m_ThetaL3L4, 2) + pow(m_PhiL3L4, 2));
131 m_ScatterAngleL3L6 = sqrt(pow(m_ThetaL3L6, 2) + pow(m_PhiL3L6, 2));
133 m_ScatterAngleGradL3L3 = (l3HitPosEnd - l3HitPosBegin).Angle(l3HitPosBegin) * 180. / TMath::Pi();
134 m_ScatterAngleGradL3L4 = (l4HitPosBegin - l3HitPosBegin).Angle(l3HitPosBegin) * 180. / TMath::Pi();
135 m_ScatterAngleGradL3L6 = (l6HitPosEnd - l3HitPosBegin).Angle(l3HitPosBegin) * 180. / TMath::Pi();
138 m_ScatterAngleV3GradL3L3 = l3MomentumEnd.
Angle(l3MomentumBegin) * 180. / TMath::Pi();
139 m_ScatterAngleV3GradL3L4 = l4MomentumBegin.
Angle(l3MomentumBegin) * 180. / TMath::Pi();
140 m_ScatterAngleV3GradL3L6 = l6MomentumEnd.
Angle(l3MomentumBegin) * 180. / TMath::Pi();
143 m_distXY = (l3HitPosBegin - l4HitPosBegin).Perp();
145 m_deltaPL3L3 = l3MomentumBegin.
Mag() - l3MomentumEnd.
Mag();
146 m_deltaPL3L4 = l3MomentumBegin.
Mag() - l4MomentumBegin.
Mag();
147 m_deltaPL3L6 = l3MomentumBegin.
Mag() - l6MomentumEnd.
Mag();
149 m_tree->get().Fill();
154 void StudyMaterialEffectsModule::terminate()
156 B2WARNING(
"StudyMaterialEffects: there were " << m_COUNTERsuccessfullEvents <<
" events with hits resulting in root output");
159 if (!ProcHandler::parallelProcessingUsed() or ProcHandler::isOutputProcess()) {
161 m_tree->write(m_file);
187 if (aMcParticle.hasStatus(MCParticle::c_PrimaryParticle) ==
false)
continue;
DataType Phi() const
The azimuth angle.
DataType Theta() const
The polar angle.
DataType Mag() const
The magnitude (rho in spherical coordinate system).
DataType Angle(const B2Vector3< DataType > &q) const
The angle w.r.t.
In the store you can park objects that have to be accessed by various modules.
A Class to store the Monte Carlo particle information.
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from this object to another store array.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Class SVDTrueHit - Records of tracks that either enter or leave the sensitive volume.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
StudyMaterialEffectsModule.
float getEntryU() const
Return local u coordinate of hit when entering silicon.
TVector3 getEntryMomentum() const
Return momentum at the start point of the track.
TVector3 getExitMomentum() const
Return momentum at the endpoint of the track.
float getExitU() const
Return local u coordinate of hit at the endpoint of the track.
float getExitV() const
Return local v coordinate of hit at the endpoint of the track.
float getEntryV() const
Return local v coordinate of the start point of the track.
Base class to provide Sensor Information for PXD and SVD.
TVector3 pointToGlobal(const TVector3 &local, bool reco=false) const
Convert a point from local to global coordinates.
TVector3 vectorToGlobal(const TVector3 &local, bool reco=false) const
Convert a vector from local to global coordinates.
Class to uniquely identify a any structure of the PXD and SVD.
baseType getLayerNumber() const
Get the layer id.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.