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 | Static Private Attributes
ParticleTowerProducer Class Reference

#include <RecoHI/ParticleTowerProducer/src/ParticleTowerProducer.cc>

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

Public Member Functions

 ParticleTowerProducer (const edm::ParameterSet &)
 
 ~ParticleTowerProducer ()
 
- 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 ()
 
int eta2ieta (double eta) const
 
DetId getNearestTower (const reco::PFCandidate &in) const
 
DetId getNearestTower (double eta, double phi) const
 
int phi2iphi (double phi, int ieta) const
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
void resetTowers (edm::Event &iEvent, const edm::EventSetup &iSetup)
 

Private Attributes

double etaedge [42]
 
CaloGeometry const * geo_
 
double PI
 
TRandom * random_
 
edm::InputTag src_
 
std::map< DetId, double > towers_
 
bool useHF_
 

Static Private Attributes

static const double etacent []
 
static const double etatow []
 

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 30 of file ParticleTowerProducer.h.

Constructor & Destructor Documentation

ParticleTowerProducer::ParticleTowerProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 65 of file ParticleTowerProducer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), Pi, PI, random_, src_, and useHF_.

65  :
66  geo_(0)
67 {
68  //register your products
69  src_ = iConfig.getParameter<edm::InputTag>("src");
70  useHF_ = iConfig.getUntrackedParameter<bool>("useHF");
71 
72  produces<CaloTowerCollection>();
73 
74  //now do what ever other initialization is needed
75  random_ = new TRandom();
76  PI = TMath::Pi();
77 
78 
79 
80 }
const double Pi
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
CaloGeometry const * geo_
ParticleTowerProducer::~ParticleTowerProducer ( )

Definition at line 83 of file ParticleTowerProducer.cc.

84 {
85 
86  // do anything here that needs to be done at desctruction time
87  // (e.g. close files, deallocate resources etc.)
88 
89 }

Member Function Documentation

void ParticleTowerProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 210 of file ParticleTowerProducer.cc.

References etacent, etaedge, etatow, i, and useHF_.

211 {
212  // tower edges from fast sim, used starting at index 30 for the HF
213  const double etatow[42] = {0.000, 0.087, 0.174, 0.261, 0.348, 0.435, 0.522, 0.609, 0.696, 0.783, 0.870, 0.957, 1.044, 1.131, 1.218, 1.305, 1.392, 1.479, 1.566, 1.653, 1.740, 1.830, 1.930, 2.043, 2.172, 2.322, 2.500, 2.650, 2.853, 3.000, 3.139, 3.314, 3.489, 3.664, 3.839, 4.013, 4.191, 4.363, 4.538, 4.716, 4.889, 5.191};
214 
215  // tower centers derived directly from by looping over HCAL towers and printing out the values, used up until eta = 3 where the HF/Endcap interface becomes problematic
216  const double etacent[40] = {
217  0.0435, // 1
218  0.1305, // 2
219  0.2175, // 3
220  0.3045, // 4
221  0.3915, // 5
222  0.4785, // 6
223  0.5655, // 7
224  0.6525, // 8
225  0.7395, // 9
226  0.8265, // 10
227  0.9135, // 11
228  1.0005, // 12
229  1.0875, // 13
230  1.1745, // 14
231  1.2615, // 15
232  1.3485, // 16
233  1.4355, // 17
234  1.5225, // 18
235  1.6095, // 19
236  1.6965, // 20
237  1.785 , // 21
238  1.88 , // 22
239  1.9865, // 23
240  2.1075, // 24
241  2.247 , // 25
242  2.411 , // 26
243  2.575 , // 27
244  2.759 , // 28
245  2.934 , // 29
246  2.90138,// 29
247  3.04448,// 30
248  3.21932,// 31
249  3.39462,// 32
250  3.56966,// 33
251  3.74485,// 34
252  3.91956,// 35
253  4.09497,// 36
254  4.27007,// 37
255  4.44417,// 38
256  4.62046 // 39
257  };
258 
259  // Use the real towers centrers for the barrel and endcap up to eta=3
260  etaedge[0] = 0.;
261  for(int i=1;i<30;i++){
262  etaedge[i] = (etacent[i-1]-etaedge[i-1])*2.0 + etaedge[i-1];
263  //std::cout<<" i "<<i<<" etaedge "<<etaedge[i]<<std::endl;
264  }
265  // beyond eta = 3 just use the fast sim values
266  if(useHF_){
267  for(int i=30;i<42;i++){
268  etaedge[i]=etatow[i];
269  //std::cout<<" i "<<i<<" etaedge "<<etaedge[i]<<std::endl;
270  }
271  }
272 }
int i
Definition: DBlmapReader.cc:9
static const double etatow[]
static const double etacent[]
void ParticleTowerProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 276 of file ParticleTowerProducer.cc.

