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
 
- 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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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 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 37 of file EcalIsolatedParticleCandidateProducer.cc.

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

38 {
39  InConeSize_ = conf.getParameter<double>("EcalInnerConeSize");
40  OutConeSize_= conf.getParameter<double>("EcalOuterConeSize");
41  hitCountEthr_= conf.getParameter<double>("ECHitCountEnergyThreshold");
42  hitEthr_=conf.getParameter<double>("ECHitEnergyThreshold");
43  tok_l1tau_ = consumes<l1extra::L1JetParticleCollection>(conf.getParameter<edm::InputTag>("L1eTauJetsSource"));
44  tok_hlt_ = consumes<trigger::TriggerFilterObjectWithRefs>(conf.getParameter<edm::InputTag>("L1GTSeedLabel"));
45  tok_EB_ = consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("EBrecHitCollectionLabel"));
46  tok_EE_ = consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("EErecHitCollectionLabel"));
47 
48  //register your products
49  produces< reco::IsolatedPixelTrackCandidateCollection >();
50 
51 }
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 54 of file EcalIsolatedParticleCandidateProducer.cc.

55 {
56 
57  // do anything here that needs to be done at desctruction time
58  // (e.g. close files, deallocate resources etc.)
59 
60 }

Member Function Documentation

void EcalIsolatedParticleCandidateProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 199 of file EcalIsolatedParticleCandidateProducer.cc.

199  {
200 }
void EcalIsolatedParticleCandidateProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 204 of file EcalIsolatedParticleCandidateProducer.cc.

Referenced by o2olib.O2ORunMgr::executeJob().

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

Definition at line 69 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().

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