CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 IsolatedEcalPixelTrackCandidateProducer (const edm::ParameterSet &)
 
 ~IsolatedEcalPixelTrackCandidateProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

double coneSizeEta0_
 
double coneSizeEta1_
 
double hitCountEthr_
 
double hitEthr_
 
edm::EDGetTokenT
< EcalRecHitCollection
tok_eb
 
edm::EDGetTokenT
< EcalRecHitCollection
tok_ee
 
edm::EDGetTokenT
< trigger::TriggerFilterObjectWithRefs
tok_trigcand
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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.

References coneSizeEta0_, coneSizeEta1_, edm::ParameterSet::getParameter(), hitCountEthr_, hitEthr_, tok_eb, tok_ee, and tok_trigcand.

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

Definition at line 51 of file IsolatedEcalPixelTrackCandidateProducer.cc.

51 { }

Member Function Documentation

void IsolatedEcalPixelTrackCandidateProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 142 of file IsolatedEcalPixelTrackCandidateProducer.cc.

142 { }
void IsolatedEcalPixelTrackCandidateProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 145 of file IsolatedEcalPixelTrackCandidateProducer.cc.

145 { }
void IsolatedEcalPixelTrackCandidateProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 54 of file IsolatedEcalPixelTrackCandidateProducer.cc.

References funct::abs(), coneSizeEta0_, coneSizeEta1_, gather_cfg::cout, reco::deltaR(), PV3DBase< T, PVType, FrameType >::eta(), eta(), edm::EventSetup::get(), edm::Event::getByToken(), CaloGeometry::getPosition(), hitCountEthr_, hitEthr_, edm::HandleBase::isValid(), AlCaHLTBitMon_ParallelJobs::p, phi, PV3DBase< T, PVType, FrameType >::phi(), edm::ESHandle< class >::product(), edm::Event::put(), dttmaxenums::R, reco::IsolatedPixelTrackCandidate::SetEnergyIn(), reco::IsolatedPixelTrackCandidate::SetEnergyOut(), reco::IsolatedPixelTrackCandidate::SetNHitIn(), reco::IsolatedPixelTrackCandidate::SetNHitOut(), tok_eb, tok_ee, tok_trigcand, and trigger::TriggerTrack.

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

