ATLAS Offline Software
Loading...
Searching...
No Matches
D3PD::SCFillerTool Class Reference

Block filler tool for EM samplings from a CaloCluster. More...

#include <SCFillerTool.h>

Inheritance diagram for D3PD::SCFillerTool:

Public Member Functions

 SCFillerTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Gaudi tool constructor.
virtual StatusCode book ()
 Book variables for this block.
virtual StatusCode initialize ()
virtual StatusCode fill (const CaloCellContainer &p)
 Fill one block — type-safe version.
virtual void fillHashTables (const CaloCellContainer &p)
virtual void dumpHashTables (const CaloCellContainer &p)
virtual void resetEnergies ()
 BlockFillerToolImpl (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Gaudi tool constructor.
virtual StatusCode configureD3PD (IAddVariable *tree, const std::type_info &ti)
 Configure during initialization: type-check.
StatusCode configureD3PD (IAddVariable *tree)
 Configure the parent tree.
virtual StatusCode fillUntyped (const void *p, bool again=false)
 Fill one block.
virtual StatusCode fillAgain (const CaloCellContainer &p)
 Fill one block, after AGAIN has been returned (type-safe).
virtual StatusCode addVariable (const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
 Add a variable to the tuple.
StatusCode addVariable (const std::string &name, CaloCellContainer *&ptr, const std::string &docstring="")
 Make the template implementation from IAddVariable visible.
StatusCode addVariable (const std::string &name, CaloCellContainer *&ptr, const std::string &docstring, const U &defval)
 Make the template implementation from IAddVariable visible.
virtual StatusCode addDimensionedVariable (const std::string &name, const std::type_info &ti, void *&ptr, const std::string &dim, const std::string &docstring="", const void *defval=0)
 Add a variable to the tuple.
StatusCode addDimensionedVariable (const std::string &name, CaloCellContainer *&ptr, const std::string &dim, const std::string &docstring="")
 Add a variable to the tuple.
StatusCode addDimensionedVariable (const std::string &name, CaloCellContainer *&ptr, const std::string &dim, const std::string &docstring, const U &defval)
 Add a variable to the tuple.

Protected Member Functions

StatusCode configureImpl (IAddVariable *tree, const std::type_info &ti, const std::type_info &fill_ti)
 Configure during initialization: type-check.
StatusCode configureImpl (IAddVariable *tree, const std::type_info &ti, const std::vector< const std::type_info * > &tis, size_t &which)
 Configure during initialization: type-check.
StatusCode convert (void const *&p) const
 Do type conversion.

Protected Attributes

ObjectMetadata m_metadata
 Metadata about the variables created by this object.

Private Attributes

const LArEM_IDm_emid
const LArFCAL_IDm_fcalid
const LArHEC_IDm_hecid
const TileIDm_tileid
const LArOnlineIDm_onlineHelper
SG::ReadCondHandleKey< LArOnOffIdMappingm_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}
int * m_nSC
 parameters
std::vector< double > * m_E
std::vector< double > * m_eta
std::vector< double > * m_phi
std::vector< double > * m_Et
std::vector< double > * m_time
std::vector< double > * m_quality
std::vector< int > * m_calo
std::vector< int > * m_region
std::vector< int > * m_sampling
std::vector< int > * m_ieta
std::vector< int > * m_jphi
std::vector< int > * m_hashid
bool m_tableFilled
std::map< const Identifier, int > m_sc_hashTable
std::vector< int > m_sc_list
std::map< int, double > m_sc_energy
std::map< int, double > m_sc_eta
std::map< int, double > m_sc_phi
std::map< int, std::vector< const CaloCell * > > m_sc_compId
std::vector< float > m_etaCut
std::vector< float > m_phiCut
std::vector< unsigned int > m_caloNums
std::vector< unsigned int > m_caloLayers
bool m_caloEtaSelection
bool m_caloPhiSelection
bool m_caloLayerSelection
bool m_caloSelection
bool m_tileDLayerOption
std::string m_prefix
 Property: the variable prefix for this block.
std::string m_suffix
 Property: the variable prefix for this block.
std::string m_blockName
 Property: the name of this block.
TypeConverter m_converter
 Helper to do type conversions.
IAddVariablem_tree
 Reference to the block name.

Static Private Attributes

static const std::string s_emptyString
 Used to provide a default value for blockName.

Detailed Description

Block filler tool for EM samplings from a CaloCluster.

Definition at line 44 of file SCFillerTool.h.

Constructor & Destructor Documentation

◆ SCFillerTool()

D3PD::SCFillerTool::SCFillerTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Standard Gaudi tool constructor.

Parameters
typeThe name of the tool type.
nameThe tool name.
parentThe tool's Gaudi parent.

Definition at line 31 of file SCFillerTool.cxx.

35 : BlockFillerTool<CaloCellContainer> (type, name, parent),
36 m_tableFilled(false),
37 m_caloEtaSelection( false ),
38 m_caloPhiSelection( false ),
39 m_caloLayerSelection( false ),
40 m_caloSelection( false ),
41 m_tileDLayerOption( false ) {
42
43 declareProperty( "CaloEtaCut", m_etaCut );
44 declareProperty( "CaloPhiCut", m_phiCut );
45 declareProperty( "CaloLayers", m_caloLayers );
46 // 1=EMB; 2=EMEC Outer Wheel; 3=EMEC Inner Wheel; 4=HEC; 5=FCAL; 6=Tile LB; 7=Tile EB
47 declareProperty( "CaloDetectors", m_caloNums );
48 declareProperty( "TileDLayerOption", m_tileDLayerOption);
49
50 SCFillerTool::book().ignore(); // Avoid coverity warnings.
51}
std::vector< unsigned int > m_caloNums
virtual StatusCode book()
Book variables for this block.
std::vector< float > m_phiCut
std::vector< float > m_etaCut
std::vector< unsigned int > m_caloLayers

Member Function Documentation

◆ addDimensionedVariable() [1/3]

StatusCode D3PD::IAddVariable::addDimensionedVariable ( const std::string & name,
CaloCellContainer *& ptr,
const std::string & dim,
const std::string & docstring,
const U & defval )
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

◆ addDimensionedVariable() [2/3]

StatusCode D3PD::IAddVariable::addDimensionedVariable ( const std::string & name,
CaloCellContainer *& ptr,
const std::string & dim,
const std::string & docstring = "" )
inherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.

If called from the constructor, the only effect is to clear ptr.

◆ addDimensionedVariable() [3/3]

StatusCode D3PD::AddVariable::addDimensionedVariable ( const std::string & name,
const std::type_info & ti,
void *& ptr,
const std::string & dim,
const std::string & docstring = "",
const void * defval = 0 )
virtualinherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
typeThe type of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
dimDimension for the variable. (Presently unimplemented!)
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Null for no default (generally means to fill with zeros). Of the type given by ti. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

Definition at line 119 of file AddVariable.cxx.

129{
130 if (!m_tree) {
131 // Called from constructor --- just initialize pointer.
132 ptr = 0;
133 return StatusCode::SUCCESS;
134 }
135
137 ti, ptr, dim,
138 docstring, defval ) );
140 ti, ptr, dim,
142}
#define CHECK(...)
Evaluate an expression and check for errors.
virtual StatusCode addDimensionedVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &dim, const std::string &docstring="", const void *defval=0)
Add a variable to the tuple.
Type-safe wrapper for block filler tools.