276  {
277 }
int ParticleTowerProducer::eta2ieta ( double  eta) const
private

Definition at line 466 of file ParticleTowerProducer.cc.

References gather_cfg::cout, etaedge, getDQMSummary::iter, findQualityFiles::size, relval_parameters_module::step, useHF_, and x.

Referenced by produce().

466  {
467  // binary search in the array of towers eta edges
468 
469  if(fabs(eta)>etaedge[41]) return 41;
470  int size = 42;
471  if(!useHF_) size = 30;
472 
473  double x = fabs(eta);
474  int curr = size / 2;
475  int step = size / 4;
476  int iter;
477  int prevdir = 0;
478  int actudir = 0;
479 
480  for (iter = 0; iter < size ; iter++) {
481 
482  if( curr >= size || curr < 1 )
483  std::cout << " ParticleTowerProducer::eta2ieta - wrong current index = "
484  << curr << " !!!" << std::endl;
485 
486  if ((x <= etaedge[curr]) && (x > etaedge[curr-1])) break;
487  prevdir = actudir;
488  if(x > etaedge[curr]) {actudir = 1;}
489  else {actudir = -1;}
490  if(prevdir * actudir < 0) { if(step > 1) step /= 2;}
491  curr += actudir * step;
492  if(curr > size) curr = size;
493  else { if(curr < 1) {curr = 1;}}
494 
495  /*
496  std::cout << " HCALProperties::eta2ieta end of iter." << iter
497  << " curr, etaedge[curr-1], etaedge[curr] = "
498  << curr << " " << etaedge[curr-1] << " " << etaedge[curr] << std::endl;
499  */
500 
501  }
502 
503  /*
504  std::cout << " HCALProperties::eta2ieta for input x = " << x
505  << " found index = " << curr-1
506  << std::endl;
507  */
508 
509  return curr;
510 }
T eta() const
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
tuple size
Write out results.
DetId ParticleTowerProducer::getNearestTower ( const reco::PFCandidate in) const
private

Definition at line 322 of file ParticleTowerProducer.cc.

References funct::abs(), deltaR(), reco::deltaR(), HcalDetId::depth(), PV3DBase< T, PVType, FrameType >::eta(), eta(), reco::LeafCandidate::eta(), geo_, CaloGeometry::getGeometry(), CaloCellGeometry::getPosition(), CaloGeometry::getValidDetIds(), DetId::Hcal, phi, PV3DBase< T, PVType, FrameType >::phi(), and reco::LeafCandidate::phi().

