CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GamIsoDetIdCollectionProducer Class Reference

#include <GamIsoDetIdCollectionProducer.h>

Inheritance diagram for GamIsoDetIdCollectionProducer:
edm::stream::EDProducer<>

Public Member Functions

void beginJob ()
 
 GamIsoDetIdCollectionProducer (const edm::ParameterSet &)
 ctor More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 producer More...
 
 ~GamIsoDetIdCollectionProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometryToken_
 
edm::InputTag emObjectLabel_
 
edm::EDGetTokenT< reco::PhotonCollectionemObjectToken_
 
double energyCut_
 
double etCandCut_
 
double etCut_
 
std::vector< int > flagsexclEB_
 
std::vector< int > flagsexclEE_
 
double innerRadius_
 
std::string interestingDetIdCollection_
 
double outerRadius_
 
edm::InputTag recHitsLabel_
 
edm::EDGetTokenT< EcalRecHitCollectionrecHitsToken_
 
std::vector< int > severitiesexclEB_
 
std::vector< int > severitiesexclEE_
 
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcdsevLvToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Original author: Matthew LeBourgeois PH/CMG Modified from : RecoEcal/EgammaClusterProducers/{src,interface}/InterestingDetIdCollectionProducer.{h,cc} by Paolo Meridiani PH/CMG

Implementation: <Notes on="" implementation>="">

Definition at line 41 of file GamIsoDetIdCollectionProducer.h.

Constructor & Destructor Documentation

◆ GamIsoDetIdCollectionProducer()

GamIsoDetIdCollectionProducer::GamIsoDetIdCollectionProducer ( const edm::ParameterSet iConfig)
explicit

ctor

Definition at line 27 of file GamIsoDetIdCollectionProducer.cc.