◆ addVariable() [1/3]

StatusCode D3PD::IAddVariable::addVariable ( const std::string & name,
CaloCellContainer *& ptr,
const std::string & docstring,
const U & defval )
inherited

Make the template implementation from IAddVariable visible.

◆ addVariable() [2/3]

StatusCode D3PD::IAddVariable::addVariable ( const std::string & name,
CaloCellContainer *& ptr,
const std::string & docstring = "" )
inherited

Make the template implementation from IAddVariable visible.

◆ addVariable() [3/3]

StatusCode D3PD::AddVariable::addVariable ( const std::string & name,
const std::type_info & ti,
void *& ptr,
const std::string & docstring = "",
const void * defval = 0 )
virtualinherited

Add a variable to the tuple.

Parameters
nameThe name of the variable.
typeThe type of the variable.
ptrPointer to the type of the variable. The pointer need not be initialized; the D3PD software will set the pointer prior to calling fill().
docstringDocumentation string for this variable.
defvalPointer to the default value to use for this variable. Null for no default (generally means to fill with zeros). Of the type given by ti. Only works for basic types.

If called from the constructor, the only effect is to clear ptr.

Definition at line 93 of file AddVariable.cxx.

90{
91 if (!m_tree) {
92 // Called from constructor --- just initialize pointer.
93 ptr = 0;
95 }
96
98 ti, ptr, docstring, defval ) );
101}
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Add a variable to the tuple.

◆ BlockFillerToolImpl()

( const std::string & type,
const std::string & name,
const IInterface * parent )
inherited

Standard Gaudi tool constructor.

Parameters
typeThe name of the tool type.
nameThe tool name.
parentThe tool's Gaudi parent.

◆ book()

StatusCode D3PD::SCFillerTool::book ( )
virtual

Book variables for this block.

Implements D3PD::BlockFillerTool< CaloCellContainer >.

Definition at line 138 of file SCFillerTool.cxx.

139{
140 CHECK( addVariable ("nSC", m_nSC ));
141 CHECK( addVariable ("E", m_E));
142 CHECK( addVariable ("eta", m_eta));
143 CHECK( addVariable ("phi", m_phi));
144 CHECK( addVariable ("Et", m_Et));
145 CHECK( addVariable ("calo", m_calo));
146 CHECK( addVariable ("region", m_region));
147 CHECK( addVariable ("sampling", m_sampling));
148 CHECK( addVariable ("ieta", m_ieta));
149 CHECK( addVariable ("jphi", m_jphi));
150 CHECK( addVariable ("hid", m_hashid));
151 CHECK( addVariable ("time", m_time));
152 CHECK( addVariable ("quality", m_quality));
153
154 return StatusCode::SUCCESS;
155}
StatusCode addVariable(const std::string &name, T *&ptr, const std::string &docstring="")
Add a variable to the tuple.
std::vector< double > * m_E
std::vector< int > * m_jphi
int * m_nSC
parameters
std::vector< int > * m_region
std::vector< int > * m_hashid
std::vector< int > * m_ieta
std::vector< int > * m_calo
std::vector< double > * m_Et
std::vector< double > * m_quality
std::vector< double > * m_eta
std::vector< double > * m_time
std::vector< double > * m_phi
std::vector< int > * m_sampling

◆ configureD3PD() [1/2]

