CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
EcalIsolatedParticleCandidateProducer Class Reference

#include <Calibration/EcalIsolatedParticleCandidateProducer/src/EcalIsolatedParticleCandidateProducer.cc>

Inheritance diagram for EcalIsolatedParticleCandidateProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalIsolatedParticleCandidateProducer (const edm::ParameterSet &)
 
 ~EcalIsolatedParticleCandidateProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector
< edm::ProductResolverIndex >
const & 
indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector
< edm::ProductResolverIndex >
const & 
putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

double hitCountEthr_
 
double hitEthr_
 
double InConeSize_
 
double OutConeSize_
 
edm::EDGetTokenT
< EcalRecHitCollection
tok_EB_
 
edm::EDGetTokenT
< EcalRecHitCollection
tok_EE_
 
edm::ESGetToken< CaloGeometry,
CaloGeometryRecord
tok_geom_
 
edm::EDGetTokenT
< trigger::TriggerFilterObjectWithRefs
tok_hlt_
 
edm::EDGetTokenT
< l1extra::L1JetParticleCollection
tok_l1tau_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: <one line="" class="" summary>="">

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

Definition at line 49 of file EcalIsolatedParticleCandidateProducer.cc.

Constructor & Destructor Documentation

EcalIsolatedParticleCandidateProducer::EcalIsolatedParticleCandidateProducer ( const edm::ParameterSet conf)
explicit

Definition at line 76 of file EcalIsolatedParticleCandidateProducer.cc.

References edm::ParameterSet::getParameter(), hitCountEthr_, hitEthr_, InConeSize_, OutConeSize_, tok_EB_, tok_EE_, tok_geom_, tok_hlt_, and tok_l1tau_.

76  {
77  InConeSize_ = conf.getParameter<double>("EcalInnerConeSize");
78  OutConeSize_ = conf.getParameter<double>("EcalOuterConeSize");
79  hitCountEthr_ = conf.getParameter<double>("ECHitCountEnergyThreshold");
80  hitEthr_ = conf.getParameter<double>("ECHitEnergyThreshold");
81  tok_l1tau_ = consumes<l1extra::L1JetParticleCollection>(conf.getParameter<edm::InputTag>("L1eTauJetsSource"));
82  tok_hlt_ = consumes<trigger::TriggerFilterObjectWithRefs>(conf.getParameter<edm::InputTag>("L1GTSeedLabel"));
83  tok_EB_ = consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("EBrecHitCollectionLabel"));
84  tok_EE_ = consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("EErecHitCollectionLabel"));
85 
86  tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
87 
88  //register your products
89  produces<reco::IsolatedPixelTrackCandidateCollection>();
90 }
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1tau_
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EcalIsolatedParticleCandidateProducer::~EcalIsolatedParticleCandidateProducer ( )
override

Definition at line 92 of file EcalIsolatedParticleCandidateProducer.cc.

92  {
93  // do anything here that needs to be done at desctruction time
94  // (e.g. close files, deallocate resources etc.)
95 }

Member Function Documentation

void EcalIsolatedParticleCandidateProducer::beginJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 58 of file EcalIsolatedParticleCandidateProducer.cc.

58 {}
void EcalIsolatedParticleCandidateProducer::endJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 59 of file EcalIsolatedParticleCandidateProducer.cc.

Referenced by o2olib.O2ORunMgr::executeJob().

59 {}
void EcalIsolatedParticleCandidateProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 243 of file EcalIsolatedParticleCandidateProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

243  {
245  desc.add<double>("ECHitEnergyThreshold", 0.05);
246  desc.add<edm::InputTag>("L1eTauJetsSource", edm::InputTag("l1extraParticles", "Tau"));
247  desc.add<edm::InputTag>("L1GTSeedLabel", edm::InputTag("l1sIsolTrack"));
248  desc.add<edm::InputTag>("EBrecHitCollectionLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
249  desc.add<edm::InputTag>("EErecHitCollectionLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
250  desc.add<double>("ECHitCountEnergyThreshold", 0.5);
251  desc.add<double>("EcalInnerConeSize", 0.3);
252  desc.add<double>("EcalOuterConeSize", 0.7);
253  descriptions.add("ecalIsolPartProd", desc);
254 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void EcalIsolatedParticleCandidateProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 102 of file EcalIsolatedParticleCandidateProducer.cc.

References relval_parameters_module::energy, PV3DBase< T, PVType, FrameType >::eta(), edm::Event::getByToken(), edm::EventSetup::getData(), CaloGeometry::getPosition(), hitCountEthr_, hitEthr_, InConeSize_, M_PI, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::phi(), funct::pow(), DiDispStaMuonMonitor_cfi::pt, edm::Event::put(), dttmaxenums::R, mathSSE::sqrt(), tok_EB_, tok_EE_, tok_geom_, tok_hlt_, tok_l1tau_, trigger::TriggerL1Jet, and trigger::TriggerL1Tau.

104  {
105 #ifdef EDM_ML_DEBUG
106  edm::LogVerbatim("HcalIsoTrack") << "get tau";
107 #endif
109  iEvent.getByToken(tok_l1tau_, l1Taus);
110 
111 #ifdef EDM_ML_DEBUG
112  edm::LogVerbatim("HcalIsoTrack") << "get geom";
113 #endif
114  const CaloGeometry* geo = &iSetup.getData(tok_geom_);
115 
116 #ifdef EDM_ML_DEBUG
117  edm::LogVerbatim("HcalIsoTrack") << "get ec rechit";
118 #endif
120  iEvent.getByToken(tok_EB_, ecalEB);
121 
123  iEvent.getByToken(tok_EE_, ecalEE);
124 
125 #ifdef EDM_ML_DEBUG
126  edm::LogVerbatim("HcalIsoTrack") << "get l1 trig obj";
127 #endif
128 
130  iEvent.getByToken(tok_hlt_, l1trigobj);
131 
132  std::vector<edm::Ref<l1t::TauBxCollection> > l1tauobjref;
133  std::vector<edm::Ref<l1t::JetBxCollection> > l1jetobjref;
134 
135  l1trigobj->getObjects(trigger::TriggerL1Tau, l1tauobjref);
136  l1trigobj->getObjects(trigger::TriggerL1Jet, l1jetobjref);
137 
138  double ptTriggered = -10;
139  double etaTriggered = -100;
140  double phiTriggered = -100;
141 
142 #ifdef EDM_ML_DEBUG
143  edm::LogVerbatim("HcalIsoTrack") << "find highest pT triggered obj";
144 #endif
145  for (unsigned int p = 0; p < l1tauobjref.size(); p++) {
146  if (l1tauobjref[p]->pt() > ptTriggered) {
147  ptTriggered = l1tauobjref[p]->pt();
148  phiTriggered = l1tauobjref[p]->phi();
149  etaTriggered = l1tauobjref[p]->eta();
150  }
151  }
152  for (unsigned int p = 0; p < l1jetobjref.size(); p++) {
153  if (l1jetobjref[p]->pt() > ptTriggered) {
154  ptTriggered = l1jetobjref[p]->pt();
155  phiTriggered = l1jetobjref[p]->phi();
156  etaTriggered = l1jetobjref[p]->eta();
157  }
158  }
159 
160  auto iptcCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
161 
162 #ifdef EDM_ML_DEBUG
163  edm::LogVerbatim("HcalIsoTrack") << "loop over l1taus";
164 #endif
165  for (l1extra::L1JetParticleCollection::const_iterator tit = l1Taus->begin(); tit != l1Taus->end(); tit++) {
166  double dphi = fabs(tit->phi() - phiTriggered);
167  if (dphi > M_PI)
168  dphi = 2 * M_PI - dphi;
169  double Rseed = sqrt(pow(etaTriggered - tit->eta(), 2) + dphi * dphi);
170  if (Rseed < 1.2)
171  continue;
172  int nhitOut = 0;
173  int nhitIn = 0;
174  double OutEnergy = 0;
175  double InEnergy = 0;
176 #ifdef EDM_ML_DEBUG
177  edm::LogVerbatim("HcalIsoTrack") << "loops over rechits";
178 #endif
179  for (EcalRecHitCollection::const_iterator eItr = ecalEB->begin(); eItr != ecalEB->end(); eItr++) {
180  double phiD, R;
181  const GlobalPoint& pos = geo->getPosition(eItr->detid());
182  double phihit = pos.phi();
183  double etahit = pos.eta();
184  phiD = fabs(phihit - tit->phi());
185  if (phiD > M_PI)
186  phiD = 2 * M_PI - phiD;
187  R = sqrt(pow(etahit - tit->eta(), 2) + phiD * phiD);
188 
189  if (R < OutConeSize_ && R > InConeSize_ && eItr->energy() > hitCountEthr_) {
190  nhitOut++;
191  }
192  if (R < InConeSize_ && eItr->energy() > hitCountEthr_) {
193  nhitIn++;
194  }
195 
196  if (R < OutConeSize_ && R > InConeSize_ && eItr->energy() > hitEthr_) {
197  OutEnergy += eItr->energy();
198  }
199  if (R < InConeSize_ && eItr->energy() > hitEthr_) {
200  InEnergy += eItr->energy();
201  }
202  }
203 
204  for (EcalRecHitCollection::const_iterator eItr = ecalEE->begin(); eItr != ecalEE->end(); eItr++) {
205  double phiD, R;
206  const GlobalPoint& pos = geo->getPosition(eItr->detid());
207  double phihit = pos.phi();
208  double etahit = pos.eta();
209  phiD = fabs(phihit - tit->phi());
210  if (phiD > M_PI)
211  phiD = 2 * M_PI - phiD;
212  R = sqrt(pow(etahit - tit->eta(), 2) + phiD * phiD);
213  if (R < OutConeSize_ && R > InConeSize_ && eItr->energy() > hitCountEthr_) {
214  nhitOut++;
215  }
216  if (R < InConeSize_ && eItr->energy() > hitCountEthr_) {
217  nhitIn++;
218  }
219  if (R < OutConeSize_ && R > InConeSize_ && eItr->energy() > hitEthr_) {
220  OutEnergy += eItr->energy();
221  }
222  if (R < InConeSize_ && eItr->energy() > hitEthr_) {
223  InEnergy += eItr->energy();
224  }
225  }
226 #ifdef EDM_ML_DEBUG
227  edm::LogVerbatim("HcalIsoTrack") << "create and push_back candidate";
228 #endif
230  l1extra::L1JetParticleRef(l1Taus, tit - l1Taus->begin()), InEnergy, OutEnergy, nhitIn, nhitOut);
231  iptcCollection->push_back(newca);
232  }
233 
234  //Use the ExampleData to create an ExampleData2 which
235  // is put into the Event
236 
237 #ifdef EDM_ML_DEBUG
238  edm::LogVerbatim("HcalIsoTrack") << "put cand into event";
239 #endif
240  iEvent.put(std::move(iptcCollection));
241 }
Log< level::Info, true > LogVerbatim
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
std::vector< EcalRecHit >::const_iterator const_iterator
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1tau_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
T sqrt(T t)
Definition: SSEVec.h:19
def move
Definition: eostools.py:511
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
#define M_PI
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_
T eta() const
Definition: PV3DBase.h:73
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

Member Data Documentation

double EcalIsolatedParticleCandidateProducer::hitCountEthr_
private
double EcalIsolatedParticleCandidateProducer::hitEthr_
private
double EcalIsolatedParticleCandidateProducer::InConeSize_
private
double EcalIsolatedParticleCandidateProducer::OutConeSize_
private
edm::EDGetTokenT<EcalRecHitCollection> EcalIsolatedParticleCandidateProducer::tok_EB_
private
edm::EDGetTokenT<EcalRecHitCollection> EcalIsolatedParticleCandidateProducer::tok_EE_
private
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> EcalIsolatedParticleCandidateProducer::tok_geom_
private
edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> EcalIsolatedParticleCandidateProducer::tok_hlt_
private
edm::EDGetTokenT<l1extra::L1JetParticleCollection> EcalIsolatedParticleCandidateProducer::tok_l1tau_
private