ATLAS Offline Software
Loading...
Searching...
No Matches
MdtVsTgcRawData_maptgchits.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6// Package : MdtVsTgcRawDataValAlg
7// Author: M.King(Kobe)
8// Feb. 2011
9//
10// DESCRIPTION:
11// Subject: TGC Efficiency -->TGC Efficiency plots including EIFI by comparing with MDT Segments
13
15
20
24
25#include <TH1F.h>
26#include <TH2F.h>
27#include <TH1.h>
28#include <TH2.h>
29#include <inttypes.h>
30
31#include <sstream>
32#include <algorithm>
33#include <fstream>
34
35void
37 const Muon::TgcPrepDataContainer *tgc_prepcontainer){//use new mdt segment
38 ATH_MSG_DEBUG("inside maptgchits" );
39
41 // loop over MDT Segment Collection
42 xAOD::MuonSegmentContainer::const_iterator mdtseg_itr = newsegment->begin();
43 xAOD::MuonSegmentContainer::const_iterator mdtseg_end = newsegment->end();
44 for(; mdtseg_itr!=mdtseg_end; ++mdtseg_itr){
45 if(!(*mdtseg_itr)->muonSegment().isValid())continue;
46 // Get segm
47 const Muon::MuonSegment* segm = dynamic_cast<const Muon::MuonSegment*>(*(*mdtseg_itr)->muonSegment());
48 if (segm == nullptr) {
49 ATH_MSG_ERROR( "no pointer to segm!!!" );
50 break;
51 }
52 // Initialize variables
53 int stationName=0;
54 int nMdtMeas[4] = {0,0,0,0};
55 bool isMdt=false, isEndcap=false;
56
57 // Loop through contained ROTs and count used MDT and TGC stations
58 for(unsigned int i=0;i<segm->numberOfContainedROTs();++i){
59 // Get station information
60 const Trk::RIO_OnTrack* rio = segm->rioOnTrack(i);
61 if(!rio) continue;
62 Identifier id = rio->identify();
63 stationName = int(m_idHelperSvc->mdtIdHelper().stationName(id));
64 // Flag Segments with ROTs in the MDT & Endcap
65 if(m_idHelperSvc->isMdt(id))isMdt=true;
66 if(m_idHelperSvc->isEndcap(id))isEndcap=true;
67 // If ROT is MDT
68 if((stationName==13)||(stationName==49)){nMdtMeas[0]++;}
69 if((stationName==14)||(stationName==15)){nMdtMeas[1]++;}
70 if((stationName==17)||(stationName==18)){nMdtMeas[2]++;}
71 if((stationName==20)||(stationName==21)){nMdtMeas[3]++;}
72 }
73 if(!isMdt)continue;
74 if(!isEndcap)continue;
75
76 // Establish which MDT stations the Segment is in
77 int nStations = 0;
78 for(int jMDT=0;jMDT<4;jMDT++){
79 if(nMdtMeas[jMDT]){
80 nStations++;
81 }
82 }
83 // Check that the Segment only occupies one Station
84 if(nStations!=1)continue;
85
86 // Get Position pointer and segmAC index
87 const Amg::Vector3D segmGlobalPos = segm->globalPosition();
88 int segmAC = (segmGlobalPos.z()<0);// a:0, c:1
89
90 // Fill MDT data
91 for(int jMDT=0;jMDT<4;jMDT++){// jMDT
92 if(nMdtMeas[jMDT]){// If hits in this Station
93 // Get position variables
94 float segmGlobalEta = std::abs(segmGlobalPos.eta());
95 float segmGlobalPhi = segmGlobalPos.phi();
96 if(segmGlobalPhi<0) segmGlobalPhi+=2*M_PI;
97 // Fill position histogram
98 m_mdt_segmmap[segmAC][jMDT]->Fill(segmGlobalPhi, segmGlobalEta);
99 }// If hits in Station
100 }// jMDT
101 }// MDT Segment Collection
102
104 //loop over TGC Prep Data container
105 Muon::TgcPrepDataContainer::const_iterator tgc_it_end=tgc_prepcontainer->end();
106 for( Muon::TgcPrepDataContainer::const_iterator tgc_it=tgc_prepcontainer->begin();
107 tgc_it!=tgc_it_end;
108 ++tgc_it){
109
110 //loop over TGC Prep Data collection
111 Muon::TgcPrepDataCollection::const_iterator tgc_itc_end=(*tgc_it)->end();
112 for( Muon::TgcPrepDataCollection::const_iterator tgc_itc=(*tgc_it)->begin();
113 tgc_itc!= tgc_itc_end;
114 ++tgc_itc){
115 const Muon::TgcPrepData* tpd=*tgc_itc;
116
117 // Get detector information
118 const MuonGM::TgcReadoutElement *tre = tpd->detectorElement();
119 const std::string tgcStationType = tre->getStationType();
120
121 // Get detector variables
122 Identifier tgcid=(*tgc_itc)->identify();
123 int tgcStationName = m_idHelperSvc->tgcIdHelper().stationName(tgcid);
124
125 // Get position variables
126 const Amg::Vector3D tgcGlobalPos = tpd->globalPosition();
127 float tgcGlobalPhi = tgcGlobalPos.phi();
128 if(tgcGlobalPhi<0)tgcGlobalPhi+=2*M_PI;
129
130 // Cut non-TGC-Endcap
131 if(tgcStationName<41 || tgcStationName>48)continue;
132 }// TGC PRD Collection
133 }// TGC PRD Container
134
135 return;
136}// End of function
137
138// Finalize histograms which need post processing
140
141}// End of function
#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 noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
const_iterator end() const
return const_iterator for end of container
const_iterator begin() const
return const_iterator for first entry
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
void maphists(const xAOD::MuonSegmentContainer *m_newsegment, const Muon::TgcPrepDataContainer *tgc_prepcontainer)
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
This is the common class for 3D segments used in the muon spectrometer.
const Trk::RIO_OnTrack * rioOnTrack(unsigned int) const
returns the RIO_OnTrack (also known as ROT) objects depending on the integer
virtual const Amg::Vector3D & globalPosition() const override final
global position
Class to represent TGC measurements.
Definition TgcPrepData.h:32
virtual const Amg::Vector3D & globalPosition() const override final
Returns the global position.
virtual const MuonGM::TgcReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD The pointer will be zero if the det el is not ...
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
Eigen::Matrix< double, 3, 1 > Vector3D
MuonPrepDataContainerT< TgcPrepData > TgcPrepDataContainer
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".