StatusCode D3PD::AddVariable::configureD3PD ( IAddVariable * tree)
inherited

Configure the parent tree.

Parameters
treeThe parent IAddVariable instance.

Definition at line 69 of file AddVariable.cxx.

62{
63 m_tree = tree;
64 m_metadata.clear();
66}

◆ configureD3PD() [2/2]

virtual StatusCode D3PD::BlockFillerTool< CaloCellContainer >::configureD3PD ( IAddVariable * tree,
const std::type_info & ti )
virtualinherited

Configure during initialization: type-check.

Parameters
treeOur parent for tuple making.
tiGives the type of the object being passed to fillUntyped.

configureD3PD should check that the type of the object coming as input is compatible with what it expects, and raise an error otherwise.

◆ configureImpl() [1/2]

StatusCode D3PD::BlockFillerToolImpl::configureImpl ( IAddVariable * tree,
const std::type_info & ti,
const std::type_info & fill_ti )
protectedinherited

Configure during initialization: type-check.

Parameters
treeOur parent for tuple making.
tiGives the type of the object being passed to fillUntyped.
fill_tiis the type of object that the user code will expect.

This is the common implementation for the configureD3PD method of IBlockFillerTool. It checks that the type of the object coming as input is compatible with what the user code is expecting, and raises an error otherwise.

Definition at line 70 of file BlockFillerToolImpl.cxx.

58{
60 CHECK( m_converter.init (ti, fill_ti) );
61
63}

◆ configureImpl() [2/2]

StatusCode D3PD::BlockFillerToolImpl::configureImpl ( IAddVariable * tree,
const std::type_info & ti,
const std::vector< const std::type_info * > & tis,
size_t & which )
protectedinherited

Configure during initialization: type-check.

Parameters
treeOur parent for tuple making.
tiGives the type of the object being passed to fillUntyped.
tisList of possible input types that we can accept.
[out]whichIndex of the accepted type.

This is the common implementation for the configureD3PD method of IBlockFillerTool. It checks that the type of the object coming as input is compatible with what the user code is expecting, and raises an error otherwise.

This version allows for one of a set of types to match. If successful, WHICH is set to the index (0-based) of the matching type.

Definition at line 91 of file BlockFillerToolImpl.cxx.

87{
89 CHECK( m_converter.init (ti, tis, which) );
91}

◆ convert()

StatusCode D3PD::BlockFillerToolImpl::convert ( void const *& p) const
protectedinherited

Do type conversion.

Parameters
p[in,out]Pointer to convert.

On entry, p is a pointer to an object of the type that was passed into configureImpl as ti. Convert the pointer to point to an object of the type that was given as fill_ti. If the conversion fails, the pointer is set to 0 (and FAILURE is returned).

Definition at line 107 of file BlockFillerToolImpl.cxx.

106{
107 p = m_converter.convertUntyped (p);
108 if (!p) {
110 << "Pointer conversion from " << m_converter.srcName() << " to "
111 << m_converter.dstName() << "failed.";
112 return StatusCode::FAILURE;
113 }
114 return StatusCode::SUCCESS;
115}
#define REPORT_MESSAGE(LVL)
Report a message.

◆ dumpHashTables()

void D3PD::SCFillerTool::dumpHashTables ( const CaloCellContainer & p)
virtual

Definition at line 248 of file SCFillerTool.cxx.

248 {
249//---------------------------------------------------------------------------------
250 typedef CaloCellContainer CONTAINER;
251 CONTAINER::const_iterator f_cell = p.begin();
252 CONTAINER::const_iterator l_cell = p.end();
253
254 for( ; f_cell != l_cell; ++f_cell ) {
255 const CaloCell* cell = ( *f_cell );
256 Identifier id = cell->ID();
257 int posneg = (cell->eta()>=0.0) ? 1: -1;
258 int sc_hash = m_sc_hashTable[ id ];
259 // m_sc_compId[sc_hash];
260 if ( posneg > 0 ) {
261 if ( m_emid->is_lar_em(id) ) {
262 if (m_emid->is_em_barrel(id) ) {
263 int ieta = m_emid->eta(id);
264 int jphi = m_emid->phi(id);
265 int lay = m_emid->sampling(id);
266 // int reg = m_emid->region(id);
267 std::cout << "SCFillerTool::dumpHashTables() [ONLY EM BARREL] ==> posneg,lay,ieta,jphi= " << posneg << ", " << lay << ", " << ieta << ", " << jphi << " ID: " << id << " sc_hash: " << sc_hash << std::endl;
268 }
269 }
270 }
271 }
272 std::map< int, std::vector<const CaloCell*> >::iterator it = m_sc_compId.begin();
273 for( ; it!=m_sc_compId.end(); ++it) {
274 int scID = (*it).first;
275 int key = scID;
276 std::vector<const CaloCell*> v = (*it).second;
277 int nl = v.size();
278 int pn = ((key >> 28) & 0x1) ? 1: -1;
279 int calo = ((key >> 24) & 0xf)*pn;
280 int region = (key>>20) & 0xf;
281 unsigned int lay = (key>>16) & 0xf;
282 int ieta = (key>>8) & 0xff;
283 int jphi = key & 0xff;
284 if (abs(calo)==1 && pn>0) {
285 std::cout << "SCFillerTool::dumpHashTables() ===> scID = " << scID << " calo,pn,region,lay,ieta,jphi: " << calo << ", " << pn << ", " << region << ", " << lay << ", " << ieta << ", " << jphi << std::endl;
286 std::cout << "SCFillerTool::dumpHashTables() ===> scID = " << scID << " No. of cells: " << nl << std::endl;
287 std::cout << "SCFillerTool::dumpHashTables() ===> " ;
288 for (const CaloCell* cell : v) {
289 std::cout << cell << ", " ;
290 }
291 std::cout << "" << std::endl;
292 }
293 }
294}
std::map< const Identifier, int > m_sc_hashTable
std::map< int, std::vector< const CaloCell * > > m_sc_compId
const LArEM_ID * m_emid

