ATLAS Offline Software
sTGCHitsTestTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "sTGCHitsTestTool.h"
6 
7 #include "Identifier/Identifier.h"
8 
10 
13 
15 
18 
20 #include "CLHEP/Vector/LorentzVector.h"
21 
22 #include "GaudiKernel/NTuple.h"
23 #include "GaudiKernel/SmartDataPtr.h"
24 #include "GaudiKernel/IDataProviderSvc.h"
25 #include "GaudiKernel/ITHistSvc.h"
26 #include "GaudiKernel/INTupleSvc.h"
27 
28 #include "TH2D.h"
29 #include "TROOT.h"
30 #include "TFile.h"
31 #include "TTree.h"
32 #include "TF1.h"
33 #include "TH1F.h"
34 
35 using namespace MuonGM;
36 using namespace std;
37 
38 
40  CHECK(executeCheckEventInfo());
41 
42  if (m_DosTGCTest) {
43  const sTGCSimHitCollection* p_collection = nullptr;
44  CHECK(evtStore()->retrieve(p_collection,"sTGC_Hits"));
45  for (const sTGCSimHit& hit : *p_collection) {
46  Amg::Vector3D u = hit.globalPosition();
47  CHECK(executeFillHistos(u));
48 
49 
50  const sTgcHitIdHelper* hitHelper = sTgcHitIdHelper::GetHelper();
51  int simId = hit.sTGCId();
52  std::string sim_stationName = hitHelper->GetStationName(simId);
53 
54  static const std::string QS1C("QS1C");
55  static const std::string QS2C("QS2C");
56  static const std::string QS3C("QS3C");
57  static const std::string QL1P("QL1P");
58  static const std::string QL2P("QL2P");
59  static const std::string QL3P("QL3P");
60 
61  if (sim_stationName==QS1C && u.z()>0){
62  m_sTgc_TransverseView_QS1C_posZ->Fill(u.x(),u.y());
63  }
64 
65 
66  if (sim_stationName==QS2C && u.z()>0){
67  m_sTgc_TransverseView_QS2C_posZ->Fill(u.x(),u.y());
68  }
69 
70 
71  if (sim_stationName==QS3C && u.z()>0){
72  m_sTgc_TransverseView_QS3C_posZ->Fill(u.x(),u.y());
73  }
74 
75  if (sim_stationName==QL1P && u.z()>0){
76  m_sTgc_TransverseView_QL1P_posZ->Fill(u.x(),u.y());
77  }
78 
79 
80  if (sim_stationName==QL2P && u.z()>0){
81  m_sTgc_TransverseView_QL2P_posZ->Fill(u.x(),u.y());
82  }
83 
84  if (sim_stationName==QL3P && u.z()>0){
85  m_sTgc_TransverseView_QL3P_posZ->Fill(u.x(),u.y());
86  }
87 
88  double r_sTGc = sqrt(u.x()*u.x()+u.y()*u.y());
89 
90  if (u.z() > 0){
91  m_sTgc_rZview_positiveZ->Fill(u.z(), r_sTGc);
92  }
93 
94 
95  // GeoMMHit ghit(hit);
96  // if (!ghit) continue;
97  // Amg::Vector3D u = ghit.getGlobalPosition();
98  // CHECK(executeFillHistos(u));
99  }
100  }
101 
102  return StatusCode::SUCCESS;
103 }
104 
105 
108  _TH2D( m_sTgc_TransverseView_QS1C_posZ,"sTGC_TransverseView_QS1C_posZ",1200,-6000.,6000.,1200,-6000.,6000.);
109  _TH2D( m_sTgc_TransverseView_QS2C_posZ,"sTGC_TransverseView_QS2C_posZ",1200,-6000.,6000.,1200,-6000.,6000.);
110  _TH2D( m_sTgc_TransverseView_QS3C_posZ,"sTGC_TransverseView_QS3C_posZ",1200,-6000.,6000.,1200,-6000.,6000.);
111 
112  _TH2D( m_sTgc_TransverseView_QL1P_posZ,"sTGC_TransverseView_QL1P_posZ",1200,-6000.,6000.,1200,-6000.,6000.);
113  _TH2D( m_sTgc_TransverseView_QL2P_posZ,"sTGC_TransverseView_QL2P_posZ",1200,-6000.,6000.,1200,-6000.,6000.);
114  _TH2D( m_sTgc_TransverseView_QL3P_posZ,"sTGC_TransverseView_QL3P_posZ",1200,-6000.,6000.,1200,-6000.,6000.);
115 
116  _TH2D(m_sTgc_rZview_positiveZ,"sTGC_rZView_posZ",2000,6500.,8500.,5000,0.,5000.);
117  return StatusCode::SUCCESS;
118 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
sTgcReadoutElement.h
sTgcHitIdHelper::GetHelper
static const sTgcHitIdHelper * GetHelper()
Definition: sTgcHitIdHelper.cxx:24
AtlasHitsVector
Definition: AtlasHitsVector.h:33
sTGCSimHit.h
GeoMuonHits.h
sTGCSimHitCollection.h
sTGCHitsTestTool.h
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
McEventCollection.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
_TH2D
#define _TH2D(var, name, nbinx, xmin, xmax, nbiny, ymin, ymax)
Definition: SimTestHisto.h:81
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
sTGCHitsTestTool::initialize
virtual StatusCode initialize() override final
Definition: sTGCHitsTestTool.cxx:106
sTgcHitIdHelper::GetStationName
std::string GetStationName(const int &hid) const
Definition: sTgcHitIdHelper.cxx:56
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonDetectorManager.h
sTGCSimHit
Definition: sTGCSimHit.h:15
MuonHitTestToolBase::initialize
virtual StatusCode initialize() override
Definition: MuonHitTestToolBase.cxx:111
sTgcHitIdHelper
Definition: sTgcHitIdHelper.h:13
sTGCHitsTestTool::processEvent
virtual StatusCode processEvent() override final
Definition: sTGCHitsTestTool.cxx:39
sTgcHitIdHelper.h