ATLAS Offline Software
TileCalibHitNtuple.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 // Atlas includes
8 #include "GaudiKernel/MsgStream.h"
9 #include "Gaudi/Property.h"
11 
12 // ROOT includes
13 #include "TTree.h"
14 
15 static const InterfaceID IID_ITileCalibHitNtuple("TileCalibHitNtuple", 1, 0);
16 
17 const InterfaceID&
19  return IID_ITileCalibHitNtuple;
20 }
21 
25 TileCalibHitNtuple::TileCalibHitNtuple(const std::string& type, const std::string& name, const IInterface* parent)
27  m_thistSvc("THistSvc", name),
28  m_streamName("AANT"),
29  m_ntupleID("TileCalibHit"),
30  m_treeSize(16000000000LL),
31  m_ntuplePtr(0),
32  m_level(0),
33  m_det(0),
34  m_mod(0),
35  m_tow(0),
36  m_samp(0),
37  m_reg(0),
38  m_calc(0),
39  m_evt(0),
40  m_xPos(0.0),
41  m_yPos(0.0),
42  m_zPos(0.0),
43  m_ener(0.0),
44  m_volume{0},
45  m_pid(0),
46  m_ekine(0.0),
47  m_xLocal(0.0),
48  m_yLocal(0.0),
49  m_zLocal(0.0),
50  m_phiLocal(0.0)
51 
52 {
53 
54  declareInterface<TileCalibHitNtuple>(this);
55 
56  declareProperty("THistSvc", m_thistSvc);
57  declareProperty("StreamName", m_streamName);
58  declareProperty("NTupleID", m_ntupleID);
59  declareProperty("TreeSize", m_treeSize);
60  declareProperty("InfoLevel", m_level);
61 
62 }
63 
68 }
69 
74 
75  ATH_MSG_INFO("in initialize()");
76 
77  CHECK(m_thistSvc.retrieve());
78 
79  m_ntuplePtr = new TTree(m_ntupleID.c_str(), "TileCalibHit-Ntuple");
80  m_ntuplePtr->SetMaxTreeSize(m_treeSize);
81 
82  m_ntuplePtr->Branch("detector", &m_det, "detector/S");
83  m_ntuplePtr->Branch("module", &m_mod, "module/S");
84  m_ntuplePtr->Branch("tower", &m_tow, "tower/S");
85  m_ntuplePtr->Branch("sample", &m_samp, "sample/S");
86  m_ntuplePtr->Branch("region", &m_reg, "region/S");
87  m_ntuplePtr->Branch("IDcalc", &m_calc, "IDcalc/S");
88  m_ntuplePtr->Branch("event", &m_evt, "event/S");
89  m_ntuplePtr->Branch("xPos", &m_xPos, "xPos/F");
90  m_ntuplePtr->Branch("yPos", &m_yPos, "yPos/F");
91  m_ntuplePtr->Branch("zPos", &m_zPos, "zPos/F");
92  m_ntuplePtr->Branch("energy", &m_ener, "energy/F");
93  if (m_level != 0) {
94  m_ntuplePtr->Branch("volume", &m_volume, "volume/C");
95  m_ntuplePtr->Branch("pid", &m_pid, "pid/S");
96  m_ntuplePtr->Branch("ekine", &m_ekine, "ekine/F");
97  m_ntuplePtr->Branch("xLocal", &m_xLocal, "xLocal/F");
98  m_ntuplePtr->Branch("yLocal", &m_yLocal, "yLocal/F");
99  m_ntuplePtr->Branch("zLocal", &m_zLocal, "zLocal/F");
100  m_ntuplePtr->Branch("phiLocal", &m_phiLocal, "phiLocal/F");
101  }
102 
103  StatusCode sc = m_thistSvc->regTree("/" + m_streamName + "/" + m_ntupleID, m_ntuplePtr);
104 
105  if (sc.isFailure()) {
106  ATH_MSG_ERROR("Problem registering TileCalibHit Tree");
107  }
108 
109  return sc;
110 }
111 
116 
117  ATH_MSG_INFO("Finalizing");
118 
119  return StatusCode::SUCCESS;
120 }
121 
122 void TileCalibHitNtuple::storeHit(int det, int mod, int tow, int samp, int reg, int calc, int evt, float x, float y,
123  float z, float e, const char *volume, int pid, float ekine, float xLocal,
124  float yLocal, float zLocal, float phiLocal) {
125  m_det = det;
126  m_mod = mod;
127  m_tow = tow;
128  m_samp = samp;
129  m_reg = reg;
130  m_calc = calc;
131  m_evt = evt;
132  m_xPos = x;
133  m_yPos = y;
134  m_zPos = z;
135  m_ener = e;
136  if (m_level != 0) {
137  if (volume) strncpy(m_volume, volume, 99);
138  else m_volume[0] = 0;
139  m_pid = pid;
140  m_ekine = ekine;
141  m_xLocal = xLocal;
142  m_yLocal = yLocal;
143  m_zLocal = zLocal;
144  m_phiLocal = phiLocal;
145  }
146 
147  m_ntuplePtr->Fill();
148 }
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
TileCalibHitNtuple::initialize
virtual StatusCode initialize()
intialize method
Definition: TileCalibHitNtuple.cxx:73
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TileCalibHitNtuple::m_xPos
float m_xPos
Definition: TileCalibHitNtuple.h:78
TileCalibHitNtuple::m_streamName
std::string m_streamName
Definition: TileCalibHitNtuple.h:61
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
TileCalibHitNtuple::m_xLocal
float m_xLocal
Definition: TileCalibHitNtuple.h:85
TileCalibHitNtuple::m_phiLocal
float m_phiLocal
Definition: TileCalibHitNtuple.h:88
TileCalibHitNtuple::m_zLocal
float m_zLocal
Definition: TileCalibHitNtuple.h:87
TileCalibHitNtuple::TileCalibHitNtuple
TileCalibHitNtuple(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition: TileCalibHitNtuple.cxx:25
m_mod
G4double m_mod[8][6]
modules para [Length,NAnodes,NCathodes,elec.
Definition: PresParameterDef.h:19
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
TileCalibHitNtuple::m_det
short m_det
Definition: TileCalibHitNtuple.h:71
x
#define x
TileCalibHitNtuple::finalize
virtual StatusCode finalize()
finalize method
Definition: TileCalibHitNtuple.cxx:115
TileCalibHitNtuple::m_ntuplePtr
TTree * m_ntuplePtr
Definition: TileCalibHitNtuple.h:66
TileCalibHitNtuple::~TileCalibHitNtuple
virtual ~TileCalibHitNtuple()
Destructor.
Definition: TileCalibHitNtuple.cxx:67
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
TileCalibHitNtuple::m_ekine
float m_ekine
Definition: TileCalibHitNtuple.h:84
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
z
#define z
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TileCalibHitNtuple::m_mod
short m_mod
Definition: TileCalibHitNtuple.h:72
TileCalibHitNtuple::m_volume
char m_volume[100]
Definition: TileCalibHitNtuple.h:82
TileCalibHitNtuple::interfaceID
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Definition: TileCalibHitNtuple.cxx:18
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
TileCalibHitNtuple::m_tow
short m_tow
Definition: TileCalibHitNtuple.h:73
TileCalibHitNtuple::m_ener
float m_ener
Definition: TileCalibHitNtuple.h:81
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
TileCalibHitNtuple::m_calc
short m_calc
Definition: TileCalibHitNtuple.h:76
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
errorcheck.h
Helpers for checking error return status codes and reporting errors.
TileCalibHitNtuple::m_reg
short m_reg
Definition: TileCalibHitNtuple.h:75
TileCalibHitNtuple::m_thistSvc
ServiceHandle< ITHistSvc > m_thistSvc
Definition: TileCalibHitNtuple.h:58
TileCalibHitNtuple::storeHit
void storeHit(int det, int mod, int tow, int samp, int reg, int calc, int evt, float x, float y, float z, float e, const char *volume=0, int pid=0, float ekine=0., float xLocal=0., float yLocal=0., float zLocal=0., float phiLocal=0.)
Definition: TileCalibHitNtuple.cxx:122
TileCalibHitNtuple.h
y
#define y
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TileCalibHitNtuple::m_pid
short m_pid
Definition: TileCalibHitNtuple.h:83
TileCalibHitNtuple::m_treeSize
int64_t m_treeSize
Definition: TileCalibHitNtuple.h:63
TileCalibHitNtuple::m_level
int m_level
Definition: TileCalibHitNtuple.h:68
TileCalibHitNtuple::m_ntupleID
std::string m_ntupleID
Definition: TileCalibHitNtuple.h:62
TileCalibHitNtuple::m_yPos
float m_yPos
Definition: TileCalibHitNtuple.h:79
TileCalibHitNtuple::m_yLocal
float m_yLocal
Definition: TileCalibHitNtuple.h:86
TileCalibHitNtuple::m_evt
short m_evt
Definition: TileCalibHitNtuple.h:77
AthAlgTool
Definition: AthAlgTool.h:26
beamspotnt.calc
calc
Definition: bin/beamspotnt.py:1252
TileCalibHitNtuple::m_samp
short m_samp
Definition: TileCalibHitNtuple.h:74
TileCalibHitNtuple::m_zPos
float m_zPos
Definition: TileCalibHitNtuple.h:80