ATLAS Offline Software
Loading...
Searching...
No Matches
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
15ZDCHitsTestTool::ZDCHitsTestTool(const std::string& type, const std::string& name, const IInterface* parent)
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}
27
29{
30 ATH_CHECK (detStore()->retrieve( m_ZdcID ) );
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
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_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define CHECK(...)
Evaluate an expression and check for errors.
#define _TH1D(var, name, nbin, xmin, xmax)
#define _SET_TITLE(var, title, xaxis, yaxis)
ZDC_SimFiberHit_Collection::const_iterator ZDC_SimFiberHit_ConstIterator
std::string m_path
SimTestToolBase(const std::string &type, const std::string &name, const IInterface *parent)
ZDCHitsTestTool(const std::string &type, const std::string &name, const IInterface *parent)
StatusCode processEvent()
StatusCode initialize()
const ZdcID * m_ZdcID
TH1 * m_zdc[2][4]
TH1 * m_rpd[2][16]
int getNPhotons() const
Identifier getID() const