The fill method checks if enough information is provided such that the branch is cleared from the information of the prevoius event and in cases of that updates did no happen befure a default value is provided.
--> returns false if no update is called or the dummy value has not been defined
15 {
17 SG::ReadHandle<MMSimHitCollection> mmContainer{
m_key, ctx};
20 return false;
21 }
22 const MuonGM::MuonDetectorManager* MuonDetMgr =
getDetMgr(ctx);
23 if (!MuonDetMgr) { return false; }
24 unsigned int n_hits{0};
25
27 if (!mmContainer->size())
ATH_MSG_DEBUG(
"MM Sim container is empty");
28 for (const MMSimHit& hit : *mmContainer) {
29 int simId = hit.MMId();
30
31 if(hit.depositEnergy()==0.) continue;
32
33
34 int barcode = hit.particleLink().barcode();
37
40
43
47
54
55 if( stphi == 0 ){
56 ATH_MSG_ERROR(
"MicroMegas validation: unexpected phi range " << stphi);
57 return false;
58 }
59
61 side == 1 ? steta+1 : -steta-1,
62 (stphi-1)/2+1,multilayer,layer,1 );
64
65
68 }
71 }
75 }
78 }
79
83
85 if (!detEl) {
86 ATH_MSG_ERROR(
"MMSimHitVariables::fillVariables() - Failed to retrieve MMReadoutElement for "<<
idHelperSvc()->mmIdHelper().print_to_string(offId).c_str());
87 return false;
88 }
89
90
91 const Trk::PlaneSurface& surf = detEl->
surface(offId);
92
94 Amg::Vector3D hpos(hit.globalPosition().x(),hit.globalPosition().y(),hit.globalPosition().z());
96
97
99
100 Amg::Vector2D posOnSurfUnProjected(rSurface_pos.x(),rSurface_pos.y());
101
102
104 ldir = surf.
transform().inverse().linear()*
Amg::Vector3D(hit.globalDirection().x(), hit.globalDirection().y(), hit.globalDirection().z());
105
106 double scale, scaletop;
107 double gasgap = 5.;
108
109 scale = -rSurface_pos.z()/ldir.z();
110 scaletop = (gasgap+rSurface_pos.z())/ldir.z();
111
113 Amg::Vector3D hitOnTopSurface = rSurface_pos + scaletop*ldir;
114 Amg::Vector2D posOnSurf (hitOnSurface.x(), hitOnSurface.y());
115 Amg::Vector2D posOnTopSurf (hitOnTopSurface.x(),hitOnTopSurface.y());
116
117
118 int stripNumber = detEl->
stripNumber(posOnSurf,offId);
119
120
122
123 if( stripNumber == -1 ){
124 ATH_MSG_WARNING(
"MicroMegas validation: failed to obtain strip number " <<
idHelperSvc()->mmIdHelper().print_to_string(offId) );
126 stripNumber = 1;
127 }
128
129 Identifier oldId = offId;
132 ATH_MSG_WARNING(
"MicroMegas validation: MM id has bad layer field(2)! " << std::endl <<
" " <<
idHelperSvc()->mmIdHelper().print_to_string(offId) << std::endl
133 <<
" " <<
idHelperSvc()->mmIdHelper().print_to_string(oldId) <<
" stripN " << stripNumber );
134 }
135
138 ATH_MSG_WARNING(
"MicroMegas validation: failed to obtain local position for identifier " <<
idHelperSvc()->mmIdHelper().print_to_string(offId) );
139 }
140
142 ATH_MSG_DEBUG(
"Global hit : r " << hit.globalPosition().perp() <<
", phi " << hit.globalPosition().phi() <<
", z " << hit.globalPosition().z()
143 << "; detEl: r " << detpos.perp() << ", phi " << detpos.phi() << ", z " << detpos.z()
144 <<
"; surf z " << surf.
center().z() <<
", ml " << multilayer <<
", l " << layer );
145 ATH_MSG_DEBUG(
" detEl: x " << dSurface_pos.x() <<
" y " << dSurface_pos.y() <<
" z " << dSurface_pos.z());
146 ATH_MSG_DEBUG(
"MM Fast digit: x " << fastDigitPos.x() <<
" y " << fastDigitPos.y()
147 << ", gToL: x " << rSurface_pos.x() << " y " << rSurface_pos.y() << " z " << rSurface_pos.z() );
148
149
153
156
157 ++n_hits;
158 }
160
162 return true;
163 }
#define ATH_MSG_WARNING(x)
int GetLayer(const int &hid) const
static const MicromegasHitIdHelper * GetHelper()
int GetSide(const int &hid) const
int GetPhiSector(const int &hid) const
int GetMultiLayer(const int &hid) const
int GetZSector(const int &hid) const
std::string GetStationName(const int &hid) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override final
strip position – local or global If the strip number is outside the range of valid strips,...
bool insideActiveBounds(const Identifier &id, const Amg::Vector2D &locpos, double tol1=0., double tol2=0.) const
boundary check Wrapper Trk::PlaneSurface::insideBounds() taking into account the passivated width
virtual int stripNumber(const Amg::Vector2D &pos, const Identifier &id) const override final
strip number corresponding to local position.
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
const MMReadoutElement * getMMReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const Amg::Transform3D & absTransform() const
const Amg::Vector3D globalPosition() const
ThreeVectorBranch m_NSWMM_hitGlobalPosition
ScalarBranch< unsigned int > & m_NSWMM_nSimHits
MmIdentifierBranch m_NSWMM_Id
VectorBranch< float > & m_NSWMM_globalTime
VectorBranch< int > & m_NSWMM_trackId
VectorBranch< float > & m_NSWMM_depositEnergy
ThreeVectorBranch m_NSWMM_hitToDsurfacePosition
VectorBranch< float > & m_NSWMM_FastDigitRsurfacePositionY
VectorBranch< int > & m_NSWMM_particleEncoding
VectorBranch< float > & m_NSWMM_FastDigitRsurfacePositionX
VectorBranch< float > & m_NSWMM_kineticEnergy
VectorBranch< bool > & m_NSWMM_isInsideBounds
ThreeVectorBranch m_NSWMM_detector_globalPosition
ThreeVectorBranch m_NSWMM_hitGlobalDirection
ThreeVectorBranch m_NSWMM_hitToRsurfacePosition
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
const Muon::IMuonIdHelperSvc * idHelperSvc() const
virtual const MmIdHelper & mmIdHelper() const =0
access to CscIdHelper
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
bool isSmall(const ChIndex index)
Returns true if the chamber index is in a small sector.
constexpr uint8_t stationPhi
station Phi 1 to 8
constexpr uint8_t stationEta
1 to 3