ATLAS Offline Software
MuonSegmentReader.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6 @ author Zhen Yan (zhen.yan@cern.ch)
7 */
8 
9 #ifndef MUONCALIB_MUONSEGMENTREADER_H
10 #define MUONCALIB_MUONSEGMENTREADER_H
12 //#include "xAODTracking/TrackParticleContainer.h"
16 
19 #include "TrkTrack/TrackInfo.h"
22 
25 #include "GaudiKernel/ServiceHandle.h"
26 #include "GaudiKernel/ToolHandle.h"
27 // #include "MdtCalibSvc/MdtCalibrationTool.h"
35 //#include "MuonTester/MuonTesterBranch.h"
37 
38 #include "TTree.h"
39 
42 namespace Trk {
43  //class IExtrapolator;
44  class IResidualPullCalculator;
46  class RIO_OnTrack;
47 } // namespace Trk
48 
49 using namespace MuonVal ;
50 namespace MuonCalib {
51 
53  {
54  public:
56 
57  //virtual StatusCode initialize() override;
58  virtual StatusCode initialize() override;
59  // virtual StatusCode execute (const EventContext& ctx) const override;
60  virtual StatusCode execute () override;
61  virtual StatusCode finalize () override;
62 
63  unsigned int cardinality() const override final { return 1; } ;
64 
65  private:
66 
67  SG::ReadHandleKey<xAOD::EventInfo> m_evtKey{this, "EventInfoKey", "EventInfo", "xAOD::EventInfo ReadHandleKey"};
68 
69  // Loop for track_coll = ["MuonSpectrometerTracks","ExtrapolatedMuonTracks", "CombinedMuonTracks", "MSOnlyExtrapolatedTracks"] if input data type is ESD
70  SG::ReadHandleKey<TrackCollection> m_TrkKey {this, "MuonTrackLocations", "MuonSpectrometerTracks"};
71 
72  SG::ReadHandleKey<Muon::MdtPrepDataContainer> m_MdtPrepDataKey {this, "MdtPrepData", "MDT_DriftCircles","MDT DriftCircles"};
73  SG::ReadHandleKey<Muon::RpcPrepDataContainer> m_RpcPrepDataKey {this,"RpcPrdCollection","RPC_Measurements","RPC PRD Container"};
74  SG::ReadHandleKey<Muon::TgcPrepDataContainer> m_TgcPrepDataKey{this,"TgcPrdCollection","TGC_Measurements","TGC PRD Container"};
75 
76  // /** MuonDetectorManager from the conditions store */
77  SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_DetectorManagerKey{this, "DetectorManagerKey", "MuonDetectorManager",
78  "Key of input MuonDetectorManager condition data"};
79 
80  ServiceHandle<Muon::IMuonIdHelperSvc> m_MuonIdHelper{this, "MuonIdHelper", "Muon::MuonIdHelperSvc/MuonIdHelperSvc",
81  "Handle to the MuonIdHelperSvc"};
82 
84  ToolHandle<IMdtCalibrationTool> m_calibrationTool{this, "CalibrationTool", "MdtCalibrationTool"};
85 
86  PublicToolHandle<Trk::IResidualPullCalculator> m_pullCalculator{this, "PullCalculator",
87  "Trk::ResidualPullCalculator/ResidualPullCalculator"};
88 
89  ToolHandle<MuonCalib::IIdToFixedIdTool> m_idToFixedIdTool{this, "IdToFixedIdTool", "MuonCalib::IdToFixedIdTool/MuonCalib_IdToFixedIdTool"};
90 
91  PublicToolHandle<Muon::MuonEDMPrinterTool> m_printer{this, "Printer", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};
92 
93  MuonTesterTree m_tree{"Segments", "CALIBNTUPLESTREAM"};
94  // book event_x branches
95  ScalarBranch<int>& m_runNumber{m_tree.newScalar<int>("event_runNumber")};
96  ScalarBranch<int>& m_eventNumber{m_tree.newScalar<int>("event_eventNumber")};
97  ScalarBranch<int>& m_lumiBlock{m_tree.newScalar<int>("event_lumiBlock")};
98  ScalarBranch<int>& m_bcId{m_tree.newScalar<int>("event_bcId")};
99  ScalarBranch<int>& m_timeStamp{m_tree.newScalar<int>("event_timeStamp")};
100  ScalarBranch<float>& m_pt{m_tree.newScalar<float>("event_LVL2Pt")};
101  //ScalarBranch<unsigned int>& m_eventTag{m_tree.newScalar<unsigned int>("event_eventTag")};
102  //ScalarBranch<int>& m_nEvent{m_tree.newScalar<int>("event_nEvent")};
103 
104  // rawMDT hit branches
105  ScalarBranch<int>& m_rawMdt_nRMdt{m_tree.newScalar<int>("rawMdt_nRMdt")}; //total number of MDT hits in the event
106  VectorBranch<unsigned int>& m_rawMdt_id{m_tree.newVector<unsigned int>("rawMdt_id")}; //identifier of the raw MDT hit (given by MuonFixedId)
107  VectorBranch<int>& m_rawMdt_tdc{m_tree.newVector<int>("rawMdt_tdc")}; //tdc counts of the raw MDT hit
108  VectorBranch<int>& m_rawMdt_adc{m_tree.newVector<int>("rawMdt_adc")}; //adc counts of the raw MDT hit
109  ThreeVectorBranch m_rawMdt_gPos{m_tree,"rawMdt_gPos"};
110 
111  // rawRPC hit branches
112  ScalarBranch<int>& m_rawRpc_nRRpc{m_tree.newScalar<int>("rawRpc_nRRpc")}; //total number of MDT hits in the event
113  VectorBranch<unsigned int>& m_rawRpc_id{m_tree.newVector<unsigned int>("rawRpc_id")}; //identifier of the raw MDT hit (given by MuonFixedId)
114  VectorBranch<float>& m_rawRpc_time{m_tree.newVector<float>("rawRpc_time")}; //times of the raw RPC hit
115  ThreeVectorBranch m_rawRpc_gPos{m_tree,"rawRpc_gPos"};
116 
117  // rawRPC hit branches
118  ScalarBranch<int>& m_rawTgc_nRTgc{m_tree.newScalar<int>("rawTgc_nRTgc")}; //total number of MDT hits in the event
119  VectorBranch<unsigned int>& m_rawTgc_id{m_tree.newVector<unsigned int>("rawTgc_id")}; //identifier of the raw MDT hit (given by MuonFixedId)
120  VectorBranch<int>& m_rawTgc_bcBitMap{m_tree.newVector<int>("rawTgc_bcBitMap")}; //times of the raw MDT hit
121  ThreeVectorBranch m_rawTgc_gPos{m_tree,"rawTgc_gPos"};
122 
123  // Muon Track branches
124  ScalarBranch<int>& m_trk_nTracks{m_tree.newScalar<int>("trk_nTracks")};
125  VectorBranch<float>& m_trk_d0{m_tree.newVector<float>("trk_d0")};
126  VectorBranch<float>& m_trk_z0{m_tree.newVector<float>("trk_z0")};
127  VectorBranch<float>& m_trk_phi{m_tree.newVector<float>("trk_phi")};
128  VectorBranch<float>& m_trk_theta{m_tree.newVector<float>("trk_theta")};
129  VectorBranch<float>& m_trk_eta{m_tree.newVector<float>("trk_eta")};
130  VectorBranch<float>& m_trk_qOverP{m_tree.newVector<float>("trk_qOverP")};
131  VectorBranch<float>& m_trk_pt{m_tree.newVector<float>("trk_pt")};
132  VectorBranch<float>& m_trk_chi2{m_tree.newVector<float>("trk_chi2")};
133  VectorBranch<int>& m_trk_ndof{m_tree.newVector<int>("trk_ndof")};
134  VectorBranch<int>& m_trk_author{m_tree.newVector<int>("trk_author")};
135  ThreeVectorBranch m_trk_perigee{m_tree,"trk_perigee"} ;
136 
137  VectorBranch<int>& m_trk_nMdtHits{m_tree.newVector<int>("trk_nMdtHits")};
138  VectorBranch<int>& m_trk_nMdtHoles{m_tree.newVector<int>("trk_nMdtHoles")};
139  VectorBranch<int>& m_trk_nOutliersHits{m_tree.newVector<int>("trk_nOutliersHits")};
140  VectorBranch<int>& m_trk_nRpcPhiHits{m_tree.newVector<int>("trk_nRpcPhiHits")};
141  VectorBranch<int>& m_trk_nRpcEtaHits{m_tree.newVector<int>("trk_nRpcEtaHits")};
142  VectorBranch<int>& m_trk_nTgcPhiHits{m_tree.newVector<int>("trk_nTgcPhiHits")};
143  VectorBranch<int>& m_trk_nTgcEtaHits{m_tree.newVector<int>("trk_nTgcEtaHits")};
144 
145  // Muon Track Hit branches (MDT)
146  ScalarBranch<int>& m_trkHit_nMdtHits{m_tree.newScalar<int>("trkHit_nMdtHits")}; // total MDT track hits
147  VectorBranch<int>& m_trkHit_trackIndex{m_tree.newVector<int>("trkHit_trackIndex")};
148  ThreeVectorBranch m_trkHit_gPos{m_tree,"trkHit_gPos"} ;
149  ThreeVectorBranch m_trkHit_pos{m_tree,"trkHit_pos"} ;
150  ThreeVectorBranch m_trkHit_closestApproach{m_tree,"trkHit_closestApproach"} ;
151  ThreeVectorBranch m_trkHit_gClosestApproach{m_tree,"trkHit_gClosestApproach"} ;
152  ThreeVectorBranch m_trkHit_center{m_tree,"trkHit_center"};
153 
154  VectorBranch<int>& m_trkHit_adc{m_tree.newVector<int>("trkHit_adc")};
155  VectorBranch<int>& m_trkHit_type{m_tree.newVector<int>("trkHit_type")}; // 1 hits, 4 outliers
156  VectorBranch<int>& m_trkHit_tdc{m_tree.newVector<int>("trkHit_tdc")};
157  VectorBranch<float>& m_trkHit_resi{m_tree.newVector<float>("trkHit_resi")};
158  VectorBranch<float>& m_trkHit_pull{m_tree.newVector<float>("trkHit_pull")};
159  VectorBranch<unsigned int>& m_trkHit_id{m_tree.newVector<unsigned int>("trkHit_id")};
160  VectorBranch<float>& m_trkHit_driftRadius{m_tree.newVector<float>("trkHit_driftRadius")};
161  VectorBranch<float>& m_trkHit_error{m_tree.newVector<float>("trkHit_error")};
162  VectorBranch<float>& m_trkHit_rTrk{m_tree.newVector<float>("trkHit_rTrk")};
163  VectorBranch<float>& m_trkHit_driftTime{m_tree.newVector<float>("trkHit_driftTime")};
164  VectorBranch<float>& m_trkHit_distRO{m_tree.newVector<float>("trkHit_distRO")};
165  VectorBranch<float>& m_trkHit_localAngle{m_tree.newVector<float>("trkHit_localAngle")};
166 
167  // branches with driftTime corrections
168  VectorBranch<float>& m_trkHit_tubeT0{m_tree.newVector<float>("trkHit_tubeT0")};
169  VectorBranch<float>& m_trkHit_triggerTime{m_tree.newVector<float>("trkHit_triggerTime")};
170  VectorBranch<float>& m_trkHit_tubeMeanAdc{m_tree.newVector<float>("trkHit_tubeMeanAdc")};
171  VectorBranch<float>& m_trkHit_slewTime{m_tree.newVector<float>("trkHit_slewTime")};
172  VectorBranch<float>& m_trkHit_lorTime{m_tree.newVector<float>("trkHit_lorTime")};
173  VectorBranch<float>& m_trkHit_propTime{m_tree.newVector<float>("trkHit_propTime")};
174  VectorBranch<float>& m_trkHit_tempTime{m_tree.newVector<float>("trkHit_tempTime")};
175  VectorBranch<float>& m_trkHit_bkgTime{m_tree.newVector<float>("trkHit_bkgTime")};
176  VectorBranch<float>& m_trkHit_tof{m_tree.newVector<float>("trkHit_tof")};
177  VectorBranch<int>& m_trkHit_calibStatus{m_tree.newVector<int>("trkHit_calibStatus")};
178 
179  // Muon Track Hole branches (MDT)
180  ScalarBranch<int>& m_trkHole_nHoles{m_tree.newScalar<int>("trkHole_nHoles")}; // total holes
181  VectorBranch<int>& m_trkHole_trackIndex{m_tree.newVector<int>("trkHole_trackIndex")};
182  VectorBranch<int>& m_trkHole_type{m_tree.newVector<int>("trkHole_type")}; // 1 MDT, 2 RPC, 3 TGC
183  ThreeVectorBranch m_trkHole_gPos{m_tree,"trkHole_gPos"} ;
184  VectorBranch<unsigned int>& m_trkHole_id{m_tree.newVector<unsigned int>("trkHole_id")};
185  VectorBranch<float>& m_trkHole_driftRadius{m_tree.newVector<float>("trkHole_driftRadius")};
186 
187  // Muon Track trigger hit branches (RPC & TGC)
188  ScalarBranch<int>& m_trkTriggerHit_nHits{m_tree.newScalar<int>("trkTriggerHit_nHits")}; // total trigger hits
189  VectorBranch<int>& m_trkTriggerHit_trackIndex{m_tree.newVector<int>("trkTriggerHit_trackIndex")};
190  VectorBranch<int>& m_trkTriggerHit_type{m_tree.newVector<int>("trkTriggerHit_type")}; // 0 unknown, 1 RPC rot, 2 RPC crot, 3 TGC rot, 4 TGC strip, 5 TGC wire
191  ThreeVectorBranch m_trkTriggerHit_gPos{m_tree,"trkTriggerHit_gPos"} ;
192  VectorBranch<unsigned int>& m_trkTriggerHit_id{m_tree.newVector<unsigned int>("trkTriggerHit_id")};
193  VectorBranch<float>& m_trkTriggerHit_time{m_tree.newVector<float>("trkTriggerHit_time")}; // time for RPC and bcBitMap for TGC
194 
195  // store functions
196  void storeMeasurement(const EventContext& ctx, const MuonGM::MuonDetectorManager* MuonDetMgr, unsigned int itrk, const Trk::TrackStateOnSurface* trk_state, const Trk::MeasurementBase* measurement);
197  void storeHole(const Trk::TrackStateOnSurface * trk_state, unsigned int itrk) ;
198 
199  };
200 
201  } // namespace MuonCalib
202 #endif
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
AthHistogramAlgorithm::AthHistogramAlgorithm
AthHistogramAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Definition: AthHistogramAlgorithm.cxx:31
MuonEDMPrinterTool.h
initialize
void initialize()
Definition: run_EoverP.cxx:894
IMdtCalibrationTool.h
MuonTesterTreeDict.h
IExtrapolator.h
MuonVal::VectorBranch< unsigned int >
MuonCalib::MuonSegmentReader::cardinality
unsigned int cardinality() const override final
Definition: MuonSegmentReader.h:63
MuonPrepDataContainer.h
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
SG::ReadHandleKey< xAOD::EventInfo >
MuonVal::ThreeVectorBranch
Definition: ThreeVectorBranch.h:19
AthHistogramAlgorithm.h
LArG4FSStartPointFilterLegacy.execute
execute
Definition: LArG4FSStartPointFilterLegacy.py:20
MuonCalib::MuonSegmentReader
Definition: MuonSegmentReader.h:53
AthAlgorithm.h
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
Trk::MeasurementBaseType::CompetingRIOsOnTrack
@ CompetingRIOsOnTrack
Definition: MeasurementBase.h:50
MuonMDT_CablingMap.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrackCollection.h
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
AthHistogramAlgorithm
Definition: AthHistogramAlgorithm.h:32
Trk::MeasurementBase
Definition: MeasurementBase.h:58
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
MuonVal
Class to store array like branches into the n-tuples.
Definition: MuonTPMetaDataAlg.cxx:25
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
MuonVal::ScalarBranch< int >
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
TrackInfo.h
Trk::MeasurementBaseType::RIO_OnTrack
@ RIO_OnTrack
Definition: MeasurementBase.h:49
MuonDetectorManager.h
EventInfo.h
IResidualPullCalculator.h
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager >
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
MuonSegment.h
IMuonIdHelperSvc.h
SegmentCollection.h
IIdToFixedIdTool.h
ServiceHandle< Muon::IMuonIdHelperSvc >