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
EcalIsolatedParticleCandidateProducer Class Reference

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

Inheritance diagram for EcalIsolatedParticleCandidateProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalIsolatedParticleCandidateProducer (const edm::ParameterSet &)
 
 ~EcalIsolatedParticleCandidateProducer ()
 
- 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
 
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

const CaloGeometrygeo
 
double hitCountEthr_
 
double hitEthr_
 
double InConeSize_
 
double OutConeSize_
 
edm::EDGetTokenT
< EcalRecHitCollection
tok_EB_
 
edm::EDGetTokenT
< EcalRecHitCollection
tok_EE_
 
edm::EDGetTokenT
< trigger::TriggerFilterObjectWithRefs
tok_hlt_
 
edm::EDGetTokenT
< l1extra::L1JetParticleCollection
tok_l1tau_
 

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 21 of file EcalIsolatedParticleCandidateProducer.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file EcalIsolatedParticleCandidateProducer.cc.

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

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

Definition at line 56 of file EcalIsolatedParticleCandidateProducer.cc.

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

Member Function Documentation

void EcalIsolatedParticleCandidateProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 220 of file EcalIsolatedParticleCandidateProducer.cc.

220  {
221 }
void EcalIsolatedParticleCandidateProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 225 of file EcalIsolatedParticleCandidateProducer.cc.

225  {
226 }
void EcalIsolatedParticleCandidateProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 71 of file EcalIsolatedParticleCandidateProducer.cc.

References relval_parameters_module::energy, PV3DBase< T, PVType, FrameType >::eta(), geo, edm::EventSetup::get(), edm::Event::getByToken(), CaloGeometry::getPosition(), hitCountEthr_, hitEthr_, InConeSize_, AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::phi(), funct::pow(), RecoTauCleanerPlugins::pt, edm::Event::put(), dttmaxenums::R, mathSSE::sqrt(), tok_EB_, tok_EE_, tok_hlt_, tok_l1tau_, trigger::TriggerL1CenJet, and trigger::TriggerL1TauJet.

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