322  {
323 
324  double eta = in.eta();
325  double phi = in.phi();
326 
327  double minDeltaR = 9999;
328 
329  std::vector<DetId> alldid = geo_->getValidDetIds();
330 
331  DetId returnId;
332 
333  //int nclosetowers=0;
334 
335  for(std::vector<DetId>::const_iterator did=alldid.begin(); did != alldid.end(); did++){
336  if( (*did).det() == DetId::Hcal ){
337 
338  HcalDetId hid(*did);
339 
340  // which layer is irrelevant for an eta-phi map, no?
341 
342  if( hid.depth() != 1 ) continue;
343 
344  GlobalPoint pos =geo_->getGeometry(hid)->getPosition();
345 
346  double hcalEta = pos.eta();
347  double hcalPhi = pos.phi();
348 
349  //std::cout<<" transverse distance = "<<sqrt(pos.x()*pos.x()+pos.y()*pos.y())<<std::endl;
350 
351  //std::cout<<" ieta "<<(hid).ieta()<<" iphi "<<(hid).iphi()<<" hcalEta "<<hcalEta<<" hcalPhi "<<hcalPhi<<std::endl;
352 
353  double deltaR = reco::deltaR(eta,phi,hcalEta,hcalPhi);
354 
355  // need to factor in the size of the tower
356  double towersize = 0.087;
357 
358  int ieta = (hid).ieta();
359 
360  if(abs(ieta)>21){
361  if(abs(ieta)>29) towersize=0.175;
362  else{
363  if(abs(ieta)==22) towersize=0.1;
364  else if(abs(ieta)==23) towersize=0.113;
365  else if(abs(ieta)==24) towersize=0.129;
366  else if(abs(ieta)==25) towersize=0.16;
367  else if(abs(ieta)==26) towersize=0.168;
368  else if(abs(ieta)==27) towersize=0.15;
369  else if(abs(ieta)==28) towersize=0.218;
370  else if(abs(ieta)==29) towersize=0.132;
371  }
372  }
373 
374  deltaR /= towersize;
375  //if(deltaR<1/3.) nclosetowers++;
376 
377  if(deltaR<minDeltaR){
378  returnId = DetId(*did);
379  minDeltaR = deltaR;
380  }
381 
382  //if(abs(eta-hcalEta)<towersize/2. && abs(phi-hcalPhi)<towersize/2.) break;
383  }
384  }
385  //if(nclosetowers>1)std::cout<<"eta "<<eta<<" phi "<<phi<<" minDeltaR "<<minDeltaR<<" nclosetowers "<<nclosetowers<<std::endl;
386  return returnId;
387 
388 
389 }
virtual float phi() const
momentum azimuthal angle
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
double deltaR(const T1 &t1, const T2 &t2)
Definition: deltaR.h:48
T eta() const
virtual float eta() const
momentum pseudorapidity
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
Definition: DetId.h:18
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:90
T eta() const
Definition: PV3DBase.h:76
const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:76
CaloGeometry const * geo_
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
Definition: DDAxes.h:10
DetId ParticleTowerProducer::getNearestTower ( double  eta,
double  phi 
) const
private

Definition at line 392 of file ParticleTowerProducer.cc.

References funct::abs(), deltaR(), reco::deltaR(), HcalDetId::depth(), PV3DBase< T, PVType, FrameType >::eta(), geo_, CaloGeometry::getGeometry(), CaloCellGeometry::getPosition(), CaloGeometry::getValidDetIds(), DetId::Hcal, and PV3DBase< T, PVType, FrameType >::phi().

