CMS 3D CMS Logo

EgammaEcalExtractor.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaEcalExtractor.cc
3 // ----------------------------------------------------------------------------
4 // Type: Class implementation header
5 // Package: EgammaIsolationAlgos/EgammaIsolationAlgos
6 // Class: EgammaEcalExtractor
7 // Language: Standard C++
8 // Project: CMS
9 // OrigAuth: Gilles De Lentdecker
10 // Institute: IIHE-ULB
11 //=============================================================================
12 //*****************************************************************************
13 
29 
30 #include <Math/VectorUtil.h>
31 
32 #include <functional>
33 #include <vector>
34 
35 namespace egammaisolation {
36 
38  public:
41  : etMin_(par.getParameter<double>("etMin")),
42  conesize_(par.getParameter<double>("extRadius")),
43  scmatch_(par.getParameter<bool>("superClusterMatch")),
45  iC.consumes<reco::BasicClusterCollection>(par.getParameter<edm::InputTag>("basicClusters"))),
47  iC.consumes<reco::SuperClusterCollection>(par.getParameter<edm::InputTag>("superClusters"))) {}
48 
49  ~EgammaEcalExtractor() override;
50 
51  void fillVetos(const edm::Event& ev, const edm::EventSetup& evSetup, const reco::TrackCollection& tracks) override {
52  }
54  const edm::EventSetup& evSetup,
55  const reco::Track& track) const override {
56  throw cms::Exception("Configuration Error")
57  << "This extractor " << (typeid(this).name()) << " is not made for tracks";
58  }
60  const edm::EventSetup& evSetup,
61  const reco::Candidate& c) const override;
62 
63  private:
64  // ---------- member data --------------------------------
65 
66  // Parameters of isolation cone geometry.
67  // Photon case
68  double etMin_;
69  double conesize_;
70  bool scmatch_; // true-> reject basic clusters matched to the superclsuter
71  // false-> fill all basic clusters
74  };
75 
76 } // namespace egammaisolation
77 
81 
82 using namespace egammaisolation;
83 using namespace reco::isodeposit;
84 
86 
88  const edm::EventSetup& evSetup,
89  const reco::Candidate& candidate) const {
91  math::XYZPoint position = sc->position();
92  // match the photon hybrid supercluster with those with Algo==0 (island)
93  double delta1 = 1000.;
94  double deltacur = 1000.;
95  const reco::SuperCluster* matchedsupercluster = nullptr;
96  bool MATCHEDSC = false;
97 
98  Direction candDir(position.eta(), position.phi());
99  reco::IsoDeposit deposit(candDir);
100  deposit.setVeto(reco::IsoDeposit::Veto(candDir, 0)); // no veto is needed for this deposit
101  deposit.addCandEnergy(sc->energy() * sin(2 * atan(exp(-sc->eta()))));
102 
103  for (auto const& scItr : ev.get(superClusterToken_)) {
104  const reco::SuperCluster* supercluster = &scItr;
105 
106  if (supercluster->seed()->algo() == 0) {
107  deltacur = ROOT::Math::VectorUtil::DeltaR(supercluster->position(), position);
108  if (deltacur < delta1) {
109  delta1 = deltacur;
110  matchedsupercluster = supercluster;
111  MATCHEDSC = true;
112  }
113  }
114  }
115 
116  const reco::BasicCluster* cluster = nullptr;
117 
118  //loop over basic clusters
119  for (auto const& cItr : ev.get(basicClusterToken_)) {
120  cluster = &cItr;
121  // double ebc_bcchi2 = cluster->chi2();
122  int ebc_bcalgo = cluster->algo();
123  double ebc_bce = cluster->energy();
124  double ebc_bceta = cluster->eta();
125  double ebc_bcet = ebc_bce * sin(2 * atan(exp(ebc_bceta)));
126  double newDelta = 0.;
127 
128  if (ebc_bcet > etMin_ && ebc_bcalgo == 0) {
129  // if (ebc_bcchi2 < 30.) {
130 
131  if (MATCHEDSC || !scmatch_) { //skip selection if user wants to fill all superclusters
132  bool inSuperCluster = false;
133 
134  if (scmatch_) { // only try the matching if needed
135  reco::CaloCluster_iterator theEclust = matchedsupercluster->clustersBegin();
136  // loop over the basic clusters of the matched supercluster
137  for (; theEclust != matchedsupercluster->clustersEnd(); ++theEclust) {
138  if ((**theEclust) == (*cluster))
139  inSuperCluster = true;
140  }
141  }
142  if (!inSuperCluster || !scmatch_) { //skip selection if user wants to fill all superclusters
143  newDelta = ROOT::Math::VectorUtil::DeltaR(cluster->position(), position);
144  if (newDelta < conesize_) {
145  deposit.addDeposit(Direction(cluster->eta(), cluster->phi()), ebc_bcet);
146  }
147  }
148  }
149  // } // matches ebc_bcchi2
150  } // matches ebc_bcet && ebc_bcalgo
151  }
152 
153  // std::cout << "Will return ecalIsol = " << ecalIsol << std::endl;
154  return deposit;
155 }
reco::CaloCluster::phi
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:184
electrons_cff.bool
bool
Definition: electrons_cff.py:366
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
MessageLogger.h
egammaisolation::EgammaEcalExtractor::etMin_
double etMin_
Definition: EgammaEcalExtractor.cc:68
egammaisolation
Definition: EgammaTrackSelector.h:11
reco::SuperCluster
Definition: SuperCluster.h:18
BasicCluster.h
edm::EDGetTokenT< reco::BasicClusterCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
egammaisolation::EgammaEcalExtractor::deposit
reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const override
Definition: EgammaEcalExtractor.cc:53
edm::PtrVectorItr
Definition: PtrVector.h:51
reco::Candidate::get
T get() const
get a component
Definition: Candidate.h:221
reco::IsoDeposit::Veto
Definition: IsoDeposit.h:59
egammaisolation::EgammaEcalExtractor::EgammaEcalExtractor
EgammaEcalExtractor(const edm::ParameterSet &par, edm::ConsumesCollector &&iC)
Definition: EgammaEcalExtractor.cc:39
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
RecoCandidate.h
BasicClusterFwd.h
edm::Ref< SuperClusterCollection >
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition: SuperClusterFwd.h:9
MakerMacros.h
Track.h
TrackFwd.h
reco::isodeposit
Definition: IsoDeposit.h:31
reco::CaloCluster
Definition: CaloCluster.h:31
reco::Track
Definition: Track.h:27
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
reco::BasicClusterCollection
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
Definition: BasicClusterFwd.h:16
IsoDeposit.h
egammaisolation::EgammaEcalExtractor::fillVetos
void fillVetos(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &tracks) override
Definition: EgammaEcalExtractor.cc:51
IsoDepositExtractor.h
edm::ParameterSet
Definition: ParameterSet.h:47
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
reco::SuperCluster::seed
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
reco::CaloCluster::eta
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
Event.h
egammaisolation::EgammaEcalExtractor::basicClusterToken_
edm::EDGetTokenT< reco::BasicClusterCollection > basicClusterToken_
Definition: EgammaEcalExtractor.cc:72
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
edmplugin::PluginFactory
Definition: PluginFactory.h:34
egammaisolation::EgammaEcalExtractor::superClusterToken_
edm::EDGetTokenT< reco::SuperClusterCollection > superClusterToken_
Definition: EgammaEcalExtractor.cc:73
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
egammaisolation::EgammaEcalExtractor::~EgammaEcalExtractor
~EgammaEcalExtractor() override
Definition: EgammaEcalExtractor.cc:85
reco::SuperCluster::clustersBegin
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:86
edm::EventSetup
Definition: EventSetup.h:58
electronAnalyzer_cfi.DeltaR
DeltaR
Definition: electronAnalyzer_cfi.py:33
egammaisolation::EgammaEcalExtractor::EgammaEcalExtractor
EgammaEcalExtractor(const edm::ParameterSet &par, edm::ConsumesCollector &iC)
Definition: EgammaEcalExtractor.cc:40
InputTag.h
reco::CaloCluster::position
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
reco::Candidate
Definition: Candidate.h:27
egammaisolation::EgammaEcalExtractor::scmatch_
bool scmatch_
Definition: EgammaEcalExtractor.cc:70
reco::CaloCluster::algo
AlgoId algo() const
algorithm identifier
Definition: CaloCluster.h:190
reco::isodeposit::Direction
Definition: IsoDepositDirection.h:19
SuperCluster.h
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
Exception
Definition: hltDiff.cc:245
IsoDepositExtractorFactory.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EventSetup.h
reco::IsoDeposit
Definition: IsoDeposit.h:49
ConsumesCollector.h
Candidate.h
ParameterSet.h
reco::isodeposit::IsoDepositExtractor
Definition: IsoDepositExtractor.h:24
reco::SuperCluster::clustersEnd
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:89
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
edm::Event
Definition: Event.h:73
egammaisolation::EgammaEcalExtractor
Definition: EgammaEcalExtractor.cc:37
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
egammaisolation::EgammaEcalExtractor::conesize_
double conesize_
Definition: EgammaEcalExtractor.cc:69