◆ fill()

StatusCode D3PD::SCFillerTool::fill ( const CaloCellContainer & p)
virtual

Fill one block — type-safe version.

Parameters
pThe input object.

This is called once per object. The caller is responsible for arranging that all the pointers for booked variables are set appropriately upon entry.

Implements D3PD::BlockFillerTool< CaloCellContainer >.

Definition at line 166 of file SCFillerTool.cxx.

166 {
167
168 if ( !m_tableFilled ) {
169 m_tableFilled = true;
172 ATH_MSG_INFO("**** after fillHashTables in first event");
173 }
174
176
177 typedef CaloCellContainer CONTAINER;
178 CONTAINER::const_iterator f_cell = p.begin();
179 CONTAINER::const_iterator l_cell = p.end();
180 for( ; f_cell != l_cell; ++f_cell ) {
181 const CaloCell* cell = ( *f_cell );
182 const Identifier id = cell->ID();
183 int scid = m_sc_hashTable[id];
184 m_sc_energy[scid] += cell->energy();
185 }
186
187 int nSC = 0;
188 std::vector<int>::iterator it;
189 it=m_sc_list.begin();
190 for ( ; it!=m_sc_list.end(); ++it ) {
191 int key = *it;
192 // int sc_hash = (sc_side << 28) | ( sc_calo << 24 ) | (sc_region << 20 ) | ( sc_layer << 16 ) | ( sc_ieta << 8 ) | ( sc_jphi );
193 int pn = ((key >> 28) & 0x1) ? 1: -1;
194 int calo = ((key >> 24) & 0xf)*pn;
195 int region = (key>>20) & 0xf;
196 unsigned int lay = (key>>16) & 0xf;
197 int ieta = (key>>8) & 0xff;
198 int jphi = key & 0xff;
199
200 float feta = m_sc_eta[key];
201 float fphi = m_sc_phi[key];
202 int lardet = abs((key >> 24) & 0xf);
203
204 if (m_caloSelection) {
205 std::vector< unsigned int >::const_iterator theFound =
206 std::find( m_caloNums.begin(), m_caloNums.end(), lardet );
207 if( theFound == m_caloNums.end() ) continue;
208 }
209 if ( m_caloEtaSelection ) {
210 if (feta<m_etaCut[0] || feta>m_etaCut[1]) continue;
211 }
212 if ( m_caloPhiSelection ) {
213 if (fphi<m_phiCut[0] || fphi>m_phiCut[1]) continue;
214 }
215 if ( m_caloLayerSelection ) {
216 bool tmp=false;
217 for( unsigned int j=0; j<m_caloLayers.size(); j++) {
218 if (m_caloLayers[j]==lay) tmp=true;
219 }
220 if (!tmp) continue;
221 }
222 nSC++;
223 m_E->push_back( m_sc_energy[ key ] );
224 m_calo->push_back( calo );
225 m_region->push_back( region );
226 m_sampling->push_back( lay );
227 m_ieta->push_back( ieta );
228 m_jphi->push_back( jphi );
229 m_hashid->push_back( key );
230 m_eta->push_back( feta );
231 m_phi->push_back( m_sc_phi[ key ] );
232 m_Et->push_back( m_sc_energy[key]/cosh( feta ) );
233 }
234 *m_nSC = nSC;
235
236 return StatusCode::SUCCESS;
237}
#define ATH_MSG_INFO(x)
std::map< int, double > m_sc_eta
virtual void fillHashTables(const CaloCellContainer &p)
std::vector< int > m_sc_list
std::map< int, double > m_sc_phi
virtual void dumpHashTables(const CaloCellContainer &p)
std::map< int, double > m_sc_energy
virtual void resetEnergies()

◆ fillAgain()

virtual StatusCode D3PD::BlockFillerTool< CaloCellContainer >::fillAgain ( const CaloCellContainer & p)
virtualinherited

Fill one block, after AGAIN has been returned (type-safe).

Parameters
pThe input object.

Once fill returns AGAIN, the parent should call fillAgain with the same arguments. This continues until fillAgain returns something other than AGAIN.

By default, this just calls fill().

◆ fillHashTables()

void D3PD::SCFillerTool::fillHashTables ( const CaloCellContainer & p)
virtual

Definition at line 297 of file SCFillerTool.cxx.

