|
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;
350 return StatusCode::SUCCESS;
362 const float epsilon = 0.00001;
374 std::vector<HashCell> mySeedCells;
375 mySeedCells.reserve (2000);
377 std::vector<HashCluster *> myHashClusters;
378 myHashClusters.reserve (10000);
382 HashCell* hashCells = cellVector.data() -
m_hashMin;
394 << cellColl.
name() );
395 return StatusCode::RECOVERABLE;
409 cellIter != cellIterEnd;
415 noiseCDO->getEffectiveSigma(pCell->
ID(),pCell->
gain(),pCell->
energy()) : \
416 noiseCDO->getNoise(pCell->
ID(),pCell->
gain());
418 float signedE = pCell->
energy();
419 float signedEt = pCell->
et();
420 float signedRatio = epsilon;
422 signedRatio = signedE/noiseSigma;
430 bool passedSeedAndTimeCut = (passedSeedCut && passTimeCut_seedCell);
432 bool passedNeighborAndTimeCut = passedNeighborCut;
433 if(
m_cutOOTseed && passedSeedCut && !passTimeCut_seedCell) passedNeighborAndTimeCut=
false;
435 bool passedCellAndTimeCut = passedCellCut;
436 if(
m_cutOOTseed && passedSeedCut && !passTimeCut_seedCell) passedCellAndTimeCut=
false;
438 if ( passedCellAndTimeCut || passedNeighborAndTimeCut || passedSeedAndTimeCut ) {
447 if ( m_doALotOfPrintoutInFirstEvent ) {
448 ATH_MSG_DEBUG(
" [ExtId|Id|SubDet|HashId|eta|phi|E/noise|Et]: "
450 <<
"|" << mypCell->ID().getString()
452 <<
"|" << (
unsigned int)hashid
453 <<
"|" << pCell->
eta()
454 <<
"|" << pCell->
phi()
455 <<
"|" << signedRatio
461 HashCell hashCell(tmpClusterCell);
462 if ( passedNeighborAndTimeCut || passedSeedAndTimeCut ) {
463 HashCluster *tmpCluster =
464 new (tmpclus_pool.
allocate()) HashCluster (tmplist_pool);
466 tmpCluster->add(hashCell);
467 myHashClusters.push_back(tmpCluster);
469 if ( passedSeedAndTimeCut
474 mySeedCells.push_back(hashCell);
477 hashCells[hashid] = hashCell;
490 std::sort(mySeedCells.begin(),mySeedCells.end(),compareSoverN);
494 std::sort(mySeedCells.begin(),mySeedCells.end(),compareSoverN);
500 std::sort(mySeedCells.begin(),mySeedCells.end(),compareSoverN);
504 std::sort(mySeedCells.begin(),mySeedCells.end(),compareSoverN);
510 for (
const HashCell& hc : mySeedCells) {
512 << hc.getCaloTopoTmpClusterCell()->getSubDet()
514 << (
unsigned int)hc.getCaloTopoTmpClusterCell()->getID()
516 << hc.getCaloTopoTmpClusterCell()->getSignedRatio()
522 std::vector<HashCell> myNextCells;
523 myNextCells.reserve (1000);
525 std::vector<IdentifierHash> theNeighbors;
526 theNeighbors.reserve(22);
528 std::vector<IdentifierHash> theNNeighbors;
529 theNNeighbors.reserve(22);
538 while ( !mySeedCells.empty() ) {
543 for (HashCell& hc : mySeedCells) {
553 doRestrictHECIWandFCal &&
569 HashCell neighborCell = hashCells[nId];
570 if ( neighborCell.getCaloTopoTmpClusterCell() ) {
572 neighborCell.getCaloTopoTmpClusterCell();
575 bool isAboveNeighborThreshold =
578 if ( isAboveNeighborThreshold && !pNCell->
getUsed() ) {
580 myNextCells.push_back(neighborCell);
583 if ( myCluster != otherCluster ) {
584 HashCluster *toKill =
nullptr;
585 HashCluster *toKeep =
nullptr;
586 if ( !otherCluster || isAboveNeighborThreshold ) {
588 auto compareClusters = [&](
const auto &
c1,
const auto &
c2) {
602 return c1->size() >
c2->size();
606 if ( !otherCluster || compareClusters(myCluster, otherCluster) ) {
607 toKill = otherCluster;
612 toKeep = otherCluster;
615 for (
auto *hc : *toKill)
616 hc->setCaloTopoTmpHashCluster(toKeep);
617 toKeep->add(*toKill);
621 toKeep->add(neighborCell);
631 mySeedCells.swap (myNextCells);
638 std::vector<std::unique_ptr<CaloProtoCluster> > sortClusters;
639 sortClusters.reserve (myHashClusters.size());
641 for (HashCluster* tmpCluster : myHashClusters) {
642 bool addCluster(
false);
643 if ( tmpCluster->size() > 1 )
645 else if ( tmpCluster->size() == 1 ) {
648 if ( clusCellIter->getUsed() )
652 std::unique_ptr<CaloProtoCluster> myCluster = std::make_unique<CaloProtoCluster>(cellCollLink);
657 const size_t iCell =
cell->getCaloCell();
660 const float cl_et = myCluster->
et();
662 sortClusters.push_back(std::move(myCluster));
668 std::sort(sortClusters.begin(),sortClusters.end(),[](
const std::unique_ptr<CaloProtoCluster>& pc1,
669 const std::unique_ptr<CaloProtoCluster>& pc2) {
672 volatile double et1(pc1->et());
673 volatile double et2(pc2->et());
679 clusColl->
reserve(sortClusters.size());
681 for (
const auto& protoCluster: sortClusters) {
684 xAODCluster->
addCellLink(protoCluster->releaseCellLinks());
689 tmpclus_pool.
erase();
690 tmpcell_pool.
erase();
692 return StatusCode::SUCCESS;
716 bool isInTime =
true;
721 const unsigned pmask= pCell->
caloDDE()->
is_tile() ? 0x8080 : 0x2000;
732 std::vector<IdentifierHash> theNeighbors;
752 std::vector<IdentifierHash> theNextNeighbors;
755 if (n2Id != hashid) {
775 std::vector<IdentifierHash> theNeighbors;
798 std::vector<IdentifierHash> theNeighbors;
807 if ( isInTime )
break;
818 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)
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 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.