44 {
45
47
48 const unsigned hashMax=
m_onlineID->channelHashMax();
49
51
53
54 coral::AttributeListSpecification*
spec =
new coral::AttributeListSpecification();
55
56 spec->extend(
"costheta",
"blob");
57 spec->extend(
"sinthetacosphi",
"blob");
58 spec->extend(
"sinthetasinphi",
"blob");
59 spec->extend(
"offlineTTid",
"blob");
60
61 AthenaAttributeList* attr=new AthenaAttributeList(*spec);
62 coral::Blob& costhetaBlob = (*attr)["costheta"].data<coral::Blob>();
63 coral::Blob& sinthetacosphiBlob = (*attr)["sinthetacosphi"].data<coral::Blob>();
64 coral::Blob& sinthetasinphiBlob = (*attr)["sinthetasinphi"].data<coral::Blob>();
65 coral::Blob& offlineTTidBlob = (*attr)["offlineTTid"].data<coral::Blob>();
66
67
68 costhetaBlob.resize(hashMax*sizeof(float));
69 sinthetacosphiBlob.resize(hashMax*sizeof(float));
70 sinthetasinphiBlob.resize(hashMax*sizeof(float));
71 offlineTTidBlob.resize(hashMax*sizeof(uint32_t));
72
73 float* pcostheta=static_cast<float*>(costhetaBlob.startingAddress());
74 float* psinthetacosphi=static_cast<float*>(sinthetacosphiBlob.startingAddress());
75 float* psinthetasinphi=static_cast<float*>(sinthetasinphiBlob.startingAddress());
76 uint32_t* pofflineTTid=
static_cast<uint32_t*
>(offlineTTidBlob.startingAddress());
77
79
80 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{
m_caloMgrKey};
82 const CaloDetDescrManager *theCaloDDM = *caloMgrHandle;
84 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{
m_cablingKey};
85 const LArOnOffIdMapping*
cabling{*cablingHdl};
86 if(!cabling) {
88 return StatusCode::FAILURE;
89 }
90
91 for (
unsigned hs=0;
hs<hashMax;++
hs) {
92 const HWIdentifier chid=
m_onlineID->channel_Id(hs);
93
94 if(!
cabling->isOnlineConnected(chid)){
96
98 psinthetacosphi[
hs]=0.0;
99 psinthetasinphi[
hs]=0.0;
101 continue;
102 }
103 const Identifier
id=
cabling->cnvToIdentifier(chid);
104 const CaloDetDescrElement *caloDDE = theCaloDDM->
get_element(
id);
105 if(!caloDDE){
107 return StatusCode::FAILURE;
108 }
110
111 const float eta = caloDDE->
eta();
112 const float phi = caloDDE->
phi();
113 const float v = 1./cosh(
eta);
114 const float costheta=tanh(
eta);
115 const float sinthetacosphi=
v*
cos(
phi);
116 const float sinthetasinphi=
v*
sin(
phi);
117
118 pcostheta[
hs]=costheta;
119 psinthetacosphi[
hs]=sinthetacosphi;
120 psinthetasinphi[
hs]=sinthetasinphi;
121 pofflineTTid[
hs]=
m_ttService->whichTTID(
id).get_identifier32().get_compact();
122 }
123 }
124
125
127
128 const AthenaAttributeList* attr=0;
129
131
132 const coral::Blob& costhetaBlob = (*attr)["costheta"].data<coral::Blob>();
133 const coral::Blob& sinthetacosphiBlob = (*attr)["sinthetacosphi"].data<coral::Blob>();
134 const coral::Blob& sinthetasinphiBlob = (*attr)["sinthetasinphi"].data<coral::Blob>();
135 const coral::Blob& offlineTTidBlob = (*attr)["offlineTTid"].data<coral::Blob>();
136
137 const float* pcostheta=static_cast<const float*>(costhetaBlob.startingAddress());
138 const float* psinthetacosphi=static_cast<const float*>(sinthetacosphiBlob.startingAddress());
139 const float* psinthetasinphi=static_cast<const float*>(sinthetasinphiBlob.startingAddress());
140 const uint32_t* pofflineTTid=
static_cast<const uint32_t*
>(offlineTTidBlob.startingAddress());
141
142
143 std::ostream *
out = &(std::cout);
150 }
151 else
153 }
154
155 for (
unsigned hs=0;
hs<hashMax;++
hs) {
156 const HWIdentifier chid=
m_onlineID->channel_Id(hs);
158 << pcostheta[
hs] <<
" " << psinthetacosphi[
hs] <<
" " << psinthetasinphi[
hs]
159 <<
" 0x"<< std::hex << pofflineTTid[
hs] << std::dec << std::endl;
160 }
161
162
165 }
166
167 return StatusCode::SUCCESS;
168}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
IdentifierHash calo_hash() const
cell calo hash
float eta() const
cell eta
float phi() const
cell phi
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
value_type get_compact() const
Get the compact id.
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.