ATLAS Offline Software
Loading...
Searching...
No Matches
MdtVsTgcRawData_correlation.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6// Package : MdtVsTgcRawDataValAlg
7// Authors: A. Ishikawa(Kobe)
8// Jun. 2008
9//
10// DESCRIPTION
11// Subject: correlation btw MDT hits vs TGC RoI -->Offline Muon Data Quality
13
15
21
22#include <inttypes.h>
23#include <sstream>
24#include <algorithm>
25
26void
28 const Muon::TgcCoinDataContainer* tgccontainer){
29
30 ATH_MSG_DEBUG("inside correlation" );
31 //StatusCode sc=StatusCode::SUCCESS;
32
33 // MuonDetectorManager from the conditions store
35 const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr();
36 if(MuonDetMgr==nullptr){
37 ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object");
38 return;
39 }
40
41 //loop over TGC RoI container
44 it!=it_end;
45 ++it){
46
47
48 ATH_MSG_DEBUG( "size of tgc collection is " << (*it) -> size() );
49
50 //loop over TGC RoI collection
52 for( Muon::TgcCoinDataCollection::const_iterator itc=(*it)->begin();
53 itc!= itc_end;
54 ++itc){
55
56 const Muon::TgcCoinData* tcd=*itc;
57 Identifier tgcid=(*itc)->identify();
58
59 if( tcd->type() != Muon::TgcCoinData::TYPE_SL )continue;
60
61 int ac=(tcd->isAside()==false);//isNotAside a:0, c:1
62 int ef=(tcd->isForward()==false);//isNotForward f:0, e:1
63 int phi48=tcd->phi();//48(24)
64 int roi=tcd->roi();
65 int roieta;//1-53
66 int roiphi;//1-192
67
68 roi2etaphi(*tcd, roieta, roiphi);
69
70 //int tgcMdtSector=roiphi2mdtSector(roiphi,ef);
71
72 const MuonGM::TgcReadoutElement* pReadoutElementTGC = MuonDetMgr->getTgcReadoutElement(tgcid);
73 const Amg::Vector3D pos = pReadoutElementTGC->channelPos(tgcid);
74
75 float tgcEta = std::abs(pos.eta());
76 float tgcPhi = pos.phi();
77 if(tgcPhi<0)tgcPhi+=2*M_PI;
78
79
80 ATH_MSG_DEBUG("ac "<<ac
81 <<" ef "<<ef
82 <<" phi48 "<<phi48
83 <<" roi "<<roi
84 <<" roieta "<<roieta
85 <<" roiphi "<<roiphi
86 <<" tgcEta "<<tgcEta
87 <<" tgcPhi "<<tgcPhi );
88
89
90 //loop over MDT container
92 Muon::MdtPrepDataContainer::const_iterator container_end=mdt_hit_container->end();
93 for (containerIt = mdt_hit_container->begin() ;
94 containerIt != container_end ;
95 ++containerIt){
96
97 Identifier mdt_id = (*containerIt)->identify();
98 // Field Range Notes
99 // ==============================================================================
100 // StationName unsigned integer maps to "BIL", "EMS" ,etc.
101 // StationEta [-6,-1] backward endcap (-1 at lowest R)
102 // [-8,8] barrel (increases with Z)
103 // [-6,-1]+[1,6] forward endcap (1 at lowest R)
104 // StationPhi [1,8] increases with phi
105 // Technology [0] maps to "MDT"
106 // Multilayer [1,2] barrel: increases with R
107 // endcap: increases with |Z|
108 // TubeLayer [1,4] barrel: increases with R
109 // endcap: increases with |Z|
110 // Tube [1,n] barrel: increases with |Z|
111 // endcap: increases with R
112 // ==============================================================================
113
114 int mdtStationName = int(m_idHelperSvc->mdtIdHelper().stationName(mdt_id)) ;
115
116 //SN Layer Tube Radial
117 //13:EIL 2x4 x54 x4
118 //49:EIS 2x4 x36 x2
119 //17:EML 2x3 x64 x5
120 //18:EMS 2x3 x64 x5
121 //20:EOL 2x3 x48 x6
122 //21:EOS 2x3 x48 x6
123
124 //only Endcap MDT
125 //if(mdtStationName!=13 && mdtStationName!=49 && mdtStationName!=17 && mdtStationName!=18 && mdtStationName!=20 && mdtStationName!=21 )continue;
126
127 //if (m_debuglevel){
128 //m_log<<MSG::DEBUG
130 // <<endmsg;
131 //}
132
133 //only Endcap middle MDT
134 if(mdtStationName!=17 && mdtStationName!=18 )continue;
135
136 int mdtStationEta = int(m_idHelperSvc->mdtIdHelper().stationEta(mdt_id)) ;//backward:[-6,-1], forward:[1,6], (1 or -1 at lowest R)
137 int mdtStationPhi = int(m_idHelperSvc->mdtIdHelper().stationPhi(mdt_id)) ;//[1:8]
138 int mdtAC = (mdtStationEta<0);//a:0, c:1
139
140 float mdtSector=mdtStationPhi*2.-1.;
141 if(mdtStationName==18)mdtSector+=1;
142 double mdtSectorPhi = (mdtSector-1.)*M_PI/8.;
143
144 //same Side
145 if(ac!=mdtAC)continue;
146 ATH_MSG_DEBUG( "size of mdt collection is " << (*containerIt) -> size() );
147
148 ATH_MSG_DEBUG("mdtStationName "<<mdtStationName
149 <<" mdtStationEta "<<mdtStationEta
150 <<" mdtStationPhi "<<mdtStationPhi
151 <<" mdtSectorPhi "<<mdtSectorPhi );
152
153 //loop over MDT PRD Collection
154 Muon::MdtPrepDataCollection::const_iterator collection_it_end=(*containerIt)->end();
155
156
157 int tmp[2][4][64];
158 for(int i=0;i<2;i++)
159 for(int j=0;j<4;j++)
160 for(int k=0;k<64;k++)
161 tmp[i][j][k]=0;
162
163 for(Muon::MdtPrepDataCollection::const_iterator mdtCollection=(*containerIt)->begin();
164 mdtCollection!= collection_it_end;
165 ++mdtCollection){
166
167 Identifier mdt_id2 = (*mdtCollection)->identify();
168
169 int mdtMultiLayer = int(m_idHelperSvc->mdtIdHelper().multilayer(mdt_id2));
170 int mdtTubeLayer = int(m_idHelperSvc->mdtIdHelper().tubeLayer(mdt_id2));
171 int mdtTube = int(m_idHelperSvc->mdtIdHelper().tube(mdt_id2));
172 int mdtTubeIdForEM = (std::abs(mdtStationEta)-1)*64 + mdtTube -1;
173
174 ATH_MSG_DEBUG("mdtMultiLayer "<<mdtMultiLayer
175 <<" mdtTubeLayer "<<mdtTubeLayer
176 <<" mdtTube "<<mdtTube
177 <<" mdtTubeIdForEM "<<mdtTubeIdForEM );
178
179 if(tmp[mdtMultiLayer-1][mdtTubeLayer-1][mdtTube-1]==1)continue;
180 tmp[mdtMultiLayer-1][mdtTubeLayer-1][mdtTube-1]=1;
181
182 int adc = (*mdtCollection)->adc();
183 int tdc = (*mdtCollection)->tdc();
184
185 if(adc < m_MdtAdcCut )continue;
186
187 const MuonGM::MdtReadoutElement* pReadoutElementMDT = MuonDetMgr->getMdtReadoutElement(mdt_id2);
188 const Amg::Vector3D mdtgPos = pReadoutElementMDT->tubePos(mdt_id2); //global position of the wire
189 float mdtEta = std::abs(mdtgPos.eta());
190 float mdtPhi = mdtgPos.phi();
191 float mdtr = mdtgPos.perp();
192 float mdtz = mdtgPos.z();
193 if(mdtPhi<0)mdtPhi+=2*M_PI;
194
195 ATH_MSG_DEBUG(" Name "<<mdtStationName
196 <<" Eta "<<mdtStationEta
197 <<" Phi "<<mdtStationPhi
198 <<" MultiLayer "<<mdtMultiLayer
199 <<" TubeLayer "<<mdtTubeLayer
200 <<" Tube "<<mdtTube
201 <<" TubeIdForEM "<<mdtTubeIdForEM
202 <<" Eta "<<mdtEta
203 <<" Phi "<<mdtPhi
204 <<" r "<<mdtr
205 <<" z "<<mdtz
206 <<" Sec "<<mdtSector
207 <<" SecPhi "<<mdtSectorPhi
208 <<" ADC "<<adc
209 <<" TDC "<<tdc );
210
211 }//MDT collection
212 }//MDT container
213 }//TGC collection
214 }//TGC container
215}
#define M_PI
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const
return const_iterator for end of container
const_iterator begin() const
return const_iterator for first entry
void roi2etaphi(const Muon::TgcCoinData &cd, int &eta, int &phi)
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey
void correlation(const Muon::MdtPrepDataContainer *mdt_hit_container, const Muon::TgcCoinDataContainer *tgc_trigger_container)
Amg::Vector3D tubePos(const Identifier &id) const
Returns the global position of the given tube.
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)
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip)
int roi() const
return ROI number
CoinDataType type() const
return the coincidence type (HIPT, LPT, SL)
bool isAside() const
Aside or Cside.
int phi() const
return phi number of trigger sector
bool isForward() const
Forward region or Endcap region.
const_pointer_type cptr()
Eigen::Matrix< double, 3, 1 > Vector3D
MuonCoinDataContainer< TgcCoinDataCollection > TgcCoinDataContainer
MuonPrepDataContainerT< MdtPrepData > MdtPrepDataContainer