CMS 3D CMS Logo

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

#include <EleIsoDetIdCollectionProducer.h>

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

Public Member Functions

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

Private Attributes

edm::InputTag emObjectLabel_
 
edm::EDGetToken emObjectToken_
 
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::EDGetToken recHitsToken_
 
std::vector< int > severitiesexclEB_
 
std::vector< int > severitiesexclEE_
 

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 32 of file EleIsoDetIdCollectionProducer.h.

Constructor & Destructor Documentation

◆ EleIsoDetIdCollectionProducer()

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

ctor

Definition at line 31 of file EleIsoDetIdCollectionProducer.cc.

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

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

◆ ~EleIsoDetIdCollectionProducer()

EleIsoDetIdCollectionProducer::~EleIsoDetIdCollectionProducer ( )
override

Definition at line 66 of file EleIsoDetIdCollectionProducer.cc.

66 {}

Member Function Documentation

◆ beginJob()

void EleIsoDetIdCollectionProducer::beginJob ( void  )

Definition at line 68 of file EleIsoDetIdCollectionProducer.cc.

68 {}

◆ produce()

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

producer

Definition at line 71 of file EleIsoDetIdCollectionProducer.cc.

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

References 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::get(), get, 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_, and EcalSeverityLevelAlgo::severityLevel().

Member Data Documentation

◆ emObjectLabel_

edm::InputTag EleIsoDetIdCollectionProducer::emObjectLabel_
private

Definition at line 46 of file EleIsoDetIdCollectionProducer.h.

◆ emObjectToken_

edm::EDGetToken EleIsoDetIdCollectionProducer::emObjectToken_
private

Definition at line 44 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ energyCut_

double EleIsoDetIdCollectionProducer::energyCut_
private

Definition at line 47 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ etCandCut_

double EleIsoDetIdCollectionProducer::etCandCut_
private

Definition at line 49 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ etCut_

double EleIsoDetIdCollectionProducer::etCut_
private

Definition at line 48 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ flagsexclEB_

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

Definition at line 56 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

◆ flagsexclEE_

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

Definition at line 57 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

◆ innerRadius_

double EleIsoDetIdCollectionProducer::innerRadius_
private

Definition at line 51 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ interestingDetIdCollection_

std::string EleIsoDetIdCollectionProducer::interestingDetIdCollection_
private

Definition at line 52 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

◆ outerRadius_

double EleIsoDetIdCollectionProducer::outerRadius_
private

Definition at line 50 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ recHitsLabel_

edm::InputTag EleIsoDetIdCollectionProducer::recHitsLabel_
private

Definition at line 45 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ recHitsToken_

edm::EDGetToken EleIsoDetIdCollectionProducer::recHitsToken_
private

Definition at line 43 of file EleIsoDetIdCollectionProducer.h.

Referenced by produce().

◆ severitiesexclEB_

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

Definition at line 54 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

◆ severitiesexclEE_

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

Definition at line 55 of file EleIsoDetIdCollectionProducer.h.

Referenced by EleIsoDetIdCollectionProducer(), and produce().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
EcalSeverityLevelAlgo
Definition: EcalSeverityLevelAlgo.h:33
EcalRecHit
Definition: EcalRecHit.h:15
EleIsoDetIdCollectionProducer::recHitsLabel_
edm::InputTag recHitsLabel_
Definition: EleIsoDetIdCollectionProducer.h:45
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
CaloGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
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
edm::Handle< reco::GsfElectronCollection >
EleIsoDetIdCollectionProducer::innerRadius_
double innerRadius_
Definition: EleIsoDetIdCollectionProducer.h:51
EcalBarrel
Definition: EcalSubdetector.h:10
EleIsoDetIdCollectionProducer::outerRadius_
double outerRadius_
Definition: EleIsoDetIdCollectionProducer.h:50
EleIsoDetIdCollectionProducer::etCandCut_
double etCandCut_
Definition: EleIsoDetIdCollectionProducer.h:49
EleIsoDetIdCollectionProducer::flagsexclEE_
std::vector< int > flagsexclEE_
Definition: EleIsoDetIdCollectionProducer.h:57
CaloGeometry
Definition: CaloGeometry.h:21
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
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 >
EcalSeverityLevelAlgoRcd
Definition: EcalSeverityLevelAlgoRcd.h:12
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
EleIsoDetIdCollectionProducer::severitiesexclEE_
std::vector< int > severitiesexclEE_
Definition: EleIsoDetIdCollectionProducer.h:55
iEvent
int iEvent
Definition: GenABIO.cc:224
EleIsoDetIdCollectionProducer::emObjectLabel_
edm::InputTag emObjectLabel_
Definition: EleIsoDetIdCollectionProducer.h:46
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
EleIsoDetIdCollectionProducer::energyCut_
double energyCut_
Definition: EleIsoDetIdCollectionProducer.h:47
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
CaloDualConeSelector
Definition: CaloDualConeSelector.h:14
DetId::Ecal
Definition: DetId.h:27
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
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
EleIsoDetIdCollectionProducer::recHitsToken_
edm::EDGetToken recHitsToken_
Definition: EleIsoDetIdCollectionProducer.h:43
EleIsoDetIdCollectionProducer::emObjectToken_
edm::EDGetToken emObjectToken_
Definition: EleIsoDetIdCollectionProducer.h:44
EleIsoDetIdCollectionProducer::interestingDetIdCollection_
std::string interestingDetIdCollection_
Definition: EleIsoDetIdCollectionProducer.h:52
EleIsoDetIdCollectionProducer::flagsexclEB_
std::vector< int > flagsexclEB_
Definition: EleIsoDetIdCollectionProducer.h:56
EleIsoDetIdCollectionProducer::severitiesexclEB_
std::vector< int > severitiesexclEB_
Definition: EleIsoDetIdCollectionProducer.h:54
EleIsoDetIdCollectionProducer::etCut_
double etCut_
Definition: EleIsoDetIdCollectionProducer.h:48
edm::InputTag
Definition: InputTag.h:15