ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
CSCHitsTestTool Class Reference

#include <CSCHitsTestTool.h>

Inheritance diagram for CSCHitsTestTool:
Collaboration diagram for CSCHitsTestTool:

Public Member Functions

 CSCHitsTestTool (const std::string &type, const std::string &name, const IInterface *parent)
 
StatusCode initialize ()
 
StatusCode processEvent ()
 

Protected Member Functions

Identifier getIdentifier (HitID)
 
StatusCode checkIdentifier (Identifier)
 
StatusCode executeCheckEventInfo ()
 
StatusCode executeFillHistos (const Amg::Vector3D &)
 
StatusCode executeFillHistosSectors_Wedge1 (const Amg::Vector3D &, std::string)
 
StatusCode executeFillHistosSectors_Wedge2 (const Amg::Vector3D &, std::string)
 
StatusCode executeFillHistos_sTGc (const Amg::Vector3D &, std::string)
 

Protected Attributes

std::string m_detname
 
const MuonGM::MuonDetectorManagerm_pMuonMgr
 
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey {this, "EventInfo", "EventInfo", "EventInfo name"}
 SG key for Event Info. More...
 
double m_BarrelEtaCut
 MDT barrel eta cut, applicable to the MDT 2D cross section plot. More...
 
TH1 * m_muonevnt
 
TH1 * m_muonrun
 
TH1 * m_muoneta
 
TH1 * m_muontheta
 
TH1 * m_muonphi
 
TH1 * m_muonzResid
 
TH1 * m_muonphiResid
 
TH2 * m_muondetBarrel
 
TH2 * m_muonlongView
 
TH1 * m_eta
 
TH1 * m_theta
 
TH1 * m_phi
 
TH1 * m_zResid
 
TH1 * m_phiResid
 
TH2 * m_detBarrel
 
TH2 * m_longView
 
Amg::Vector3D m_direction
 
std::string m_path {"/truth/"}
 
ServiceHandle< ITHistSvc > m_histSvc {"THistSvc", "SimTestHisto"}
 

Private Attributes

bool m_DoCSCTest
 
const CscIdHelperm_pCscIdHelper
 

structors and AlgTool implementation

HepMC::ConstGenParticlePtr getPrimary ()
 
std::string m_key
 The MC truth key. More...
 

Detailed Description

Definition at line 12 of file CSCHitsTestTool.h.

Constructor & Destructor Documentation

◆ CSCHitsTestTool()

CSCHitsTestTool::CSCHitsTestTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)
inline

Definition at line 17 of file CSCHitsTestTool.h.

17  :
20  {
21  declareProperty("DoCSCTest", m_DoCSCTest=true);
22  }

Member Function Documentation

◆ checkIdentifier()

StatusCode CSCHitsTestTool::checkIdentifier ( Identifier  offid)
protected

Definition at line 48 of file CSCHitsTestTool.cxx.

48  {
49  const MuonGM::CscReadoutElement* descriptor = m_pMuonMgr->getCscReadoutElement(offid);
50  if (!descriptor) {
51  ATH_MSG_FATAL("CSC readout element not found for Id = " << m_pCscIdHelper->show_to_string(offid));
52  return StatusCode::FAILURE;
53  }
54 
55  // Testing Sim to Offline ID conversion
56  Amg::Vector3D csc_gPos = descriptor->stripPos(offid);
57  double csc_strip_phi = csc_gPos.phi();
58  if (csc_strip_phi < 0.) csc_strip_phi += 2.*M_PI;
59  double csc_strip_perp __attribute ((unused)) = csc_gPos.perp();
60  double csc_strip_z __attribute ((unused)) = csc_gPos.z();
61  double csc_strip_cot __attribute ((unused)) = 1./tan(csc_gPos.theta());
62 
63  return StatusCode::SUCCESS;
64 }

◆ executeCheckEventInfo()

StatusCode MuonHitTestToolBase::executeCheckEventInfo ( )
protectedinherited

Definition at line 35 of file MuonHitTestToolBase.cxx.

