ATLAS Offline Software
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 
14 #include "MdtVsTgcRawDataValAlg.h"
15 
21 
22 #include <inttypes.h>
23 #include <sstream>
24 #include <algorithm>
25 
26 void
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
42  Muon::TgcCoinDataContainer::const_iterator it_end=tgccontainer->end();
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 }
createDCubeDigitHistograms.mdtTubeLayer
mdtTubeLayer
Definition: createDCubeDigitHistograms.py:111
Muon::MuonPrepDataContainer
Template for Muon PRD containers (which are basically collections of MuonPrepDataCollections).
Definition: MuonPrepDataContainer.h:42
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
MdtVsTgcRawDataValAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MdtVsTgcRawDataValAlg.h:69
Muon::TgcCoinData::isAside
bool isAside() const
Aside or Cside.
Definition: TgcCoinData.h:348
Muon::TgcCoinData::type
CoinDataType type() const
return the coincidence type (HIPT, LPT, SL)
Definition: TgcCoinData.h:346
skel.it
it
Definition: skel.GENtoEVGEN.py:396
MdtVsTgcRawDataValAlg.h
M_PI
#define M_PI
Definition: ActiveFraction.h:11
Muon::TgcCoinData
Definition: TgcCoinData.h:37
MuonChamberNameConverter.h
MuonGM::TgcReadoutElement::channelPos
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip)
MdtVsTgcRawDataValAlg::m_DetectorManagerKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey
Definition: MdtVsTgcRawDataValAlg.h:66
MuonGM::MuonDetectorManager::getTgcReadoutElement
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:247
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
MuonGM::MuonDetectorManager::getMdtReadoutElement
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:204
MdtVsTgcRawDataValAlg::m_MdtAdcCut
int m_MdtAdcCut
Definition: MdtVsTgcRawDataValAlg.h:86
MuonChambersRange.h
MuonGM::MdtReadoutElement
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h:51
lumiFormat.i
int i
Definition: lumiFormat.py:85
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonGM::TgcReadoutElement
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h:42
MuonCosmicSetup.h
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition: IdentifiableContainerMT.h:239
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:79
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition: IdentifiableContainerMT.h:233
MuonDQAHistMap.h
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
createDCubeDigitHistograms.mdtStationEta
mdtStationEta
Definition: createDCubeDigitHistograms.py:104
MdtVsTgcRawDataValAlg::roi2etaphi
void roi2etaphi(const Muon::TgcCoinData &cd, int &eta, int &phi)
Definition: MdtVsTgcRawData_functions.cxx:28
Muon::MuonCoinDataContainer
Definition: MuonCoinDataContainer.h:32
Muon::TgcCoinData::roi
int roi() const
return ROI number
Definition: TgcCoinData.h:378
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Muon::TgcCoinData::isForward
bool isForward() const
Forward region or Endcap region.
Definition: TgcCoinData.h:354
MdtVsTgcRawDataValAlg::correlation
void correlation(const Muon::MdtPrepDataContainer *mdt_hit_container, const Muon::TgcCoinDataContainer *tgc_trigger_container)
Definition: MdtVsTgcRawData_correlation.cxx:27
MuonGM::MdtReadoutElement::tubePos
Amg::Vector3D tubePos(const Identifier &id) const
Returns the global position of the given tube.
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
Muon::TgcCoinData::TYPE_SL
@ TYPE_SL
Definition: TgcCoinData.h:52
MuonFixedId.h
LheEventFiller_Common.ef
ef
Definition: SFGen_i/share/common/LheEventFiller_Common.py:7
createDCubeDigitHistograms.mdtTube
mdtTube
Definition: createDCubeDigitHistograms.py:110
fitman.k
k
Definition: fitman.py:528
createDCubeDigitHistograms.mdtStationPhi
mdtStationPhi
Definition: createDCubeDigitHistograms.py:105
Muon::TgcCoinData::phi
int phi() const
return phi number of trigger sector
Definition: TgcCoinData.h:350
Identifier
Definition: IdentifierFieldParser.cxx:14