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
18
19#include <inttypes.h>
20#include <sstream>
21#include <algorithm>
22
23void
25 const Muon::TgcCoinDataContainer* tgccontainer){
26
27 ATH_MSG_DEBUG("inside correlation" );
28 //StatusCode sc=StatusCode::SUCCESS;
29
30 // MuonDetectorManager from the conditions store
32 const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr();
33 if(MuonDetMgr==nullptr){
34 ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object");
35 return;
36 }
37
38 //loop over TGC RoI container
41 it!=it_end;
42 ++it){
43
44
45 ATH_MSG_DEBUG( "size of tgc collection is " << (*it) -> size() );
46
47 //loop over TGC RoI collection
49 for( Muon::TgcCoinDataCollection::const_iterator itc=(*it)->begin();
50 itc!= itc_end;
51 ++itc){
52
53 const Muon::TgcCoinData* tcd=*itc;
54 Identifier tgcid=(*itc)->identify();
55
56 if( tcd->type() != Muon::TgcCoinData::TYPE_SL )continue;
57
58 int ac=(tcd->isAside()==false);//isNotAside a:0, c:1
59 int ef=(tcd->isForward()==false);//isNotForward f:0, e:1
60 int phi48=tcd->phi();//48(24)
61 int roi=tcd->roi();
62 int roieta;//1-53
63 int roiphi;//1-192
64
65 roi2etaphi(*tcd, roieta, roiphi);
66
67 //int tgcMdtSector=roiphi2mdtSector(roiphi,ef);
68
69 const MuonGM::TgcReadoutElement* pReadoutElementTGC = MuonDetMgr->getTgcReadoutElement(tgcid);
70 const Amg::Vector3D pos = pReadoutElementTGC->channelPos(tgcid);
71
72 float tgcEta = std::abs(pos.eta());
73 float tgcPhi = pos.phi();
74 if(tgcPhi<0)tgcPhi+=2*M_PI;
75
76
77 ATH_MSG_DEBUG("ac "<<ac
78 <<" ef "<<ef
79 <<" phi48 "<<phi48
80 <<" roi "<<roi
81 <<" roieta "<<roieta
82 <<" roiphi "<<roiphi
83 <<" tgcEta "<<tgcEta
84 <<" tgcPhi "<<tgcPhi );
85
86
87 //loop over MDT container
89 Muon::MdtPrepDataContainer::const_iterator container_end=mdt_hit_container->end();
90 for (containerIt = mdt_hit_container->begin() ;
91 containerIt != container_end ;
92 ++containerIt){
93
94 Identifier mdt_id = (*containerIt)->identify();
95 // Field Range Notes
96 // ==============================================================================
97 // StationName unsigned integer maps to "BIL", "EMS" ,etc.
98 // StationEta [-6,-1] backward endcap (-1 at lowest R)
99 // [-8,8] barrel (increases with Z)
100 // [-6,-1]+[1,6] forward endcap (1 at lowest R)
101 // StationPhi [1,8] increases with phi
102 // Technology [0] maps to "MDT"
103 // Multilayer [1,2] barrel: increases with R
104 // endcap: increases with |Z|
105 // TubeLayer [1,4] barrel: increases with R
106 // endcap: increases with |Z|
107 // Tube [1,n] barrel: increases with |Z|
108 // endcap: increases with R
109 // ==============================================================================
110
111 int mdtStationName = int(m_idHelperSvc->mdtIdHelper().stationName(mdt_id)) ;
112
113 //SN Layer Tube Radial
114 //13:EIL 2x4 x54 x4
115 //49:EIS 2x4 x36 x2
116 //17:EML 2x3 x64 x5
117 //18:EMS 2x3 x64 x5
118 //20:EOL 2x3 x48 x6
119 //21:EOS 2x3 x48 x6
120
121 //only Endcap MDT
122 //if(mdtStationName!=13 && mdtStationName!=49 && mdtStationName!=17 && mdtStationName!=18 && mdtStationName!=20 && mdtStationName!=21 )continue;
123
124 //if (m_debuglevel){
125 //m_log<<MSG::DEBUG
127 // <<endmsg;
128 //}
129
130 //only Endcap middle MDT
131 if(mdtStationName!=17 && mdtStationName!=18 )continue;
132
133 int mdtStationEta = int(m_idHelperSvc->mdtIdHelper().stationEta(mdt_id)) ;//backward:[-6,-1], forward:[1,6], (1 or -1 at lowest R)
134 int mdtStationPhi = int(m_idHelperSvc->mdtIdHelper().stationPhi(mdt_id)) ;//[1:8]
135 int mdtAC = (mdtStationEta<0);//a:0, c:1
136
137 float mdtSector=mdtStationPhi*2.-1.;
138 if(mdtStationName==18)mdtSector+=1;
139 double mdtSectorPhi = (mdtSector-1.)*M_PI/8.;
140
141 //same Side
142 if(ac!=mdtAC)continue;
143 ATH_MSG_DEBUG( "size of mdt collection is " << (*containerIt) -> size() );
144
145 ATH_MSG_DEBUG("mdtStationName "<<mdtStationName
146 <<" mdtStationEta "<<mdtStationEta
147 <<" mdtStationPhi "<<mdtStationPhi
148 <<" mdtSectorPhi "<<mdtSectorPhi );
149
150 //loop over MDT PRD Collection
151 Muon::MdtPrepDataCollection::const_iterator collection_it_end=(*containerIt)->end();
152
153
154 int tmp[2][4][64];
155 for(int i=0;i<2;i++)
156 for(int j=0;j<4;j++)
157 for(int k=0;k<64;k++)
158 tmp[i][j][k]=0;
159
160 for(Muon::MdtPrepDataCollection::const_iterator mdtCollection=(*containerIt)->begin();
161 mdtCollection!= collection_it_end;
162 ++mdtCollection){
163
164 Identifier mdt_id2 = (*mdtCollection)->identify();
165
166 int mdtMultiLayer = int(m_idHelperSvc->mdtIdHelper().multilayer(mdt_id2));
167 int mdtTubeLayer = int(m_idHelperSvc->mdtIdHelper().tubeLayer(mdt_id2));
168 int mdtTube = int(m_idHelperSvc->mdtIdHelper().tube(mdt_id2));
169 int mdtTubeIdForEM = (std::abs(mdtStationEta)-1)*64 + mdtTube -1;
170
171 ATH_MSG_DEBUG("mdtMultiLayer "<<mdtMultiLayer
172 <<" mdtTubeLayer "<<mdtTubeLayer
173 <<" mdtTube "<<mdtTube
174 <<" mdtTubeIdForEM "<<mdtTubeIdForEM );
175
176 if(tmp[mdtMultiLayer-1][mdtTubeLayer-1][mdtTube-1]==1)continue;
177 tmp[mdtMultiLayer-1][mdtTubeLayer-1][mdtTube-1]=1;
178
179 int adc = (*mdtCollection)->adc();
180 int tdc = (*mdtCollection)->tdc();
181
182 if(adc < m_MdtAdcCut )continue;
183
184 const MuonGM::MdtReadoutElement* pReadoutElementMDT = MuonDetMgr->getMdtReadoutElement(mdt_id2);
185 const Amg::Vector3D mdtgPos = pReadoutElementMDT->tubePos(mdt_id2); //global position of the wire
186 float mdtEta = std::abs(mdtgPos.eta());
187 float mdtPhi = mdtgPos.phi();
188 float mdtr = mdtgPos.perp();
189 float mdtz = mdtgPos.z();
190 if(mdtPhi<0)mdtPhi+=2*M_PI;
191
192 ATH_MSG_DEBUG(" Name "<<mdtStationName
193 <<" Eta "<<mdtStationEta
194 <<" Phi "<<mdtStationPhi
195 <<" MultiLayer "<<mdtMultiLayer
196 <<" TubeLayer "<<mdtTubeLayer
197 <<" Tube "<<mdtTube
198 <<" TubeIdForEM "<<mdtTubeIdForEM
199 <<" Eta "<<mdtEta
200 <<" Phi "<<mdtPhi
201 <<" r "<<mdtr
202 <<" z "<<mdtz
203 <<" Sec "<<mdtSector
204 <<" SecPhi "<<mdtSectorPhi
205 <<" ADC "<<adc
206 <<" TDC "<<tdc );
207
208 }//MDT collection
209 }//MDT container
210 }//TGC collection
211 }//TGC container
212}
#define M_PI
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
size_t size() const
Number of registered mappings.
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
MuonPrepDataContainerT< MdtPrepData > MdtPrepDataContainer
MuonCoinDataContainer< TgcCoinDataCollection > TgcCoinDataContainer