36 {
37  SG::ReadHandle<xAOD::EventInfo> eventInfo (m_eventInfoKey,Gaudi::Hive::currentContext());
38  ATH_CHECK(eventInfo.isValid());
39  uint64_t evt = eventInfo->eventNumber();
40  int numrun = eventInfo->runNumber();
41  ATH_MSG_VERBOSE("Processing EventInfo event #"<< evt<< " run: " << numrun);
42  m_muonevnt->Fill(evt);
43  m_muonrun->Fill(numrun);
44  const McEventCollection* mcEvent;
45  CHECK(evtStore()->retrieve(mcEvent,m_key));
46 
47  // *AS* Why only if mcEvent ==1? when would there be more than one event?
48  if (mcEvent->size()!=1) {
49  m_direction=Amg::Vector3D(0.,0.,0.);
50  return StatusCode::SUCCESS;
51  }
52 
53  // *AS* Why this (double) loop, if only the last entry is preserved?
54  // changed it to take the gen particle
56  for (e=mcEvent->begin();e!=mcEvent->end(); ++e) {
57  for (auto p: (**e)) {
59  Amg::Vector3D temp_momentum(p->momentum().px(),
60  p->momentum().py(),
61  p->momentum().pz());
62  m_direction = temp_momentum.unit();
63  break;
64  }
65  }
66  }
67  return StatusCode::SUCCESS;
68 }

◆ executeFillHistos()

StatusCode MuonHitTestToolBase::executeFillHistos ( const Amg::Vector3D u)
protectedinherited

for MDTs that have barrel + endcap section, take only the barrel when plotting the xy-2d plot of the detector

Definition at line 70 of file MuonHitTestToolBase.cxx.

70  {
72 
73  if (m_direction.perp() > 0 && fabs(m_direction.eta())<m_BarrelEtaCut){
74  //mdtdet->Fill(u.x(),u.y());
75  m_muondetBarrel->Fill(u.x(),u.y());
76  m_detBarrel->Fill(u.x(),u.y());
77  }
78 
79  double rad=sqrt(u.x()*u.x()+u.y()*u.y());
80  m_muonlongView->Fill(u.z(),rad);
81  m_longView->Fill(u.z(),rad);
82 
83  // //m_direction vector is filled with truth above, so here it is wrong (no eta, theta, phi of the hit!!!)
84  // *AS* why not use "u"?
85  // theta->Fill(m_direction.theta());
86  // theta->Fill(m_direction.theta());
87  // eta->Fill(m_direction.eta());
88  // eta->Fill(m_direction.eta());
89  // phi->Fill(m_direction.phi());
90  // phi->Fill(m_direction.phi());
91 
92  if (m_direction.perp() > 0) {
93  m_muonzResid->Fill(u.cross(m_direction).dot(m_direction.cross(Amg::Vector3D(0,0,1)).unit()));
94  m_muonphiResid->Fill(u.cross(m_direction).z());
95 
96  m_zResid->Fill(u.cross(m_direction).dot(m_direction.cross(Amg::Vector3D(0,0,1)).unit()));
97  m_phiResid->Fill(u.cross(m_direction).z());
98  }
99  else {
100  m_muonzResid->Fill(0);
101  m_muonphiResid->Fill(0);
102  m_zResid->Fill(0);
103  m_phiResid->Fill(0);
104  }
105 
106  return StatusCode::SUCCESS;
107 }

◆ executeFillHistos_sTGc()

StatusCode MuonHitTestToolBase::executeFillHistos_sTGc ( const Amg::Vector3D ,
std::string   
)
protectedinherited

◆ executeFillHistosSectors_Wedge1()

StatusCode MuonHitTestToolBase::executeFillHistosSectors_Wedge1 ( const Amg::Vector3D ,
std::string   
)
protectedinherited

◆ executeFillHistosSectors_Wedge2()

StatusCode MuonHitTestToolBase::executeFillHistosSectors_Wedge2 ( const Amg::Vector3D ,
std::string   
)
protectedinherited

◆ getIdentifier()

Identifier CSCHitsTestTool::getIdentifier ( HitID  cschit)
protected

Definition at line 22 of file CSCHitsTestTool.cxx.

22  {
23  const CscHitIdHelper* cschelper = CscHitIdHelper::GetHelper();
24 
25  const std::string & csc_stname = cschelper->GetStationName(cschit);
26  int csc_steta = cschelper->GetZSector(cschit);
27  int csc_stphi = cschelper->GetPhiSector(cschit);
28  int csc_cl = cschelper->GetChamberLayer(cschit);
29  int csc_wl = cschelper->GetWireLayer(cschit);
30  int csc_measphi = 1;
31  int csc_strip = 1;
32 
33  // Create the offline identifiers, fill them with hit info. Ready to be
34  // accessed and retrieve info. Currently not used in this code except for
35  // some checks.
36  // ======================================================================
37  Identifier offid = m_pCscIdHelper->channelID(csc_stname, csc_steta,
38  csc_stphi, csc_cl, csc_wl,
39  csc_measphi, csc_strip);
40  if (offid == 0) {
41  ATH_MSG_FATAL("CSC: Cannot build a valid Identifier; skip ");
42  }
43  // *AS* really info level? perhaps debug or verbose?
44  ATH_MSG_VERBOSE(" CSC: Offline Id "<<m_pCscIdHelper->show_to_string(offid));
45  return offid;
46 }