297 {
298//---------------------------------------------------------------------------------
299 typedef CaloCellContainer CONTAINER;
300 CONTAINER::const_iterator f_cell = p.begin();
301 CONTAINER::const_iterator l_cell = p.end();
302
303 int /*posneg,*/reg,lay,ieta,jphi;
304 int sc_side, sc_calo, sc_region, sc_layer, sc_ieta, sc_jphi;
305 //float sc_feta, sc_fphi;
306
307 SG::ReadCondHandle<LArOnOffIdMapping> cabling (m_cablingKey);
308
309 for( ; f_cell != l_cell; ++f_cell ) {
310 const CaloCell* cell = ( *f_cell );
311 Identifier id = cell->ID();
312 //posneg = (cell->eta()>=0.0) ? 1: -1;
313 sc_side = (cell->eta()>=0.0) ? 1: 0;
314 sc_ieta = -999;
315 sc_jphi = -999;
316 //sc_feta = 0.;
317 //sc_fphi = 0.;
318 sc_calo = -1;
319 sc_region = -1;
320 sc_layer = -1;
321
322 ieta = -999;
323 jphi = -999;
324
325 if ( m_emid->is_lar_em(id) ) {
326 ieta = m_emid->eta(id);
327 jphi = m_emid->phi(id);
328 lay = m_emid->sampling(id);
329 reg = m_emid->region(id);
330 sc_region = reg;
331 sc_layer = lay;
332 if (m_emid->is_em_barrel(id) ) {
333 sc_calo = 1;
334 if ( lay == 0 ) {
335 sc_ieta = int(ieta/4);
336 sc_jphi = jphi;
337 } else if ( lay == 1 ) {
338 sc_ieta = (reg==0) ? int(ieta/8) : 56+ieta;
339 sc_jphi = (reg==0) ? jphi: int(jphi/4);
340 } else if ( lay == 2 ) {
341 sc_ieta = (reg==0) ? ieta: 56 + ieta;
342 sc_jphi = int(jphi/4);
343 } else if ( lay == 3 ) {
344 sc_ieta = int(ieta/2);
345 sc_jphi = int(jphi/4);
346 }
347 } else if ( m_emid->is_em_endcap_outer(id) ) {
348 sc_calo = 2;
349 if ( lay == 0 ) {
350 sc_ieta = int(ieta/4);
351 sc_jphi = jphi;
352 sc_region = 1;
353 } else if (lay == 1) {
354 // sc_ieta = (reg<=1) ? 0 : ((reg==2) ? 1+int(ieta/8) : ((reg==3) ? 13+int(ieta/8) : ((reg==4) ? 19+int(ieta/4): 35)));
355 sc_ieta = (reg<=1) ? 0 : ((reg==2) ? 1+int(ieta/8) : ((reg==3) ? 13+int(ieta/4) : ((reg==4) ? 25+int(ieta/4): 41)));
356 sc_jphi = jphi;
357 sc_region = (reg<2) ? 0: reg-1;
358 } else if (lay==2) {
359 sc_ieta = (reg==0) ? 0 : 1+ieta;
360 sc_jphi = int(jphi/4);
361 sc_region = (ieta<3) ? 0: ((ieta<15) ? 1 : ((ieta<23) ? 2 : ((ieta<39) ? 3 : 4)));
362 } else if (lay==3) {
363 sc_ieta = int(ieta/2);
364 sc_jphi = int(jphi/4);
365 sc_region = (ieta<6) ? 1: ((ieta<10) ? 2 : ((ieta<18) ? 3: 4));
366 } else {
367 sc_ieta = -999;
368 sc_jphi = -999;
369 sc_region = -999;
370 }
371 } else if ( m_emid->is_em_endcap_inner(id) ) {
372 sc_calo = 3;
373 sc_ieta = (ieta<6) ? int(ieta/2) : 47;
374 sc_jphi = int(jphi/2);
375 sc_region = (ieta<6) ? 5 : 6;
376 }
377 } else if (m_hecid->is_lar_hec(id)) {
378 sc_layer = m_hecid->sampling(id);
379 sc_region = m_hecid->region(id);
380 sc_calo= 4;
381 ieta = m_hecid->eta(id);
382 jphi = m_hecid->phi(id);
383 sc_ieta = (sc_region==0) ? ieta : 10+ieta;
384 sc_jphi = jphi;
385 sc_region = 0;
386 } else if (m_fcalid->is_lar_fcal(id)) {
387 HWIdentifier hwid = cabling->createSignalChannelID( id );
388 sc_calo = 5;
389 const int lay = m_fcalid->module(id);
390 const int s = m_onlineHelper->slot(hwid);
391 const int c = m_onlineHelper->channel(hwid);
392 const int c64 = c%64;
393 sc_layer = lay;
394 if (lay==3) {
395 sc_ieta = 4-int((c%16)/4);
396 int jphip = 8*(s-14) + 3 + 4*int(c/64)-int(c64/16);
397 int jphin = 8*(s-14) + 7 - int(c/16);
398 sc_jphi = (sc_side)>0 ? jphip : jphin;
399 sc_region = 0;
400 } else if (lay==2) {
401 sc_ieta = ((c%32)<16 ? 4 : 8) - int((c%32)/4);
402 int jphip = 4*(s-10) + 1 + 2*int(c/64)-int(c64/32);
403 int jphin = ((s>=12) ? 14 -4*(s-12): 6 -4*(s-10) ) + int(c64/32) -2*int(c/64);
404 sc_jphi = (sc_side>0) ? jphip : jphin;
405 sc_region = 0;
406 } else if (lay==1) {
407 ieta = 15-int(c64%16) + 16*int(c64/16);
408 sc_ieta = int(ieta/4);
409 int jphip = int(c/64) + 2*(s- ((s==9) ? 2 : 1));
410 int jphin = ((s<5) ? 7 - 2*(s-1) : 15 - 2*(s-((s==9)?6:5))) - int(c/64);
411 sc_jphi = (sc_side>0) ? jphip : jphin;
412 if (c64<16) {
413 sc_region = 0;
414 } else if (c64>=16 && c64<32 ) {
415 sc_region = 1;
416 } else if (c64>=32 && c64<48 ) {
417 sc_region = 2;
418 } else {
419 sc_region = 3;
420 }
421 }
422 } else if (m_tileid->is_tile(id) ) {
423 sc_region = 0;
424 sc_layer = m_tileid->sampling(id);
425 sc_side = (m_tileid->side(id)>0) ? 1 : 0;
426 ieta = m_tileid->tower(id);
427 jphi = m_tileid->module(id);
428 sc_ieta = ieta;
429 sc_jphi = jphi;
430 if ( m_tileid->is_tile_barrel(id) )
431 sc_calo = 6;
432 if ( m_tileid->is_tile_extbarrel(id) )
433 sc_calo = 7;
434 }
435 if( sc_ieta<0 || sc_jphi<0 || sc_calo<=0 || sc_region<0 || sc_layer<0 ) continue;
436 // This is a kludge so that for HEC/Tile (sc_calo=4,6,7) the SC hash id don't have any layer information...(11/27/12)
437 if (sc_calo==4)
438 sc_layer = 0;
439 if (sc_calo==6 || sc_calo==7) {
440 if ( sc_layer!=2 || !m_tileDLayerOption)
441 sc_layer = 0;
442 }
443 int sc_hash = (sc_side << 28) | ( sc_calo << 24 ) | (sc_region << 20 ) | ( sc_layer << 16 ) | ( sc_ieta << 8 ) | ( sc_jphi );
444 m_sc_hashTable[ id ] = sc_hash;
445 m_sc_compId[sc_hash].push_back( cell );
446 }
447
448 std::map< int, std::vector<const CaloCell*> >::iterator it = m_sc_compId.begin();
449 for( ; it!=m_sc_compId.end(); ++it) {
450 int scID = (*it).first;
451 m_sc_list.push_back( scID );
452 std::vector<const CaloCell*> v = (*it).second;
453 int nl = v.size();
454 std::vector<const CaloCell*>::iterator vit;
455 /*
456 if ( ((scID >> 24) & 0xf) >= 6 ) {
457 std::cout << "*** KAKKA TILECAL: THIS IS A TILECAL SCELL hash= " << std::hex << scID << " no. of cells: " << nl << std::endl;
458 for( vit=v.begin(); vit!=v.end(); ++vit) {
459 std::cout << " " << (*vit)->ID() << " ";
460 }
461 std::cout << "" << std::endl;
462 for( vit=v.begin(); vit!=v.end(); ++vit) {
463 std::cout << " " << (*vit)->eta() << " ";
464 }
465 std::cout << "" << std::endl;
466 for( vit=v.begin(); vit!=v.end(); ++vit) {
467 std::cout << " " << (*vit)->phi() << " ";
468 }
469 std::cout << "" << std::endl;
470 }
471 */
472 double feta = 0;
473 double fphi = 0;
474 for( vit=v.begin(); vit!=v.end(); ++vit) {
475 feta += (*vit)->eta();
476 fphi += (*vit)->phi();
477 }
478 if (nl>0) {
479 feta /= nl;
480 fphi /= nl;
481 }
482 m_sc_eta[ scID ] = feta;
483 m_sc_phi[ scID ] = fphi;
484 } // for (; it!=m_sc_compId...)
485
486
487}
const TileID * m_tileid
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
const LArFCAL_ID * m_fcalid
const LArHEC_ID * m_hecid
const LArOnlineID * m_onlineHelper

