ATLAS Offline Software
Loading...
Searching...
No Matches
MuonSegmentReader.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "GaudiKernel/ITHistSvc.h"
13
14
15namespace MuonCalib {
16
18{
19
20 ATH_CHECK(m_evtKey.initialize() );
21 //ATH_CHECK(m_TrkSegKey.initialize());
22 ATH_CHECK(m_TrkKey.initialize());
23 //ATH_CHECK(m_CbTrkKey.initialize());
24 //ATH_CHECK(m_EMEO_TrkKey.initialize()); // run3 only EM EO MS tracks
25 ATH_CHECK(m_MdtPrepDataKey.initialize());
26 ATH_CHECK(m_RpcPrepDataKey.initialize());
27 ATH_CHECK(m_TgcPrepDataKey.initialize());
28 ATH_CHECK(m_calibrationTool.retrieve());
29 ATH_MSG_VERBOSE("MdtCalibrationTool retrieved with pointer = " << m_calibrationTool);
30
31 ATH_CHECK(m_DetectorManagerKey.initialize());
32 ATH_CHECK(m_idToFixedIdTool.retrieve());
33 ATH_CHECK(m_pullCalculator.retrieve());
34 // ATH_CHECK(m_assocTool.retrieve());
35 // ATH_CHECK(m_idHelperSvc.retrieve());
36 ATH_CHECK(m_MuonIdHelper.retrieve());
37 ATH_CHECK(m_printer.retrieve());
38 //ATH_CHECK(histSvc.retrieve() );
39 ATH_CHECK(m_tree.init(this));
40
41
42
43 return StatusCode::SUCCESS;
44}
45
47{
48
49 // fill eventInfo branches
50 const EventContext& ctx = Gaudi::Hive::currentContext();
52 if (!eventInfo.isValid()) {
53 ATH_MSG_ERROR("Did not find xAOD::EventInfo");
54 return StatusCode::FAILURE;
55 }
56
57 m_runNumber = eventInfo->runNumber();
58 m_eventNumber = eventInfo->eventNumber();
59 m_lumiBlock = eventInfo->lumiBlock();
60 m_bcId = eventInfo->bcid();
61 m_timeStamp = eventInfo->timeStamp();
62 m_pt = eventInfo->timeStampNSOffset(); // special treatment in eventInfo for muon calibration stream data
63
64 // load Geo
66 const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr();
67 if (!MuonDetMgr) {
68 ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object");
69 return StatusCode::FAILURE;
70 }
71
72 // fill the rawMdt Hit branches
74 ATH_MSG_DEBUG("Size of MdtPrepDataContainer : "<<mdtPrepRawData->size());
75 // Loop MdtPrepDataContainer
76 for( auto mdtColl : *mdtPrepRawData){
77 for (const Muon::MdtPrepData* prd : *mdtColl) {
78 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(prd->identify());
79 m_rawMdt_id.push_back(fixid.getIdInt()) ;
80 m_rawMdt_tdc.push_back(prd->tdc());
81 m_rawMdt_adc.push_back(prd->adc());
82 m_rawMdt_gPos.push_back(prd->globalPosition());
83 ATH_MSG_DEBUG("Mdt FixedId "<<fixid.getIdInt()<<" prd phi "<<prd->globalPosition().phi()<<" prd theta "<<prd->globalPosition().theta());
84 } // end of MdtPrepDataCollection
85 } // end of MdtPrepDataContainer
87 ATH_MSG_DEBUG("Number of MDT raw Hits : "<<m_rawMdt_nRMdt);
88
89 // fill the rawRpc Hit branches
91 ATH_MSG_DEBUG("Size of RpcPrepDataContainer : "<<rpcPrepRawData->size());
92 // Loop RpcPrepDataContainer
93 for( auto rpcColl : *rpcPrepRawData) {
94 for (const Muon::RpcPrepData* prd : *rpcColl) {
95 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(prd->identify());
96 m_rawRpc_id.push_back(fixid.getIdInt()) ;
97 m_rawRpc_time.push_back(prd->time());
98 m_rawRpc_gPos.push_back(prd->globalPosition());
99 ATH_MSG_DEBUG("Rpc FixedId "<<fixid.getIdInt()<<" prd phi "<<prd->globalPosition().phi()<<" prd theta "<<prd->globalPosition().theta());
100 } // end of RpcPrepDataCollection
101 } // end of RpcPrepDataContainer
102 m_rawRpc_nRRpc = m_rawRpc_id.size() ;
103 ATH_MSG_DEBUG("Number of Rpc raw Hits : "<<m_rawRpc_nRRpc);
104
105 // fill the rawTgc Hit branches
107 ATH_MSG_DEBUG("Size of TgcPrepDataContainer : "<<tgcPrepRawData->size());
108 // Loop TgcPrepDataContainer
109 for (auto tgcColl : *tgcPrepRawData) {
110 for (const Muon::TgcPrepData* prd : *tgcColl) {
111 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(prd->identify());
112 m_rawTgc_id.push_back(fixid.getIdInt()) ;
113 m_rawTgc_bcBitMap.push_back(prd->getBcBitMap());
114 m_rawTgc_gPos.push_back(prd->globalPosition());
115 ATH_MSG_DEBUG("Tgc FixedId "<<fixid.getIdInt()<<" prd phi "<<prd->globalPosition().phi()<<" prd theta "<<prd->globalPosition().theta());
116 } // end of TgcPrepDataCollection
117 } // end of TgcPrepDataContainer
118 m_rawTgc_nRTgc = m_rawTgc_id.size() ;
119 ATH_MSG_DEBUG("Number of Tgc raw Hits : "<<m_rawTgc_nRTgc);
120
121 // fill the muon standalone tracks branches
123 ATH_MSG_INFO("Number of Muon StandAlone Tracks : "<<muTrks->size());
124 m_trk_nTracks = muTrks->size() ;
125 // if tracks were found, print MDT track hits
126 for (unsigned int itrk = 0; itrk < muTrks->size(); ++itrk) {
127 const Trk::Track* trkSA = muTrks->at(itrk) ;
128 ATH_MSG_DEBUG(m_printer->print(*trkSA));
129 ATH_MSG_DEBUG("Track author : "<<m_printer->printPatRec(*trkSA));
130 ATH_MSG_DEBUG("TrackHit measurements : "<<m_printer->printMeasurements(*trkSA));
131 m_trk_author.push_back(208); // Hardcode 208 as Moore for MuonStandaloneTrack
132 // get trackSummary
133 const Trk::MuonTrackSummary* summary = nullptr;
134 // check if the track already has a MuonTrackSummary, if not calculate it using the helper
135 const Trk::TrackSummary* trkSummary = trkSA->trackSummary();
136 if (not trkSummary) continue;
137 m_trk_nMdtHits.push_back(trkSummary->get(Trk::numberOfMdtHits));
140 m_trk_nRpcPhiHits.push_back(trkSummary->get(Trk::numberOfRpcPhiHits));
141 m_trk_nTgcPhiHits.push_back(trkSummary->get(Trk::numberOfTgcPhiHits));
142 m_trk_nRpcEtaHits.push_back(trkSummary->get(Trk::numberOfRpcEtaHits));
143 m_trk_nTgcEtaHits.push_back(trkSummary->get(Trk::numberOfTgcEtaHits));
144 m_trk_nMdtHoles.push_back(trkSummary->get(Trk::numberOfMdtHoles));
145
146 ATH_MSG_DEBUG("Mdt Hits " << trkSummary->get(Trk::numberOfMdtHits)
147 <<" Mdt Holes "<< trkSummary->get(Trk::numberOfMdtHoles)
148 << "Mdt Outliers " << trkSummary->get(Trk::numberOfOutliersOnTrack)
149 << " TGC Phi Eta Hits "<<trkSummary->get(Trk::numberOfTgcPhiHits)<<" "<<trkSummary->get(Trk::numberOfTgcEtaHits)
150 << " RPC Phi Eta Hits "<<trkSummary->get(Trk::numberOfRpcPhiHits)<<" "<<trkSummary->get(Trk::numberOfRpcEtaHits));
151
152 summary = trkSummary->muonTrackSummary();
153 if (!summary) {
154 ATH_MSG_WARNING("No muon summary is present");
155 } else {
156 ATH_MSG_DEBUG("print MuonSummary : "<<m_printer->print(*summary));
157 }
158
159 // Trk perigee
160 const Trk::Perigee* perigee = trkSA->perigeeParameters();
161 if (!perigee) {
162 ATH_MSG_WARNING(" was expecting a perigee here... ");
163 return StatusCode::FAILURE;
164 }
165 // track direction vector
166 const Amg::Vector3D dir = perigee->momentum().unit();
167 m_trk_perigee.push_back(dir);
168 m_trk_d0.push_back(perigee->parameters()[Trk::d0]);
169 m_trk_z0.push_back(perigee->parameters()[Trk::z0]);
170 m_trk_phi.push_back(perigee->parameters()[Trk::phi0]);
171 m_trk_theta.push_back(perigee->parameters()[Trk::theta]);
172 m_trk_qOverP.push_back(perigee->parameters()[Trk::qOverP]);
173 m_trk_eta.push_back(perigee->eta());
174 m_trk_pt.push_back(perigee->pT());
175
176 // Trk fit quality
177 const Trk::FitQuality* fq = trkSA->fitQuality();
178 if (!fq) {
179 ATH_MSG_WARNING(" was expecting a FitQuality here... ");
180 return StatusCode::FAILURE;
181 }
182 m_trk_chi2.push_back(fq->chiSquared()) ;
183 m_trk_ndof.push_back(fq->numberDoF());
184
185 // Loop track hits by trk_states and store the measure
187 if (!trk_states) {
188 ATH_MSG_WARNING(" track without states, discarding track ");
189 return StatusCode::FAILURE;
190 }
191
192 unsigned int nMeasurement = 0, nHole = 0;
193 for (const Trk::TrackStateOnSurface* trk_state : *trk_states) {
194 // First handle the case of mdtHole
195 if (trk_state->type(Trk::TrackStateOnSurface::Hole)) {
196 storeHole(trk_state, itrk);
197 nHole ++;
198 continue;
199 }
200
201 const Trk::MeasurementBase* measurement = trk_state->measurementOnTrack();
202 if (!measurement) continue;
203 storeMeasurement(ctx, MuonDetMgr, itrk, trk_state, measurement);
204 nMeasurement ++;
205 } // end of track hit loop
206 ATH_MSG_DEBUG("Total recorded hits in the track "<<itrk<<" #Mesurement "<<nMeasurement<<" #Hole "<<nHole) ;
207 } // end of track loop
211 ATH_MSG_DEBUG("Total recorded "<<m_trkHit_type.size()<<" MDT hits, "<<m_trkTriggerHit_type.size()<<" Trigger hits and "<<m_trkHole_type.size()<<" hole hits in all tracks!") ;
212
213
214 if (!m_tree.fill(ctx)) return StatusCode::FAILURE;
215 return StatusCode::SUCCESS;
216}
217
218void MuonSegmentReader::storeHole(const Trk::TrackStateOnSurface * trk_state, unsigned int itrk) {
219 ATH_MSG_DEBUG(" MDT Hole on track ");
220 const Trk::TrackParameters *trackPars = trk_state->trackParameters();
221 if (!trackPars) return;
222 Amg::Vector3D pos = trackPars->position();
223 m_trkHole_gPos.push_back(pos);
224
226 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(idHole);
227 m_trkHole_id.push_back(fixid.getIdInt()) ;
228 ATH_MSG_DEBUG(" Hole stored at position x " << pos.x() << " y " << pos.y() << " z " << pos.z());
229 // check the hit type (1 MDT /2 RPC/3 TGC)
230 if (m_MuonIdHelper->isMdt(idHole)) m_trkHole_type.push_back(1);
231 else if (m_MuonIdHelper->isRpc(idHole)) m_trkHole_type.push_back(2);
232 else if (m_MuonIdHelper->isTgc(idHole)) m_trkHole_type.push_back(3);
233 else {
234 m_trkHole_type.push_back(0);
235 ATH_MSG_DEBUG("None of MDT/RPC/TGC Identifier match, something wrong!");
236 }
237
238 m_trkHole_driftRadius.push_back(std::abs(trackPars->parameters()[Trk::locR]));
239 m_trkHole_trackIndex.push_back(itrk);
240
241} // end storeHole
242
243
244void MuonSegmentReader::storeMeasurement(const EventContext& ctx, const MuonGM::MuonDetectorManager* MuonDetMgr, unsigned int itrk, const Trk::TrackStateOnSurface* trk_state, const Trk::MeasurementBase* measurement) {
245
246 const Trk::TrackParameters *trackPars = trk_state->trackParameters();
247 const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(measurement);
248
249 if (rot) { // case of measurement exist
250 Identifier rot_id = rot->identify();
251 if (m_MuonIdHelper->isMdt(rot_id)) {
252 const Muon::MdtDriftCircleOnTrack* mrot = dynamic_cast<const Muon::MdtDriftCircleOnTrack*>(rot);
253 if (!mrot) {
254 ATH_MSG_DEBUG("This is not a MdtDriftCircleOnTrack!!! ");
255 return;
256 }
257 int hitType = 0;
259 hitType = 1;
260 }
261 else if (trk_state->type(Trk::TrackStateOnSurface::Outlier)) {
262 hitType = 4;
263 }
264 else ATH_MSG_WARNING("This hit is not measurement o outlier, hit type wrong!");
265 m_trkHit_type.push_back(hitType);
266
267 // get PRD
268 const Muon::MdtPrepData* prd = mrot->prepRawData();
269 Identifier id = prd->identify();
270 int adc = prd->adc();
271 int tdc = prd->tdc();
272 Amg::Vector3D prd_pos = prd->globalPosition();
273 ATH_MSG_DEBUG("PRD ADC "<<adc<<" PRD TDC "<<tdc<<" PRD gPos "<<prd_pos);
274 // add the implement of calibrationTool, initialize global position by mrot
275 MdtCalibInput calibIn{*prd};
276 calibIn.setClosestApproach(mrot->globalPosition());
277 calibIn.setTrackDirection(trackPars->momentum().unit(), true);
278 const MdtCalibOutput calibResult{m_calibrationTool->calibrate(ctx, calibIn, false)};
279 ATH_MSG_DEBUG("print "<<calibIn << " calibResult : "<<calibResult);
280 m_trkHit_tubeT0.push_back(calibResult.tubeT0());
281 m_trkHit_tubeMeanAdc.push_back(calibResult.meanAdc());
282 m_trkHit_lorTime.push_back(calibResult.lorentzTime());
283 m_trkHit_slewTime.push_back(calibResult.slewingTime());
284 m_trkHit_propTime.push_back(calibResult.signalPropagationTime());
285 m_trkHit_tempTime.push_back(calibResult.temperatureTime());
286 m_trkHit_bkgTime.push_back(calibResult.backgroundTime());
287 m_trkHit_tof.push_back(calibIn.timeOfFlight());
288 m_trkHit_triggerTime.push_back(calibIn.triggerTime());
289 m_trkHit_calibStatus.push_back(calibResult.status());
290
291 // fill the trkHit branches
292 m_trkHit_adc.push_back(adc) ;
293 m_trkHit_tdc.push_back(tdc) ;
294 m_trkHit_trackIndex.push_back(itrk) ;
295 m_trkHit_driftTime.push_back(mrot->driftTime());
296
297 float localAngle = mrot->localAngle() ;
298 float driftRadius = mrot->driftRadius() ;
299 float error = std::sqrt(mrot->localCovariance()(0, 0));
300 m_trkHit_error.push_back(error) ;
301 m_trkHit_localAngle.push_back(localAngle);
302 m_trkHit_driftRadius.push_back(driftRadius) ;
303
304 const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement(id);
305 if( !detEl ) {
306 ATH_MSG_WARNING( "getGlobalToStation failed to retrieve detEL byebye" );
307 return;
308 }
309
310 // get the 2nd coordinator from the track hit measurement
311 Amg::Vector3D trkHitPos = trackPars->position();
312 // global to local transformation for chamber coordination
313 Amg::Transform3D gToStation = detEl->GlobalToAmdbLRSTransform();
314
315 Amg::Vector3D trkHitPosLoc = gToStation* trkHitPos;
316 m_trkHit_closestApproach.push_back(trkHitPosLoc);
317 m_trkHit_gClosestApproach.push_back(trkHitPos);
318
319 // get trkHit local position from measurement
320 Amg::Vector3D mrot_gPos = mrot->globalPosition(); // equal to Amg::Vector3D mb_pos = it->globalPosition();
321 Amg::Vector3D mrot_pos = gToStation* mrot_gPos;
322
323 //distion to readout 2nd coordinators
324 float distRo_det = detEl->distanceFromRO(trkHitPos, id);
325 m_trkHit_distRO.push_back(distRo_det) ;
326
327 // save the local postion of hit center for local refitting, set x = 0, y = coordinator along the Ntube, z = coordinator along the Nlayer
328 Amg::Vector3D wireCenter = gToStation*detEl->tubePos(id);
329 wireCenter.x() = 0;
330 ATH_MSG_DEBUG(m_MuonIdHelper->mdtIdHelper().stationNameString(int(m_MuonIdHelper->mdtIdHelper().stationName(id)))<<" "<<m_MuonIdHelper->stationEta(id)<<" "<<m_MuonIdHelper->stationPhi(id)
331 <<" "<<"ml: "<<m_MuonIdHelper->mdtIdHelper().multilayer(id)<<" lb: "<<m_MuonIdHelper->mdtIdHelper().tubeLayer(id)<<" tube: "<<m_MuonIdHelper->mdtIdHelper().tube(id)
332 << " detEl wireLocalCenter " << " x : "<<wireCenter.x()<< " y : " << wireCenter.y()<< " z : "<<wireCenter.z());
333
334 m_trkHit_center.push_back(wireCenter);
335 m_trkHit_gPos.push_back(mrot_gPos);
336 m_trkHit_pos.push_back(mrot_pos);
337
338 // residual calculator
339 float residualBiased = -999.;
340 float pullBiased = -999.;
341 {
342 std::optional<Trk::ResidualPull> resPullBiased = m_pullCalculator->residualPull(measurement, trackPars, Trk::ResidualPull::Biased );
343 if(resPullBiased.has_value()){
344 residualBiased = resPullBiased.value().residual().front();
345 pullBiased = resPullBiased.value().pull().front();
346 }
347 }
348 // residual definition double residual = measurement->localParameters()[Trk::loc1] - trkPar->parameters()[Trk::loc1];
349 m_trkHit_resi.push_back(residualBiased) ;
350 m_trkHit_pull.push_back(pullBiased) ;
351 m_trkHit_rTrk.push_back(trackPars->parameters()[Trk::loc1]) ;
352
353 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(id);
354 m_trkHit_id.push_back(fixid.getIdInt()) ;
355
356 // debugging printout
357 ATH_MSG_DEBUG("trackHit distRO " << distRo_det<<" positionAlongWire "<<mrot->positionAlongWire()<<" tubeLength "<<detEl->tubeLength(id));
358 ATH_MSG_DEBUG("prd hit global position measurement " <<" x : "<< prd_pos.x()<<" y : "<< prd_pos.y()<<" z : "<<prd_pos.z());
359 ATH_MSG_DEBUG("MdtDriftCircleOnTrack hit global position measurement " << " x : " <<mrot_gPos.x()<<" y : "<< mrot_gPos.y() <<" z : "<<mrot_gPos.z());
360 ATH_MSG_DEBUG("trackHitPos from trackPars " << " x : "<<trkHitPos.x() <<" y : "<<trkHitPos.y() <<" z : "<< trkHitPos.z() );
361 ATH_MSG_DEBUG("trackHit Local Pos from globaltolocalCoords " <<" x : "<< trkHitPosLoc.x() <<" y : "<< trkHitPosLoc.y() <<" z : "<< trkHitPosLoc.z());
362 ATH_MSG_DEBUG("mrod Local Pos from globaltolocalCoords " <<" x : "<< mrot_pos.x() <<" y : "<< mrot_pos.y() <<" z : "<< mrot_pos.z());
363 ATH_MSG_DEBUG("TrackIndex "<<itrk<<" station " << fixid.stationNumberToFixedStationString(fixid.stationName()) << " eta " << fixid.eta() << " phi " << fixid.phi() << " ML " << fixid.mdtMultilayer() << " Layer " << fixid.mdtTubeLayer()
364 <<" Tube "<<fixid.mdtTube()<< " MROT drift R " << mrot->driftRadius() << " errDriftRadius " << error<< " drift Time "
365 << mrot->driftTime() <<" ADC "<<adc<<" TDC "<<tdc);
366 ATH_MSG_DEBUG(" driftRadius from driftRadius func "<<driftRadius<<" rTrk track fit to wire "<<trackPars->parameters()[Trk::loc1]<<" residualBiased " << residualBiased << " pullBiased " << pullBiased);
367
368 } // finish mdt hit loop
369
370 else if (m_MuonIdHelper->isRpc(rot_id)) {
371
372 ATH_MSG_DEBUG("Found the RPC ROT "<<rot_id<<" !");
373 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(rot_id);
374 m_trkTriggerHit_id.push_back(fixid.getIdInt()) ;
375 m_trkTriggerHit_trackIndex.push_back(itrk);
376 m_trkTriggerHit_type.push_back(1); // RPC ROT
377 const Muon::RpcClusterOnTrack* rpc = dynamic_cast<const Muon::RpcClusterOnTrack*>(rot);
378 const Muon::RpcPrepData* rpcPRD = rpc->prepRawData();
379 m_trkTriggerHit_time.push_back(rpcPRD->time());
380 m_trkTriggerHit_gPos.push_back(rpcPRD->globalPosition());
381
382 } // end of RPC rot
383 else if (m_MuonIdHelper->isTgc(rot_id)) {
384
385 ATH_MSG_DEBUG("Found the TGC ROT "<<rot_id<<" !");
386 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(rot_id);
387 m_trkTriggerHit_id.push_back(fixid.getIdInt()) ;
388 m_trkTriggerHit_trackIndex.push_back(itrk);
389 m_trkTriggerHit_type.push_back(3); // tgc ROT
390 const Muon::TgcClusterOnTrack* tgc = dynamic_cast<const Muon::TgcClusterOnTrack*>(rot);
391 const Muon::TgcPrepData* tgcPRD = tgc->prepRawData() ;
392 m_trkTriggerHit_time.push_back(tgcPRD->getBcBitMap());
393 m_trkTriggerHit_gPos.push_back(tgcPRD->globalPosition());
394
395 } //end of TGC rot
396 else {
397 ATH_MSG_DEBUG("Couldn't find track ROT ID "<<rot_id);
398 }
399
400 } // end of rot case
401 else {
402 ATH_MSG_DEBUG("No ROT! Check the competingROT");
403 // use competingROT from RPC and TGC
404 const Muon::CompetingMuonClustersOnTrack* crot = dynamic_cast<const Muon::CompetingMuonClustersOnTrack*>(measurement);
405 if (crot) {
406 const std::vector<const Muon::MuonClusterOnTrack*>& rots = crot->containedROTs();
407 if (rots.size() > 0) {
408 std::vector<const Muon::MuonClusterOnTrack*>::const_iterator itR = rots.begin(), itR_end = rots.end();
409 for (; itR != itR_end; ++itR) {
410 Identifier crot_id = (*itR)->identify() ;
411 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(crot_id);
412 m_trkTriggerHit_id.push_back(fixid.getIdInt());
413 m_trkTriggerHit_trackIndex.push_back(itrk);
414 if (m_MuonIdHelper->isTgc(crot_id)) {
415 ATH_MSG_DEBUG("This is TGC competing hits on track!") ;
416 if (m_MuonIdHelper->tgcIdHelper().isStrip(crot_id)) m_trkTriggerHit_type.push_back(5); // tgc strip hit, measuresPhi
417 else m_trkTriggerHit_type.push_back(4); // tgc wire hit
418 const Muon::TgcClusterOnTrack* tgc = dynamic_cast<const Muon::TgcClusterOnTrack*>(*itR);
419 const Muon::TgcPrepData* tgcPRD = tgc ? tgc->prepRawData() : nullptr;
420 if (tgcPRD) {
421 m_trkTriggerHit_time.push_back(tgcPRD->getBcBitMap());
422 m_trkTriggerHit_gPos.push_back(tgcPRD->globalPosition());
423 }
424 else {
425 m_trkTriggerHit_time.push_back(0);
426 m_trkTriggerHit_gPos.push_back(Amg::Vector3D(0,0,0));
427 }
428 } // tgc case
429 else if (m_MuonIdHelper->isRpc(crot_id)) {
430 ATH_MSG_DEBUG("This is RPC competing hits on track!") ;
431 m_trkTriggerHit_type.push_back(2);
432 const Muon::RpcClusterOnTrack* rpc = dynamic_cast<const Muon::RpcClusterOnTrack*>(*itR);
433 const Muon::RpcPrepData* rpcPRD = rpc ? rpc->prepRawData() : nullptr;
434 if (rpcPRD) {
435 m_trkTriggerHit_time.push_back(rpcPRD->time());
436 m_trkTriggerHit_gPos.push_back(rpcPRD->globalPosition());
437 }
438 else {
439 m_trkTriggerHit_time.push_back(0);
440 m_trkTriggerHit_gPos.push_back(Amg::Vector3D(0,0,0));
441 } // rpc case
442 } // rpc case
443 else {
444 m_trkTriggerHit_type.push_back(0);
445 m_trkTriggerHit_time.push_back(0);
446 m_trkTriggerHit_gPos.push_back(Amg::Vector3D(0,0,0));
447 }
448 } // end of crots loop
449 } // end of crots size check
450 } // end of crot check
451 } // end of CompetingROT
452} // end of store measurement
453
455{
456 ATH_MSG_INFO("MuonSegmentReader :: Finalize + Matching");
457 ATH_CHECK(m_tree.write());
458 return StatusCode::SUCCESS;
459}
460
461} // namespace MuonCalib
#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 ATH_MSG_DEBUG(x)
Derived DataVector<T>.
Definition DataVector.h:795
void setClosestApproach(const Amg::Vector3D &approach)
Sets the closest approach.
double timeOfFlight() const
Returns the time of flight.
double triggerTime() const
Returns the trigger offset time.
void setTrackDirection(const Amg::Vector3D &trackDir, bool hasPhi)
Sets the direction of the externally determined track.
double backgroundTime() const
Return the time correction arising from background processes.
MdtDriftCircleStatus status() const
Status of the calibration.
double temperatureTime() const
Returns the time corrections stemming from temperature & pressure corrections.
double signalPropagationTime() const
Returns the signal propagation time.
double lorentzTime() const
Returns the time corrections from the signal propgation inside a magnetic field.
double tubeT0() const
Returns the point in time where the muon typically enters the chamber.
double meanAdc() const
Returns the mean tube adc.
double slewingTime() const
Returns the slewing time (Needed time that the accumulated charge passes the electronic threshold to ...
Implements fixed identifiers not dependent upon Athena Identifier for internal use in the calibration...
Definition MuonFixedId.h:50
static std::string stationNumberToFixedStationString(const int station)
int mdtTubeLayer() const
Mdt specific:
int mdtTube() const
Mdt specific:
unsigned int getIdInt() const
int mdtMultilayer() const
Mdt specific:
VectorBranch< unsigned int > & m_rawRpc_id
ServiceHandle< Muon::IMuonIdHelperSvc > m_MuonIdHelper
VectorBranch< float > & m_trkHit_triggerTime
VectorBranch< float > & m_trk_d0
VectorBranch< int > & m_trkHit_tdc
VectorBranch< float > & m_trkHit_error
ScalarBranch< int > & m_trkTriggerHit_nHits
ScalarBranch< int > & m_lumiBlock
ScalarBranch< float > & m_pt
VectorBranch< float > & m_trk_qOverP
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_TgcPrepDataKey
ScalarBranch< int > & m_trk_nTracks
VectorBranch< int > & m_trk_ndof
virtual StatusCode initialize() override
VectorBranch< unsigned int > & m_trkTriggerHit_id
void storeHole(const Trk::TrackStateOnSurface *trk_state, unsigned int itrk)
ThreeVectorBranch m_trkHit_closestApproach
PublicToolHandle< Trk::IResidualPullCalculator > m_pullCalculator
VectorBranch< float > & m_trk_theta
VectorBranch< int > & m_trkHit_trackIndex
VectorBranch< float > & m_rawRpc_time
SG::ReadHandleKey< xAOD::EventInfo > m_evtKey
VectorBranch< float > & m_trk_phi
VectorBranch< int > & m_trkHit_type
VectorBranch< float > & m_trk_chi2
SG::ReadHandleKey< Muon::MdtPrepDataContainer > m_MdtPrepDataKey
ThreeVectorBranch m_trkHit_gClosestApproach
void storeMeasurement(const EventContext &ctx, const MuonGM::MuonDetectorManager *MuonDetMgr, unsigned int itrk, const Trk::TrackStateOnSurface *trk_state, const Trk::MeasurementBase *measurement)
VectorBranch< int > & m_trkHole_type
VectorBranch< int > & m_trkTriggerHit_trackIndex
ThreeVectorBranch m_trkTriggerHit_gPos
ScalarBranch< int > & m_runNumber
VectorBranch< float > & m_trkHit_rTrk
ScalarBranch< int > & m_trkHit_nMdtHits
VectorBranch< float > & m_trkHit_driftRadius
VectorBranch< unsigned int > & m_trkHit_id
VectorBranch< int > & m_trk_nRpcEtaHits
VectorBranch< float > & m_trkHit_tubeT0
VectorBranch< int > & m_trk_nOutliersHits
VectorBranch< float > & m_trk_z0
VectorBranch< float > & m_trkHit_lorTime
VectorBranch< int > & m_trk_nMdtHoles
PublicToolHandle< Muon::MuonEDMPrinterTool > m_printer
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey
MuonDetectorManager from the conditions store.
VectorBranch< int > & m_trk_nRpcPhiHits
VectorBranch< unsigned int > & m_trkHole_id
VectorBranch< int > & m_trkHole_trackIndex
ScalarBranch< int > & m_eventNumber
VectorBranch< float > & m_trkHit_tof
VectorBranch< float > & m_trkHit_tubeMeanAdc
VectorBranch< float > & m_trkHit_localAngle
ScalarBranch< int > & m_trkHole_nHoles
ScalarBranch< int > & m_rawTgc_nRTgc
VectorBranch< int > & m_rawMdt_adc
VectorBranch< float > & m_trkHit_pull
SG::ReadHandleKey< Muon::RpcPrepDataContainer > m_RpcPrepDataKey
VectorBranch< int > & m_trk_nTgcPhiHits
VectorBranch< float > & m_trk_eta
VectorBranch< int > & m_trkHit_calibStatus
VectorBranch< float > & m_trkHit_slewTime
ToolHandle< IMdtCalibrationTool > m_calibrationTool
pointer to MdtCalibSvc
VectorBranch< unsigned int > & m_rawTgc_id
ToolHandle< MuonCalib::IIdToFixedIdTool > m_idToFixedIdTool
VectorBranch< int > & m_trkTriggerHit_type
VectorBranch< float > & m_trkTriggerHit_time
VectorBranch< float > & m_trkHit_bkgTime
virtual StatusCode finalize() override
VectorBranch< float > & m_trk_pt
VectorBranch< int > & m_trk_author
VectorBranch< int > & m_trk_nMdtHits
VectorBranch< int > & m_rawTgc_bcBitMap
VectorBranch< unsigned int > & m_rawMdt_id
VectorBranch< float > & m_trkHit_tempTime
ScalarBranch< int > & m_rawMdt_nRMdt
ScalarBranch< int > & m_timeStamp
ScalarBranch< int > & m_bcId
VectorBranch< float > & m_trkHit_driftTime
SG::ReadHandleKey< TrackCollection > m_TrkKey
virtual StatusCode execute() override
ScalarBranch< int > & m_rawRpc_nRRpc
VectorBranch< float > & m_trkHit_propTime
VectorBranch< int > & m_trk_nTgcEtaHits
VectorBranch< float > & m_trkHole_driftRadius
VectorBranch< float > & m_trkHit_distRO
VectorBranch< int > & m_trkHit_adc
VectorBranch< int > & m_rawMdt_tdc
VectorBranch< float > & m_trkHit_resi
Amg::Vector3D tubePos(const Identifier &id) const
Returns the global position of the given tube.
double distanceFromRO(const Amg::Vector3D &GlobalHitPosition, const Identifier &id) const
double tubeLength(const int tubeLayer, const int tube) const
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Class for competing MuonClusters, it extends the Trk::CompetingRIOsOnTrack base class.
const std::vector< const MuonClusterOnTrack * > & containedROTs() const
returns the vector of SCT_ClusterOnTrack objects .
This class represents the corrected MDT measurements, where the corrections include the effects of wi...
double localAngle() const
Returns the local angle, as determined by the extrapolation used when creating this Trk::RIO_OnTrack.
virtual const Amg::Vector3D & globalPosition() const override final
Returns the global Position.
double driftRadius() const
Returns the value of the drift radius.
double driftTime() const
Returns the value of the drift time used to obtain the drift radius.
double positionAlongWire() const
Returns the position along the wire, as determined by the extrapolation used when creating this Trk::...
virtual const MdtPrepData * prepRawData() const override final
Returns the PrepRawData used to create this corrected measurement.
Class to represent measurements from the Monitored Drift Tubes.
Definition MdtPrepData.h:33
int adc() const
Returns the ADC (typically range is 0 to 250)
virtual const Amg::Vector3D & globalPosition() const
Returns the global position of the CENTER of the drift tube (i.e.
int tdc() const
Returns the TDC (typically range is 0 to 2500).
Class to represent calibrated clusters formed from RPC strips.
virtual const RpcPrepData * prepRawData() const override final
Returns the RpcPrepData - is a TRT_DriftCircle in this scope.
Class to represent RPC measurements.
Definition RpcPrepData.h:35
virtual const Amg::Vector3D & globalPosition() const override
Returns the global position.
float time() const
Returns the time.
Class to represent calibrated clusters formed from TGC strips.
virtual const TgcPrepData * prepRawData() const
Returns the TgcPrepData - is a TRT_DriftCircle in this scope.
Class to represent TGC measurements.
Definition TgcPrepData.h:32
virtual const Amg::Vector3D & globalPosition() const override final
Returns the global position.
uint16_t getBcBitMap() const
Returns the bcBitMap of this PRD bit2 for Previous BC, bit1 for Current BC, bit0 for Next BC.
const_pointer_type cptr()
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition FitQuality.h:97
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition FitQuality.h:60
double chiSquared() const
returns the of the overall track fit
Definition FitQuality.h:56
This class is the pure abstract base class for all fittable tracking measurements.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Detailed track summary for the muon system Give access to hit counts per chamber.
double eta() const
Access method for pseudorapidity - from momentum.
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
double pT() const
Access method for transverse momentum.
Identifier identify() const
return the identifier
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
Definition RIO_OnTrack.h:70
Identifier identify() const
return the identifier -extends MeasurementBase
@ Biased
RP with track state including the hit.
Identifier associatedDetectorElementIdentifier() const
return Identifier of the associated Detector Element
represents the track state (measurement, material, fit parameters and quality) at a surface.
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload
bool type(const TrackStateOnSurfaceType type) const
Use this method to find out if the TSoS is of a certain type: i.e.
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
@ Hole
A hole on the track - this is defined in the following way.
A summary of the information contained by a track.
const MuonTrackSummary * muonTrackSummary() const
returns a pointer to the MuonTrackSummary if available
int get(const SummaryType &type) const
returns the summary information for the passed SummaryType.
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
const Perigee * perigeeParameters() const
return Perigee.
const Trk::TrackSummary * trackSummary() const
Returns a pointer to the const Trk::TrackSummary owned by this const track (could be nullptr)
const FitQuality * fitQuality() const
return a pointer to the fit quality const-overload
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
@ locR
Definition ParamDefs.h:44
@ phi0
Definition ParamDefs.h:65
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ loc1
Definition ParamDefs.h:34
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64
ParametersBase< TrackParametersDim, Charged > TrackParameters
@ numberOfMdtHoles
number of MDT measurements missing from the track
@ numberOfOutliersOnTrack
100 times the standard deviation of the chi2 from the surfaces