◆ getPrimary()

HepMC::ConstGenParticlePtr SimTestToolBase::getPrimary ( )
protectedinherited

Definition at line 20 of file SimTestToolBase.cxx.

21 {
22  const McEventCollection* mcCollection;
23  if (evtStore()->retrieve(mcCollection,m_key).isSuccess()) {
25  for (e=mcCollection->begin();e!=mcCollection->end(); ++e) {
26  for (auto p : (**e)) {
28  return p;
29  }
30  }
31  }
32  }
33  return 0;
34 }

◆ initialize()

StatusCode CSCHitsTestTool::initialize ( )
virtual

Reimplemented from MuonHitTestToolBase.

Definition at line 114 of file CSCHitsTestTool.cxx.

114  {
115  // initialise general histograms
117 
119 
120  return StatusCode::SUCCESS;
121 }

◆ processEvent()

StatusCode CSCHitsTestTool::processEvent ( )

Definition at line 66 of file CSCHitsTestTool.cxx.

66  {
68 
69  // *AS* which direction is selected in the end?
70  // should match with truth particle using barcode (particleID)
71 
72  // MuonSpectrometer
73  // Get the generic MuonSpectrometer (MDT,RPC,CSC,TGC) histograms
74  // Short description:
75  // MuonSpectrometer cross section
76  // MuonSpectrometer longitudinal
77  // Number of events processed from truth
78  // Event specific run number
79  // Eta, Theta, Phi, z residual (...), phi residual (...) of hits in MuonSpectrometer
80 
81  // CSC
82  // Get the CSC histograms
83  // Short description:
84  // MuonSpectrometer RPC cross section
85  // MuonSpectrometer RPC longitudinal
86  // Eta, Theta, Phi, z residual (...), phi residual (...) of hits in CSCs
87 
88  if (m_DoCSCTest) {
89  // -- loop over CSC hit collection --
90  const CSCSimHitCollection* p_collection = nullptr;
91  if (evtStore()->retrieve(p_collection,"CSC_Hits") == StatusCode::SUCCESS) {
92  for (const CSCSimHit& hit : *p_collection) {
93 
94  // Check the Hits identifiers, access the functions that give:
95  // Station name, station eta, station phi, chamber layer, wire layer.
96  HitID cschit= hit.CSCid();
97  Identifier offid= getIdentifier(cschit);
98  CHECK(checkIdentifier(offid));
99 
100  // Check Hits. For every hit within the event, get the global position
101  // Amg::Vector3D u and then retrieve all releveant info either from the
102  // Amg::Vector3D or from the MC vector (direction)
103  GeoCSCHit ghit(hit);
104  if (!ghit) continue;
105  Amg::Vector3D u = ghit.getGlobalPosition();
107  }
108  }
109  }
110 
111  return StatusCode::SUCCESS;
112 }

Member Data Documentation

◆ m_BarrelEtaCut

double MuonHitTestToolBase::m_BarrelEtaCut
protectedinherited

MDT barrel eta cut, applicable to the MDT 2D cross section plot.

Definition at line 44 of file MuonHitTestToolBase.h.

◆ m_detBarrel

TH2* MuonHitTestToolBase::m_detBarrel
protectedinherited

Definition at line 54 of file MuonHitTestToolBase.h.

◆ m_detname

std::string MuonHitTestToolBase::m_detname
protectedinherited

Definition at line 37 of file MuonHitTestToolBase.h.

◆ m_direction

Amg::Vector3D MuonHitTestToolBase::m_direction
protectedinherited

Definition at line 58 of file MuonHitTestToolBase.h.

◆ m_DoCSCTest

bool CSCHitsTestTool::m_DoCSCTest
private

Definition at line 34 of file CSCHitsTestTool.h.

◆ m_eta

TH1* MuonHitTestToolBase::m_eta
protectedinherited

Definition at line 52 of file MuonHitTestToolBase.h.

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> MuonHitTestToolBase::m_eventInfoKey {this, "EventInfo", "EventInfo", "EventInfo name"}
protectedinherited

