ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TestBeam
TBRec
src
TBMWPCRec.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
6
#include "
TBMWPCRec.h
"
7
8
9
TBMWPCRec::TBMWPCRec
(
const
std::string& name,
10
ISvcLocator* pSvcLocator) :
11
AthAlgorithm
(name,pSvcLocator)
12
{
13
// job options
14
15
declareProperty
(
"SGkey"
,
m_SGkey
=
"MWPCRawCont"
);
16
declareProperty
(
"SGrecordkey"
,
m_SGrecordkey
=
"MWPCCont"
);
17
18
19
20
declareProperty
(
"MWPCwirestep"
,
m_mwpc_wirestep
);
21
declareProperty
(
"MWPChalfsize"
,
m_mwpc_halfsize
);
22
23
declareProperty
(
"MWPCinvX"
,
m_mwpc_invX
);
24
declareProperty
(
"MWPCinvY"
,
m_mwpc_invY
);
25
26
}
27
28
TBMWPCRec::~TBMWPCRec
()
29
{ }
30
31
StatusCode
32
TBMWPCRec::initialize
()
33
{
34
m_mwpc_names
[0]=
"X2"
;
m_mwpc_names
[1]=
"Y2"
;
m_mwpc_names
[2]=
"X3"
;
m_mwpc_names
[3]=
"Y3"
;
m_mwpc_names
[4]=
"X4"
;
35
m_mwpc_names
[5]=
"Y4"
;
m_mwpc_names
[6]=
"X5"
;
m_mwpc_names
[7]=
"Y5"
;
36
37
return
StatusCode::SUCCESS;
38
}
39
40
StatusCode
41
TBMWPCRec::execute
(
const
EventContext& ctx)
42
{
43
ATH_MSG_DEBUG
(
"In execute()"
);
44
45
// Reconstruct MWPC :
46
TBMWPCRawCont
* mwpcrawCont;
47
StatusCode
sc
=
evtStore
()->retrieve(mwpcrawCont,
m_SGkey
);
48
if
(
sc
.isFailure()){
49
ATH_MSG_INFO
(
"TBObjectReco: Retrieval of "
<<
m_SGkey
<<
" failed"
);
50
51
}
else
{
52
ATH_MSG_DEBUG
(
"TBMWPCRec : Retrieval of "
<<
m_SGkey
<<
" succeed : cont size="
<< mwpcrawCont->
size
());
53
54
auto
mwpcCont = std::make_unique<TBMWPCCont>();
55
56
// Loop over MWPC
57
for
(
const
TBMWPCRaw
* mwpcraw : *mwpcrawCont) {
58
std::string name = mwpcraw->getDetectorName();
59
unsigned
int
ind=0;
60
// Find calibration index for this MWPC
61
while
(ind<8)
62
{
63
if
(name==
m_mwpc_names
[ind])
break
;
64
else
ind++;
65
}
66
if
(ind==8) {
67
ATH_MSG_ERROR
(
"No calibrations for MWPC"
<<name);
68
continue
;
69
}
70
71
// build new MWPC
72
73
std::vector<int> cwireno = mwpcraw->getCwireno();
74
std::vector<int> nwires = mwpcraw->getNwires();
75
76
std::vector<float> cluspos;
77
std::vector<float> clussize;
78
79
cluspos.clear(); clussize.clear();
80
81
unsigned
int
nclus = cwireno.size();
82
if
(nclus!=nwires.size()) {
83
ATH_MSG_INFO
(
" Problem with cluster number in MWPC plane "
<<ind);
84
continue
;
85
}
86
for
(
unsigned
int
clus=0;clus<nclus;clus++){
87
88
// Cluster center (cm) (from 2002 code)
89
float
coor = -
m_mwpc_halfsize
[ind]+
m_mwpc_wirestep
[ind]*cwireno[clus];
90
coor += (nwires[clus]%2==0) ? 0.5*
m_mwpc_wirestep
[ind] : 0;
91
if
(mwpcraw->isX())
92
coor *=
m_mwpc_invX
[ind];
93
else
94
coor *=
m_mwpc_invY
[ind];
95
96
// Halfsize of cluster (cm) (from 2002 code)
97
float
hwidth = 0.5*nwires[clus]*
m_mwpc_wirestep
[ind];
98
99
ATH_MSG_DEBUG
(
" coor= "
<<coor<<
"cm , w="
<<hwidth<<
"cm"
);
100
101
cluspos.push_back(coor);
102
clussize.push_back(hwidth);
103
104
}
105
106
auto
mwpc = std::make_unique<TBMWPC>(name);
107
mwpc->setCPos(cluspos);
108
mwpc->setClusterSizeC(clussize);
109
mwpc->setXchambers(mwpcraw->isX());
110
111
mwpc->setOverflow(mwpcraw->isOverflow());
112
113
mwpcCont->push_back(std::move(mwpc));
114
}
115
116
ATH_MSG_DEBUG
(
" recording "
<<
m_SGrecordkey
);
117
sc
=
evtStore
()->record(std::move(mwpcCont),
m_SGrecordkey
);
118
if
(
sc
.isFailure( ) ) {
119
ATH_MSG_FATAL
(
"Cannot record MWPCCont"
);
120
}
121
}
122
123
if
(
sc
.isFailure( ) ) {
124
setFilterPassed
(
false
, ctx);
125
}
else
{
126
setFilterPassed
(
true
, ctx);
127
}
128
return
StatusCode::SUCCESS;
129
130
}
131
132
133
StatusCode
134
TBMWPCRec::finalize
()
135
{
136
return
StatusCode::SUCCESS;
137
}
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x,...)
Definition
AthMsgStreamMacros.h:48
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
TBMWPCRec.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Definition
AthCommonAlgorithm.h:99
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TBMWPCRawCont
"TBEvent/TBMWPCRawCont.h"
Definition
TBMWPCRawCont.h:18
TBMWPCRaw
Definition
TBMWPCRaw.h:24
TBMWPCRec::m_mwpc_invY
std::vector< int > m_mwpc_invY
Definition
TBMWPCRec.h:53
TBMWPCRec::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
TBMWPCRec.cxx:41
TBMWPCRec::~TBMWPCRec
virtual ~TBMWPCRec()
Definition
TBMWPCRec.cxx:28
TBMWPCRec::m_mwpc_wirestep
std::vector< float > m_mwpc_wirestep
Definition
TBMWPCRec.h:49
TBMWPCRec::TBMWPCRec
TBMWPCRec(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TBMWPCRec.cxx:9
TBMWPCRec::finalize
virtual StatusCode finalize() override
Definition
TBMWPCRec.cxx:134
TBMWPCRec::m_SGkey
std::string m_SGkey
Definition
TBMWPCRec.h:41
TBMWPCRec::m_mwpc_halfsize
std::vector< float > m_mwpc_halfsize
Definition
TBMWPCRec.h:50
TBMWPCRec::initialize
virtual StatusCode initialize() override
Definition
TBMWPCRec.cxx:32
TBMWPCRec::m_SGrecordkey
std::string m_SGrecordkey
Definition
TBMWPCRec.h:41
TBMWPCRec::m_mwpc_names
std::string m_mwpc_names[8]
Definition
TBMWPCRec.h:47
TBMWPCRec::m_mwpc_invX
std::vector< int > m_mwpc_invX
Definition
TBMWPCRec.h:52
Generated on
for ATLAS Offline Software by
1.17.0