CMS 3D CMS Logo

List of all members | 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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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::vector< ModuleDescription const * > &modules, 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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< EcalRecHitCollectiontok_EB_
 
edm::EDGetTokenT< EcalRecHitCollectiontok_EE_
 
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefstok_hlt_
 
edm::EDGetTokenT< l1extra::L1JetParticleCollectiontok_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
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 

Detailed Description

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

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

Definition at line 19 of file EcalIsolatedParticleCandidateProducer.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file EcalIsolatedParticleCandidateProducer.cc.

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

35  {
36  InConeSize_ = conf.getParameter<double>("EcalInnerConeSize");
37  OutConeSize_ = conf.getParameter<double>("EcalOuterConeSize");
38  hitCountEthr_ = conf.getParameter<double>("ECHitCountEnergyThreshold");
39  hitEthr_ = conf.getParameter<double>("ECHitEnergyThreshold");
40  tok_l1tau_ = consumes<l1extra::L1JetParticleCollection>(conf.getParameter<edm::InputTag>("L1eTauJetsSource"));
41  tok_hlt_ = consumes<trigger::TriggerFilterObjectWithRefs>(conf.getParameter<edm::InputTag>("L1GTSeedLabel"));
42  tok_EB_ = consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("EBrecHitCollectionLabel"));
43  tok_EE_ = consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("EErecHitCollectionLabel"));
44 
45  //register your products
46  produces<reco::IsolatedPixelTrackCandidateCollection>();
47 }
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1tau_
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_
EcalIsolatedParticleCandidateProducer::~EcalIsolatedParticleCandidateProducer ( )
override

Definition at line 49 of file EcalIsolatedParticleCandidateProducer.cc.

49  {
50  // do anything here that needs to be done at desctruction time
51  // (e.g. close files, deallocate resources etc.)
52 }

Member Function Documentation

void EcalIsolatedParticleCandidateProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 189 of file EcalIsolatedParticleCandidateProducer.cc.

189 {}
void EcalIsolatedParticleCandidateProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 192 of file EcalIsolatedParticleCandidateProducer.cc.

Referenced by o2olib.O2ORunMgr::executeJob().

192 {}
void EcalIsolatedParticleCandidateProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivate

Definition at line 59 of file EcalIsolatedParticleCandidateProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), PV3DBase< T, PVType, FrameType >::eta(), edm::EventSetup::get(), edm::Event::getByToken(), trigger::TriggerRefsCollections::getObjects(), CaloGeometry::getPosition(), hitCountEthr_, hitEthr_, InConeSize_, M_PI, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::phi(), funct::pow(), edm::ESHandle< T >::product(), EnergyCorrector::pt, edm::Event::put(), dttmaxenums::R, mathSSE::sqrt(), tok_EB_, tok_EE_, tok_hlt_, tok_l1tau_, trigger::TriggerL1Jet, and trigger::TriggerL1Tau.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