SG key for Event Info.

Definition at line 41 of file MuonHitTestToolBase.h.

◆ m_histSvc

ServiceHandle<ITHistSvc> SimTestHisto::m_histSvc {"THistSvc", "SimTestHisto"}
protectedinherited

Definition at line 35 of file SimTestHisto.h.

◆ m_key

std::string SimTestToolBase::m_key
protectedinherited

The MC truth key.

Definition at line 34 of file SimTestToolBase.h.

◆ m_longView

TH2 * MuonHitTestToolBase::m_longView
protectedinherited

Definition at line 54 of file MuonHitTestToolBase.h.

◆ m_muondetBarrel

TH2* MuonHitTestToolBase::m_muondetBarrel
protectedinherited

Definition at line 50 of file MuonHitTestToolBase.h.

◆ m_muoneta

TH1* MuonHitTestToolBase::m_muoneta
protectedinherited

Definition at line 48 of file MuonHitTestToolBase.h.

◆ m_muonevnt

TH1* MuonHitTestToolBase::m_muonevnt
protectedinherited

Definition at line 47 of file MuonHitTestToolBase.h.

◆ m_muonlongView

TH2 * MuonHitTestToolBase::m_muonlongView
protectedinherited

Definition at line 50 of file MuonHitTestToolBase.h.

◆ m_muonphi

TH1 * MuonHitTestToolBase::m_muonphi
protectedinherited

Definition at line 48 of file MuonHitTestToolBase.h.

◆ m_muonphiResid

TH1 * MuonHitTestToolBase::m_muonphiResid
protectedinherited

Definition at line 49 of file MuonHitTestToolBase.h.

◆ m_muonrun

TH1 * MuonHitTestToolBase::m_muonrun
protectedinherited

Definition at line 47 of file MuonHitTestToolBase.h.

◆ m_muontheta

TH1 * MuonHitTestToolBase::m_muontheta
protectedinherited

Definition at line 48 of file MuonHitTestToolBase.h.

◆ m_muonzResid

TH1* MuonHitTestToolBase::m_muonzResid
protectedinherited

Definition at line 49 of file MuonHitTestToolBase.h.

◆ m_path

std::string SimTestHisto::m_path {"/truth/"}
protectedinherited

Definition at line 34 of file SimTestHisto.h.

◆ m_pCscIdHelper

const CscIdHelper* CSCHitsTestTool::m_pCscIdHelper
private

Definition at line 36 of file CSCHitsTestTool.h.

◆ m_phi

TH1 * MuonHitTestToolBase::m_phi
protectedinherited

Definition at line 52 of file MuonHitTestToolBase.h.

◆ m_phiResid

TH1 * MuonHitTestToolBase::m_phiResid
protectedinherited

Definition at line 53 of file MuonHitTestToolBase.h.

◆ m_pMuonMgr

const MuonGM::MuonDetectorManager* MuonHitTestToolBase::m_pMuonMgr
protectedinherited

Definition at line 38 of file MuonHitTestToolBase.h.

◆ m_theta

TH1 * MuonHitTestToolBase::m_theta
protectedinherited

Definition at line 52 of file MuonHitTestToolBase.h.

◆ m_zResid

TH1* MuonHitTestToolBase::m_zResid
protectedinherited

