ATLAS Offline Software
MdtVsTgcRawDataValAlg.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), M.King(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 
16 #include "MuonRDO/TgcRdo.h"
18 #include "MuonRDO/TgcRdoIdHash.h"
26 
27 #include <inttypes.h>
28 #include <sstream>
29 #include <algorithm>
30 #include <fstream>
31 
33 
34 MdtVsTgcRawDataValAlg::MdtVsTgcRawDataValAlg( const std::string & type, const std::string & name, const IInterface* parent )
36 {
37  // Declare the properties
38  declareProperty("CheckCabling", m_checkCabling=false);
39  declareProperty("TgcLv1File", m_tgclv1file=true);
40  declareProperty("ChamberName", m_chamberName="XXX");
41  declareProperty("StationSize", m_StationSize="XXX");
42  declareProperty("Sector", m_sector=0);
43  declareProperty("Side", m_side=0);
44  declareProperty("LastEvent", m_lastEvent=0);
45  declareProperty("CosmicStation", m_cosmicStation=0);
46  declareProperty("MdtAdcCut", m_MdtAdcCut=50);
47  declareProperty("MdtTdcCut", m_MdtTdcCut=1600);
48 
49  // initialize class members
50 
51  for(int ac=0; ac<2; ac++){
52  m_mvt_cutspassed[ac] = nullptr;
53  for(int jMDT=0; jMDT<4; jMDT++){
54  m_mdt_segmmap[ac][jMDT] = nullptr;
55  for(int sMDT=0; sMDT<4; sMDT++){
56  m_mdt_segmposdirsag[ac][jMDT][sMDT] = nullptr;
57  for(int iREPT=0; iREPT<4; iREPT++){
58  m_mdt_segmmatchsag[ac][jMDT][sMDT][iREPT] = nullptr;
59  m_mdt_trackdirdirsag[ac][jMDT][sMDT][iREPT] = nullptr;
60  m_mdt_trackchecksag[ac][jMDT][sMDT][iREPT][0] = nullptr;
61  m_mdt_trackchecksag[ac][jMDT][sMDT][iREPT][1] = nullptr;
62  }
63  }
64  }
65  for(int WS=0; WS<2; WS++){
66  for(int EffNDE=0; EffNDE<4; EffNDE++){
67  m_eff_stationmapbase[ac][WS][EffNDE] = nullptr;
68  m_eff_stationmapmid[ac][WS][EffNDE] = nullptr;
69  m_eff_stationmap[ac][WS][EffNDE] = nullptr;
70  }
71  }
72  }
73 
74  // Initialize to zero
75  for(int i=0;i<2;i++)// AC
76  for(int jTGC=0;jTGC<4;jTGC++)// TGC Station
77  for(int f=0;f<2;f++)// FE
78  for(int k=0;k<2;k++)// WireStrip
79  for(int x=0;x<4;x++){
80  m_mvt_extrprdsag[i][jTGC][f][k][x]=nullptr;
81  m_mvt_extrprdsag2[i][jTGC][f][k][x]=nullptr;
82  }
83  for(int k=0;k<2;k++)
84  for(int i=0;i<2;i++)
85  for(int x=0;x<4;x++){
86  m_tgc_prdcompsag[i][k][x]=nullptr;
87  }
88 
89 }
90 
92  ATH_MSG_INFO( " deleting MdtVsTgcRawDataValAlg " );
93 }
94 
95 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
96 
100  ATH_MSG_INFO( "in initializing MdtVsTgcRawDataValAlg" );
101  // MuonDetectorManager from the conditions store
103  ATH_CHECK(m_idHelperSvc.retrieve());
104 
105  //MDT z position
106  //Name MultiLayer TubeLayer z
107  //17 1 1 14142.5
108  //17 1 2 14168.5
109  //17 1 3 14194.5
110  //17 2 1 14394.6
111  //17 2 2 14420.6
112  //17 2 3 14446.6
113  //18 1 1 13726.5
114  //18 1 2 13752.5
115  //18 1 3 13778.5
116  //18 2 1 13978.6
117  //18 2 2 14004.6
118  //18 2 3 14030.6
119 
120  // Retrieve the MuonDetectorManager
121  const MuonGM::MuonDetectorManager* MuonDetMgrDS=nullptr;
122  ATH_CHECK( detStore()->retrieve(MuonDetMgrDS) );
123  ATH_MSG_DEBUG( " Found the MuonDetectorManager from detector store. " );
124  prepareTREarray(MuonDetMgrDS);
126  ATH_CHECK(m_tgc_CoinContainerName.initialize());
129  return StatusCode::SUCCESS;
130 }
131 
132 
133 /*----------------------------------------------------------------------------------*/
135 /*----------------------------------------------------------------------------------*/
136  ATH_MSG_DEBUG( "TGC RawData Monitoring Histograms being booked" );
137 
138  //declare a group of histograms
139  std::string generic_path_mdtvstgclv1 = "Muon/MuonRawDataMonitoring/MDTvsTGC";
140  //MonGroup mdtvstgclv1_expert( this, generic_path_mdtvstgclv1+"/Global", expert, run );
141  MonGroup mdtvstgclv1_expert_a( this, generic_path_mdtvstgclv1+"/TGCEA", run, ATTRIB_UNMANAGED );
142  MonGroup mdtvstgclv1_expert_c( this, generic_path_mdtvstgclv1+"/TGCEC", run, ATTRIB_UNMANAGED );
143 
144  if(newRunFlag()){
145  ATH_MSG_INFO( "MdtVsTgc RawData Monitoring : begin of run" );
146 
147  ATH_CHECK( bookmaphists(mdtvstgclv1_expert_a, mdtvstgclv1_expert_c) );
148  ATH_CHECK( bookeffhists(mdtvstgclv1_expert_a, mdtvstgclv1_expert_c) );
149  }//isNewRun
150  return StatusCode::SUCCESS;
151 }
152 
153 
154 /*----------------------------------------------------------------------------------*/
156 /*----------------------------------------------------------------------------------*/
157  ATH_MSG_DEBUG( "MdtVsTgcRawDataValAlg::TGC RawData Monitoring Histograms being filled" );
158 
159  //TGC PRD
161 
162  //TGC Coincidence
164 
165  ATH_MSG_DEBUG( "size of tgc container is " << tgc_coin_container -> size() );
166 
167  //MDT PRD
169 
171  tgceffcalc(mdt_segment_collection.cptr(), tgc_prd_container.cptr());
172  maphists(mdt_segment_collection.cptr(), tgc_prd_container.cptr());
173 
174  //only analyze nSL==1
175  int nSL = numberOfSL(tgc_coin_container.cptr());
176 
177  if(nSL==1){
178  //fill MDT hit vs TGC RoI
179  correlation(mdt_prd_container.cptr(), tgc_coin_container.cptr());
180  }
181 
182 
183  return StatusCode::SUCCESS; // statuscode check
184 }
185 /*----------------------------------------------------------------------------------*/
187 /*----------------------------------------------------------------------------------*/
188 
189  ATH_MSG_DEBUG( "MdtVsTgcRawDataValAlg finalize()" );
190  if(endOfRunFlag()){
193  }
194  return StatusCode::SUCCESS;
195 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
MdtVsTgcRawDataValAlg::m_mdt_trackdirdirsag
TH1 * m_mdt_trackdirdirsag[2][4][4][4]
Definition: MdtVsTgcRawDataValAlg.h:152
MdtVsTgcRawDataValAlg::m_mdt_segmposdirsag
TH1 * m_mdt_segmposdirsag[2][4][4]
Definition: MdtVsTgcRawDataValAlg.h:151
MdtVsTgcRawDataValAlg::numberOfSL
int numberOfSL(const Muon::TgcCoinDataContainer *tgctrgcontainer)
Definition: MdtVsTgcRawData_functions.cxx:83
MdtVsTgcRawDataValAlg::m_eff_stationmapbase
TH2 * m_eff_stationmapbase[2][2][4]
Definition: MdtVsTgcRawDataValAlg.h:143
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
MdtVsTgcRawDataValAlg::maphists
void maphists(const xAOD::MuonSegmentContainer *m_newsegment, const Muon::TgcPrepDataContainer *tgc_prepcontainer)
Definition: MdtVsTgcRawData_maptgchits.cxx:38
MdtVsTgcRawDataValAlg::fillHistograms
virtual StatusCode fillHistograms()
An inheriting class should either override this function or fillHists().
Definition: MdtVsTgcRawDataValAlg.cxx:155
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
MdtVsTgcRawDataValAlg::procHistograms
virtual StatusCode procHistograms()
An inheriting class should either override this function or finalHists().
Definition: MdtVsTgcRawDataValAlg.cxx:186
MdtVsTgcRawDataValAlg::m_sector
int m_sector
Definition: MdtVsTgcRawDataValAlg.h:77
MdtVsTgcRawDataValAlg::m_chamberName
std::string m_chamberName
Definition: MdtVsTgcRawDataValAlg.h:75
MdtVsTgcRawDataValAlg::tgceffcalcfinalize
void tgceffcalcfinalize()
Definition: MdtVsTgcRawData_TGCEffCheck.cxx:145
MdtVsTgcRawDataValAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MdtVsTgcRawDataValAlg.h:69
ManagedMonitorToolBase
Provides functionality for users to implement and save histograms, ntuples, and summary data,...
Definition: ManagedMonitorToolBase.h:73
MdtVsTgcRawDataValAlg::prepareTREarray
void prepareTREarray(const MuonGM::MuonDetectorManager *MuonDetMgrDS)
Definition: MdtVsTgcRawData_TGCEffCheck.cxx:86
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
MdtVsTgcRawDataValAlg::bookHistogramsRecurrent
virtual StatusCode bookHistogramsRecurrent()
An inheriting class should either override this function, bookHists() or bookHistograms().
Definition: MdtVsTgcRawDataValAlg.cxx:134
MdtVsTgcRawDataValAlg.h
MdtVsTgcRawDataValAlg::m_mdt_SegmentCollectionName
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_mdt_SegmentCollectionName
Definition: MdtVsTgcRawDataValAlg.h:84
MdtVsTgcRawDataValAlg::m_mdt_PrepDataContainerName
SG::ReadHandleKey< Muon::MdtPrepDataContainer > m_mdt_PrepDataContainerName
Definition: MdtVsTgcRawDataValAlg.h:83
MdtVsTgcRawDataValAlg::m_cosmicStation
int m_cosmicStation
Definition: MdtVsTgcRawDataValAlg.h:80
MdtVsTgcRawDataValAlg::m_tgc_prdcompsag
TH1 * m_tgc_prdcompsag[2][2][4]
Definition: MdtVsTgcRawDataValAlg.h:149
x
#define x
MdtVsTgcRawDataValAlg::m_mvt_cutspassed
TH1 * m_mvt_cutspassed[2]
Definition: MdtVsTgcRawDataValAlg.h:109
MuonChamberNameConverter.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
MdtVsTgcRawDataValAlg::m_DetectorManagerKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey
Definition: MdtVsTgcRawDataValAlg.h:66
MdtVsTgcRawDataValAlg::m_tgc_PrepDataContainerName
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_tgc_PrepDataContainerName
Definition: MdtVsTgcRawDataValAlg.h:81
MdtVsTgcRawDataValAlg::m_mdt_trackchecksag
TH1 * m_mdt_trackchecksag[2][4][4][4][2]
Definition: MdtVsTgcRawDataValAlg.h:153
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
MdtVsTgcRawDataValAlg::initialize
StatusCode initialize()
Definition: MdtVsTgcRawDataValAlg.cxx:98
ManagedMonitorToolBase::MonGroup
A container of information describing a monitoring object.
Definition: ManagedMonitorToolBase.h:137
MdtVsTgcRawDataValAlg::m_MdtAdcCut
int m_MdtAdcCut
Definition: MdtVsTgcRawDataValAlg.h:86
ManagedMonitorToolBase::initialize
virtual StatusCode initialize()
Definition: ManagedMonitorToolBase.cxx:617
MuonChambersRange.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MdtVsTgcRawDataValAlg::m_mvt_extrprdsag
TH1 * m_mvt_extrprdsag[2][4][2][2][4]
Definition: MdtVsTgcRawDataValAlg.h:147
MdtVsTgcRawDataValAlg::m_tgc_CoinContainerName
SG::ReadHandleKey< Muon::TgcCoinDataContainer > m_tgc_CoinContainerName
Definition: MdtVsTgcRawDataValAlg.h:82
MdtVsTgcRawDataValAlg::m_mvt_extrprdsag2
TH1 * m_mvt_extrprdsag2[2][4][2][2][4]
Definition: MdtVsTgcRawDataValAlg.h:148
MdtVsTgcRawDataValAlg::~MdtVsTgcRawDataValAlg
virtual ~MdtVsTgcRawDataValAlg()
Definition: MdtVsTgcRawDataValAlg.cxx:91
ManagedMonitorToolBase::ATTRIB_UNMANAGED
@ ATTRIB_UNMANAGED
Definition: ManagedMonitorToolBase.h:130
test_pyathena.parent
parent
Definition: test_pyathena.py:15
MuonCosmicSetup.h
AthenaMonManager.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
hist_file_dump.f
f
Definition: hist_file_dump.py:135
run
Definition: run.py:1
TgcRdoContainer.h
TgcRdo.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
MdtVsTgcRawDataValAlg::bookeffhists
StatusCode bookeffhists(MonGroup &mdtvstgclv1_expert_a, MonGroup &mdtvstgclv1_expert_c)
Definition: MdtVsTgcRawData_bookhistograms.cxx:100
MdtVsTgcRawDataValAlg::m_MdtTdcCut
int m_MdtTdcCut
Definition: MdtVsTgcRawDataValAlg.h:87
MdtVsTgcRawDataValAlg::m_checkCabling
bool m_checkCabling
Definition: MdtVsTgcRawDataValAlg.h:72
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
MdtVsTgcRawDataValAlg::correlation
void correlation(const Muon::MdtPrepDataContainer *mdt_hit_container, const Muon::TgcCoinDataContainer *tgc_trigger_container)
Definition: MdtVsTgcRawData_correlation.cxx:27
MdtVsTgcRawDataValAlg::m_StationSize
std::string m_StationSize
Definition: MdtVsTgcRawDataValAlg.h:76
MdtVsTgcRawDataValAlg::m_mdt_segmmap
TH2 * m_mdt_segmmap[2][4]
Definition: MdtVsTgcRawDataValAlg.h:111
MdtVsTgcRawDataValAlg::bookmaphists
StatusCode bookmaphists(MonGroup &mdtvstgclv1_expert_a, MonGroup &mdtvstgclv1_expert_c)
Definition: MdtVsTgcRawData_bookhistograms.cxx:27
MdtVsTgcRawDataValAlg::maphistsfinalize
void maphistsfinalize()
Definition: MdtVsTgcRawData_maptgchits.cxx:141
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
ManagedMonitorToolBase::endOfRunFlag
bool endOfRunFlag() const
Definition: ManagedMonitorToolBase.h:797
TgcRdoIdHash.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MdtVsTgcRawDataValAlg::m_mdt_segmmatchsag
TH1 * m_mdt_segmmatchsag[2][4][4][4]
Definition: MdtVsTgcRawDataValAlg.h:150
MdtVsTgcRawDataValAlg::m_eff_stationmap
TH2 * m_eff_stationmap[2][2][4]
Definition: MdtVsTgcRawDataValAlg.h:145
MuonClusterOnTrack.h
MdtVsTgcRawDataValAlg::m_tgclv1file
bool m_tgclv1file
Definition: MdtVsTgcRawDataValAlg.h:73
MdtVsTgcRawDataValAlg::m_side
int m_side
Definition: MdtVsTgcRawDataValAlg.h:78
MdtVsTgcRawDataValAlg::m_lastEvent
int m_lastEvent
Definition: MdtVsTgcRawDataValAlg.h:79
MuonFixedId.h
MdtVsTgcRawDataValAlg::MdtVsTgcRawDataValAlg
MdtVsTgcRawDataValAlg(const std::string &type, const std::string &name, const IInterface *parent)
Definition: MdtVsTgcRawDataValAlg.cxx:34
MdtVsTgcRawDataValAlg::m_eff_stationmapmid
TH2 * m_eff_stationmapmid[2][2][4]
Definition: MdtVsTgcRawDataValAlg.h:144
SegmentCollection.h
MdtVsTgcRawDataValAlg::tgceffcalc
void tgceffcalc(const xAOD::MuonSegmentContainer *m_newsegment, const Muon::TgcPrepDataContainer *tgc_prepcontainer)
Definition: MdtVsTgcRawData_TGCEffCheck.cxx:36
fitman.k
k
Definition: fitman.py:528
ManagedMonitorToolBase::newRunFlag
bool newRunFlag() const
Definition: ManagedMonitorToolBase.h:792