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