◆ fillUntyped()

virtual StatusCode D3PD::BlockFillerTool< CaloCellContainer >::fillUntyped ( const void * p,
bool again = false )
virtualinherited

Fill one block.

Parameters
pThe input object.
againSet if this is a subsequent call requested by an AGAIN return

This is called once per object. The type of the object at which p points is given by the ti argument to configureD3PD. The caller is responsible for arranging that all the pointers for booked variables are set appropriately upon entry.

If the return status is the special code AGAIN (defined above), then this filler tool wants to make multiple entries. The parent should set up to capture a new ‘row’ and run through the list of block filler tools again, but for this tool call fillAgainUntyped instead of fillUntyped. This should be repeated as long as fillAgainUntyped returns AGAIN.

Once fillUntyped returns AGAIN, the parent should call fillUntyped with the same p argument and again set to true. This continues until fillUntyped returns something other than AGAIN.

Not all parents may support this. In that case, returning AGAIN will be treated as an error.

◆ initialize()

StatusCode D3PD::SCFillerTool::initialize ( )
virtual

Definition at line 53 of file SCFillerTool.cxx.

53 {
54
55 ServiceHandle<StoreGateSvc> detStore("DetectorStore", name());
56 CHECK( detStore.retrieve() ) ;
57
58 // CHECK ( detStore->retrieve(m_dd_man) );
59 CHECK ( detStore->retrieve(m_emid) );
60 CHECK ( detStore->retrieve(m_fcalid) );
61 CHECK ( detStore->retrieve(m_hecid) );
62 CHECK ( detStore->retrieve(m_tileid) );
63 CHECK ( detStore->retrieve(m_onlineHelper));
64
65 const unsigned int nSubCalo = 7; // static_cast< int >( CaloCell_ID::NSUBCALO );
66
67 //check calo number specified
68 m_caloSelection = false;
69 if( m_caloNums.size() == 0 ) {
70 ATH_MSG_INFO( " *** SCFillerTool: No calorimeter selection" );
71 return StatusCode::SUCCESS;
72 } else if( m_caloNums.size() > nSubCalo ) {
73 REPORT_MESSAGE( MSG::FATAL )
74 << " More than " << nSubCalo << " calo specified. "
75 << "Must be wrong. Stop.";
76 return StatusCode::FAILURE;
77 } else {
78 m_caloSelection = true;
79 for( unsigned int index = 0; index < m_caloNums.size(); ++index ) {
80 if( m_caloNums[ index ]> nSubCalo ) {
81 REPORT_MESSAGE( MSG::FATAL )
82 << "Invalid calo specification:"
83 << m_caloNums[index] << "Stop.";
84 return StatusCode::FAILURE;
85 } else {
86 ATH_MSG_INFO( "*** SCFillerTool: Select calorimeter " << m_caloNums[ index ] );
87 }
88 }
89 }
90
91 m_caloEtaSelection = false;
92 if ( m_etaCut.size() >0 ) {
93 if ( m_etaCut.size()== 2 && m_etaCut[0]<m_etaCut[1] ) {
94 REPORT_MESSAGE( MSG::INFO ) << "*** SCFillerTool: Eta Selection specified: " << m_etaCut[0] << ", " << m_etaCut[1];
96 } else {
97 REPORT_MESSAGE( MSG::FATAL ) << " *** SCFillerTool: Invalid Eta Cut Range specified: Abort!";
98 return StatusCode::FAILURE;
99 }
100 }
101
102 m_caloPhiSelection = false;
103 if ( m_phiCut.size() >0 ) {
104 if ( m_phiCut.size() == 2 && m_phiCut[0]<m_phiCut[1] ) {
105 REPORT_MESSAGE( MSG::INFO ) << "*** SCFillerTool: Phi Selection specified: " << m_phiCut[0] << ", " << m_phiCut[1];
106 m_caloPhiSelection = true;
107 } else {
108 REPORT_MESSAGE( MSG::FATAL ) << " *** SCFillerTool: Invalid Phi Cut Range specified: Abort!";
109 return StatusCode::FAILURE;
110 }
111 }
112
113 m_caloLayerSelection = false;
114 if ( m_caloLayers.size()>0 ) {
115 if ( m_caloLayers.size()>28 ) {
116 REPORT_MESSAGE( MSG::FATAL ) << " *** SCFillerTool: Invalid No. of Calo Layer selection: " << m_caloLayers.size() << " Abort!";
117 return StatusCode::FAILURE;
118 }
119 for( unsigned int j=0; j<m_caloLayers.size(); j++) {
120 if (m_caloLayers[j]>27 ) {
121 REPORT_MESSAGE( MSG::FATAL ) << " *** SCFillerTool: Invalid Calo Layer selection: " << m_caloLayers[j] << " Abort!";
122 return StatusCode::FAILURE;
123 }
124 }
126 }
127
128 ATH_CHECK( m_cablingKey.initialize() );
129
130 ATH_MSG_INFO( " *** SCFillerTool: completed" );
131 return StatusCode::SUCCESS;
132}
#define ATH_CHECK
Evaluate an expression and check for errors.
str index
Definition DeMoScan.py:362

◆ resetEnergies()

void D3PD::SCFillerTool::resetEnergies ( )
virtual

Definition at line 239 of file SCFillerTool.cxx.

239 {
240 std::map<int,double>::iterator it;
241 it=m_sc_energy.begin();
242 for ( ; it!=m_sc_energy.end(); ++it ) {
243 (*it).second=0.0;
244 }
245}

Member Data Documentation

◆ m_blockName

std::string D3PD::BlockFillerToolImpl::m_blockName
privateinherited

Property: the name of this block.

Definition at line 118 of file BlockFillerToolImpl.h.

◆ m_cablingKey

SG::ReadCondHandleKey<LArOnOffIdMapping> D3PD::SCFillerTool::m_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}
private

Definition at line 74 of file SCFillerTool.h.

75{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};

◆ m_calo

std::vector<int>* D3PD::SCFillerTool::m_calo
private

Definition at line 88 of file SCFillerTool.h.

◆ m_caloEtaSelection

bool D3PD::SCFillerTool::m_caloEtaSelection
private

Definition at line 108 of file SCFillerTool.h.

◆ m_caloLayers

std::vector< unsigned int > D3PD::SCFillerTool::m_caloLayers
private

Definition at line 106 of file SCFillerTool.h.

◆ m_caloLayerSelection

bool D3PD::SCFillerTool::m_caloLayerSelection
private

Definition at line 110 of file SCFillerTool.h.

◆ m_caloNums

std::vector< unsigned int > D3PD::SCFillerTool::m_caloNums
private

Definition at line 105 of file SCFillerTool.h.

◆ m_caloPhiSelection

bool D3PD::SCFillerTool::m_caloPhiSelection
private

Definition at line 109 of file SCFillerTool.h.

◆ m_caloSelection

bool D3PD::SCFillerTool::m_caloSelection
private

Definition at line 111 of file SCFillerTool.h.

◆ m_converter

TypeConverter D3PD::BlockFillerToolImpl::m_converter
privateinherited

Helper to do type conversions.

Definition at line 121 of file BlockFillerToolImpl.h.

◆ m_E

std::vector<double>* D3PD::SCFillerTool::m_E
private

Definition at line 81 of file SCFillerTool.h.

◆ m_emid

const LArEM_ID* D3PD::SCFillerTool::m_emid
private

Definition at line 69 of file SCFillerTool.h.

◆ m_Et

std::vector<double>* D3PD::SCFillerTool::m_Et
private

Definition at line 84 of file SCFillerTool.h.

◆ m_eta

std::vector<double>* D3PD::SCFillerTool::m_eta
private

Definition at line 82 of file SCFillerTool.h.

◆ m_etaCut

std::vector<float> D3PD::SCFillerTool::m_etaCut
private

Definition at line 103 of file SCFillerTool.h.

◆ m_fcalid

const LArFCAL_ID* D3PD::SCFillerTool::m_fcalid
private

Definition at line 70 of file SCFillerTool.h.

◆ m_hashid

std::vector<int>* D3PD::SCFillerTool::m_hashid
private

Definition at line 93 of file SCFillerTool.h.

◆ m_hecid

const LArHEC_ID* D3PD::SCFillerTool::m_hecid
private

Definition at line 71 of file SCFillerTool.h.

◆ m_ieta

std::vector<int>* D3PD::SCFillerTool::m_ieta
private

Definition at line 91 of file SCFillerTool.h.

◆ m_jphi

std::vector<int>* D3PD::SCFillerTool::m_jphi
private

Definition at line 92 of file SCFillerTool.h.

◆ m_metadata

ObjectMetadata D3PD::AddVariable::m_metadata
protectedinherited

Metadata about the variables created by this object.

Definition at line 129 of file AddVariable.h.

◆ m_nSC

int* D3PD::SCFillerTool::m_nSC
private

parameters

Definition at line 80 of file SCFillerTool.h.

◆ m_onlineHelper

const LArOnlineID* D3PD::SCFillerTool::m_onlineHelper
private

Definition at line 73 of file SCFillerTool.h.

◆ m_phi

std::vector<double>* D3PD::SCFillerTool::m_phi
private

Definition at line 83 of file SCFillerTool.h.

◆ m_phiCut

std::vector<float> D3PD::SCFillerTool::m_phiCut
private

Definition at line 104 of file SCFillerTool.h.

◆ m_prefix

std::string D3PD::BlockFillerToolImpl::m_prefix
privateinherited

Property: the variable prefix for this block.

Definition at line 112 of file BlockFillerToolImpl.h.

◆ m_quality

std::vector<double>* D3PD::SCFillerTool::m_quality
private

Definition at line 86 of file SCFillerTool.h.

◆ m_region

std::vector<int>* D3PD::SCFillerTool::m_region
private

Definition at line 89 of file SCFillerTool.h.

◆ m_sampling

std::vector<int>* D3PD::SCFillerTool::m_sampling
private

Definition at line 90 of file SCFillerTool.h.

◆ m_sc_compId

std::map<int, std::vector<const CaloCell*> > D3PD::SCFillerTool::m_sc_compId
private

Definition at line 101 of file SCFillerTool.h.

◆ m_sc_energy

std::map<int, double> D3PD::SCFillerTool::m_sc_energy
private

Definition at line 98 of file SCFillerTool.h.

◆ m_sc_eta

std::map<int, double> D3PD::SCFillerTool::m_sc_eta
private

Definition at line 99 of file SCFillerTool.h.

◆ m_sc_hashTable

std::map<const Identifier, int> D3PD::SCFillerTool::m_sc_hashTable
private

Definition at line 96 of file SCFillerTool.h.

◆ m_sc_list

std::vector<int> D3PD::SCFillerTool::m_sc_list
private

Definition at line 97 of file SCFillerTool.h.

◆ m_sc_phi

std::map<int, double> D3PD::SCFillerTool::m_sc_phi
private

Definition at line 100 of file SCFillerTool.h.

◆ m_suffix

std::string D3PD::BlockFillerToolImpl::m_suffix
privateinherited

Property: the variable prefix for this block.

Definition at line 115 of file BlockFillerToolImpl.h.

◆ m_tableFilled

bool D3PD::SCFillerTool::m_tableFilled
private

Definition at line 95 of file SCFillerTool.h.

◆ m_tileDLayerOption

bool D3PD::SCFillerTool::m_tileDLayerOption
private

Definition at line 113 of file SCFillerTool.h.

◆ m_tileid

const TileID* D3PD::SCFillerTool::m_tileid
private

Definition at line 72 of file SCFillerTool.h.

◆ m_time

std::vector<double>* D3PD::SCFillerTool::m_time
private

Definition at line 85 of file SCFillerTool.h.

◆ m_tree

IAddVariable* D3PD::AddVariable::m_tree
privateinherited

Reference to the block name.

The parent IAddVariable instance.

Definition at line 143 of file AddVariable.h.

◆ s_emptyString

const std::string D3PD::AddVariable::s_emptyString
staticprivateinherited

Used to provide a default value for blockName.

Definition at line 41 of file AddVariable.h.


The documentation for this class was generated from the following files: