CMS 3D CMS Logo

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

#include <Calibration/HcalIsolatedTrackReco/src/IsolatedEcalPixelTrackCandidateProducer.cc>

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

Public Member Functions

 IsolatedEcalPixelTrackCandidateProducer (const edm::ParameterSet &)
 
 ~IsolatedEcalPixelTrackCandidateProducer () 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 produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

const double coneSizeEta0_
 
const double coneSizeEta1_
 
const double hitCountEthr_
 
const double hitEthr_
 
const edm::EDGetTokenT< EcalRecHitCollectiontok_eb
 
const edm::EDGetTokenT< EcalRecHitCollectiontok_ee
 
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefstok_trigcand
 

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 20 of file IsolatedEcalPixelTrackCandidateProducer.h.

Constructor & Destructor Documentation

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

Definition at line 37 of file IsolatedEcalPixelTrackCandidateProducer.cc.

37  :
38  tok_ee( consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("EERecHitSource")) ),
39  tok_eb( consumes<EcalRecHitCollection>(conf.getParameter<edm::InputTag>("EBRecHitSource")) ),
40  tok_trigcand( consumes<trigger::TriggerFilterObjectWithRefs>(conf.getParameter<edm::InputTag>("filterLabel")) ),
41  coneSizeEta0_( conf.getParameter<double>("EcalConeSizeEta0") ),
42  coneSizeEta1_( conf.getParameter<double>("EcalConeSizeEta1") ),
43  hitCountEthr_( conf.getParameter<double>("ECHitCountEnergyThreshold") ),
44  hitEthr_( conf.getParameter<double>("ECHitEnergyThreshold") )
45 {
46  // register the products
47  produces< reco::IsolatedPixelTrackCandidateCollection >();
48 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< EcalRecHitCollection > tok_eb
const edm::EDGetTokenT< EcalRecHitCollection > tok_ee
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_trigcand
IsolatedEcalPixelTrackCandidateProducer::~IsolatedEcalPixelTrackCandidateProducer ( )
override

Definition at line 50 of file IsolatedEcalPixelTrackCandidateProducer.cc.

50 { }

Member Function Documentation

void IsolatedEcalPixelTrackCandidateProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivate

Definition at line 53 of file IsolatedEcalPixelTrackCandidateProducer.cc.

References funct::abs(), edm::SortedCollection< T, SORT >::begin(), coneSizeEta0_, coneSizeEta1_, reco::deltaR(), edm::SortedCollection< T, SORT >::end(), PVValHelper::eta, PV3DBase< T, PVType, FrameType >::eta(), edm::EventSetup::get(), edm::Event::getByToken(), trigger::TriggerRefsCollections::getObjects(), CaloGeometry::getPosition(), hitCountEthr_, hitEthr_, edm::HandleBase::isValid(), eostools::move(), AlCaHLTBitMon_ParallelJobs::p, phi, PV3DBase< T, PVType, FrameType >::phi(), edm::ESHandle< T >::product(), edm::Event::put(), dttmaxenums::R, reco::IsolatedPixelTrackCandidate::setEnergyIn(), reco::IsolatedPixelTrackCandidate::setEnergyOut(), reco::IsolatedPixelTrackCandidate::setNHitIn(), reco::IsolatedPixelTrackCandidate::setNHitOut(), edm::SortedCollection< T, SORT >::size(), tok_eb, tok_ee, tok_trigcand, HiIsolationCommonParameters_cff::track, and trigger::TriggerTrack.

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

53  {
54 #ifdef DebugLog
55  edm::LogInfo("HcalIsoTrack") << "==============Inside IsolatedEcalPixelTrackCandidateProducer";
56 #endif
58  iSetup.get<CaloGeometryRecord>().get(pG);
59  const CaloGeometry* geo = pG.product();
60 
62  iEvent.getByToken(tok_eb,ecalEB);
63 
65  iEvent.getByToken(tok_ee,ecalEE);
66 #ifdef DebugLog
67  edm::LogInfo("HcalIsoTrack") << "ecal Collections isValid: " << ecalEB.isValid() << "/" << ecalEE.isValid();
68 #endif
69 
71  iEvent.getByToken(tok_trigcand,trigCand);
72 
73  std::vector< edm::Ref<reco::IsolatedPixelTrackCandidateCollection> > isoPixTrackRefs;
74  trigCand->getObjects(trigger::TriggerTrack, isoPixTrackRefs);
75  int nCand=isoPixTrackRefs.size();
76 
77  auto iptcCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
78 #ifdef DebugLog
79  edm::LogInfo("HcalIsoTrack") << "coneSize_ " << coneSizeEta0_ << "/"<< coneSizeEta1_ << " hitCountEthr_ " << hitCountEthr_ << " hitEthr_ " << hitEthr_;
80 #endif
81  for (int p=0; p<nCand; p++) {
82  int nhitIn(0), nhitOut(0);
83  double inEnergy(0), outEnergy(0);
84  std::pair<double,double> etaPhi(isoPixTrackRefs[p]->track()->eta(), isoPixTrackRefs[p]->track()->phi());
85  if (isoPixTrackRefs[p]->etaPhiEcalValid()) etaPhi = isoPixTrackRefs[p]->etaPhiEcal();
86  double etaAbs = std::abs(etaPhi.first);
87  double coneSize_ = (etaAbs > 1.5) ? coneSizeEta1_ : (coneSizeEta0_*(1.5-etaAbs)+coneSizeEta1_*etaAbs)/1.5;
88 #ifdef DebugLog
89  edm::LogInfo("HcalIsoTrack") << "Track: eta/phi " << etaPhi.first << "/" << etaPhi.second << " pt:" << isoPixTrackRefs[p]->track()->pt() << " cone " << coneSize_ << "\n" << "rechit size EB/EE : " << ecalEB->size() << "/" << ecalEE->size() << " coneSize_: " << coneSize_;
90 #endif
91  if (etaAbs<1.7) {
92  for (EcalRecHitCollection::const_iterator eItr=ecalEB->begin(); eItr!=ecalEB->end(); eItr++) {
93  const GlobalPoint& pos = geo->getPosition(eItr->detid());
94  double R = reco::deltaR(pos.eta(),pos.phi(),etaPhi.first,etaPhi.second);
95  if (R < coneSize_) {
96  nhitIn++;
97  inEnergy += (eItr->energy());
98  if (eItr->energy() > hitCountEthr_) nhitOut++;
99  if (eItr->energy() > hitEthr_) outEnergy += (eItr->energy());
100 #ifdef DebugLog
101  edm::LogInfo("HcalIsoTrack") << "Rechit Close to the track has energy " << eItr->energy() << " eta/phi: " << pos.eta() << "/" << pos.phi() << " deltaR: " << R;
102 #endif
103  }
104  }
105  }
106  if (etaAbs>1.25) {
107  for (EcalRecHitCollection::const_iterator eItr=ecalEE->begin(); eItr!=ecalEE->end(); eItr++) {
108  const GlobalPoint& pos = geo->getPosition(eItr->detid());
109  double R = reco::deltaR(pos.eta(),pos.phi(),etaPhi.first,etaPhi.second);
110  if (R < coneSize_) {
111  nhitIn++;
112  inEnergy += (eItr->energy());
113  if (eItr->energy() > hitCountEthr_) nhitOut++;
114  if (eItr->energy() > hitEthr_) outEnergy += (eItr->energy());
115 #ifdef DebugLog
116  edm::LogInfo("HcalIsoTrack") << "Rechit Close to the track has energy " << eItr->energy() << " eta/phi: " << pos.eta() << "/" << pos.phi() << " deltaR: " << R;
117 #endif
118  }
119  }
120  }
121 #ifdef DebugLog
122  edm::LogInfo("HcalIsoTrack") << "nhitIn:" << nhitIn << " inEnergy:" << inEnergy << " nhitOut:" << nhitOut << " outEnergy:" << outEnergy;
123 #endif
124  reco::IsolatedPixelTrackCandidate newca(*isoPixTrackRefs[p]);
125  newca.setEnergyIn(inEnergy);
126  newca.setEnergyOut(outEnergy);
127  newca.setNHitIn(nhitIn);
128  newca.setNHitOut(nhitOut);
129  iptcCollection->push_back(newca);
130  }
131 #ifdef DebugLog
132  edm::LogInfo("HcalIsoTrack") << "ncand:" << nCand << " outcollction size:" << iptcCollection->size();
133 #endif
134  iEvent.put(std::move(iptcCollection));
135 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
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
const edm::EDGetTokenT< EcalRecHitCollection > tok_eb
const edm::EDGetTokenT< EcalRecHitCollection > tok_ee
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:70
bool isValid() const
Definition: HandleBase.h:74
const_iterator end() const
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_trigcand
const T & get() const
Definition: EventSetup.h:55
T eta() const
Definition: PV3DBase.h:76
size_type size() const
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510
const_iterator begin() const

Member Data Documentation

const double IsolatedEcalPixelTrackCandidateProducer::coneSizeEta0_
private

Definition at line 32 of file IsolatedEcalPixelTrackCandidateProducer.h.

Referenced by produce().

const double IsolatedEcalPixelTrackCandidateProducer::coneSizeEta1_
private

Definition at line 33 of file IsolatedEcalPixelTrackCandidateProducer.h.

Referenced by produce().

const double IsolatedEcalPixelTrackCandidateProducer::hitCountEthr_
private

Definition at line 34 of file IsolatedEcalPixelTrackCandidateProducer.h.

Referenced by produce().

const double IsolatedEcalPixelTrackCandidateProducer::hitEthr_
private

Definition at line 35 of file IsolatedEcalPixelTrackCandidateProducer.h.

Referenced by produce().

const edm::EDGetTokenT<EcalRecHitCollection> IsolatedEcalPixelTrackCandidateProducer::tok_eb
private

Definition at line 30 of file IsolatedEcalPixelTrackCandidateProducer.h.

Referenced by produce().

const edm::EDGetTokenT<EcalRecHitCollection> IsolatedEcalPixelTrackCandidateProducer::tok_ee
private

Definition at line 29 of file IsolatedEcalPixelTrackCandidateProducer.h.

Referenced by produce().

const edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> IsolatedEcalPixelTrackCandidateProducer::tok_trigcand
private

Definition at line 31 of file IsolatedEcalPixelTrackCandidateProducer.h.

Referenced by produce().