|
ATLAS Offline Software
|
Go to the documentation of this file.
10 #include "GaudiKernel/MsgStream.h"
12 #include "CLHEP/Units/SystemOfUnits.h"
14 #include "Identifier/Identifier.h"
18 #include "CaloDetDescr/CaloDetDescrElement.h"
22 #include "CaloGeoHelpers/CaloSampling.h"
26 #include "boost/io/ios_state.hpp"
46 const std::string&
name,
74 return StatusCode::SUCCESS;
98 <<
"tool does not hang off the TBXMLWriter algorithm."
100 return StatusCode::FAILURE;
105 if ( checkOut.isFailure() )
108 <<
"cannot convert properties correctly!"
110 return StatusCode::FAILURE;
116 <<
"list of included calo samplings:"
123 <<
"\042 with SubCalo index "
133 const EventContext& ctx = Gaudi::Hive::currentContext();
138 if ( checkOut.isFailure() )
141 <<
"cannot produce run XML files."
143 return StatusCode::FAILURE;
162 outStream <<
"<!-- TBXMLCaloCellWriterTool: begin write cell container "
165 std::vector<std::string> theCellAttrNames;
166 theCellAttrNames.push_back(
"name");
167 theCellAttrNames.push_back(
"ncols");
168 theCellAttrNames.push_back(
"nrows");
169 theCellAttrNames.push_back(
"idtype");
170 theCellAttrNames.push_back(
"etype");
171 std::vector<std::string> theCellAttrValues;
173 std::ostringstream theCols;
174 theCols <<
m_nCols << std::ends;
180 std::ostringstream theRows;
181 theRows <<
nRows << std::ends;
182 theCellAttrValues.push_back(theCols.str());
183 theCellAttrValues.push_back(theRows.str());
184 theCellAttrValues.push_back(
"uint");
185 theCellAttrValues.push_back(
"double");
187 theCellAttrNames,theCellAttrValues);
198 baseIndex, lastIndex);
200 unsigned int theCtr = 0;
201 bool isTerminated =
false;
202 for ( ; firstCell != lastCell; ++firstCell )
205 double eta = (*firstCell)->eta();
206 double phi = (*firstCell)->phi();
223 (*firstCell)->caloDDE()->calo_hash();
258 if ( theCtr == 0 || ( theCtr %
m_nCols ) == 0 )
262 theIndex -= (
int)baseIndex;
263 boost::io::ios_base_all_saver streamsave (outStream);
265 << std::setw(10) << std::setfill(
' ') << theIndex <<
" "
266 << std::setw(3) << std::setfill(
' ') << subIndex <<
" "
267 << std::setw(3) << std::setfill(
' ') << lyrIndex <<
" "
268 << std::setw(3) << std::setfill(
' ') << regIndex <<
" "
269 << std::setw(3) << std::setfill(
' ') << etaIndex <<
" "
270 << std::setw(3) << std::setfill(
' ') <<
phiIndex <<
" "
271 << std::setw(10) << std::setprecision(5) <<
theEnergy;
273 if ( (isTerminated = ( theCtr %
m_nCols )) == 0 )
275 outStream << std::endl;
279 if ( ! isTerminated ) outStream << std::endl;
282 outStream <<
"<!-- TBXMLCaloCellWriterTool: end write cell container "
286 return StatusCode::SUCCESS;
303 std::ostringstream thisFileName;
304 thisFileName << fileDir <<
"/geom."
305 << std::setw(6) << std::setfill(
'0')
308 std::ofstream thisFileStream((thisFileName.str()).c_str());
311 std::vector<std::string> theRunElements;
312 theRunElements.push_back(
"FCalGeomTable*");
313 this->
openDictionary(thisFileStream,
"FCalGeomTable",theRunElements);
314 std::vector<std::string> theRunAttr;
315 theRunAttr.push_back(
"name CDATA #REQUIRED");
316 this->
addAttributes(thisFileStream,
"FCalGeomTable",theRunAttr);
319 std::vector<std::string> anyData;
320 anyData.push_back(
"ANY");
322 std::vector<std::string> theGeomAttr;
323 theGeomAttr.push_back(
"name CDATA #REQUIRED");
324 this->
addAttributes(thisFileStream,
"FCalGeomTable",theGeomAttr);
339 firstIndex, lastIndex);
340 safeIndex = firstIndex;
343 std::vector<std::string> theRunValues(theRunAttr.size());
344 for (
unsigned int i=0;
i<theRunAttr.size();
i++ )
346 if ( (theRunAttr[
i]).
find(
"name") != std::string::npos )
348 theRunValues[
i] =
"FCalMod0";
350 theRunAttr[
i].substr(0,theRunAttr[
i].find_first_of(
" "));
353 this->
openElement(thisFileStream,
"FCalGeomTable",theRunAttr,theRunValues);
354 theRunValues[0] =
"FCalCells";
355 this->
openElement(thisFileStream,
"FCalGeomTable",theRunAttr,theRunValues);
356 thisFileStream <<
"<!-- 32-bit Id"
364 <<
"-->" << std::endl;
367 std::map<int,double> smallestDx;
368 std::map<int,double> largestDx;
369 for (
unsigned int iCtr = (
unsigned int)safeIndex;
370 iCtr <= (
unsigned int)lastIndex; iCtr++ )
377 double dx = theElement->
dx();
379 if ( smallestDx.find(theCalo) == smallestDx.end() )
381 smallestDx[theCalo] =
dx;
382 largestDx[theCalo] =
dx;
386 if (
dx < smallestDx[theCalo] ) smallestDx[theCalo] =
dx;
387 if (
dx > largestDx[theCalo] ) largestDx[theCalo] =
dx;
392 for (
unsigned int iCtr=(
unsigned int)firstIndex;
393 iCtr<=(
unsigned int)lastIndex; iCtr++ )
405 double theX = theElement->
x();
406 double theY = theElement->
y();
407 double theZ = theElement->
z();
409 double dx = theElement->
dx();
410 int tileSize =
dx > 1.1*smallestDx[theCalo] ? 1 : 0;
413 thisFileStream <<
" "
415 << std::setfill(
' ') << iCtr-(
unsigned int)firstIndex
417 << std::setw(2) << std::setfill(
' ') << theModule
419 << std::setw(2) << std::setfill(
' ') << theEta
421 << std::setw(2) << std::setfill(
' ') << thePhi
423 << std::setw(10) << std::setprecision(5) << theX <<
" "
424 << std::setw(10) << std::setprecision(5) << theY <<
" "
425 << std::setw(10) << std::setprecision(5) << theZ <<
" "
427 << std::setw(2) << std::setfill(
' ') << tileSize
431 thisFileStream.close();
433 return StatusCode::SUCCESS;
451 while ( firstCalo != lastCalo )
453 if ( *firstCalo ==
"LAREM" )
458 else if ( *firstCalo ==
"LARHEC" )
463 else if ( *firstCalo ==
"LARFCAL" )
468 else if ( *firstCalo ==
"TILE" )
487 if (
sample ==
"PreSamplerB" )
495 if (
sample ==
"TileBar0" )
497 if (
sample ==
"TileBar1" )
499 if (
sample ==
"TileBar2" )
501 if (
sample ==
"TileExt0" )
503 if (
sample ==
"TileExt1" )
505 if (
sample ==
"TileExt2" )
530 ? StatusCode::FAILURE
531 : StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
JetConstituentVector::iterator iterator
Const iterator class for DataVector/DataList.
int region(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
Scalar phi() const
phi method
std::string find(const std::string &s)
return a remapped string
Scalar eta() const
pseudorapidity method
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
bool is_em_endcap(const Identifier id) const
test if the id belongs to the EM Endcap
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
CaloCellContainer::const_iterator beginConstCalo(CaloCell_ID::SUBCALO caloNum) const
get const iterators on cell of just one calo
bool is_tile_barrel(const Identifier id) const
test if the id belongs to the Tiles barrel
bool is_hec(const Identifier id) const
test if the id belongs to the HEC
Definition of CaloDetDescrManager.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
msgSvc
Provide convenience handles for various services.
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
bool is_fcal(const Identifier id) const
test if the id belongs to the FCAL - true also for MiniFCAL
int sampling(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
::StatusCode StatusCode
StatusCode definition for legacy code.
bool is_tile_extbarrel(const Identifier id) const
test if the id belongs to the Tiles extended barrel
int nCellsCalo(const CaloCell_ID::SUBCALO caloNum) const
get number of cels of given calorimeter
int eta(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
int sub_calo(const Identifier id) const
returns an int taken from SUBCALO enum and describing the subCalo to which the Id belongs.
bool is_em_barrel(const Identifier id) const
test if the id belongs to the EM barrel
size_t dataSize(TDA::PayloadIterator start)
Size in bytes of the buffer that is needed to decode next fragment data content.
StatusCode initialize(bool used=true)
int phi(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
Container class for CaloCell.
Identifier cell_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, const int eta, const int phi) const
Make a cell (== channel) ID from constituting fields and subCalo index; for (Mini)FCAL,...
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
This class provides the client interface for accessing the detector description information common to...
CaloCell_ID::CaloSample getSampling() const
cell sampling
CaloCellContainer::const_iterator endConstCalo(CaloCell_ID::SUBCALO caloNum) const
unsigned constexpr int nRows
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
const std::string & getFileDir() const