ATLAS Offline Software
Loading...
Searching...
No Matches
ZDCHitsTestTool Class Reference

#include <ZDCHitsTestTool.h>

Inheritance diagram for ZDCHitsTestTool:
Collaboration diagram for ZDCHitsTestTool:

Public Member Functions

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

Protected Attributes

std::string m_path {"/truth/"}
ServiceHandle< ITHistSvc > m_histSvc {"THistSvc", "SimTestHisto"}

Private Attributes

TH1 * m_zdc [2][4]
TH1 * m_rpd [2][16]
const ZdcIDm_ZdcID = nullptr

structors and AlgTool implementation

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

Detailed Description

Definition at line 12 of file ZDCHitsTestTool.h.

Constructor & Destructor Documentation

◆ ZDCHitsTestTool()

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

Definition at line 15 of file ZDCHitsTestTool.cxx.

16 : SimTestToolBase(type, name, 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}
SimTestToolBase(const std::string &type, const std::string &name, const IInterface *parent)
TH1 * m_rpd[2][16]

Member Function Documentation

◆ 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}
DataModel_detail::const_iterator< DataVector > const_iterator
Standard 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.
std::string m_key
The MC truth key.
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...
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ initialize()

StatusCode ZDCHitsTestTool::initialize ( )
virtual

Reimplemented from SimTestToolBase.

Definition at line 28 of file ZDCHitsTestTool.cxx.

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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define _TH1D(var, name, nbin, xmin, xmax)
#define _SET_TITLE(var, title, xaxis, yaxis)
std::string m_path
const ZdcID * m_ZdcID
TH1 * m_zdc[2][4]

◆ processEvent()

StatusCode ZDCHitsTestTool::processEvent ( )

Definition at line 51 of file ZDCHitsTestTool.cxx.

51 {
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}
#define ATH_MSG_ERROR(x)
#define CHECK(...)
Evaluate an expression and check for errors.
ZDC_SimFiberHit_Collection::const_iterator ZDC_SimFiberHit_ConstIterator

Member Data Documentation

◆ m_histSvc

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

Definition at line 35 of file SimTestHisto.h.

35{"THistSvc", "SimTestHisto"};

◆ m_key

std::string SimTestToolBase::m_key
protectedinherited

The MC truth key.

Definition at line 34 of file SimTestToolBase.h.

◆ m_path

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

Definition at line 34 of file SimTestHisto.h.

34{"/truth/"};

◆ m_rpd

TH1 * ZDCHitsTestTool::m_rpd[2][16]
private

Definition at line 25 of file ZDCHitsTestTool.h.

◆ m_zdc

TH1* ZDCHitsTestTool::m_zdc[2][4]
private

Definition at line 25 of file ZDCHitsTestTool.h.

◆ m_ZdcID

const ZdcID* ZDCHitsTestTool::m_ZdcID = nullptr
private

Definition at line 26 of file ZDCHitsTestTool.h.


The documentation for this class was generated from the following files: