26 return StatusCode::SUCCESS;
31 const EventContext& ctx,
36 std::vector<ElementLink<xAOD::PFOContainer>>
empty;
37 tau.setShotPFOLinks(
empty);
41 return StatusCode::SUCCESS;
45 if (!caloCellInHandle.
isValid()) {
46 ATH_MSG_ERROR (
"Could not retrieve HiveDataObj with key " << caloCellInHandle.
key());
47 return StatusCode::FAILURE;
55 std::vector<const CaloCell*> seedCells;
60 while (!seedCells.empty()) {
62 const CaloCell* cell = seedCells.front();
82 double dPhi = TVector2::Phi_mpi_pi( phiNeigCell->
phi() - cell->phi());
83 double ratio = phiNeigCell->
pt()*wtCell_phiNeigCell/(cell->pt()*wtCell_cell + phiNeigCell->
pt()*wtCell_phiNeigCell);
84 float phi = cell->phi()+dPhi*ratio;
85 float pt = cell->pt()*wtCell_cell+phiNeigCell->
pt()*wtCell_phiNeigCell;
87 shot->
setP4(
static_cast<float>(pt),
static_cast<float>(cell->eta()),
static_cast<float>(
phi),
static_cast<float>(cell->m()));
90 shot->
setP4(
static_cast<float>(cell->pt()*
m_caloWeightTool->wtCell(cell)),
static_cast<float>(cell->eta()),
static_cast<float>(cell->phi()),
static_cast<float>(cell->m()));
101 shot->
setAttribute<
int>(xAOD::PFODetails::PFOAttributes::tauShots_seedHash, seedHash);
106 shot->
setAttribute<
float>(xAOD::PFODetails::PFOAttributes::tauShots_pt1, pt1);
109 shot->
setAttribute<
float>(xAOD::PFODetails::PFOAttributes::tauShots_pt3, pt3);
112 shot->
setAttribute<
float>(xAOD::PFODetails::PFOAttributes::tauShots_pt5, pt5);
115 shot->
setAttribute<
int>(xAOD::PFODetails::PFOAttributes::tauShots_nPhotons, nPhotons);
120 tau.addShotPFOLink(PFOElementLink);
123 auto cellIndex = std::find(seedCells.begin(), seedCells.end(), cell);
124 seedCells.erase(cellIndex);
126 cellIndex = std::find(seedCells.begin(), seedCells.end(), phiNeigCell);
127 seedCells.erase(cellIndex);
131 return StatusCode::SUCCESS;
137 float absEta=std::abs(
eta);
160 if(etaBin==2)
return 0;
162 const std::vector<float>& minPtCut =
m_minPtCut.value();
164 ATH_MSG_DEBUG(
"etaBin = " << etaBin <<
", energy = " << energy);
165 ATH_MSG_DEBUG(
"MinPtCut: " << minPtCut.at(etaBin) <<
"DoubleShotCut: " << doubleShotCut.at(etaBin));
167 if (energy < minPtCut.at(etaBin))
return 0;
168 if (energy > doubleShotCut.at(etaBin))
return 2;
175 std::vector<const CaloCell*>& cells,
176 const EventContext& ctx)
const {
178 std::vector<const CaloCell*> removed_cells;
181 if (!removedClustersHandle.
isValid()){
182 ATH_MSG_ERROR (
"Could not retrieve HiveDataObj with key " << removedClustersHandle.
key());
183 return StatusCode::FAILURE;
187 for (
auto cluster : *removed_clusters_cont){
188 for(
auto cell_it = cluster->cell_cbegin(); cell_it != cluster->cell_cend(); cell_it++){
189 removed_cells.push_back(*cell_it);
196 std::vector<const CaloCell*> shotCells = acc_shotCells(tau);
198 for (
const CaloCell* cell : shotCells) {
202 if (
m_removeElectronCells &&
inEleRM() && std::find(removed_cells.cbegin(), removed_cells.cend(), cell) != removed_cells.cend())
continue;
204 cells.push_back(cell);
206 return StatusCode::SUCCESS;
213 std::vector<const CaloCell*>& seedCells,
214 const EventContext& ctx)
const {
217 assert(seedCells.empty());
218 std::vector<const CaloCell*> cells;
222 std::set<IdentifierHash> seedCellHashes;
228 std::vector<IdentifierHash> nextEtaHashes;
230 std::vector<IdentifierHash> prevEtaHashes;
233 std::vector<IdentifierHash> neighHashes = std::move(nextEtaHashes);
234 neighHashes.insert(neighHashes.end(),prevEtaHashes.begin(),prevEtaHashes.end());
241 if (seedCellHashes.find(neighHash) != seedCellHashes.end()) {
248 if (!neighCell)
continue;
255 if (!status)
continue;
257 seedCells.push_back(cell);
258 seedCellHashes.insert(cellHash);
261 return StatusCode::SUCCESS;
267 std::vector<IdentifierHash> neigHashes;
271 if (neigHashes.size() > 1) {
272 ATH_MSG_DEBUG(cell1Hash <<
" has " << neigHashes.size() <<
" neighbours in the next phi direction !");
274 if (std::find(neigHashes.begin(), neigHashes.end(), cell2Hash) != neigHashes.end()) {
280 if (neigHashes.size() > 1) {
281 ATH_MSG_DEBUG(cell1Hash <<
" has " << neigHashes.size() <<
" neighbours in the previous phi direction !");
283 return std::find(neigHashes.begin(), neigHashes.end(), cell2Hash) != neigHashes.end();
289 const std::vector<const CaloCell*>& seedCells)
const {
294 std::vector<const CaloCell*> neighCells;
295 for (
const CaloCell* neighCell : seedCells) {
296 if (neighCell == &seedCell)
continue;
300 neighCells.push_back(neighCell);
306 const CaloCell* phiNeigCell =
nullptr;
307 if (!neighCells.empty()) {
308 phiNeigCell = neighCells[0];
318 int maxDepth)
const {
319 std::vector<const CaloCell*> cells;
333 std::vector<const CaloCell*>& cells,
339 if (
depth > maxDepth)
return;
343 std::vector<IdentifierHash> neigHashes;
354 if (!newCell)
continue;
356 cells.push_back(newCell);
359 if (neigHashes.size() > 1) {
360 ATH_MSG_DEBUG(cellHash <<
" has " << neigHashes.size() <<
" neighbours in the eta direction !");
377 std::vector<const CaloCell*> windowNeighbours = this->
getEtaNeighbours(*cell, cellContainer, maxDepth);
379 std::vector<const CaloCell*> mergeCells = this->
getEtaNeighbours(*phiNeigCell, cellContainer, maxDepth);
380 windowNeighbours.push_back(phiNeigCell);
381 windowNeighbours.insert(windowNeighbours.end(), mergeCells.begin(), mergeCells.end());
388 for (
const CaloCell* thisCell : windowNeighbours) {
389 shotCluster->
addCell(cellContainer.
findIndex(thisCell->caloDDE()->calo_hash()), 1.0);
401 double pt1 = cell1->
pt()*
m_info.m_caloWeightTool->wtCell(cell1);
402 double pt2 = cell2->
pt()*
m_info.m_caloWeightTool->wtCell(cell2);
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_INFO(x,...)
static const Attributes_t empty
const ServiceHandle< StoreGateSvc > & detStore() const
Container class for CaloCell.
const CaloCell * findCell(const IdentifierHash theHash) const
fast find method given identifier hash.
int findIndex(const IdentifierHash theHash) const
Return index of the cell with a given hash.
Data object for each calorimeter readout cell.
virtual double phi() const override final
get phi (through CaloDetDescrElement)
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
void reserve(const size_t s)
Method to reserve space the underlying vector<pair>.
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.
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
IdentifierHash calo_hash() const
cell calo hash
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ElementLink implementation for ROOT usage.
bool toContainedElement(BaseConstReference container, ElementType element)
Set link to point to given element (slowest).
This is a "hash" representation of an Identifier.
virtual double pt() const
transverse momentum
Helper class to provide constant type-safe access to aux data.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
StatusCode selectSeedCells(const xAOD::TauJet &tau, const CaloCellContainer &cellContainer, std::vector< const CaloCell * > &seedCells, const EventContext &ctx) const
Select the seed cells used to construct the shot Cells must sastisfy:
void addEtaNeighbours(const CaloCell &cell, const CaloCellContainer &cellContainer, std::vector< const CaloCell * > &cells, int depth, int maxDepth, bool next) const
Get neighbour cells in the eta direction.
std::vector< const CaloCell * > getEtaNeighbours(const CaloCell &cell, const CaloCellContainer &cellContainer, int maxDepth) const
Get neighbour cells in the eta direction.
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_removedClusterInputContainer
Gaudi::Property< int > m_nCellsInEta
xAOD::CaloCluster * createShotCluster(const CaloCell *cell, const CaloCell *phiNeighCell, const CaloCellContainer &cellContainer, xAOD::CaloClusterContainer *clusterContainer) const
Create the shot cluster Shot cluster contains 5x1 cells from the seed cell and hottestneighbour cell ...
SG::ReadHandleKey< CaloCellContainer > m_caloCellInputContainer
const CaloCell_ID * m_calo_id
calo cell navigation
ToolHandle< IHadronicCalibrationTool > m_caloWeightTool
Gaudi::Property< bool > m_removeElectronCells
StatusCode selectCells(const xAOD::TauJet &tau, std::vector< const CaloCell * > &cells, const EventContext &ctx) const
Apply preselection of the cells Cells within dR < 0.4, in EM1, and pt > 100 MeV are selected.
virtual StatusCode executeTool(xAOD::TauJet &pTau, const EventContext &ctx, xAOD::CaloClusterContainer &tauShotCaloClusContainer, xAOD::PFOContainer &tauShotPFOContainer) const override
TauShotFinder(const std::string &name)
int getNPhotons(float eta, float energy) const
Get NPhotons in shot.
const CaloCell * getPhiNeighbour(const CaloCell &seedCell, const std::vector< const CaloCell * > &seedCells) const
Get the hottest neighbour cell in the phi direction.
Gaudi::Property< std::vector< float > > m_minPtCut
Gaudi::Property< std::vector< float > > m_doubleShotCut
virtual StatusCode initialize() override
Tool initializer.
bool isPhiNeighbour(IdentifierHash cell1Hash, IdentifierHash cell2Hash) const
Check whether two cells are neighbours in the phi direction.
int getEtaBin(float eta) const
Get eta bin.
Gaudi::Property< float > m_energyThreshold
CaloClusterCellLink * getOwnCellLinks()
Get a pointer to the owned CaloClusterCellLink object (non-const version).
bool addCell(const unsigned index, const double weight)
Method to add a cell to the cluster (Beware: Kinematics not updated!).
void setAttribute(PFODetails::PFOAttributes AttributeType, const T &anAttribute)
Set a PFO Variable via enum - overwrite is allowed.
bool setClusterLink(const ElementLink< xAOD::CaloClusterContainer > &theCluster)
Set a cluster constituent - does NOT append to existing container.
void setCenterMag(float CenterMag)
set CenterMag moment needed for vertex correction
void setP4(const FourMom_t &vec)
set the 4-vec
void setBDTPi0Score(float BDTPi0Score)
set BDT Score used to classify clusters as Pi0 like or not
void setCharge(float charge)
set charge of PFO
std::string depth
tag string for intendation
std::vector< std::vector< const CaloCell * > > getCellBlock(const xAOD::PFO &shot, const CaloCell_ID *calo_id)
Get cell block with (currently) 2 x 5 cells in correct order for variable calculations.
float ptWindow(const std::vector< std::vector< const CaloCell * > > &shotCells, int windowSize, const ToolHandle< IHadronicCalibrationTool > &caloWeightTool)
pt in a window of (currently) 2 x windowSize cells
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
PFO_v1 PFO
Definition of the current "pfo version".
PFOContainer_v1 PFOContainer
Definition of the current "pfo container version".
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TauJet_v3 TauJet
Definition of the current "tau version".
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
ptSort(const TauShotFinder &info)
bool operator()(const CaloCell *c1, const CaloCell *c2)
const TauShotFinder & m_info