ATLAS Offline Software
Loading...
Searching...
No Matches
MuonSegmentReader.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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
46StatusCode MuonSegmentReader::execute(const EventContext& ctx)
47{
48
49 // fill eventInfo branches
51 if (!eventInfo.isValid()) {
52 ATH_MSG_ERROR("Did not find xAOD::EventInfo");
53 return StatusCode::FAILURE;
54 }
55
56 m_runNumber = eventInfo->runNumber();
57 m_eventNumber = eventInfo->eventNumber();
58 m_lumiBlock = eventInfo->lumiBlock();
59 m_bcId = eventInfo->bcid();
60 m_timeStamp = eventInfo->timeStamp();
61 m_pt = eventInfo->timeStampNSOffset(); // special treatment in eventInfo for muon calibration stream data
62
63 // load Geo
65 const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr();
66 if (!MuonDetMgr) {
67 ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object");
68 return StatusCode::FAILURE;
69 }
70
71 // fill the rawMdt Hit branches
73 ATH_MSG_DEBUG("Size of MdtPrepDataContainer : "<<mdtPrepRawData->size());
74 // Loop MdtPrepDataContainer
75 for( auto mdtColl : *mdtPrepRawData){
76 for (const Muon::MdtPrepData* prd : *mdtColl) {
77 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(prd->identify());
78 m_rawMdt_id.push_back(fixid.getIdInt()) ;
79 m_rawMdt_tdc.push_back(prd->tdc());
80 m_rawMdt_adc.push_back(prd->adc());
81 m_rawMdt_gPos.push_back(prd->globalPosition());
82 ATH_MSG_DEBUG("Mdt FixedId "<<fixid.getIdInt()<<" prd phi "<<prd->globalPosition().phi()<<" prd theta "<<prd->globalPosition().theta());
83 } // end of MdtPrepDataCollection
84 } // end of MdtPrepDataContainer
86 ATH_MSG_DEBUG("Number of MDT raw Hits : "<<m_rawMdt_nRMdt);
87
88 // fill the rawRpc Hit branches
90 ATH_MSG_DEBUG("Size of RpcPrepDataContainer : "<<rpcPrepRawData->size());
91 // Loop RpcPrepDataContainer
92 for( auto rpcColl : *rpcPrepRawData) {
93 for (const Muon::RpcPrepData* prd : *rpcColl) {
94 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(prd->identify());
95 m_rawRpc_id.push_back(fixid.getIdInt()) ;
96 m_rawRpc_time.push_back(prd->time());
97 m_rawRpc_gPos.push_back(prd->globalPosition());
98 ATH_MSG_DEBUG("Rpc FixedId "<<fixid.getIdInt()<<" prd phi "<<prd->globalPosition().phi()<<" prd theta "<<prd->globalPosition().theta());
99 } // end of RpcPrepDataCollection
100 } // end of RpcPrepDataContainer
101 m_rawRpc_nRRpc = m_rawRpc_id.size() ;
102 ATH_MSG_DEBUG("Number of Rpc raw Hits : "<<m_rawRpc_nRRpc);
103
104 // fill the rawTgc Hit branches
106 ATH_MSG_DEBUG("Size of TgcPrepDataContainer : "<<tgcPrepRawData->size());
107 // Loop TgcPrepDataContainer
108 for (auto tgcColl : *tgcPrepRawData) {
109 for (const Muon::TgcPrepData* prd : *tgcColl) {
110 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(prd->identify());
111 m_rawTgc_id.push_back(fixid.getIdInt()) ;
112 m_rawTgc_bcBitMap.push_back(prd->getBcBitMap());
113 m_rawTgc_gPos.push_back(prd->globalPosition());
114 ATH_MSG_DEBUG("Tgc FixedId "<<fixid.getIdInt()<<" prd phi "<<prd->globalPosition().phi()<<" prd theta "<<prd->globalPosition().theta());
115 } // end of TgcPrepDataCollection
116 } // end of TgcPrepDataContainer
117 m_rawTgc_nRTgc = m_rawTgc_id.size() ;
118 ATH_MSG_DEBUG("Number of Tgc raw Hits : "<<m_rawTgc_nRTgc);
119
120 // fill the muon standalone tracks branches
122 ATH_MSG_INFO("Number of Muon StandAlone Tracks : "<<muTrks->size());
123 m_trk_nTracks = muTrks->size() ;
124 // if tracks were found, print MDT track hits
125 for (unsigned int itrk = 0; itrk < muTrks->size(); ++itrk) {
126 const Trk::Track* trkSA = muTrks->at(itrk) ;
127 ATH_MSG_DEBUG(m_printer->print(*trkSA));
128 ATH_MSG_DEBUG("Track author : "<<m_printer->printPatRec(*trkSA));
129 ATH_MSG_DEBUG("TrackHit measurements : "<<m_printer->printMeasurements(*trkSA));
130 m_trk_author.push_back(208); // Hardcode 208 as Moore for MuonStandaloneTrack
131 // get trackSummary
132 const Trk::MuonTrackSummary* summary = nullptr;
133 // check if the track already has a MuonTrackSummary, if not calculate it using the helper
134 const Trk::TrackSummary* trkSummary = trkSA->trackSummary();
135 if (not trkSummary) continue;
136 m_trk_nMdtHits.push_back(trkSummary->get(Trk::numberOfMdtHits));
139 m_trk_nRpcPhiHits.push_back(trkSummary->get(Trk::numberOfRpcPhiHits));
140 m_trk_nTgcPhiHits.push_back(trkSummary->get(Trk::numberOfTgcPhiHits));
141 m_trk_nRpcEtaHits.push_back(trkSummary->get(Trk::numberOfRpcEtaHits));
142 m_trk_nTgcEtaHits.push_back(trkSummary->get(Trk::numberOfTgcEtaHits));
143 m_trk_nMdtHoles.push_back(trkSummary->get(Trk::numberOfMdtHoles));
144
145 ATH_MSG_DEBUG("Mdt Hits " << trkSummary->get(Trk::numberOfMdtHits)
146 <<" Mdt Holes "<< trkSummary->get(Trk::numberOfMdtHoles)
147 << "Mdt Outliers " << trkSummary->get(Trk::numberOfOutliersOnTrack)
148 << " TGC Phi Eta Hits "<<trkSummary->get(Trk::numberOfTgcPhiHits)<<" "<<trkSummary->get(Trk::numberOfTgcEtaHits)
149 << " RPC Phi Eta Hits "<<trkSummary->get(Trk::numberOfRpcPhiHits)<<" "<<trkSummary->get(Trk::numberOfRpcEtaHits));
150
151 summary = trkSummary->muonTrackSummary();
152 if (!summary) {
153 ATH_MSG_WARNING("No muon summary is present");
154 } else {
155 ATH_MSG_DEBUG("print MuonSummary : "<<m_printer->print(*summary));
156 }
157
158 // Trk perigee
159 const Trk::Perigee* perigee = trkSA->perigeeParameters();
160 if (!perigee) {
161 ATH_MSG_WARNING(" was expecting a perigee here... ");
162 return StatusCode::FAILURE;
163 }
164 // track direction vector
165 const Amg::Vector3D dir = perigee->momentum().unit();
166 m_trk_perigee.push_back(dir);
167 m_trk_d0.push_back(perigee->parameters()[Trk::d0]);
168 m_trk_z0.push_back(perigee->parameters()[Trk::z0]);
169 m_trk_phi.push_back(perigee->parameters()[Trk::phi0]);
170 m_trk_theta.push_back(perigee->parameters()[Trk::theta]);
171 m_trk_qOverP.push_back(perigee->parameters()[Trk::qOverP]);
172 m_trk_eta.push_back(perigee->eta());
173 m_trk_pt.push_back(perigee->pT());
174
175 // Trk fit quality
176 const Trk::FitQuality* fq = trkSA->fitQuality();
177 if (!fq) {
178 ATH_MSG_WARNING(" was expecting a FitQuality here... ");
179 return StatusCode::FAILURE;
180 }
181 m_trk_chi2.push_back(fq->chiSquared()) ;
182 m_trk_ndof.push_back(fq->numberDoF());
183
184 // Loop track hits by trk_states and store the measure
186 if (!trk_states) {
187 ATH_MSG_WARNING(" track without states, discarding track ");
188 return StatusCode::FAILURE;
189 }
190
191 unsigned int nMeasurement = 0, nHole = 0;
192 for (const Trk::TrackStateOnSurface* trk_state : *trk_states) {
193 // First handle the case of mdtHole
194 if (trk_state->type(Trk::TrackStateOnSurface::Hole)) {
195 storeHole(trk_state, itrk);
196 nHole ++;
197 continue;
198 }
199
200 const Trk::MeasurementBase* measurement = trk_state->measurementOnTrack();
201 if (!measurement) continue;
202 storeMeasurement(ctx, MuonDetMgr, itrk, trk_state, measurement);
203 nMeasurement ++;
204 } // end of track hit loop
205 ATH_MSG_DEBUG("Total recorded hits in the track "<<itrk<<" #Mesurement "<<nMeasurement<<" #Hole "<<nHole) ;
206 } // end of track loop
210 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!") ;
211
212
213 if (!m_tree.fill(ctx)) return StatusCode::FAILURE;
214 return StatusCode::SUCCESS;
215}
216
217void MuonSegmentReader::storeHole(const Trk::TrackStateOnSurface * trk_state, unsigned int itrk) {
218 ATH_MSG_DEBUG(" MDT Hole on track ");
219 const Trk::TrackParameters *trackPars = trk_state->trackParameters();
220 if (!trackPars) return;
221 Amg::Vector3D pos = trackPars->position();
222 m_trkHole_gPos.push_back(pos);
223
225 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(idHole);
226 m_trkHole_id.push_back(fixid.getIdInt()) ;
227 ATH_MSG_DEBUG(" Hole stored at position x " << pos.x() << " y " << pos.y() << " z " << pos.z());
228 // check the hit type (1 MDT /2 RPC/3 TGC)
229 if (m_MuonIdHelper->isMdt(idHole)) m_trkHole_type.push_back(1);
230 else if (m_MuonIdHelper->isRpc(idHole)) m_trkHole_type.push_back(2);
231 else if (m_MuonIdHelper->isTgc(idHole)) m_trkHole_type.push_back(3);
232 else {
233 m_trkHole_type.push_back(0);
234 ATH_MSG_DEBUG("None of MDT/RPC/TGC Identifier match, something wrong!");
235 }
236
237 m_trkHole_driftRadius.push_back(std::abs(trackPars->parameters()[Trk::locR]));
238 m_trkHole_trackIndex.push_back(itrk);
239
240} // end storeHole
241
242
243void MuonSegmentReader::storeMeasurement(const EventContext& ctx, const MuonGM::MuonDetectorManager* MuonDetMgr, unsigned int itrk, const Trk::TrackStateOnSurface* trk_state, const Trk::MeasurementBase* measurement) {
244
245 const Trk::TrackParameters *trackPars = trk_state->trackParameters();
246 const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(measurement);
247
248 if (rot) { // case of measurement exist
249 Identifier rot_id = rot->identify();
250 if (m_MuonIdHelper->isMdt(rot_id)) {
251 const Muon::MdtDriftCircleOnTrack* mrot = dynamic_cast<const Muon::MdtDriftCircleOnTrack*>(rot);
252 if (!mrot) {
253 ATH_MSG_DEBUG("This is not a MdtDriftCircleOnTrack!!! ");
254 return;
255 }
256 int hitType = 0;
258 hitType = 1;
259 }
260 else if (trk_state->type(Trk::TrackStateOnSurface::Outlier)) {
261 hitType = 4;
262 }
263 else ATH_MSG_WARNING("This hit is not measurement o outlier, hit type wrong!");
264 m_trkHit_type.push_back(hitType);
265
266 // get PRD
267 const Muon::MdtPrepData* prd = mrot->prepRawData();
268 Identifier id = prd->identify();
269 int adc = prd->adc();
270 int tdc = prd->tdc();
271 Amg::Vector3D prd_pos = prd->globalPosition();
272 ATH_MSG_DEBUG("PRD ADC "<<adc<<" PRD TDC "<<tdc<<" PRD gPos "<<prd_pos);
273 // add the implement of calibrationTool, initialize global position by mrot
274 MdtCalibInput calibIn{*prd};
275 calibIn.setClosestApproach(mrot->globalPosition());
276 calibIn.setTrackDirection(trackPars->momentum().unit(), true);
277 const MdtCalibOutput calibResult{m_calibrationTool->calibrate(ctx, calibIn, false)};
278 ATH_MSG_DEBUG("print "<<calibIn << " calibResult : "<<calibResult);
279 m_trkHit_tubeT0.push_back(calibResult.tubeT0());
280 m_trkHit_tubeMeanAdc.push_back(calibResult.meanAdc());
281 m_trkHit_lorTime.push_back(calibResult.lorentzTime());
282 m_trkHit_slewTime.push_back(calibResult.slewingTime());
283 m_trkHit_propTime.push_back(calibResult.signalPropagationTime());
284 m_trkHit_tempTime.push_back(calibResult.temperatureTime());
285 m_trkHit_bkgTime.push_back(calibResult.backgroundTime());
286 m_trkHit_tof.push_back(calibIn.timeOfFlight());
287 m_trkHit_triggerTime.push_back(calibIn.triggerTime());
288 m_trkHit_calibStatus.push_back(calibResult.status());
289
290 // fill the trkHit branches
291 m_trkHit_adc.push_back(adc) ;
292 m_trkHit_tdc.push_back(tdc) ;
293 m_trkHit_trackIndex.push_back(itrk) ;
294 m_trkHit_driftTime.push_back(mrot->driftTime());
295
296 float localAngle = mrot->localAngle() ;
297 float driftRadius = mrot->driftRadius() ;
298 float error = std::sqrt(mrot->localCovariance()(0, 0));
299 m_trkHit_error.push_back(error) ;
300 m_trkHit_localAngle.push_back(localAngle);
301 m_trkHit_driftRadius.push_back(driftRadius) ;
302
303 const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement(id);
304 if( !detEl ) {
305 ATH_MSG_WARNING( "getGlobalToStation failed to retrieve detEL byebye" );
306 return;
307 }
308
309 // get the 2nd coordinator from the track hit measurement
310 Amg::Vector3D trkHitPos = trackPars->position();
311 // global to local transformation for chamber coordination
312 Amg::Transform3D gToStation = detEl->GlobalToAmdbLRSTransform();
313
314 Amg::Vector3D trkHitPosLoc = gToStation* trkHitPos;
315 m_trkHit_closestApproach.push_back(trkHitPosLoc);
316 m_trkHit_gClosestApproach.push_back(trkHitPos);
317
318 // get trkHit local position from measurement
319 Amg::Vector3D mrot_gPos = mrot->globalPosition(); // equal to Amg::Vector3D mb_pos = it->globalPosition();
320 Amg::Vector3D mrot_pos = gToStation* mrot_gPos;
321
322 //distion to readout 2nd coordinators
323 float distRo_det = detEl->distanceFromRO(trkHitPos, id);
324 m_trkHit_distRO.push_back(distRo_det) ;
325
326 // save the local postion of hit center for local refitting, set x = 0, y = coordinator along the Ntube, z = coordinator along the Nlayer
327 Amg::Vector3D wireCenter = gToStation*detEl->tubePos(id);
328 wireCenter.x() = 0;
329 ATH_MSG_DEBUG(m_MuonIdHelper->mdtIdHelper().stationNameString(int(m_MuonIdHelper->mdtIdHelper().stationName(id)))<<" "<<m_MuonIdHelper->stationEta(id)<<" "<<m_MuonIdHelper->stationPhi(id)
330 <<" "<<"ml: "<<m_MuonIdHelper->mdtIdHelper().multilayer(id)<<" lb: "<<m_MuonIdHelper->mdtIdHelper().tubeLayer(id)<<" tube: "<<m_MuonIdHelper->mdtIdHelper().tube(id)
331 << " detEl wireLocalCenter " << " x : "<<wireCenter.x()<< " y : " << wireCenter.y()<< " z : "<<wireCenter.z());
332
333 m_trkHit_center.push_back(wireCenter);
334 m_trkHit_gPos.push_back(mrot_gPos);
335 m_trkHit_pos.push_back(mrot_pos);
336
337 // residual calculator
338 float residualBiased = -999.;
339 float pullBiased = -999.;
340 {
341 std::optional<Trk::ResidualPull> resPullBiased = m_pullCalculator->residualPull(measurement, trackPars, Trk::ResidualPull::Biased );
342 if(resPullBiased.has_value()){
343 residualBiased = resPullBiased.value().residual().front();
344 pullBiased = resPullBiased.value().pull().front();
345 }
346 }
347 // residual definition double residual = measurement->localParameters()[Trk::loc1] - trkPar->parameters()[Trk::loc1];
348 m_trkHit_resi.push_back(residualBiased) ;
349 m_trkHit_pull.push_back(pullBiased) ;
350 m_trkHit_rTrk.push_back(trackPars->parameters()[Trk::loc1]) ;
351
352 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(id);
353 m_trkHit_id.push_back(fixid.getIdInt()) ;
354
355 // debugging printout
356 ATH_MSG_DEBUG("trackHit distRO " << distRo_det<<" positionAlongWire "<<mrot->positionAlongWire()<<" tubeLength "<<detEl->tubeLength(id));
357 ATH_MSG_DEBUG("prd hit global position measurement " <<" x : "<< prd_pos.x()<<" y : "<< prd_pos.y()<<" z : "<<prd_pos.z());
358 ATH_MSG_DEBUG("MdtDriftCircleOnTrack hit global position measurement " << " x : " <<mrot_gPos.x()<<" y : "<< mrot_gPos.y() <<" z : "<<mrot_gPos.z());
359 ATH_MSG_DEBUG("trackHitPos from trackPars " << " x : "<<trkHitPos.x() <<" y : "<<trkHitPos.y() <<" z : "<< trkHitPos.z() );
360 ATH_MSG_DEBUG("trackHit Local Pos from globaltolocalCoords " <<" x : "<< trkHitPosLoc.x() <<" y : "<< trkHitPosLoc.y() <<" z : "<< trkHitPosLoc.z());
361 ATH_MSG_DEBUG("mrod Local Pos from globaltolocalCoords " <<" x : "<< mrot_pos.x() <<" y : "<< mrot_pos.y() <<" z : "<< mrot_pos.z());
362 ATH_MSG_DEBUG("TrackIndex "<<itrk<<" station " << fixid.stationNumberToFixedStationString(fixid.stationName()) << " eta " << fixid.eta() << " phi " << fixid.phi() << " ML " << fixid.mdtMultilayer() << " Layer " << fixid.mdtTubeLayer()
363 <<" Tube "<<fixid.mdtTube()<< " MROT drift R " << mrot->driftRadius() << " errDriftRadius " << error<< " drift Time "
364 << mrot->driftTime() <<" ADC "<<adc<<" TDC "<<tdc);
365 ATH_MSG_DEBUG(" driftRadius from driftRadius func "<<driftRadius<<" rTrk track fit to wire "<<trackPars->parameters()[Trk::loc1]<<" residualBiased " << residualBiased << " pullBiased " << pullBiased);
366
367 } // finish mdt hit loop
368
369 else if (m_MuonIdHelper->isRpc(rot_id)) {
370
371 ATH_MSG_DEBUG("Found the RPC ROT "<<rot_id<<" !");
372 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(rot_id);
373 m_trkTriggerHit_id.push_back(fixid.getIdInt()) ;
374 m_trkTriggerHit_trackIndex.push_back(itrk);
375 m_trkTriggerHit_type.push_back(1); // RPC ROT
376 const Muon::RpcClusterOnTrack* rpc = dynamic_cast<const Muon::RpcClusterOnTrack*>(rot);
377 const Muon::RpcPrepData* rpcPRD = rpc->prepRawData();
378 m_trkTriggerHit_time.push_back(rpcPRD->time());
379 m_trkTriggerHit_gPos.push_back(rpcPRD->globalPosition());
380
381 } // end of RPC rot
382 else if (m_MuonIdHelper->isTgc(rot_id)) {
383
384 ATH_MSG_DEBUG("Found the TGC ROT "<<rot_id<<" !");
385 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(rot_id);
386 m_trkTriggerHit_id.push_back(fixid.getIdInt()) ;
387 m_trkTriggerHit_trackIndex.push_back(itrk);
388 m_trkTriggerHit_type.push_back(3); // tgc ROT
389 const Muon::TgcClusterOnTrack* tgc = dynamic_cast<const Muon::TgcClusterOnTrack*>(rot);
390 const Muon::TgcPrepData* tgcPRD = tgc->prepRawData() ;
391 m_trkTriggerHit_time.push_back(tgcPRD->getBcBitMap());
392 m_trkTriggerHit_gPos.push_back(tgcPRD->globalPosition());
393
394 } //end of TGC rot
395 else {
396 ATH_MSG_DEBUG("Couldn't find track ROT ID "<<rot_id);
397 }
398
399 } // end of rot case
400 else {
401 ATH_MSG_DEBUG("No ROT! Check the competingROT");
402 // use competingROT from RPC and TGC
403 const Muon::CompetingMuonClustersOnTrack* crot = dynamic_cast<const Muon::CompetingMuonClustersOnTrack*>(measurement);
404 if (crot) {
405 for (const auto& itR : crot->containedROTs()) {
406 Identifier crot_id = itR->identify() ;
407 MuonFixedId fixid = m_idToFixedIdTool->idToFixedId(crot_id);
408 m_trkTriggerHit_id.push_back(fixid.getIdInt());
409 m_trkTriggerHit_trackIndex.push_back(itrk);
410 if (m_MuonIdHelper->isTgc(crot_id)) {
411 ATH_MSG_DEBUG("This is TGC competing hits on track!") ;
412 if (m_MuonIdHelper->tgcIdHelper().isStrip(crot_id)) m_trkTriggerHit_type.push_back(5); // tgc strip hit, measuresPhi
413 else m_trkTriggerHit_type.push_back(4); // tgc wire hit
414 const Muon::TgcClusterOnTrack* tgc = dynamic_cast<const Muon::TgcClusterOnTrack*>(itR.get());
415 const Muon::TgcPrepData* tgcPRD = tgc ? tgc->prepRawData() : nullptr;
416 if (tgcPRD) {
417 m_trkTriggerHit_time.push_back(tgcPRD->getBcBitMap());
418 m_trkTriggerHit_gPos.push_back(tgcPRD->globalPosition());
419 }
420 else {
421 m_trkTriggerHit_time.push_back(0);
422 Amg::Vector3D zero = Amg::Vector3D::Zero();
423 m_trkTriggerHit_gPos.push_back(zero);
424 }
425 } // tgc case
426 else if (m_MuonIdHelper->isRpc(crot_id)) {
427 ATH_MSG_DEBUG("This is RPC competing hits on track!") ;
428 m_trkTriggerHit_type.push_back(2);
429 const Muon::RpcClusterOnTrack* rpc = dynamic_cast<const Muon::RpcClusterOnTrack*>(itR.get());
430 const Muon::RpcPrepData* rpcPRD = rpc ? rpc->prepRawData() : nullptr;
431 if (rpcPRD) {
432 m_trkTriggerHit_time.push_back(rpcPRD->time());
433 m_trkTriggerHit_gPos.push_back(rpcPRD->globalPosition());
434 }
435 else {
436 m_trkTriggerHit_time.push_back(0);
437 Amg::Vector3D zero = Amg::Vector3D::Zero();
438 m_trkTriggerHit_gPos.push_back(zero);
439 } // rpc case
440 } // rpc case
441 else {
442 m_trkTriggerHit_type.push_back(0);
443 m_trkTriggerHit_time.push_back(0);
444 Amg::Vector3D zero = Amg::Vector3D::Zero();
445 m_trkTriggerHit_gPos.push_back(zero);
446 }
447 } // end of crots loop
448 } // end of crot check
449 } // end of CompetingROT
450} // end of store measurement
451
453{
454 ATH_MSG_INFO("MuonSegmentReader :: Finalize + Matching");
455 ATH_CHECK(m_tree.write());
456 return StatusCode::SUCCESS;
457}
458
459} // 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
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
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
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< std::unique_ptr< 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
void zero(TH2 *h)
zero the contents of a 2d histogram
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