54  {
55 #ifdef DebugLog
56  std::cout << "==============Inside IsolatedEcalPixelTrackCandidateProducer" << std::endl;
57 #endif
59  iSetup.get<CaloGeometryRecord>().get(pG);
60  const CaloGeometry* geo = pG.product();
61 
63  iEvent.getByToken(tok_eb,ecalEB);
64 
66  iEvent.getByToken(tok_ee,ecalEE);
67 #ifdef DebugLog
68  std::cout << "ecal Collections isValid: " << ecalEB.isValid() << "/" << ecalEE.isValid() << std::endl;
69 #endif
70 
72  iEvent.getByToken(tok_trigcand,trigCand);
73 
74  std::vector< edm::Ref<reco::IsolatedPixelTrackCandidateCollection> > isoPixTrackRefs;
75  trigCand->getObjects(trigger::TriggerTrack, isoPixTrackRefs);
76  int nCand=isoPixTrackRefs.size();
77 
79 #ifdef DebugLog
80  std::cout << "coneSize_ " << coneSizeEta0_ << "/"<< coneSizeEta1_ << " hitCountEthr_ " << hitCountEthr_ << " hitEthr_ " << hitEthr_ << std::endl;
81 #endif
82  for (int p=0; p<nCand; p++) {
83  int nhitIn(0), nhitOut(0);
84  double inEnergy(0), outEnergy(0);
85  std::pair<double,double> etaPhi(isoPixTrackRefs[p]->track()->eta(), isoPixTrackRefs[p]->track()->phi());
86  if (isoPixTrackRefs[p]->etaPhiEcal()) etaPhi = isoPixTrackRefs[p]->EtaPhiEcal();
87  double etaAbs = std::abs(etaPhi.first);
88  double coneSize_ = (etaAbs > 1.5) ? coneSizeEta1_ : (coneSizeEta0_*(1.5-etaAbs)+coneSizeEta1_*etaAbs)/1.5;
89 #ifdef DebugLog
90  std::cout << "Track: eta/phi " << etaPhi.first << "/" << etaPhi.second << " pt:" << isoPixTrackRefs[p]->track()->pt() << " cone " << coneSize_ << std::endl;
91  std::cout << "rechit size EB/EE : " << ecalEB->size() << "/" << ecalEE->size() << " coneSize_: " << coneSize_ << std::endl;
92 #endif
93  if (etaAbs<1.7) {
94  for (EcalRecHitCollection::const_iterator eItr=ecalEB->begin(); eItr!=ecalEB->end(); eItr++) {
95  GlobalPoint pos = geo->getPosition(eItr->detid());
96  double R = reco::deltaR(pos.eta(),pos.phi(),etaPhi.first,etaPhi.second);
97  if (R < coneSize_) {
98  nhitIn++;
99  inEnergy += (eItr->energy());
100  if (eItr->energy() > hitCountEthr_) nhitOut++;
101  if (eItr->energy() > hitEthr_) outEnergy += (eItr->energy());
102 #ifdef DebugLog
103  std::cout << "Rechit Close to the track has energy " << eItr->energy()
104  << " eta/phi: " << pos.eta() << "/" << pos.phi() << " deltaR: " << R << std::endl;
105 #endif
106  }
107  }
108  }
109  if (etaAbs>1.25) {
110  for (EcalRecHitCollection::const_iterator eItr=ecalEE->begin(); eItr!=ecalEE->end(); eItr++) {
111  GlobalPoint pos = geo->getPosition(eItr->detid());
112  double R = reco::deltaR(pos.eta(),pos.phi(),etaPhi.first,etaPhi.second);
113  if (R < coneSize_) {
114  nhitIn++;
115  inEnergy += (eItr->energy());
116  if (eItr->energy() > hitCountEthr_) nhitOut++;
117  if (eItr->energy() > hitEthr_) outEnergy += (eItr->energy());
118 #ifdef DebugLog
119  std::cout << "Rechit Close to the track has energy " << eItr->energy()
120  << " eta/phi: " << pos.eta() << "/" << pos.phi() << " deltaR: " << R << std::endl;
121 #endif
122  }
123  }
124  }
125 #ifdef DebugLog
126  std::cout << "nhitIn:" << nhitIn << " inEnergy:" << inEnergy << " nhitOut:" << nhitOut << " outEnergy:" << outEnergy << std::endl;
127 #endif
128  reco::IsolatedPixelTrackCandidate newca(*isoPixTrackRefs[p]);
129  newca.SetEnergyIn(inEnergy);
130  newca.SetEnergyOut(outEnergy);
131  newca.SetNHitIn(nhitIn);
132  newca.SetNHitOut(nhitOut);
133  iptcCollection->push_back(newca);
134  }
135 #ifdef DebugLog
136  std::cout << "ncand:" << nCand << " outcollction size:" << iptcCollection->size() << std::endl;
137 #endif
138  std::auto_ptr<reco::IsolatedPixelTrackCandidateCollection> outCollection(iptcCollection);
139  iEvent.put(outCollection);
140 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
std::vector< EcalRecHit >::const_iterator const_iterator
double deltaR(const T1 &t1, const T2 &t2)
Definition: deltaR.h:48
T eta() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:68
std::vector< IsolatedPixelTrackCandidate > IsolatedPixelTrackCandidateCollection
collectin of IsolatedPixelTrackCandidate objects
bool isValid() const
Definition: HandleBase.h:76
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
T eta() const
Definition: PV3DBase.h:76
tuple cout
Definition: gather_cfg.py:121
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_trigcand
Definition: DDAxes.h:10

Member Data Documentation

double IsolatedEcalPixelTrackCandidateProducer::coneSizeEta0_
private
double IsolatedEcalPixelTrackCandidateProducer::coneSizeEta1_
private
double IsolatedEcalPixelTrackCandidateProducer::hitCountEthr_
private
double IsolatedEcalPixelTrackCandidateProducer::hitEthr_
private
edm::EDGetTokenT<EcalRecHitCollection> IsolatedEcalPixelTrackCandidateProducer::tok_eb
private
edm::EDGetTokenT<EcalRecHitCollection> IsolatedEcalPixelTrackCandidateProducer::tok_ee
private
edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> IsolatedEcalPixelTrackCandidateProducer::tok_trigcand
private