392  {
393 
394  // get closest tower by delta R matching
395  // Now obsolute, instead use faster premade eta-phi grid
396 
397  double minDeltaR = 9999;
398 
399  std::vector<DetId> alldid = geo_->getValidDetIds();
400 
401  DetId returnId;
402 
403  //int nclosetowers=0;
404 
405  for(std::vector<DetId>::const_iterator did=alldid.begin(); did != alldid.end(); did++){
406  if( (*did).det() == DetId::Hcal ){
407 
408  HcalDetId hid(*did);
409 
410  // which layer is irrelevant for an eta-phi map, no?
411 
412  if( hid.depth() != 1 ) continue;
413 
414  GlobalPoint pos =geo_->getGeometry(hid)->getPosition();
415 
416  double hcalEta = pos.eta();
417  double hcalPhi = pos.phi();
418 
419  //std::cout<<" transverse distance = "<<sqrt(pos.x()*pos.x()+pos.y()*pos.y())<<std::endl;
420 
421  //std::cout<<" ieta "<<(hid).ieta()<<" iphi "<<(hid).iphi()<<" hcalEta "<<hcalEta<<" hcalPhi "<<hcalPhi<<std::endl;
422 
423  double deltaR = reco::deltaR(eta,phi,hcalEta,hcalPhi);
424 
425  // need to factor in the size of the tower
426  double towersize = 0.087;
427 
428  int ieta = (hid).ieta();
429 
430  if(abs(ieta)>21){
431  if(abs(ieta)>29) towersize=0.175;
432  else{
433  if(abs(ieta)==22) towersize=0.1;
434  else if(abs(ieta)==23) towersize=0.113;
435  else if(abs(ieta)==24) towersize=0.129;
436  else if(abs(ieta)==25) towersize=0.16;
437  else if(abs(ieta)==26) towersize=0.168;
438  else if(abs(ieta)==27) towersize=0.15;
439  else if(abs(ieta)==28) towersize=0.218;
440  else if(abs(ieta)==29) towersize=0.132;
441  }
442  }
443 
444  deltaR /= towersize;
445  //if(deltaR<1/3.) nclosetowers++;
446 
447  if(deltaR<minDeltaR){
448  returnId = DetId(*did);
449  minDeltaR = deltaR;
450  }
451 
452  //if(abs(eta-hcalEta)<towersize/2. && abs(phi-hcalPhi)<towersize/2.) break;
453  }
454  }
455  //if(nclosetowers>1)std::cout<<"eta "<<eta<<" phi "<<phi<<" minDeltaR "<<minDeltaR<<" nclosetowers "<<nclosetowers<<std::endl;
456  return returnId;
457 
458 
459 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
double deltaR(const T1 &t1, const T2 &t2)
Definition: deltaR.h:48
T eta() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
Definition: DetId.h:18
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:90
T eta() const
Definition: PV3DBase.h:76
const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:76
CaloGeometry const * geo_
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
Definition: DDAxes.h:10
int ParticleTowerProducer::phi2iphi ( double  phi,
int  ieta 
) const
private

Definition at line 512 of file ParticleTowerProducer.cc.

References funct::abs(), and PI.

Referenced by produce().

512  {
513 
514  if(phi<0) phi += 2.*PI;
515  else if(phi> 2.*PI) phi -= 2.*PI;
516 
517  int iphi = (int) TMath::Ceil(phi/2.0/PI*72.);
518  // take into account larger granularity in endcap (x2) and at the end of the HF (x4)
519  if(abs(ieta)>20){
520  if(abs(ieta)<40) iphi -= (iphi+1)%2;
521  else {
522  iphi -= (iphi+1)%4;
523  if(iphi==-1) iphi=71;
524  }
525  }
526 
527  return iphi;
528 
529 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: DDAxes.h:10
void ParticleTowerProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 98 of file ParticleTowerProducer.cc.

References funct::abs(), reco::LeafCandidate::et(), PV3DBase< T, PVType, FrameType >::eta(), eta(), reco::LeafCandidate::eta(), eta2ieta(), geo_, edm::EventSetup::get(), edm::Event::getByLabel(), CaloGeometry::getGeometry(), CaloCellGeometry::getPosition(), HcalBarrel, HcalEndcap, HcalForward, getDQMSummary::iter, p4, PV3DBase< T, PVType, FrameType >::phi(), reco::LeafCandidate::phi(), phi2iphi(), parseEventContent::prod, edm::ESHandle< class >::product(), edm::Event::put(), resetTowers(), sd, src_, towers_, and useHF_.

99 {
100  using namespace edm;
101 
102  if(!geo_){
104  iSetup.get<CaloGeometryRecord>().get(pG);
105  geo_ = pG.product();
106  }
107 
108 
109  resetTowers(iEvent, iSetup);
110 
111 
113  iEvent.getByLabel(src_, inputsHandle);
114 
115  for(reco::PFCandidateCollection::const_iterator ci = inputsHandle->begin(); ci!=inputsHandle->end(); ++ci) {
116 
117  const reco::PFCandidate& particle = *ci;
118 
119  // put a cutoff if you want
120  //if(particle.et() < 0.3) continue;
121 
122  double eta = particle.eta();
123 
124  if(!useHF_ && fabs(eta) > 3. ) continue;
125 
126  int ieta = eta2ieta(eta);
127  if(eta<0) ieta *= -1;
128 
129  int iphi = phi2iphi(particle.phi(),ieta);
130 
132  if(abs(ieta)<=16) sd = HcalBarrel;
133  else if(fabs(eta)< 3.) sd = HcalEndcap; // Use the endcap until eta =3
134  else sd = HcalForward;
135 
136  HcalDetId hid = HcalDetId(sd,ieta,iphi,1); // assume depth=1
137 
138  // check against the old method (boundaries slightly shifted in the endcaps
139  /*
140  HcalDetId hid_orig = getNearestTower(particle);
141 
142  if(hid != hid_orig)
143  {
144  if(abs((hid).ieta()-(hid_orig).ieta())>1 || abs((hid).iphi()-(hid_orig).iphi()) >1 ){
145 
146  int phi_diff = 1;
147  if(abs((hid).ieta())>39 || abs((hid_orig).ieta())>39) phi_diff = 4;
148  else if(abs((hid).ieta())>20 || abs((hid_orig).ieta())>20) phi_diff = 2;
149 
150  if(abs((hid).ieta()-(hid_orig).ieta()) > 1 || abs((hid).iphi()-(hid_orig).iphi()) > phi_diff ){
151  std::cout<<" eta "<<eta<<std::endl;
152  std::cout<<" hid "<<hid<<std::endl;
153  std::cout<<" old method "<<hid_orig<<std::endl;
154  }
155  }
156  }
157  */
158  towers_[hid] += particle.et();
159  }
160 
161 
162  std::auto_ptr<CaloTowerCollection> prod(new CaloTowerCollection());
163 
164  for ( std::map< DetId, double >::const_iterator iter = towers_.begin();
165  iter != towers_.end(); ++iter ){
166 
167  CaloTowerDetId newTowerId(iter->first.rawId());
168  double et = iter->second;
169 
170  if(et>0){
171 
172  GlobalPoint pos =geo_->getGeometry(newTowerId)->getPosition();
173 
174  if(!useHF_ && fabs(pos.eta()) > 3. ) continue;
175 
176  // currently sets et = pt, mass to zero
177  // pt, eta , phi, mass
178  reco::Particle::PolarLorentzVector p4(et,pos.eta(),pos.phi(),0.);
179 
180  CaloTower newTower(newTowerId,et,0,0,0,0,p4,pos,pos);
181  prod->push_back(newTower);
182  }
183  }
184 
185 
186  //For reference, Calo Tower Constructors
187 
188  /*
189  CaloTower(const CaloTowerDetId& id,
190  double emE, double hadE, double outerE,
191  int ecal_tp, int hcal_tp,
192  const PolarLorentzVector p4,
193  GlobalPoint emPosition, GlobalPoint hadPosition);
194 
195  CaloTower(const CaloTowerDetId& id,
196  double emE, double hadE, double outerE,
197  int ecal_tp, int hcal_tp,
198  const LorentzVector p4,
199  GlobalPoint emPosition, GlobalPoint hadPosition);
200  */
201 
202 
203  iEvent.put(prod);
204 
205 
206 }
int phi2iphi(double phi, int ieta) const
virtual double et() const
transverse energy
virtual float phi() const
momentum azimuthal angle
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T eta() const
void resetTowers(edm::Event &iEvent, const edm::EventSetup &iSetup)
std::map< DetId, double > towers_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
virtual float eta() const
momentum pseudorapidity
double p4[4]
Definition: TauolaWrapper.h:92
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
int eta2ieta(double eta) const
double sd
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
T eta() const
Definition: PV3DBase.h:76
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:38
edm::SortedCollection< CaloTower > CaloTowerCollection
Definition: CaloTowerFwd.h:15
const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:76
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:29
CaloGeometry const * geo_
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
void ParticleTowerProducer::resetTowers ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 280 of file ParticleTowerProducer.cc.

References HcalDetId::depth(), PV3DBase< T, PVType, FrameType >::eta(), geo_, CaloGeometry::getGeometry(), CaloCellGeometry::getPosition(), CaloGeometry::getValidDetIds(), DetId::Hcal, towers_, and useHF_.

Referenced by produce().

281 {
282 
283  std::vector<DetId> alldid = geo_->getValidDetIds();
284 
285  for(std::vector<DetId>::const_iterator did=alldid.begin(); did != alldid.end(); did++){
286  if( (*did).det() == DetId::Hcal ){
287  HcalDetId hid = HcalDetId(*did);
288  if( hid.depth() == 1 ) {
289 
290  if(!useHF_){
291  GlobalPoint pos =geo_->getGeometry(hid)->getPosition();
292  //if((hid).iphi()==1)std::cout<<" ieta "<<(hid).ieta()<<" eta "<<pos.eta()<<" iphi "<<(hid).iphi()<<" phi "<<pos.phi()<<std::endl;
293  if(fabs(pos.eta())>3.) continue;
294  }
295  towers_[(*did)] = 0.;
296  }
297 
298  }
299  }
300 
301 
302 
303 
304  //print out tower eta boundaries
305  /*
306  int current_ieta=0;
307  float testphi =0.;
308  for(double testeta=1.7; testeta<=5.4;testeta+=0.00001){
309  HcalDetId hid = getNearestTower(testeta,testphi);
310  if((hid).ieta()!=current_ieta) {
311  std::cout<<" new ieta "<<current_ieta<<" testeta "<<testeta<<std::endl;
312  current_ieta = (hid).ieta();
313  }
314  }
315  */
316 
317 }
int depth() const
get the tower depth
Definition: HcalDetId.h:40
std::map< DetId, double > towers_
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:90
T eta() const
Definition: PV3DBase.h:76
const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:76
CaloGeometry const * geo_
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.

Member Data Documentation

const double ParticleTowerProducer::etacent[]
staticprivate

Definition at line 61 of file ParticleTowerProducer.h.

Referenced by beginJob().

double ParticleTowerProducer::etaedge[42]
private

Definition at line 62 of file ParticleTowerProducer.h.

Referenced by beginJob(), and eta2ieta().

const double ParticleTowerProducer::etatow[]
staticprivate

Definition at line 60 of file ParticleTowerProducer.h.

Referenced by beginJob().

CaloGeometry const* ParticleTowerProducer::geo_
private

Definition at line 57 of file ParticleTowerProducer.h.

Referenced by getNearestTower(), produce(), and resetTowers().

double ParticleTowerProducer::PI
private

Definition at line 54 of file ParticleTowerProducer.h.

Referenced by ParticleTowerProducer(), and phi2iphi().

TRandom* ParticleTowerProducer::random_
private

Definition at line 55 of file ParticleTowerProducer.h.

Referenced by ParticleTowerProducer().

edm::InputTag ParticleTowerProducer::src_
private

Definition at line 48 of file ParticleTowerProducer.h.

Referenced by ParticleTowerProducer(), and produce().

std::map<DetId,double> ParticleTowerProducer::towers_
private

Definition at line 51 of file ParticleTowerProducer.h.

Referenced by produce(), and resetTowers().

bool ParticleTowerProducer::useHF_
private