28  : recHitsToken_(consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitsLabel"))),
29  emObjectToken_(consumes<reco::PhotonCollection>(iConfig.getParameter<edm::InputTag>("emObjectLabel"))),
30  caloGeometryToken_(esConsumes()),
31  sevLvToken_(esConsumes()),
32  //the labels are still used to decide if its endcap or barrel...
33  recHitsLabel_(iConfig.getParameter<edm::InputTag>("recHitsLabel")),
34  emObjectLabel_(iConfig.getParameter<edm::InputTag>("emObjectLabel")),
35  energyCut_(iConfig.getParameter<double>("energyCut")),
36  etCut_(iConfig.getParameter<double>("etCut")),
37  etCandCut_(iConfig.getParameter<double>("etCandCut")),
38  outerRadius_(iConfig.getParameter<double>("outerRadius")),
39  innerRadius_(iConfig.getParameter<double>("innerRadius")),
40  interestingDetIdCollection_(iConfig.getParameter<std::string>("interestingDetIdCollection")) {
41  const std::vector<std::string> flagnamesEB =
42  iConfig.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEB");
43 
44  const std::vector<std::string> flagnamesEE =
45  iConfig.getParameter<std::vector<std::string> >("RecHitFlagToBeExcludedEE");
46 
47  flagsexclEB_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
48 
49  flagsexclEE_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
50 
51  const std::vector<std::string> severitynamesEB =
52  iConfig.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEB");
53 
54  severitiesexclEB_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
55 
56  const std::vector<std::string> severitynamesEE =
57  iConfig.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcludedEE");
58 
59  severitiesexclEE_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
60 
61  //register your products
62  produces<DetIdCollection>(interestingDetIdCollection_);
63 }

References flagsexclEB_, flagsexclEE_, edm::ParameterSet::getParameter(), interestingDetIdCollection_, severitiesexclEB_, and severitiesexclEE_.

◆ ~GamIsoDetIdCollectionProducer()

GamIsoDetIdCollectionProducer::~GamIsoDetIdCollectionProducer ( )
override

Definition at line 65 of file GamIsoDetIdCollectionProducer.cc.

65 {}

Member Function Documentation

◆ beginJob()

void GamIsoDetIdCollectionProducer::beginJob ( void  )

Definition at line 67 of file GamIsoDetIdCollectionProducer.cc.

67 {}

◆ produce()

void GamIsoDetIdCollectionProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

producer

Definition at line 70 of file GamIsoDetIdCollectionProducer.cc.

70  {
71  using namespace edm;
72  using namespace std;
73 
74  //Get EM Object
76  iEvent.getByToken(emObjectToken_, emObjectH);
77 
78  // take EcalRecHits
80  iEvent.getByToken(recHitsToken_, recHitsH);
81 
83  const CaloGeometry* caloGeom = pG.product();
84 
86  const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
87 
88  CaloDualConeSelector<EcalRecHit>* doubleConeSel_ = nullptr;
89  if (recHitsLabel_.instance() == "EcalRecHitsEB")
91  else if (recHitsLabel_.instance() == "EcalRecHitsEE")
93 
94  //Create empty output collections
95  auto detIdCollection = std::make_unique<DetIdCollection>();
96 
97  reco::PhotonCollection::const_iterator emObj;
98  if (doubleConeSel_) { //if cone selector was created
99  for (emObj = emObjectH->begin(); emObj != emObjectH->end(); emObj++) { //Loop over candidates
100 
101  if (emObj->et() < etCandCut_)
102  continue;
103 
104  GlobalPoint pclu(emObj->caloPosition().x(), emObj->caloPosition().y(), emObj->caloPosition().z());
105  doubleConeSel_->selectCallback(pclu, *recHitsH, [&](const EcalRecHit& recHitRef) {
106  const EcalRecHit* recIt = &recHitRef;
107 
108  if ((recIt->energy()) < energyCut_)
109  return; //dont fill if below E noise value
110 
111  double et = recIt->energy() * caloGeom->getPosition(recIt->detid()).perp() /
112  caloGeom->getPosition(recIt->detid()).mag();
113 
114  if (et < etCut_)
115  return; //dont fill if below ET noise value
116 
117  bool isBarrel = false;
118  if (fabs(caloGeom->getPosition(recIt->detid()).eta() < 1.479))
119  isBarrel = true;
120 
121  int severityFlag = sevLevel->severityLevel(recIt->detid(), *recHitsH);
122  std::vector<int>::const_iterator sit;
123  if (isBarrel) {
124  sit = std::find(severitiesexclEB_.begin(), severitiesexclEB_.end(), severityFlag);
125  if (sit != severitiesexclEB_.end())
126  return;
127  } else {
128  sit = std::find(severitiesexclEE_.begin(), severitiesexclEE_.end(), severityFlag);
129  if (sit != severitiesexclEE_.end())
130  return;
131  }
132 
133  if (isBarrel) {
134  // new rechit flag checks
135  if (!recIt->checkFlag(EcalRecHit::kGood)) {
136  if (recIt->checkFlags(flagsexclEB_)) {
137  return;
138  }
139  }
140  } else {
141  // new rechit flag checks
142  if (!recIt->checkFlag(EcalRecHit::kGood)) {
143  if (recIt->checkFlags(flagsexclEE_)) {
144  return;
145  }
146  }
147  }
148 
149  if (std::find(detIdCollection->begin(), detIdCollection->end(), recIt->detid()) == detIdCollection->end())
150  detIdCollection->push_back(recIt->detid());
151  }); //end rechits
152 
153  } //end candidates
154 
155  delete doubleConeSel_;
156  } //end if cone selector was created
157 
158  iEvent.put(std::move(detIdCollection), interestingDetIdCollection_);
159 }

References caloGeometryToken_, EcalRecHit::checkFlag(), EcalRecHit::checkFlags(), EcalRecHit::detid(), DetId::Ecal, EcalBarrel, EcalEndcap, emObjectToken_, EcalRecHit::energy(), energyCut_, EgHLTOffHistBins_cfi::et, PVValHelper::eta, etCandCut_, etCut_, spr::find(), flagsexclEB_, flagsexclEE_, edm::EventSetup::getHandle(), CaloGeometry::getPosition(), iEvent, innerRadius_, edm::InputTag::instance(), interestingDetIdCollection_, PixelPluginsPhase0_cfi::isBarrel, EcalRecHit::kGood, mag(), eostools::move(), outerRadius_, perp(), edm::ESHandle< T >::product(), recHitsLabel_, recHitsToken_, CaloDualConeSelector< T >::selectCallback(), severitiesexclEB_, severitiesexclEE_, EcalSeverityLevelAlgo::severityLevel(), and sevLvToken_.

Member Data Documentation

◆ caloGeometryToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> GamIsoDetIdCollectionProducer::caloGeometryToken_
private

Definition at line 54 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ emObjectLabel_

edm::InputTag GamIsoDetIdCollectionProducer::emObjectLabel_
private

Definition at line 57 of file GamIsoDetIdCollectionProducer.h.

◆ emObjectToken_

edm::EDGetTokenT<reco::PhotonCollection> GamIsoDetIdCollectionProducer::emObjectToken_
private

Definition at line 53 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ energyCut_

double GamIsoDetIdCollectionProducer::energyCut_
private

Definition at line 58 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ etCandCut_

double GamIsoDetIdCollectionProducer::etCandCut_
private

Definition at line 60 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ etCut_

double GamIsoDetIdCollectionProducer::etCut_
private

Definition at line 59 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ flagsexclEB_

std::vector<int> GamIsoDetIdCollectionProducer::flagsexclEB_
private

Definition at line 67 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().

◆ flagsexclEE_

std::vector<int> GamIsoDetIdCollectionProducer::flagsexclEE_
private

Definition at line 68 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().

◆ innerRadius_

double GamIsoDetIdCollectionProducer::innerRadius_
private

Definition at line 62 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ interestingDetIdCollection_

std::string GamIsoDetIdCollectionProducer::interestingDetIdCollection_
private

Definition at line 63 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().

◆ outerRadius_

double GamIsoDetIdCollectionProducer::outerRadius_
private

Definition at line 61 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ recHitsLabel_

edm::InputTag GamIsoDetIdCollectionProducer::recHitsLabel_
private

Definition at line 56 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ recHitsToken_

edm::EDGetTokenT<EcalRecHitCollection> GamIsoDetIdCollectionProducer::recHitsToken_
private

Definition at line 52 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ severitiesexclEB_

std::vector<int> GamIsoDetIdCollectionProducer::severitiesexclEB_
private

Definition at line 65 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().

◆ severitiesexclEE_

std::vector<int> GamIsoDetIdCollectionProducer::severitiesexclEE_
private

Definition at line 66 of file GamIsoDetIdCollectionProducer.h.

Referenced by GamIsoDetIdCollectionProducer(), and produce().

◆ sevLvToken_

edm::ESGetToken<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd> GamIsoDetIdCollectionProducer::sevLvToken_
private

Definition at line 55 of file GamIsoDetIdCollectionProducer.h.

Referenced by produce().

GamIsoDetIdCollectionProducer::severitiesexclEE_
std::vector< int > severitiesexclEE_
Definition: GamIsoDetIdCollectionProducer.h:66
GamIsoDetIdCollectionProducer::energyCut_
double energyCut_
Definition: GamIsoDetIdCollectionProducer.h:58
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
EcalSeverityLevelAlgo
Definition: EcalSeverityLevelAlgo.h:33
EcalRecHit
Definition: EcalRecHit.h:15
GamIsoDetIdCollectionProducer::etCandCut_
double etCandCut_
Definition: GamIsoDetIdCollectionProducer.h:60
EcalRecHit::detid
const DetId & detid() const
Definition: EcalRecHit.h:72
EcalSeverityLevelAlgo::severityLevel
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
Definition: EcalSeverityLevelAlgo.cc:85
edm::InputTag::instance
std::string const & instance() const
Definition: InputTag.h:37
GamIsoDetIdCollectionProducer::emObjectLabel_
edm::InputTag emObjectLabel_
Definition: GamIsoDetIdCollectionProducer.h:57
CaloGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
edm
HLT enums.
Definition: AlignableModifier.h:19
GamIsoDetIdCollectionProducer::severitiesexclEB_
std::vector< int > severitiesexclEB_
Definition: GamIsoDetIdCollectionProducer.h:65
EcalRecHit::energy
float energy() const
Definition: EcalRecHit.h:68
perp
T perp() const
Magnitude of transverse component.
Definition: Basic3DVectorLD.h:133
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
GamIsoDetIdCollectionProducer::innerRadius_
double innerRadius_
Definition: GamIsoDetIdCollectionProducer.h:62
edm::Handle< reco::PhotonCollection >
EcalBarrel
Definition: EcalSubdetector.h:10
GamIsoDetIdCollectionProducer::interestingDetIdCollection_
std::string interestingDetIdCollection_
Definition: GamIsoDetIdCollectionProducer.h:63
CaloGeometry
Definition: CaloGeometry.h:21
GamIsoDetIdCollectionProducer::recHitsToken_
edm::EDGetTokenT< EcalRecHitCollection > recHitsToken_
Definition: GamIsoDetIdCollectionProducer.h:52
GamIsoDetIdCollectionProducer::caloGeometryToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
Definition: GamIsoDetIdCollectionProducer.h:54
GamIsoDetIdCollectionProducer::recHitsLabel_
edm::InputTag recHitsLabel_
Definition: GamIsoDetIdCollectionProducer.h:56
PVValHelper::eta
Definition: PVValidationHelpers.h:69
EcalRecHit::checkFlag
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:187
edm::ESHandle< CaloGeometry >
GamIsoDetIdCollectionProducer::sevLvToken_
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > sevLvToken_
Definition: GamIsoDetIdCollectionProducer.h:55
GamIsoDetIdCollectionProducer::etCut_
double etCut_
Definition: GamIsoDetIdCollectionProducer.h:59
EcalRecHit::kGood
Definition: EcalRecHit.h:21
CaloDualConeSelector::selectCallback
void selectCallback(double eta, double phi, const edm::SortedCollection< T > &inputCollection, std::function< void(const T &)> callback)
Definition: CaloDualConeSelector.h:22
Point3DBase< float, GlobalTag >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalEndcap
Definition: EcalSubdetector.h:10
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
iEvent
int iEvent
Definition: GenABIO.cc:224
EcalRecHit::checkFlags
bool checkFlags(const std::vector< int > &flagsvec) const
check if one of the flags in a set is true
Definition: EcalRecHit.h:190
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
CaloDualConeSelector
Definition: CaloDualConeSelector.h:14
DetId::Ecal
Definition: DetId.h:27
GamIsoDetIdCollectionProducer::outerRadius_
double outerRadius_
Definition: GamIsoDetIdCollectionProducer.h:61
GamIsoDetIdCollectionProducer::flagsexclEB_
std::vector< int > flagsexclEB_
Definition: GamIsoDetIdCollectionProducer.h:67
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
GamIsoDetIdCollectionProducer::emObjectToken_
edm::EDGetTokenT< reco::PhotonCollection > emObjectToken_
Definition: GamIsoDetIdCollectionProducer.h:53
edm::InputTag
Definition: InputTag.h:15
GamIsoDetIdCollectionProducer::flagsexclEE_
std::vector< int > flagsexclEE_
Definition: GamIsoDetIdCollectionProducer.h:68