ATLAS Offline Software
ZDCHitsTestTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "ZDCHitsTestTool.h"
6 
9 
10 
11 #include <TH2D.h>
12 #include <TH1.h>
13 #include <TProfile.h>
14 
15 ZDCHitsTestTool::ZDCHitsTestTool(const std::string& type, const std::string& name, const IInterface* parent)
17 {
18  for(int side : {0,1}){
19  for(int module = 0; module < 4; module++){
20  m_zdc[side][module] = nullptr;
21  }
22  for(int channel = 0; channel < 16; channel++){
23  m_rpd[side][channel] = nullptr;
24  }
25  }
26 }
27 
29 {
31 
32  m_path+="ZDC/";
33 
34  for(int side : {0,1}){
35  std::string sideStr = (side == 0) ? "A" : "C";
36  //ZDCs
37  for(int module = 0; module < 4; module++){
38  _TH1D(m_zdc[side][module],Form("zdc_side%c_%d", std::tolower(sideStr[0]), module),100,0.,1.e6);
39  _SET_TITLE(m_zdc[side][module], Form("Cherenkov photons in ZDC - Side %s - Module %d", sideStr.c_str(), module),"n_{gamma}","counts");
40  }
41  //RPDs
42  for(int channel = 0; channel < 16; channel++){
43  _TH1D(m_rpd[side][channel],Form("rpd_side%c_%d", std::tolower(sideStr[0]), channel),100,0.,1.e4);
44  _SET_TITLE(m_rpd[side][channel], Form("Cherenkov photons in RPD - Side %s - Channel %d", sideStr.c_str(), channel),"n_{gamma}","counts");
45  }
46  }
47 
48  return StatusCode::SUCCESS;
49 }
50 
52 
53  const ZDC_SimFiberHit_Collection* iter;
54  CHECK( evtStore()->retrieve(iter,"ZDC_SimFiberHit_Collection") );
55 
57  for (it=(*iter).begin(); it != (*iter).end(); ++it) {
58  ZDC_SimFiberHit ghit(*it);
59 
60  Identifier id = ghit.getID( );
61  int side = (m_ZdcID->side(id) == -1) ? 0 : 1;
62  int module = m_ZdcID->module(id);
63  int channel = m_ZdcID->channel(id);
64 
65  if(module < 4){//ZDC
66  m_zdc[side][module]->Fill(ghit.getNPhotons());
67 
68  }else if(module == 4){//RPD
69  m_rpd[side][channel]->Fill(ghit.getNPhotons());
70 
71  }else{//Undefined
72  ATH_MSG_ERROR("ZDCHitsTestTool::processEvent Hit detected in an undefined module. Module# " << module);
73  }
74  }
75 
76  return StatusCode::SUCCESS;
77 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ZDCHitsTestTool::m_rpd
TH1 * m_rpd[2][16]
Definition: ZDCHitsTestTool.h:25
ZDC_SimFiberHit::getNPhotons
int getNPhotons() const
Definition: ZDC_SimFiberHit.h:46
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
ZDCHitsTestTool::m_zdc
TH1 * m_zdc[2][4]
Definition: ZDCHitsTestTool.h:25
ZdcID::module
int module(const Identifier &id) const
Definition: ZdcID.h:163
skel.it
it
Definition: skel.GENtoEVGEN.py:396
_SET_TITLE
#define _SET_TITLE(var, title, xaxis, yaxis)
Definition: SimTestHisto.h:93
ZDCHitsTestTool::ZDCHitsTestTool
ZDCHitsTestTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: ZDCHitsTestTool.cxx:15
ZDC_SimFiberHit_ConstIterator
ZDC_SimFiberHit_Collection::const_iterator ZDC_SimFiberHit_ConstIterator
Definition: ZDC_SimFiberHit_Collection.h:24
_TH1D
#define _TH1D(var, name, nbin, xmin, xmax)
Definition: SimTestHisto.h:47
TRT::Hit::side
@ side
Definition: HitInfo.h:83
python.PyAthena.module
module
Definition: PyAthena.py:131
SimTestToolBase
Definition: SimTestToolBase.h:20
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
PixelAthClusterMonAlgCfg.e4
e4
Definition: PixelAthClusterMonAlgCfg.py:332
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
tolower
void tolower(std::string &s)
Definition: AthenaSummarySvc.cxx:111
test_pyathena.parent
parent
Definition: test_pyathena.py:15
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
ZDC_SimFiberHit.h
ZDCHitsTestTool::m_ZdcID
const ZdcID * m_ZdcID
Definition: ZDCHitsTestTool.h:26
ZDC_SimFiberHit_Collection.h
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ZDCHitsTestTool.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ZdcID::side
int side(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: ZdcID.h:157
ZDCHitsTestTool::initialize
StatusCode initialize()
Definition: ZDCHitsTestTool.cxx:28
ZDC_SimFiberHit::getID
Identifier getID() const
Definition: ZDC_SimFiberHit.h:44
ZDC_SimFiberHit
Definition: ZDC_SimFiberHit.h:11
SimTestHisto::m_path
std::string m_path
Definition: SimTestHisto.h:34
ZDC_SimFiberHit_Collection
Definition: ZDC_SimFiberHit_Collection.h:16
ZDCHitsTestTool::processEvent
StatusCode processEvent()
Definition: ZDCHitsTestTool.cxx:51
ZdcID::channel
int channel(const Identifier &id) const
Definition: ZdcID.h:175
Identifier
Definition: IdentifierFieldParser.cxx:14