ATLAS Offline Software
CaloCellSelectorRoughdR.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // CaloCellSelectorRoughdR.cxx, (c) ATLAS Detector software
8 
10 
11 #include "CaloEvent/CaloCell.h"
14 
15 namespace Trk {
16 
17  CaloCellSelectorRoughdR::CaloCellSelectorRoughdR(double coneSize) : m_coneSize(coneSize), m_midEta(0), m_midPhi(0), m_maxDiff(0) {}
18 
20 
22  if (caloExtension.caloLayerIntersections().empty()) return false;
23 
26  // get mean direction of the calo crossings
27  Amg::Vector3D meanPos(0., 0., 0.);
28  for (auto entry : m_crossPoints) {
29  int code = std::get<0>(entry);
30  if (code < 0 || code >= 24) { continue; } // not a intersection with a calo layer
31  meanPos += std::get<1>(entry).unit();
32  }
33 
34  m_midEta = meanPos.eta();
35  m_midPhi = meanPos.phi();
36 
37  // get individual crossings max deviation from the mean direction as tolerance
38  m_maxDiff = 0.;
39  for (auto entry : m_crossPoints) {
40  int code = std::get<0>(entry);
41  if (code < 0 || code >= 24) { continue; } // not a intersection with a calo layer
42  Amg::Vector3D pos = std::get<1>(entry);
43  double rDiff = Utils::deltaR(pos.eta(), m_midEta, pos.phi(), m_midPhi);
44  if (rDiff > m_maxDiff) m_maxDiff = rDiff;
45  }
47  m_maxDiff *= m_maxDiff; // do comparison in dR*dR
49 
50  // const std::vector<const CurvilinearParameters*>& intersections = caloExtension.caloLayerIntersections();
51  // int nPts = intersections.size();
52 
53  // Amg::Vector3D meanPos(0., 0., 0.);
54  // m_maxDiff = 0.;
55 
57  // for (int i=0;i<nPts;++i){
58  // //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
59  // int code = parsIdHelper.caloSample(intersections[i]->cIdentifier());
60  // if (!parsIdHelper.isEntryToVolume(intersections[i]->cIdentifier())) code = -code;
61  // //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
62  // if ( !(code >= 0 && code < 24) ) { continue; } // not a intersection with a calo layer
63  // meanPos += intersections[i]->position().unit();
64  //}
65 
66  // m_midEta = meanPos.eta();
67  // m_midPhi = meanPos.phi();
68 
70  // for (int i=0;i<nPts;++i){
71  // //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
72  // int code = parsIdHelper.caloSample(intersections[i]->cIdentifier());
73  // if (!parsIdHelper.isEntryToVolume(intersections[i]->cIdentifier())) code = -code;
74  // //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
75  // if ( !(code >= 0 && code < 24) ) { continue; } // not a intersection with a calo layer
76  // Amg::Vector3D pos = intersections[i]->position();
77  // double rDiff = Utils::deltaR(pos.eta(), m_midEta, pos.phi(), m_midPhi);
78  // if (rDiff>m_maxDiff) m_maxDiff = rDiff;
79  //}
80 
82  // m_maxDiff += m_coneSize;
83  // m_maxDiff *= m_maxDiff; //do comparison in dR*dR
84 
85  return true;
86  }
87 
89  const CaloDetDescrElement* dde = cell.caloDDE();
90  if (!dde) return false;
91  return Utils::deltaR2(m_midEta, dde->eta(), m_midPhi, dde->phi()) < m_maxDiff;
92  }
93 
94 } // namespace Trk
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
Trk::CaloCellSelectorRoughdR::preSelectAction
bool preSelectAction(const Trk::CaloExtension &caloExtension)
Initialize selector wtih CaloExtension, returns false if the selection cannot be performed for the gi...
Definition: CaloCellSelectorRoughdR.cxx:21
Trk::CaloExtension
Tracking class to hold the extrapolation from a particle from the ID to the muon system (or the other...
Definition: CaloExtension.h:18
Trk::CaloCellSelectorRoughdR::m_crossPoints
CaloExtensionHelpers::EntryExitPerLayerVector m_crossPoints
Definition: CaloCellSelectorRoughdR.h:38
Trk::CaloCellSelectorRoughdR::m_coneSize
double m_coneSize
Definition: CaloCellSelectorRoughdR.h:32
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloExtension.h
CaloCell.h
Trk::CaloCellSelectorRoughdR::m_midPhi
double m_midPhi
Definition: CaloCellSelectorRoughdR.h:34
CaloCellSelectorUtils.h
Trk::CaloCellSelectorRoughdR::m_midEta
double m_midEta
Definition: CaloCellSelectorRoughdR.h:33
histSizes.code
code
Definition: histSizes.py:129
Utils::deltaR
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: CaloCellSelectorUtils.cxx:23
Trk::CaloCellSelectorRoughdR::CaloCellSelectorRoughdR
CaloCellSelectorRoughdR(double coneSize)
Definition: CaloCellSelectorRoughdR.cxx:17
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
CaloExtensionHelpers::entryExitPerLayerVector
void entryExitPerLayerVector(const Trk::CaloExtension &extension, EntryExitPerLayerVector &result, const LayersToSelect *selection=nullptr)
Definition: CaloExtensionHelpers.h:178
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
Trk::CaloCellSelectorRoughdR::m_maxDiff
double m_maxDiff
Definition: CaloCellSelectorRoughdR.h:35
CaloDetDescrElement::eta
float eta() const
cell eta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:344
CaloDetDescrElement::phi
float phi() const
cell phi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:346
Trk::CaloCellSelectorRoughdR::select
bool select(const CaloCell &cell) const
Method to determine if a cell is to be selected or not.
Definition: CaloCellSelectorRoughdR.cxx:88
Trk::CaloExtension::caloLayerIntersections
const std::vector< CurvilinearParameters > & caloLayerIntersections() const
access to the intersections with the calorimeter layers.
Definition: CaloExtension.h:76
CaloCellSelectorRoughdR.h
xAOD::Iso::coneSize
float coneSize(IsolationConeSize type)
convert Isolation Size into cone size
Definition: IsolationHelpers.h:27
Trk::CaloCellSelectorRoughdR::~CaloCellSelectorRoughdR
~CaloCellSelectorRoughdR()
Utils::deltaR2
double deltaR2(double eta1, double eta2, double phi1, double phi2)
Definition: CaloCellSelectorUtils.cxx:17