76{
77 ATH_MSG_INFO(
"in createObj: creating a CaloTTDescrManager object in the detector store");
78
79
80 CaloTTDescrManager* caloTTMgr = new CaloTTDescrManager();
81
82
84
85
86 const CaloLVL1_ID* lvl1_id = nullptr;
90
91
92
93
94
95
96
97 SG::ReadCondHandleKey<CaloDetDescrManager> caloMgrKey {"CaloDetDescrManager"};
99 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{caloMgrKey};
100 const CaloDetDescrManager* caloMgr = *caloMgrHandle;
101
102 SmartIF<IToolSvc> toolSvc{service("ToolSvc")};
104
105 CaloTriggerTowerService* ttSvc{nullptr};
106 ATH_CHECK(toolSvc->retrieveTool(
"CaloTriggerTowerService",ttSvc));
107
108
109
110
112
113 ATH_MSG_DEBUG(
"Initializing CaloTTMgr from values in CaloTTMgrDetDescrCnv");
114
115 int numberOfIdRegions=0;
116 int numberOfDescrRegions=0;
117 int nEmb=0;
118 int nEmec=0;
119 int nHec=0;
120 int nFcal=0;
121
122
123 const CaloLVL1_ID* lvl1_helper = lvl1_id;
124
125 std::vector<Identifier>::const_iterator itId = lvl1_id->
region_begin();
126 std::vector<Identifier>::const_iterator itIdEnd = lvl1_id->
region_end();
127
128 for(; itId!=itIdEnd;++itId){
129 Identifier regId = *itId;
130 ++numberOfIdRegions;
132
133 int region = lvl1_helper->
region(regId);
134 int halfNphi = (lvl1_helper->
phi_max(regId)+1)/2;
135 int nLay = lvl1_helper->
layer_max(regId)+1;
136
137
138 CaloTTDescriptor* calo_descriptor = new CaloTTDescriptor() ;
139 calo_descriptor->
set(regId);
140
141 if( 0 == region ) {
142
143 calo_descriptor->
set(0. ,2.5,0.1,0.,2.*
M_PI,
M_PI/halfNphi,posNeg,nLay);
144 } else if( 1 == region ) {
145
146 calo_descriptor->
set(2.5,3.1,0.2,0.,2.*
M_PI,
M_PI/halfNphi,posNeg,nLay);
147 } else if( 2 == region ) {
148
149 calo_descriptor->
set(3.1,3.2,0.1,0.,2.*
M_PI,
M_PI/halfNphi,posNeg,nLay);
150 } else if( 3 == region ) {
151
152 calo_descriptor->
set(3.2,4.9,0.4,0.,2.*
M_PI,
M_PI/halfNphi,posNeg,nLay);
153 }
154
155
156 caloTTMgr->
add(calo_descriptor);
157
158
159
162
163 int maxPhi=calo_descriptor->
nPhi();
164 for(
int iPhi=0;
iPhi<maxPhi;++
iPhi) {
165
166 Identifier TTid = lvl1_helper->
tower_id(regId,iEta,iPhi);
167 if(!lvl1_helper->
is_tile(TTid)) {
168
169 int maxLay=calo_descriptor->
nLay();
170 for(int iLay=0;iLay<maxLay;++iLay) {
171
172 Identifier layId = lvl1_helper->
layer_id(TTid,iLay);
174 if(lvl1_helper->
is_fcal(layId)) {
176 }
177 else if(lvl1_helper->
is_emec(layId) || lvl1_helper->
is_hec(layId)) {
178 isEC=true;
179 }
180 if (this->
msgLvl(MSG::DEBUG)) {
182 ++nEmb;
184 }
185 else if(lvl1_helper->
is_emec(layId)) {
186 ++nEmec;
188 }
189 else if(lvl1_helper->
is_hec(layId)) {
190 ++nHec;
192 }
193 else {
194 ++nFcal;
196 }
197 }
198
199 double dEta=calo_descriptor->
deta();
202
203 double dPhi=calo_descriptor->
dphi();
204
205
206
207 float orig=0.;
208 double phi=calo_descriptor->
phiMin() + (
iPhi+0.5)*dPhi + orig;
211
212
213 float rhoMin=99999.;
214 float rhoMax=0.;
215 float zMin=99999.;
216 float zMax=-99999.;
217
218
220
222 numberOfDescrRegions++;
223 std::vector<Identifier>::const_iterator
it =
vec.begin();
224 std::vector<Identifier>::const_iterator it_end =
vec.end();
225 for(;
it!=it_end;++
it) {
226 Identifier offId = (*it);
227 const CaloDetDescrElement* caloDDE =
230 double cDrho=caloDDE->
dr();
231 double z =caloDDE->
z_raw();
232 double cDz =caloDDE->
dz();
233
234 if( (rho-cDrho/2.)<rhoMin ) {rhoMin=std::max(rho-cDrho/2.,0.);}
235 if( (rho+cDrho/2.)>rhoMax ) {rhoMax=
rho+cDrho/2.;}
236 if( (
z-cDz/2.)<zMin ) {zMin=
z-cDz/2.;}
237 if( (
z+cDz/2.)>zMax ) {zMax=
z+cDz/2.;}
238 }
239
240
241 CaloTTDescrRegion* tt_region = new CaloTTDescrRegion(layId,calo_descriptor);
242 if(isFCAL) {
243
246 } else if(isEC) {
249 } else {
252 }
253
254 caloTTMgr->
add(tt_region);
255
256 }
257 else {
259 }
260 }
261 }
262 }
263 }
264 }
265
266
268
269 ATH_MSG_INFO(
" Initialized CaloTTMgr, number of descr regions is " << numberOfDescrRegions);
271 << nEmb << " Em Barrel "
272 << nEmec << " Em EC "
273 << nHec << " HEC "
274 << nFcal << " FCAL ");
275 ATH_MSG_DEBUG(
" number of helper regions= " << numberOfIdRegions);
276 }
277
278 return StatusCode::SUCCESS;
279}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
std::vector< size_t > vec
bool msgLvl(const MSG::Level lvl) const
Test the output level.
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
float r_raw() const
cell r_raw
float z_raw() const
cell z_raw
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
bool is_barrel_end(const Identifier id) const
Test wether given tower or layer is part of the EM barrel END.
int phi_max(const Identifier regId) const
min value of phi index (-999 == failure)
int region(const Identifier id) const
return region according to :
bool is_emb(const Identifier id) const
Test wether given tower or layer is part of the EM barrel.
bool is_tile(const Identifier id) const
Test wether given tower or layer is part of the Tile Calorimeter.
bool is_emec(const Identifier id) const
Test wether given tower or layer is part of the EM end-cap.
id_iterator region_begin() const
begin iterator over regions
int layer_max(const Identifier regId) const
max value of phi index (-999 == failure)
bool is_fcal(const Identifier id) const
Test wether given tower or layer is part of the FCAL.
id_iterator region_end() const
end iterator over regions
bool is_hec(const Identifier id) const
Test wether given tower or layer is part of the HEC.
int pos_neg_z(const Identifier id) const
return pos_neg_z according to :
Identifier tower_id(int pos_neg_z, int sampling, int region, int eta, int phi) const
build a tower identifier
Identifier layer_id(int pos_neg_z, int sampling, int region, int eta, int phi, int layer) const
build a layer identifier
void add(CaloTTDescrRegion *region)
Insertion in the vector of Det Descr regions (== Trigger Towers)
calo_descr_size calo_descriptors_size(void) const
Total number of descriptors.
void set_helper(const CaloLVL1_ID *id_helper)
set the helper used to decode the TT offline identifiers
void initialize(void)
dummy.
bool is_initialized(void) const
void set_spherical_size(double deta, double dphi, double drho)
set size of the Det Descr region – pseudo spherical system; eta is signed, rho is unsigned
void set_cylindric_size(double deta, double dphi, double dz)
set size of the Det Descr region – pseudo cylindrical system; eta is signed, z as well (same sign)
void set_spherical(double eta, double phi, double rho)
set coordinates of the Det Descr region – pseudo spherical system; eta is signed, rho is unsigned
void set_cylindric(double eta, double phi, double z)
set coordinates of the Det Descr region – pseudo cylindrical system; eta is signed,...
void set(const Identifier &id)
set internal data member m_id (which is unused.
short nPhi() const
descriptor parameter: number of phi bins
float deta() const
descriptor parameter: eta granularity
short nLay() const
descriptor parameter: number of layers
int sign_eta() const
descriptor parameter: sign of eta (+-1)
float dphi() const
descriptor parameter: phi granularity
short nEta() const
descriptor parameter: number of eta bins
float phiMin() const
descriptor parameter: min value of phi
float eta_min() const
descriptor parameter: min value of abs(eta)
std::vector< Identifier > createCellIDvecLayer(const Identifier &id) const
Return a vector of offline Identifiers (corresponding helpers = LArEM_ID, LArHEC_ID,...
const ServiceHandle< StoreGateSvc > & detStore() const
Handle to DetectorStore.
StatusCode initialize(bool used=true)
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
bool dEta(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
bool isFCAL(const xAOD::CaloCluster *cluster)
return true if the cluster (or the majority of its energy) is in the FCAL0
setScale setgFexType iEta