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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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

edm::InputTag EBrecHitCollectionLabel_
 
edm::InputTag EErecHitCollectionLabel_
 
const CaloGeometrygeo
 
double hitCountEthr_
 
double hitEthr_
 
edm::InputTag hltGTseedlabel_
 
double InConeSize_
 
edm::InputTag l1tausource_
 
double OutConeSize_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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 19 of file EcalIsolatedParticleCandidateProducer.h.

Constructor & Destructor Documentation

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

Definition at line 42 of file EcalIsolatedParticleCandidateProducer.cc.

References EBrecHitCollectionLabel_, EErecHitCollectionLabel_, edm::ParameterSet::getParameter(), hitCountEthr_, hitEthr_, hltGTseedlabel_, InConeSize_, l1tausource_, and OutConeSize_.

43 {
44  InConeSize_ = conf.getParameter<double>("EcalInnerConeSize");
45  OutConeSize_= conf.getParameter<double>("EcalOuterConeSize");
46  hitCountEthr_= conf.getParameter<double>("ECHitCountEnergyThreshold");
47  hitEthr_=conf.getParameter<double>("ECHitEnergyThreshold");
48  l1tausource_=conf.getParameter<edm::InputTag>("L1eTauJetsSource");
49  hltGTseedlabel_=conf.getParameter<edm::InputTag>("L1GTSeedLabel");
50  EBrecHitCollectionLabel_=conf.getParameter<edm::InputTag>("EBrecHitCollectionLabel");
51  EErecHitCollectionLabel_=conf.getParameter<edm::InputTag>("EErecHitCollectionLabel");
52 
53  //register your products
54  produces< reco::IsolatedPixelTrackCandidateCollection >();
55 
56 }
T getParameter(std::string const &) const
EcalIsolatedParticleCandidateProducer::~EcalIsolatedParticleCandidateProducer ( )

Definition at line 59 of file EcalIsolatedParticleCandidateProducer.cc.

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

Member Function Documentation

void EcalIsolatedParticleCandidateProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 223 of file EcalIsolatedParticleCandidateProducer.cc.

223  {
224 }
void EcalIsolatedParticleCandidateProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 228 of file EcalIsolatedParticleCandidateProducer.cc.

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

Implements edm::EDProducer.

Definition at line 74 of file EcalIsolatedParticleCandidateProducer.cc.

References EBrecHitCollectionLabel_, EErecHitCollectionLabel_, relval_parameters_module::energy, PV3DBase< T, PVType, FrameType >::eta(), geo, edm::EventSetup::get(), edm::Event::getByLabel(), CaloGeometry::getPosition(), hitCountEthr_, hitEthr_, hltGTseedlabel_, InConeSize_, l1tausource_, AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::phi(), pos, funct::pow(), edm::Event::put(), dttmaxenums::R, mathSSE::sqrt(), trigger::TriggerL1CenJet, and trigger::TriggerL1TauJet.

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

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

edm::InputTag EcalIsolatedParticleCandidateProducer::EBrecHitCollectionLabel_
private
edm::InputTag EcalIsolatedParticleCandidateProducer::EErecHitCollectionLabel_
private
const CaloGeometry* EcalIsolatedParticleCandidateProducer::geo
private

Definition at line 26 of file EcalIsolatedParticleCandidateProducer.h.

Referenced by produce().

double EcalIsolatedParticleCandidateProducer::hitCountEthr_
private
double EcalIsolatedParticleCandidateProducer::hitEthr_
private
edm::InputTag EcalIsolatedParticleCandidateProducer::hltGTseedlabel_
private
double EcalIsolatedParticleCandidateProducer::InConeSize_
private
edm::InputTag EcalIsolatedParticleCandidateProducer::l1tausource_
private
double EcalIsolatedParticleCandidateProducer::OutConeSize_
private