Definition at line 53 of file MuonHitTestToolBase.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
MuonHitTestToolBase::m_detBarrel
TH2 * m_detBarrel
Definition: MuonHitTestToolBase.h:54
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
GeoCSCHit
Definition: GeoMuonHits.h:129
MuonHitTestToolBase::m_muonphiResid
TH1 * m_muonphiResid
Definition: MuonHitTestToolBase.h:49
MuonHitTestToolBase::m_muonevnt
TH1 * m_muonevnt
Definition: MuonHitTestToolBase.h:47
MuonHitTestToolBase::executeCheckEventInfo
StatusCode executeCheckEventInfo()
Definition: MuonHitTestToolBase.cxx:35
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
CSCHitsTestTool::getIdentifier
Identifier getIdentifier(HitID)
Definition: CSCHitsTestTool.cxx:22
CSCHitsTestTool::checkIdentifier
StatusCode checkIdentifier(Identifier)
Definition: CSCHitsTestTool.cxx:48
AtlasHitsVector
Definition: AtlasHitsVector.h:33
M_PI
#define M_PI
Definition: ActiveFraction.h:11
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
MuonGM::CscReadoutElement
Definition: CscReadoutElement.h:56
MuonHitTestToolBase::m_BarrelEtaCut
double m_BarrelEtaCut
MDT barrel eta cut, applicable to the MDT 2D cross section plot.
Definition: MuonHitTestToolBase.h:44
MuonHitTestToolBase::m_longView
TH2 * m_longView
Definition: MuonHitTestToolBase.h:54
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
MuonHitTestToolBase::MuonHitTestToolBase
MuonHitTestToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition: MuonHitTestToolBase.cxx:17
CscHitIdHelper::GetChamberLayer
int GetChamberLayer(const int &hid) const
Definition: CscHitIdHelper.cxx:78
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
CscHitIdHelper::GetPhiSector
int GetPhiSector(const int &hid) const
Definition: CscHitIdHelper.cxx:67
MuonHitTestToolBase::m_muonzResid
TH1 * m_muonzResid
Definition: MuonHitTestToolBase.h:49
CscHitIdHelper::GetHelper
static const CscHitIdHelper * GetHelper()
Definition: CscHitIdHelper.cxx:23
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
CSCSimHit
Definition: CSCSimHit.h:18
HepMC::is_simulation_particle
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
Definition: MagicNumbers.h:355
MuonGM::MuonDetectorManager::getCscReadoutElement
const CscReadoutElement * getCscReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:225
MuonHitTestToolBase::m_muonlongView
TH2 * m_muonlongView
Definition: MuonHitTestToolBase.h:50
CscHitIdHelper
Definition: CscHitIdHelper.h:13
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CscHitIdHelper::GetWireLayer
int GetWireLayer(const int &hid) const
Definition: CscHitIdHelper.cxx:83
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
MuonHitTestToolBase::m_direction
Amg::Vector3D m_direction
Definition: MuonHitTestToolBase.h:58
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
CSCHitsTestTool::m_pCscIdHelper
const CscIdHelper * m_pCscIdHelper
Definition: CSCHitsTestTool.h:36
MuonHitTestToolBase::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
SG key for Event Info.
Definition: MuonHitTestToolBase.h:41
CSCHitsTestTool::m_DoCSCTest
bool m_DoCSCTest
Definition: CSCHitsTestTool.h:34
MuonHitTestToolBase::m_phiResid
TH1 * m_phiResid
Definition: MuonHitTestToolBase.h:53
CscIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int chamberLayer, int wireLayer, int measuresPhi, int strip) const
Definition: CscIdHelper.cxx:706
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonHitTestToolBase::executeFillHistos
StatusCode executeFillHistos(const Amg::Vector3D &)
Definition: MuonHitTestToolBase.cxx:70
CscHitIdHelper::GetStationName
std::string GetStationName(const int &hid) const
Definition: CscHitIdHelper.cxx:56
CscHitIdHelper::GetZSector
int GetZSector(const int &hid) const
Definition: CscHitIdHelper.cxx:72
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
unused
void unused(Args &&...)
Definition: VP1ExpertSettings.cxx:39
MuonHitTestToolBase::initialize
virtual StatusCode initialize() override
Definition: MuonHitTestToolBase.cxx:111
AtlasDetectorID::show_to_string
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:574
MuonHitTestToolBase::m_pMuonMgr
const MuonGM::MuonDetectorManager * m_pMuonMgr
Definition: MuonHitTestToolBase.h:38
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MuonHitTestToolBase::m_muonrun
TH1 * m_muonrun
Definition: MuonHitTestToolBase.h:47
MuonHitTestToolBase::m_zResid
TH1 * m_zResid
Definition: MuonHitTestToolBase.h:53
MuonGM::CscReadoutElement::stripPos
Amg::Vector3D stripPos(const Identifier &id) const
takes into account internal alignment parameters, hence gives accurate answer
Definition: CscReadoutElement.cxx:227
MuonGM::MuonDetectorManager::cscIdHelper
const CscIdHelper * cscIdHelper() const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:232
MuonHitTestToolBase::m_muondetBarrel
TH2 * m_muondetBarrel
Definition: MuonHitTestToolBase.h:50
HitID
int HitID
Definition: GenericMuonSimHit.h:13
SimTestToolBase::m_key
std::string m_key
The MC truth key.
Definition: SimTestToolBase.h:34
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
python.SystemOfUnits.rad
int rad
Definition: SystemOfUnits.py:111
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Identifier
Definition: IdentifierFieldParser.cxx:14