|
ATLAS Offline Software
|
Go to the documentation of this file.
34 #include "GaudiKernel/StatusCode.h"
35 #include "CLHEP/Units/SystemOfUnits.h"
52 const std::string&
name,
59 m_cellThresholdOnEorAbsEinSigma ( 0.),
60 m_neighborThresholdOnEorAbsEinSigma( 3.),
61 m_seedThresholdOnEorAbsEinSigma ( 6.),
62 m_seedThresholdOnTAbs ( 12.5*
ns),
63 m_timeCutUpperLimit ( 20.),
64 m_xtalkDeltaT ( 15.*
ns),
65 m_xtalk2Eratio1 ( 4.),
66 m_xtalk2Eratio2 ( 25.),
67 m_xtalk3Eratio ( 10.),
68 m_xtalkEtaEratio (4.),
70 m_neighborOption (
"super3D"),
72 m_restrictHECIWandFCalNeighbors (false),
73 m_restrictPSNeighbors (false),
74 m_seedCutsInAbsE (false),
75 m_neighborCutsInAbsE (true),
76 m_cellCutsInAbsE (true),
77 m_clusterCutsInAbsE (true),
78 m_clusterEtorAbsEtCut ( 0.*
MeV),
79 m_twogaussiannoise (false),
80 m_treatL1PredictedCellsAsGood (true),
81 m_seedCutsInT (false),
83 m_useTimeCutUpperLimit (false),
95 declareInterface<CaloClusterCollectionProcessor> (
this);
193 " SeedThresholdOnEinSigma=")
196 ", NeighborThresholdOnEinSigma=")
199 ", CellThresholdOnEinSigma=")
217 return StatusCode::FAILURE;
225 if ( caloName ==
"LAREM" )
227 else if ( caloName ==
"LARHEC" )
229 else if ( caloName ==
"LARFCAL" )
231 else if ( caloName ==
"TILE" )
235 <<
" is not a valid Calorimeter name and will be ignored! "
236 <<
"Valid names are: LAREM, LARHEC, LARFCAL, and TILE." );
241 if ( sampName ==
"PreSamplerB" )
243 else if ( sampName ==
"EMB1" )
245 else if ( sampName ==
"EMB2" )
247 else if ( sampName ==
"EMB3" )
249 else if ( sampName ==
"PreSamplerE" )
251 else if ( sampName ==
"EME1" )
253 else if ( sampName ==
"EME2" )
255 else if ( sampName ==
"EME3" )
257 else if ( sampName ==
"HEC0" )
259 else if ( sampName ==
"HEC1" )
261 else if ( sampName ==
"HEC2" )
263 else if ( sampName ==
"HEC3" )
265 else if ( sampName ==
"TileBar0" )
267 else if ( sampName ==
"TileBar1" )
269 else if ( sampName ==
"TileBar2" )
271 else if ( sampName ==
"TileGap1" )
273 else if ( sampName ==
"TileGap2" )
275 else if ( sampName ==
"TileGap3" )
277 else if ( sampName ==
"TileExt0" )
279 else if ( sampName ==
"TileExt1" )
281 else if ( sampName ==
"TileExt2" )
283 else if ( sampName ==
"FCAL0" )
285 else if ( sampName ==
"FCAL1" )
287 else if ( sampName ==
"FCAL2" )
291 <<
" is not a valid Calorimeter sampling name and will be ignored! "
292 <<
"Valid names are: "
293 <<
"PreSamplerB, EMB1, EMB2, EMB3, "
294 <<
"PreSamplerE, EME1, EME2, EME3, "
295 <<
"HEC0, HEC1, HEC2, HEC3, "
296 <<
"TileBar0, TileBar1, TileBar2, "
297 <<
"TileGap1, TileGap2, TileGap3, "
298 <<
"TileExt0, TileExt1, TileExt2, "
299 <<
"FCAL0, FCAL1, FCAL2." );
302 msg(MSG::INFO) <<
"Samplings to consider for seeds:";
304 msg() <<
" " << sampName;
324 msg(MSG::INFO) <<
"Calorimeters to consider:";
326 msg() <<
" " << caloName;
355 return StatusCode::SUCCESS;
367 const float epsilon = 0.00001;
379 std::vector<HashCell> mySeedCells;
380 mySeedCells.reserve (2000);
382 std::vector<HashCluster *> myHashClusters;
383 myHashClusters.reserve (10000);
387 HashCell* hashCells = cellVector.data() -
m_hashMin;
399 << cellColl.
name() );
400 return StatusCode::RECOVERABLE;
414 cellIter != cellIterEnd;
420 noiseCDO->getEffectiveSigma(pCell->
ID(),pCell->
gain(),pCell->
energy()) : \
421 noiseCDO->getNoise(pCell->
ID(),pCell->
gain());
423 float signedE = pCell->
energy();
424 float signedEt = pCell->
et();
425 float signedRatio = epsilon;
427 signedRatio = signedE/noiseSigma;
435 bool passedSeedAndTimeCut = (passedSeedCut && passTimeCut_seedCell);
437 bool passedNeighborAndTimeCut = passedNeighborCut;
438 if(
m_cutOOTseed && passedSeedCut && !passTimeCut_seedCell) passedNeighborAndTimeCut=
false;
440 bool passedCellAndTimeCut = passedCellCut;
441 if(
m_cutOOTseed && passedSeedCut && !passTimeCut_seedCell) passedCellAndTimeCut=
false;
443 if ( passedCellAndTimeCut || passedNeighborAndTimeCut || passedSeedAndTimeCut ) {
452 if ( m_doALotOfPrintoutInFirstEvent ) {
453 ATH_MSG_DEBUG(
" [ExtId|Id|SubDet|HashId|eta|phi|E/noise|Et]: "
455 <<
"|" << mypCell->ID().getString()
457 <<
"|" << (
unsigned int)hashid
458 <<
"|" << pCell->
eta()
459 <<
"|" << pCell->
phi()
460 <<
"|" << signedRatio
466 HashCell hashCell(tmpClusterCell);
467 if ( passedNeighborAndTimeCut || passedSeedAndTimeCut ) {
468 HashCluster *tmpCluster =
469 new (tmpclus_pool.
allocate()) HashCluster (tmplist_pool);
471 tmpCluster->add(hashCell);
472 myHashClusters.push_back(tmpCluster);
474 if ( passedSeedAndTimeCut
479 mySeedCells.push_back(hashCell);
482 hashCells[hashid] = hashCell;
495 std::sort(mySeedCells.begin(),mySeedCells.end(),compareSoverN);
499 std::sort(mySeedCells.begin(),mySeedCells.end(),compareSoverN);
505 std::sort(mySeedCells.begin(),mySeedCells.end(),compareSoverN);
509 std::sort(mySeedCells.begin(),mySeedCells.end(),compareSoverN);
515 for (
const HashCell& hc : mySeedCells) {
517 << hc.getCaloTopoTmpClusterCell()->getSubDet()
519 << (
unsigned int)hc.getCaloTopoTmpClusterCell()->getID()
521 << hc.getCaloTopoTmpClusterCell()->getSignedRatio()
527 std::vector<HashCell> myNextCells;
528 myNextCells.reserve (1000);
530 std::vector<IdentifierHash> theNeighbors;
531 theNeighbors.reserve(22);
533 std::vector<IdentifierHash> theNNeighbors;
534 theNNeighbors.reserve(22);
543 while ( !mySeedCells.empty() ) {
548 for (HashCell& hc : mySeedCells) {
558 doRestrictHECIWandFCal &&
574 HashCell neighborCell = hashCells[nId];
575 if ( neighborCell.getCaloTopoTmpClusterCell() ) {
577 neighborCell.getCaloTopoTmpClusterCell();
580 bool isAboveNeighborThreshold =
583 if ( isAboveNeighborThreshold && !pNCell->
getUsed() ) {
585 myNextCells.push_back(neighborCell);
588 if ( myCluster != otherCluster ) {
589 HashCluster *toKill =
nullptr;
590 HashCluster *toKeep =
nullptr;
591 if ( !otherCluster || isAboveNeighborThreshold ) {
593 auto compareClusters = [&](
const auto &
c1,
const auto &
c2) {
607 return c1->size() >
c2->size();
611 if ( !otherCluster || compareClusters(myCluster, otherCluster) ) {
612 toKill = otherCluster;
617 toKeep = otherCluster;
620 for (
auto *hc : *toKill)
621 hc->setCaloTopoTmpHashCluster(toKeep);
622 toKeep->add(*toKill);
626 toKeep->add(neighborCell);
636 mySeedCells.swap (myNextCells);
643 std::vector<std::unique_ptr<CaloProtoCluster> > sortClusters;
644 sortClusters.reserve (myHashClusters.size());
646 for (HashCluster* tmpCluster : myHashClusters) {
647 bool addCluster(
false);
648 if ( tmpCluster->size() > 1 )
650 else if ( tmpCluster->size() == 1 ) {
653 if ( clusCellIter->getUsed() )
657 std::unique_ptr<CaloProtoCluster> myCluster = std::make_unique<CaloProtoCluster>(cellCollLink);
662 const size_t iCell =
cell->getCaloCell();
665 const float cl_et = myCluster->
et();
667 sortClusters.push_back(std::move(myCluster));
673 std::sort(sortClusters.begin(),sortClusters.end(),[](
const std::unique_ptr<CaloProtoCluster>& pc1,
674 const std::unique_ptr<CaloProtoCluster>& pc2) {
677 volatile double et1(pc1->et());
678 volatile double et2(pc2->et());
684 clusColl->
reserve(sortClusters.size());
686 for (
const auto& protoCluster: sortClusters) {
689 xAODCluster->
addCellLink(protoCluster->releaseCellLinks());
694 tmpclus_pool.
erase();
695 tmpcell_pool.
erase();
697 return StatusCode::SUCCESS;
721 bool isInTime =
true;
726 const unsigned pmask= pCell->
caloDDE()->
is_tile() ? 0x8080 : 0x2000;
737 std::vector<IdentifierHash> theNeighbors;
757 std::vector<IdentifierHash> theNextNeighbors;
760 if (n2Id != hashid) {
780 std::vector<IdentifierHash> theNeighbors;
803 std::vector<IdentifierHash> theNeighbors;
812 if ( isInTime )
break;
823 std::vector<IdentifierHash> theNeighbors;
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
Wrapper for SG::ArenaHandle with pre-fetching.
def retrieve(aClass, aKey=None)
JetConstituentVector::iterator iterator
bool m_xtalkEMEta
if set to true, the time window is softened in the EMB2 and EME2_OW due to xtalk from direct neighbou...
bool m_xtalkEM2D
if set to true, the time window is softened in the EMB2 and EME2_OW due to xtalk from all 2D neighors
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey
Key of the CaloNoise Conditions data object.
std::pair< int, int > compare(const AmgSymMatrix(N) &m1, const AmgSymMatrix(N) &m2, double precision=1e-9, bool relative=false)
compare two matrices, returns the indices of the first element that fails the condition,...
User interface for allocating memory. See Arena.h for an overview of the arena-based memory allocator...
virtual double phi() const override final
get phi (through CaloDetDescrElement)
float m_xtalkDeltaT
additional max.
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
int region(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
std::vector< std::string > m_samplingNames
vector of names of the calorimeter samplings to consider for seeds.
const_pointer_type cptr()
Dereference the pointer.
bool m_seedCutsInAbsE
if set to true seed cuts are on and .
std::set< int > m_validSamplings
actual set of samplings to be used for seeds
bool m_restrictPSNeighbors
if set to true limit the neighbors in presampler Barrel and Endcap.
bool m_seedCutsInT
if set to true, time cut is applied to seed cells, no cut otherwise
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
const std::string & name() const
Return the StoreGate ID for the referenced object.
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *theClusters) const override
Execute on an entire collection of clusters.
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
std::vector< std::string > m_caloNames
vector of names of the calorimeters to consider.
const CaloCell_ID * m_calo_id
void setCaloTopoTmpHashCluster(CaloTopoTmpHashCluster *cluster)
CaloCellContainer::const_iterator beginConstCalo(CaloCell_ID::SUBCALO caloNum) const
get const iterators on cell of just one calo
int m_minSampling
smallest valid seed sampling found
float m_seedThresholdOnTAbs
threshold used for timing cut on seed cells.
bool msgLvl(const MSG::Level lvl) const
float m_xtalk2Eratio1
cut on Eneighbor/E to revover out of time cell close to energetic first phi neighbor cell
CaloTopoClusterMaker(const std::string &type, const std::string &name, const IInterface *parent)
Helper class to provide constant type-safe access to aux data.
bool m_clusterCutsInAbsE
if set to true final cluster cuts are on .
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
const std::string & key() const
Return the StoreGate ID for the referenced object.
uint16_t provenance() const
get provenance (data member)
float time() const
get time (data member)
bool m_xtalkEM2n
if set to true (together with m_xtalkEM2) we also extend the time window for 2nd phi neighbors
std::string m_neighborOption
type of neighbor relations to use.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
double energy() const
get energy (data member)
CaloClusterCellLink * getCellLinks()
Get a pointer to the underlying CaloClusterCellLink object.
bool m_subcaloUsed[CaloCell_ID::NSUBCALO]
Flag which subdetectors are to be used.
CaloCell_Base_ID::SUBCALO SUBCALO
int indexFirstCellCalo(const CaloCell_ID::SUBCALO caloNum) const
index of first cell of given calorimeter (-1 if none).
Description of a calorimeter cluster.
LArNeighbours::neighbourOption m_nOption
IdentifierHash calo_hash() const
cell calo hash
Gaudi::Property< bool > m_useGPUCriteria
bool m_neighborCutsInAbsE
if set to true neighbor cuts are on and .
void reserve(const size_t s)
Method to reserve space the underlying vector<pair>
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
virtual StatusCode initialize() override
CaloCell_ID::SUBCALO getSubDet() const
int sampling(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
::StatusCode StatusCode
StatusCode definition for legacy code.
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
void addCell(const unsigned cellIdx, const CaloClusterCellLink::weight_t weight=1.0)
Add a cell (forward to underlying CaloClusterCellLink)
SUBCALO
enumeration of sub calorimeters
virtual double et() const override final
get et
bool m_xtalkEM2
if set to true, the time window is softened in the EMB2 and EME2_OW due to xtalk from direct neighbou...
int sub_calo(const Identifier id) const
returns an int taken from SUBCALO enum and describing the subCalo to which the Id belongs.
float m_cellThresholdOnEorAbsEinSigma
all cells have to satisfy
float m_neighborThresholdOnEorAbsEinSigma
cells with extend the cluster
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
const IdentifierHash & getID() const
Allocator for pointer_list, specialized for NELT.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
bool m_restrictHECIWandFCalNeighbors
if set to true limit the neighbors in HEC IW and FCal2&3.
void * allocate()
Return space for new element, then allocate and prefetch one more.
bool m_cellCutsInAbsE
if set to true cell cuts are on and .
const CaloCell * findCell(const IdentifierHash theHash) const
fast find method given identifier hash.
bool is_tile() const
cell belongs to Tile
float m_clusterEtorAbsEtCut
cut on the final cluster.
float m_xtalk2DEratio
cut on Eneighbor/E to remove out of time layer layer2 all 2D neighbors
bool m_treatL1PredictedCellsAsGood
if set to true treat cells with a dead OTX which can be predicted by L1 trigger info as good instead ...
float m_xtalk3Eratio
cut on Eneighbor/E to revover out of time layer 3cell close to energetic previous sampling neighbor
Pool-based allocator. See Arena.h for an overview of the arena-based memory allocators.
CaloGain::CaloGain gain() const
get gain (data member )
int get_neighbours(const IdentifierHash caloHash, const LArNeighbours::neighbourOption &option, std::vector< IdentifierHash > &neighbourList) const
access to hashes for neighbours return == 0 for neighbours found
value_type push_back(value_type pElem)
Add an element to the end of the collection.
StatusCode initialize(bool used=true)
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
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,...
float m_timeCutUpperLimit
upper limit on the energy significance, for applying the cell time cut
double et()
Return the weighted Et of the list of cells.
bool passCellTimeCut(const CaloCell *, const CaloCellContainer *) const
float m_seedThresholdOnEorAbsEinSigma
cells with start a cluster
int m_maxSampling
largest valid seed sampling found
void addCellLink(CaloClusterCellLink *CCCL)
bool m_twogaussiannoise
if set to true use 2-gaussian noise description for TileCal
Data object for each calorimeter readout cell.
void setClusterSize(const ClusterSize)
Get cluster size.
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
CaloCell_ID::CaloSample getSampling() const
cell sampling
CaloCellContainer::const_iterator endConstCalo(CaloCell_ID::SUBCALO caloNum) const
SG::ReadHandleKey< CaloCellContainer > m_cellsKey
vector of names of the cell containers to use as input.
static void calculateKine(xAOD::CaloCluster *clu, const bool useweight=true, const bool updateLayers=true, const bool useGPUCriteria=false)
Helper class to calculate cluster kinematics based on cells.
bool hasCalo(const CaloCell_ID::SUBCALO caloNum) const
tell wether it has been filled with cells (maybe none) of a given calo
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
bool m_cutOOTseed
if set to true, seed cells failing the time cut are also excluded from cluster at all
float m_xtalk2Eratio2
cut on Eneighbor/E to revover out of time cell close to energetic second phi neighbor cell
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
const float & getSignedRatio() const
float m_xtalkEtaEratio
cut on Eneighbor/E to revover out of time layer 2 cell close in eta to energetic neighor cell
void nextDDE(Iter iter, Iter endIter)
Prefetch next CaloDDE.
xAOD::CaloCluster::ClusterSize m_clusterSize
Cluster size enum. Set based on energy cut jobO.
std::vector< bool > m_useSampling
flag for all samplings - true for used ones, false for excluded ones
static bool isBad(const CaloCell *pCell, bool treatL1PredictedCellsAsGood)
bool m_xtalkEM3
if set to true we extend the time window for direct layer 3 neighbors of high energy layer 2 cells
const CaloTopoTmpHashCluster * getCaloTopoTmpHashCluster() const
virtual double eta() const override final
get eta (through CaloDetDescrElement)
bool m_useTimeCutUpperLimit
if set to true, the time cut is not applied on cell of large significance
void erase()
Free all allocated elements.