61  {
62  // std::cout<<"get tau"<<std::endl;
63 
65  iEvent.getByToken(tok_l1tau_, l1Taus);
66 
67  // std::cout<<"get geom"<<std::endl;
68 
70  iSetup.get<CaloGeometryRecord>().get(pG);
71  const CaloGeometry* geo = pG.product();
72 
73  // std::cout<<" get ec rechit"<<std::endl;
74 
76  iEvent.getByToken(tok_EB_, ecalEB);
77 
79  iEvent.getByToken(tok_EE_, ecalEE);
80 
81  // std::cout<<"get l1 trig obj"<<std::endl;
82 
84  iEvent.getByToken(tok_hlt_, l1trigobj);
85 
86  std::vector<edm::Ref<l1t::TauBxCollection> > l1tauobjref;
87  std::vector<edm::Ref<l1t::JetBxCollection> > l1jetobjref;
88 
89  l1trigobj->getObjects(trigger::TriggerL1Tau, l1tauobjref);
90  l1trigobj->getObjects(trigger::TriggerL1Jet, l1jetobjref);
91 
92  double ptTriggered = -10;
93  double etaTriggered = -100;
94  double phiTriggered = -100;
95 
96  // std::cout<<"find highest pT triggered obj"<<std::endl;
97 
98  for (unsigned int p = 0; p < l1tauobjref.size(); p++) {
99  if (l1tauobjref[p]->pt() > ptTriggered) {
100  ptTriggered = l1tauobjref[p]->pt();
101  phiTriggered = l1tauobjref[p]->phi();
102  etaTriggered = l1tauobjref[p]->eta();
103  }
104  }
105  for (unsigned int p = 0; p < l1jetobjref.size(); p++) {
106  if (l1jetobjref[p]->pt() > ptTriggered) {
107  ptTriggered = l1jetobjref[p]->pt();
108  phiTriggered = l1jetobjref[p]->phi();
109  etaTriggered = l1jetobjref[p]->eta();
110  }
111  }
112 
113  auto iptcCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
114 
115  // std::cout<<"loop over l1taus"<<std::endl;
116 
117  for (l1extra::L1JetParticleCollection::const_iterator tit = l1Taus->begin(); tit != l1Taus->end(); tit++) {
118  double dphi = fabs(tit->phi() - phiTriggered);
119  if (dphi > M_PI)
120  dphi = 2 * M_PI - dphi;
121  double Rseed = sqrt(pow(etaTriggered - tit->eta(), 2) + dphi * dphi);
122  if (Rseed < 1.2)
123  continue;
124  int nhitOut = 0;
125  int nhitIn = 0;
126  double OutEnergy = 0;
127  double InEnergy = 0;
128  // std::cout<<" loops over rechits"<<std::endl;
129  for (EcalRecHitCollection::const_iterator eItr = ecalEB->begin(); eItr != ecalEB->end(); eItr++) {
130  double phiD, R;
131  const GlobalPoint& pos = geo->getPosition(eItr->detid());
132  double phihit = pos.phi();
133  double etahit = pos.eta();
134  phiD = fabs(phihit - tit->phi());
135  if (phiD > M_PI)
136  phiD = 2 * M_PI - phiD;
137  R = sqrt(pow(etahit - tit->eta(), 2) + phiD * phiD);
138 
139  if (R < OutConeSize_ && R > InConeSize_ && eItr->energy() > hitCountEthr_) {
140  nhitOut++;
141  }
142  if (R < InConeSize_ && eItr->energy() > hitCountEthr_) {
143  nhitIn++;
144  }
145 
146  if (R < OutConeSize_ && R > InConeSize_ && eItr->energy() > hitEthr_) {
147  OutEnergy += eItr->energy();
148  }
149  if (R < InConeSize_ && eItr->energy() > hitEthr_) {
150  InEnergy += eItr->energy();
151  }
152  }
153 
154  for (EcalRecHitCollection::const_iterator eItr = ecalEE->begin(); eItr != ecalEE->end(); eItr++) {
155  double phiD, R;
156  const GlobalPoint& pos = geo->getPosition(eItr->detid());
157  double phihit = pos.phi();
158  double etahit = pos.eta();
159  phiD = fabs(phihit - tit->phi());
160  if (phiD > M_PI)
161  phiD = 2 * M_PI - phiD;
162  R = sqrt(pow(etahit - tit->eta(), 2) + phiD * phiD);
163  if (R < OutConeSize_ && R > InConeSize_ && eItr->energy() > hitCountEthr_) {
164  nhitOut++;
165  }
166  if (R < InConeSize_ && eItr->energy() > hitCountEthr_) {
167  nhitIn++;
168  }
169  if (R < OutConeSize_ && R > InConeSize_ && eItr->energy() > hitEthr_) {
170  OutEnergy += eItr->energy();
171  }
172  if (R < InConeSize_ && eItr->energy() > hitEthr_) {
173  InEnergy += eItr->energy();
174  }
175  }
176  // std::cout<<"create and push_back candidate"<<std::endl;
178  l1extra::L1JetParticleRef(l1Taus, tit - l1Taus->begin()), InEnergy, OutEnergy, nhitIn, nhitOut);
179  iptcCollection->push_back(newca);
180  }
181 
182  //Use the ExampleData to create an ExampleData2 which
183  // is put into the Event
184 
185  // std::cout<<"put cand into event"<<std::endl;
186  iEvent.put(std::move(iptcCollection));
187 }
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
std::vector< EcalRecHit >::const_iterator const_iterator
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1tau_
T sqrt(T t)
Definition: SSEVec.h:18
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:74
#define M_PI
const_iterator end() const
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_
T eta() const
Definition: PV3DBase.h:76
T get() const
Definition: EventSetup.h:71
T const * product() const
Definition: ESHandle.h:86
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
def move(src, dest)
Definition: eostools.py:511
const_iterator begin() const

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::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> EcalIsolatedParticleCandidateProducer::tok_hlt_
private
edm::EDGetTokenT<l1extra::L1JetParticleCollection> EcalIsolatedParticleCandidateProducer::tok_l1tau_
private