72 {
73 
74  using namespace edm;
75 
76 // std::cout<<"get tau"<<std::endl;
77 
79  iEvent.getByToken(tok_l1tau_,l1Taus);
80 
81 // std::cout<<"get geom"<<std::endl;
82 
84  iSetup.get<CaloGeometryRecord>().get(pG);
85  geo = pG.product();
86 
87 // std::cout<<" get ec rechit"<<std::endl;
88 
90  iEvent.getByToken(tok_EB_,ecalEB);
91 
93  iEvent.getByToken(tok_EE_,ecalEE);
94 
95 // std::cout<<"get l1 trig obj"<<std::endl;
96 
98  iEvent.getByToken(tok_hlt_, l1trigobj);
99 
100  std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1tauobjref;
101  std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1jetobjref;
102 
103  l1trigobj->getObjects(trigger::TriggerL1TauJet, l1tauobjref);
104  l1trigobj->getObjects(trigger::TriggerL1CenJet, l1jetobjref);
105 
106  double ptTriggered=-10;
107  double etaTriggered=-100;
108  double phiTriggered=-100;
109 
110 // std::cout<<"find highest pT triggered obj"<<std::endl;
111 
112  for (unsigned int p=0; p<l1tauobjref.size(); p++)
113  {
114  if (l1tauobjref[p]->pt()>ptTriggered)
115  {
116  ptTriggered=l1tauobjref[p]->pt();
117  phiTriggered=l1tauobjref[p]->phi();
118  etaTriggered=l1tauobjref[p]->eta();
119  }
120  }
121  for (unsigned int p=0; p<l1jetobjref.size(); p++)
122  {
123  if (l1jetobjref[p]->pt()>ptTriggered)
124  {
125  ptTriggered=l1jetobjref[p]->pt();
126  phiTriggered=l1jetobjref[p]->phi();
127  etaTriggered=l1jetobjref[p]->eta();
128  }
129  }
130 
132 
133 // std::cout<<"loop over l1taus"<<std::endl;
134 
135  for (l1extra::L1JetParticleCollection::const_iterator tit=l1Taus->begin(); tit!=l1Taus->end(); tit++)
136  {
137  double dphi=fabs(tit->phi()-phiTriggered);
138  if (dphi>3.1415926535) dphi=2*3.1415926535-dphi;
139  double Rseed=sqrt(pow(etaTriggered-tit->eta(),2)+dphi*dphi);
140  if (Rseed<1.2) continue;
141  int nhitOut=0;
142  int nhitIn=0;
143  double OutEnergy=0;
144  double InEnergy=0;
145 // std::cout<<" loops over rechits"<<std::endl;
146  for (EcalRecHitCollection::const_iterator eItr=ecalEB->begin(); eItr!=ecalEB->end(); eItr++)
147  {
148  double phiD, R;
149  GlobalPoint pos = geo->getPosition(eItr->detid());
150  double phihit = pos.phi();
151  double etahit = pos.eta();
152  phiD=fabs(phihit-tit->phi());
153  if (phiD>3.1415926535) phiD=2*3.1415926535-phiD;
154  R=sqrt(pow(etahit-tit->eta(),2)+phiD*phiD);
155 
156  if (R<OutConeSize_&&R>InConeSize_&&eItr->energy()>hitCountEthr_)
157  {
158  nhitOut++;
159  }
160  if (R<InConeSize_&&eItr->energy()>hitCountEthr_)
161  {
162  nhitIn++;
163  }
164 
165  if (R<OutConeSize_&&R>InConeSize_&&eItr->energy()>hitEthr_)
166  {
167  OutEnergy+=eItr->energy();
168  }
169  if (R<InConeSize_&&eItr->energy()>hitEthr_)
170  {
171  InEnergy+=eItr->energy();
172  }
173 
174  }
175 
176  for (EcalRecHitCollection::const_iterator eItr=ecalEE->begin(); eItr!=ecalEE->end(); eItr++)
177  {
178  double phiD, R;
179  GlobalPoint pos = geo->getPosition(eItr->detid());
180  double phihit = pos.phi();
181  double etahit = pos.eta();
182  phiD=fabs(phihit-tit->phi());
183  if (phiD>3.1415926535) phiD=2*3.1415926535-phiD;
184  R=sqrt(pow(etahit-tit->eta(),2)+phiD*phiD);
185  if (R<OutConeSize_&&R>InConeSize_&&eItr->energy()>hitCountEthr_)
186  {
187  nhitOut++;
188  }
189  if (R<InConeSize_&&eItr->energy()>hitCountEthr_)
190  {
191  nhitIn++;
192  }
193  if (R<OutConeSize_&&R>InConeSize_&&eItr->energy()>hitEthr_)
194  {
195  OutEnergy+=eItr->energy();
196  }
197  if (R<InConeSize_&&eItr->energy()>hitEthr_)
198  {
199  InEnergy+=eItr->energy();
200  }
201 
202  }
203 // std::cout<<"create and push_back candidate"<<std::endl;
204  reco::IsolatedPixelTrackCandidate newca(l1extra::L1JetParticleRef(l1Taus,tit-l1Taus->begin()), InEnergy, OutEnergy, nhitIn, nhitOut);
205  iptcCollection->push_back(newca);
206  }
207 
208 
209 
210  //Use the ExampleData to create an ExampleData2 which
211  // is put into the Event
212 
213 // std::cout<<"put cand into event"<<std::endl;
214  std::auto_ptr<reco::IsolatedPixelTrackCandidateCollection> pOut(iptcCollection);
215  iEvent.put(pOut);
216 
217 }
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
std::vector< EcalRecHit >::const_iterator const_iterator
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1tau_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
T sqrt(T t)
Definition: SSEVec.h:48
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
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_
const T & get() const
Definition: EventSetup.h:55
T eta() const
Definition: PV3DBase.h:76
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40

Member Data Documentation

const CaloGeometry* EcalIsolatedParticleCandidateProducer::geo
private

Definition at line 28 of file EcalIsolatedParticleCandidateProducer.h.

Referenced by produce().

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