ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCalibTools
src
LArOFCBin_PhysCaliTdiffFromStdNtuple.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArCalibTools/LArOFCBin_PhysCaliTdiffFromStdNtuple.h
"
6
7
#include "
LArIdentifier/LArOnlineID.h
"
8
#include "
CaloIdentifier/CaloGain.h
"
9
#include "
LArRawConditions/LArOFCBinComplete.h
"
10
#include "
LArRawConditions/LArPhysCaliTdiffComplete.h
"
11
12
#include "TFile.h"
13
#include "TBranch.h"
14
#include "TTree.h"
15
#include "TChain.h"
16
17
#include <vector>
18
#include <iostream>
19
#include <fstream>
20
#include <string>
21
22
23
LArOFCBin_PhysCaliTdiffFromStdNtuple::~LArOFCBin_PhysCaliTdiffFromStdNtuple
() =
default
;
24
25
StatusCode
LArOFCBin_PhysCaliTdiffFromStdNtuple::initialize
()
26
{
27
return
StatusCode::SUCCESS ;
28
}
29
30
31
StatusCode
LArOFCBin_PhysCaliTdiffFromStdNtuple::stop
()
32
{
33
ATH_MSG_INFO
(
"... in stop()"
);
34
35
const
LArOnlineID
* onlineHelper =
nullptr
;
36
ATH_CHECK
(
detStore
()->retrieve(onlineHelper,
"LArOnlineID"
) );
37
38
TChain* outfit =
new
TChain(
m_ntuple_name
.value().c_str());
39
for
(
const
std::string& s :
m_root_file_names
) {
40
outfit->Add(s.c_str());
41
}
42
43
44
Int_t channelId{};
45
Int_t FT{}, slot{}, channel{};
46
Int_t
bin
{};
47
Double_t tdiff{};
48
49
50
Int_t gain = 0;
// LARHIGHGAIN = 0, LARMEDIUMGAIN = 1, LARLOWGAIN = 2,
51
outfit->SetBranchAddress(
"channelId"
, &channelId);
52
outfit->SetBranchAddress(
"FT"
, &FT);
53
outfit->SetBranchAddress(
"slot"
, &slot);
54
outfit->SetBranchAddress(
"channel"
, &channel);
55
outfit->SetBranchAddress(
"gain"
, &gain);
56
if
(
m_filltdiff
) {
57
outfit->SetBranchAddress(
"Tdiff"
, &tdiff);
58
}
59
if
(
m_fillofc
) {
60
outfit->SetBranchAddress(
"OFCBin"
, &
bin
);
61
}
62
63
// Create new objects
64
auto
larOFCParams = std::make_unique<LArOFCBinComplete>();
65
ATH_CHECK
( larOFCParams->setGroupingType(
m_groupingType
,
msg
()) );
66
ATH_CHECK
( larOFCParams->initialize() );
67
auto
larTdiffParams = std::make_unique<LArPhysCaliTdiffComplete>();
68
ATH_CHECK
( larTdiffParams->setGroupingType(
m_groupingType
,
msg
()) );
69
ATH_CHECK
( larTdiffParams->initialize() );
70
71
72
unsigned
int
hwid{};
73
//unsigned int uflag;
74
// loop over entries in the Tuple, one entry = one channel
75
Long64_t nentries = outfit->GetEntries();
76
for
( Long64_t i = 0; i < nentries; i++ )
77
{
78
outfit->GetEvent(i);
79
ATH_MSG_INFO
(
" Chan "
<< std::hex << channelId << std::dec );
80
ATH_MSG_INFO
(
bin
<<
" | "
<< tdiff );
81
hwid = channelId;
82
HWIdentifier
id(hwid);
83
if
(FT != onlineHelper->
feedthrough
(
id
) || slot != onlineHelper->
slot
(
id
) || channel != onlineHelper->
channel
(
id
)) {
84
ATH_MSG_ERROR
(
"Inconsistency in decoding HWID !!!!"
);
85
ATH_MSG_ERROR
( FT <<
" - "
<< onlineHelper->
feedthrough
(
id
) );
86
ATH_MSG_ERROR
( slot <<
" - "
<< onlineHelper->
slot
(
id
) );
87
ATH_MSG_ERROR
( channel <<
" - "
<< onlineHelper->
channel
(
id
) );
88
ATH_MSG_ERROR
(
"Not creating PhysWave !!!!"
);
89
continue
;
90
}
91
92
// Add to objects
93
if
(
m_fillofc
) larOFCParams->set(
id
,gain,
bin
);
94
if
(
m_filltdiff
) larTdiffParams->set(
id
,gain,tdiff);
95
}
96
97
98
// store
99
if
(
m_fillofc
) {
100
ATH_CHECK
(
detStore
()->record(std::move(larOFCParams),
m_store_key_ofcbin
) );
101
}
102
103
if
(
m_filltdiff
) {
104
ATH_CHECK
(
detStore
()->record(larTdiffParams.get(),
m_store_key_tdiff
) );
105
// and symlink
106
ILArPhysCaliTdiff
*ilarTdiff =
nullptr
;
107
ATH_CHECK
(
detStore
()->symLink(larTdiffParams.release(),ilarTdiff) );
108
}
109
110
111
ATH_MSG_INFO
(
"LArOFCBin_PhysCaliTdiffFromStdNtuple finalized!"
);
112
return
StatusCode::SUCCESS;
113
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
CaloGain.h
LArOFCBinComplete.h
LArOFCBin_PhysCaliTdiffFromStdNtuple.h
LArOnlineID.h
LArPhysCaliTdiffComplete.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCommonAlgorithm< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
HWIdentifier
Definition
HWIdentifier.h:13
ILArPhysCaliTdiff
Definition
ILArPhysCaliTdiff.h:13
LArOFCBin_PhysCaliTdiffFromStdNtuple::m_ntuple_name
StringProperty m_ntuple_name
ntuple name
Definition
LArOFCBin_PhysCaliTdiffFromStdNtuple.h:34
LArOFCBin_PhysCaliTdiffFromStdNtuple::m_store_key_tdiff
StringProperty m_store_key_tdiff
key of the PhysCaliTdiff collection in Storegate
Definition
LArOFCBin_PhysCaliTdiffFromStdNtuple.h:39
LArOFCBin_PhysCaliTdiffFromStdNtuple::m_groupingType
StringProperty m_groupingType
Grouping type. Default is Feedthrough.
Definition
LArOFCBin_PhysCaliTdiffFromStdNtuple.h:42
LArOFCBin_PhysCaliTdiffFromStdNtuple::m_fillofc
BooleanProperty m_fillofc
Definition
LArOFCBin_PhysCaliTdiffFromStdNtuple.h:37
LArOFCBin_PhysCaliTdiffFromStdNtuple::~LArOFCBin_PhysCaliTdiffFromStdNtuple
virtual ~LArOFCBin_PhysCaliTdiffFromStdNtuple()
LArOFCBin_PhysCaliTdiffFromStdNtuple::m_root_file_names
StringArrayProperty m_root_file_names
list of input ntuple file names
Definition
LArOFCBin_PhysCaliTdiffFromStdNtuple.h:32
LArOFCBin_PhysCaliTdiffFromStdNtuple::initialize
virtual StatusCode initialize() override
implements IAlgorithm::initialize()
Definition
LArOFCBin_PhysCaliTdiffFromStdNtuple.cxx:25
LArOFCBin_PhysCaliTdiffFromStdNtuple::m_store_key_ofcbin
StringProperty m_store_key_ofcbin
key of the OFCBin collection in Storegate
Definition
LArOFCBin_PhysCaliTdiffFromStdNtuple.h:36
LArOFCBin_PhysCaliTdiffFromStdNtuple::m_filltdiff
BooleanProperty m_filltdiff
Definition
LArOFCBin_PhysCaliTdiffFromStdNtuple.h:40
LArOFCBin_PhysCaliTdiffFromStdNtuple::stop
virtual StatusCode stop() override
Definition
LArOFCBin_PhysCaliTdiffFromStdNtuple.cxx:31
LArOnlineID_Base::feedthrough
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
Definition
LArOnlineID_Base.cxx:1654
LArOnlineID_Base::slot
int slot(const HWIdentifier id) const
Return the slot number of a hardware cell identifier: slot = [1,15] Slot-ID in top part of the crat...
Definition
LArOnlineID_Base.cxx:1667
LArOnlineID_Base::channel
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
Definition
LArOnlineID_Base.cxx:1673
LArOnlineID
Definition
LArOnlineID.h:21
bin
Definition
BinsDiffFromStripMedian.h:43
Generated on
for ATLAS Offline Software by
1.17.0