26 return StatusCode::SUCCESS;
35 std::vector<ElementLink<xAOD::PFOContainer>>
empty;
40 return StatusCode::SUCCESS;
44 if (!caloCellInHandle.
isValid()) {
45 ATH_MSG_ERROR (
"Could not retrieve HiveDataObj with key " << caloCellInHandle.
key());
46 return StatusCode::FAILURE;
54 std::vector<const CaloCell*> seedCells;
59 while (!seedCells.empty()) {
61 const CaloCell* cell = seedCells.front();
81 double dPhi = TVector2::Phi_mpi_pi( phiNeigCell->
phi() - cell->phi());
82 double ratio = phiNeigCell->
pt()*wtCell_phiNeigCell/(cell->pt()*wtCell_cell + phiNeigCell->
pt()*wtCell_phiNeigCell);
83 float phi = cell->phi()+dPhi*ratio;
84 float pt = cell->pt()*wtCell_cell+phiNeigCell->
pt()*wtCell_phiNeigCell;
86 shot->
setP4(
static_cast<float>(pt),
static_cast<float>(cell->eta()),
static_cast<float>(
phi),
static_cast<float>(cell->m()));
89 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()));
100 shot->
setAttribute<
int>(xAOD::PFODetails::PFOAttributes::tauShots_seedHash, seedHash);
105 shot->
setAttribute<
float>(xAOD::PFODetails::PFOAttributes::tauShots_pt1, pt1);
108 shot->
setAttribute<
float>(xAOD::PFODetails::PFOAttributes::tauShots_pt3, pt3);
111 shot->
setAttribute<
float>(xAOD::PFODetails::PFOAttributes::tauShots_pt5, pt5);
114 shot->
setAttribute<
int>(xAOD::PFODetails::PFOAttributes::tauShots_nPhotons, nPhotons);
122 auto cellIndex = std::find(seedCells.begin(), seedCells.end(), cell);
123 seedCells.erase(cellIndex);
125 cellIndex = std::find(seedCells.begin(), seedCells.end(), phiNeigCell);
126 seedCells.erase(cellIndex);
130 return StatusCode::SUCCESS;
136 float absEta=std::abs(
eta);
159 if(etaBin==2)
return 0;
161 const std::vector<float>& minPtCut =
m_minPtCut.value();
163 ATH_MSG_DEBUG(
"etaBin = " << etaBin <<
", energy = " << energy);
164 ATH_MSG_DEBUG(
"MinPtCut: " << minPtCut.at(etaBin) <<
"DoubleShotCut: " << doubleShotCut.at(etaBin));
166 if (energy < minPtCut.at(etaBin))
return 0;
167 if (energy > doubleShotCut.at(etaBin))
return 2;
174 std::vector<const CaloCell*>& cells)
const {
176 std::vector<const CaloCell*> removed_cells;
179 if (!removedClustersHandle.
isValid()){
180 ATH_MSG_ERROR (
"Could not retrieve HiveDataObj with key " << removedClustersHandle.
key());
181 return StatusCode::FAILURE;
185 for (
auto cluster : *removed_clusters_cont){
186 for(
auto cell_it = cluster->cell_cbegin(); cell_it != cluster->cell_cend(); cell_it++){
187 removed_cells.push_back(*cell_it);
194 std::vector<const CaloCell*> shotCells = acc_shotCells(tau);
196 for (
const CaloCell* cell : shotCells) {
201 if (
m_removeElectronCells &&
inEleRM() && std::find(removed_cells.cbegin(), removed_cells.cend(), cell) != removed_cells.cend())
continue;
203 cells.push_back(cell);
205 return StatusCode::SUCCESS;
212 std::vector<const CaloCell*>& seedCells)
const {
215 assert(seedCells.empty());
216 std::vector<const CaloCell*> cells;
220 std::set<IdentifierHash> seedCellHashes;
226 std::vector<IdentifierHash> nextEtaHashes;
228 std::vector<IdentifierHash> prevEtaHashes;
231 std::vector<IdentifierHash> neighHashes = nextEtaHashes;
232 neighHashes.insert(neighHashes.end(),prevEtaHashes.begin(),prevEtaHashes.end());
239 if (seedCellHashes.find(neighHash) != seedCellHashes.end()) {
246 if (!neighCell)
continue;
253 if (!status)
continue;
255 seedCells.push_back(cell);
256 seedCellHashes.insert(cellHash);
259 return StatusCode::SUCCESS;
265 std::vector<IdentifierHash> neigHashes;
269 if (neigHashes.size() > 1) {
270 ATH_MSG_DEBUG(cell1Hash <<
" has " << neigHashes.size() <<
" neighbours in the next phi direction !");
272 if (std::find(neigHashes.begin(), neigHashes.end(), cell2Hash) != neigHashes.end()) {
278 if (neigHashes.size() > 1) {
279 ATH_MSG_DEBUG(cell1Hash <<
" has " << neigHashes.size() <<
" neighbours in the previous phi direction !");
281 return std::find(neigHashes.begin(), neigHashes.end(), cell2Hash) != neigHashes.end();
287 const std::vector<const CaloCell*>& seedCells)
const {
292 std::vector<const CaloCell*> neighCells;
293 for (
const CaloCell* neighCell : seedCells) {
294 if (neighCell == &seedCell)
continue;
298 neighCells.push_back(neighCell);
304 const CaloCell* phiNeigCell =
nullptr;
305 if (!neighCells.empty()) {
306 phiNeigCell = neighCells[0];
316 int maxDepth)
const {
317 std::vector<const CaloCell*> cells;
331 std::vector<const CaloCell*>& cells,
337 if (
depth > maxDepth)
return;
341 std::vector<IdentifierHash> neigHashes;
352 if (!newCell)
continue;
354 cells.push_back(newCell);
357 if (neigHashes.size() > 1) {
358 ATH_MSG_DEBUG(cellHash <<
" has " << neigHashes.size() <<
" neighbours in the eta direction !");
375 std::vector<const CaloCell*> windowNeighbours = this->
getEtaNeighbours(*cell, cellContainer, maxDepth);
377 std::vector<const CaloCell*> mergeCells = this->
getEtaNeighbours(*phiNeigCell, cellContainer, maxDepth);
378 windowNeighbours.push_back(phiNeigCell);
379 windowNeighbours.insert(windowNeighbours.end(), mergeCells.begin(), mergeCells.end());
386 for (
const CaloCell* cell : windowNeighbours) {
387 shotCluster->
addCell(cellContainer.
findIndex(cell->caloDDE()->calo_hash()), 1.0);
399 double pt1 = cell1->
pt()*
m_info.m_caloWeightTool->wtCell(cell1);
400 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.
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 data, ElementType element, IProxyDict *sg=0)
Set from element pointer and a reference to the container (storable)
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 selectCells(const xAOD::TauJet &tau, std::vector< const CaloCell * > &cells) const
Apply preselection of the cells Cells within dR < 0.4, in EM1, and pt > 100 MeV are selected.
virtual StatusCode executeShotFinder(xAOD::TauJet &pTau, xAOD::CaloClusterContainer &tauShotCaloClusContainer, xAOD::PFOContainer &tauShotPFOContainer) const override
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
StatusCode selectSeedCells(const xAOD::TauJet &tau, const CaloCellContainer &cellContainer, std::vector< const CaloCell * > &seedCells) const
Select the seed cells used to construct the shot Cells must sastisfy:
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
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
void setShotPFOLinks(const PFOLinks_t &shotPFOs)
void addShotPFOLink(const ElementLink< PFOContainer > &pfo)
add a shot PFO to the tau
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