ATLAS Offline Software
Loading...
Searching...
No Matches
MdtVsTgcRawData_SegmSorting.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 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
21#include <inttypes.h>
22#include <sstream>
23#include <algorithm>
24#include <fstream>
25
26// New Sort Segments in the MDT Endcap into Sides and MDT Stations
27void
29 std::vector<const Muon::MuonSegment*> (&sortedSegments)[2][4]){
30
31 // Loop over all segments in event
32 xAOD::MuonSegmentContainer::const_iterator mdtseg_itr = newsegment->begin();
33 xAOD::MuonSegmentContainer::const_iterator mdtseg_end = newsegment->end();
34 for(; mdtseg_itr!=mdtseg_end; ++mdtseg_itr){
35 if(!(*mdtseg_itr)->muonSegment().isValid())continue;
36 // Get segm
37 const Muon::MuonSegment* segm = dynamic_cast<const Muon::MuonSegment*>(*(*mdtseg_itr)->muonSegment());
38 if (segm == nullptr) {
39 ATH_MSG_ERROR( "no pointer to segm!!!" );
40 break;
41 }
42
43 bool isMdt=false, isEndcap=false; // Flags for whether the Segment has hits from the MDT/Endcap
44 int nMdtMeas[4]={0,0,0,0}; // int array to count number of MDT hits in different stations
45
46 // Loop through contained ROTs and identify used stations
47 for(unsigned int iROT=0; iROT<segm->numberOfContainedROTs(); ++iROT){
48 const Trk::RIO_OnTrack* rio = segm->rioOnTrack(iROT);
49 if(!rio){
50 ATH_MSG_DEBUG("No RIO");
51 continue;
52 }
53 Identifier id = rio->identify();
54
55 // Identify MDT Endcap Segments
56 if(m_idHelperSvc->isMdt(id))isMdt=true;
57 if(m_idHelperSvc->isEndcap(id))isEndcap=true;
58
59 int stationName = int(m_idHelperSvc->mdtIdHelper().stationName(id));
60 // Large (L) = odd, greater r, Small (S) = even, lower r
61 // 13=EIL 49=EIS 14=EEL 15=EES 17=EML 18=EMS 20=EOL 21=EOS
62 if((stationName==13)||(stationName==49))nMdtMeas[0]++;// MDT
63 if((stationName==14)||(stationName==15))nMdtMeas[1]++;// MDT
64 if((stationName==17)||(stationName==18))nMdtMeas[2]++;// MDT
65 if((stationName==20)||(stationName==21))nMdtMeas[3]++;// MDT
66 }
67
68 // If not Endcap and does not contain MDT hits
69 if(!isMdt||!isEndcap)continue;
70
71 // Get Side
72 int segmAC = (segm->globalPosition().eta()<0);// a:0, c:1
73
74 // Check MDT Stations included in this Segment
75 int nMDTStations=0; int MDTStationj=-1;
76 for(int jMDT=0;jMDT<4;jMDT++){
77 if(nMdtMeas[jMDT]!=0){
78 nMDTStations++;
79 MDTStationj=jMDT;
80 }
81 }
82
83 // MC data has an odd channel set always triggering segments, this cuts them
84 if((segmAC==0)&&(MDTStationj==0)&&
85 (segm->globalPosition().eta()>1.815)&&(segm->globalPosition().eta()<1.82)&&
86 (segm->globalPosition().phi()>2.857)&&(segm->globalPosition().phi()<2.862))continue;
87
88 // If there is only one station pass the segment data on to the variables
89 if(nMDTStations==1){
90 //HasStationSegm[segmAC][MDTStationj]=true;
91 sortedSegments[segmAC][MDTStationj].push_back(segm);
92 }
93 }// Loop over segments
94}// End of function
Scalar eta() const
pseudorapidity method
#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.
void SortMDTSegments(const xAOD::MuonSegmentContainer *m_newsegment, std::vector< const Muon::MuonSegment * >(&sortedSegments)[2][4])
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
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 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
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".