ATLAS Offline Software
Loading...
Searching...
No Matches
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
15namespace Trk {
16
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
88 bool CaloCellSelectorRoughdR::select(const CaloCell& cell) const {
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
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
This class groups all DetDescr information related to a CaloCell.
bool preSelectAction(const Trk::CaloExtension &caloExtension)
Initialize selector wtih CaloExtension, returns false if the selection cannot be performed for the gi...
CaloExtensionHelpers::EntryExitPerLayerVector m_crossPoints
bool select(const CaloCell &cell) const
Method to determine if a cell is to be selected or not.
Tracking class to hold the extrapolation through calorimeter Layers Both the caloEntryLayerIntersecti...
const std::vector< CurvilinearParameters > & caloLayerIntersections() const
access to the intersections with the calorimeter layers.
Eigen::Matrix< double, 3, 1 > Vector3D
void entryExitPerLayerVector(const Trk::CaloExtension &extension, EntryExitPerLayerVector &result, const LayersToSelect *selection=nullptr)
Ensure that the ATLAS eigen extensions are properly loaded.
double deltaR2(double eta1, double eta2, double phi1, double phi2)
double deltaR(double eta1, double eta2, double phi1, double phi2)