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

#include <EgammaHLTHybridClusterProducer.h>

Inheritance diagram for EgammaHLTHybridClusterProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 EgammaHLTHybridClusterProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~EgammaHLTHybridClusterProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

bool counterExceeded () const
 

Private Attributes

std::string basicclusterCollection_
 
HybridClusterAlgo::DebugLevel debugL
 
bool doIsolated_
 
std::string hitcollection_
 
edm::InputTag hitproducer_
 
HybridClusterAlgohybrid_p
 
double l1LowerThr_
 
double l1LowerThrIgnoreIsolation_
 
edm::InputTag l1TagIsolated_
 
edm::InputTag l1TagNonIsolated_
 
double l1UpperThr_
 
int nEvt_
 
int nMaxPrintout_
 
PositionCalc posCalculator_
 
double regionEtaMargin_
 
double regionPhiMargin_
 
std::string superclusterCollection_
 

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)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 19 of file EgammaHLTHybridClusterProducer.h.

Constructor & Destructor Documentation

EgammaHLTHybridClusterProducer::EgammaHLTHybridClusterProducer ( const edm::ParameterSet ps)

Definition at line 49 of file EgammaHLTHybridClusterProducer.cc.

References basicclusterCollection_, debugL, doIsolated_, edm::ParameterSet::getParameter(), hitcollection_, hitproducer_, hybrid_p, l1LowerThr_, l1LowerThrIgnoreIsolation_, l1TagIsolated_, l1TagNonIsolated_, l1UpperThr_, nEvt_, HybridClusterAlgo::pDEBUG, HybridClusterAlgo::pERROR, HybridClusterAlgo::pINFO, posCalculator_, regionEtaMargin_, regionPhiMargin_, HybridClusterAlgo::setDynamicPhiRoad(), and superclusterCollection_.

50 {
51 
52  // The debug level
53  std::string debugString = ps.getParameter<std::string>("debugLevel");
54  if (debugString == "DEBUG") debugL = HybridClusterAlgo::pDEBUG;
55  else if (debugString == "INFO") debugL = HybridClusterAlgo::pINFO;
57 
58  basicclusterCollection_ = ps.getParameter<std::string>("basicclusterCollection");
59  superclusterCollection_ = ps.getParameter<std::string>("superclusterCollection");
60  hitproducer_ = ps.getParameter<edm::InputTag>("ecalhitproducer");
61  hitcollection_ =ps.getParameter<std::string>("ecalhitcollection");
62 
63 
64 
65  // L1 matching parameters
66  l1TagIsolated_ = ps.getParameter< edm::InputTag > ("l1TagIsolated");
67  l1TagNonIsolated_ = ps.getParameter< edm::InputTag > ("l1TagNonIsolated");
68 
69  doIsolated_ = ps.getParameter<bool>("doIsolated");
70 
71  l1LowerThr_ = ps.getParameter<double> ("l1LowerThr");
72  l1UpperThr_ = ps.getParameter<double> ("l1UpperThr");
73  l1LowerThrIgnoreIsolation_ = ps.getParameter<double> ("l1LowerThrIgnoreIsolation");
74 
75  regionEtaMargin_ = ps.getParameter<double>("regionEtaMargin");
76  regionPhiMargin_ = ps.getParameter<double>("regionPhiMargin");
77 
78  // Parameters for the position calculation:
79  posCalculator_ = PositionCalc( ps.getParameter<edm::ParameterSet>("posCalcParameters") );
80 
81 
82  hybrid_p = new HybridClusterAlgo(ps.getParameter<double>("HybridBarrelSeedThr"),
83  ps.getParameter<int>("step"),
84  ps.getParameter<double>("ethresh"),
85  ps.getParameter<double>("eseed"),
86  ps.getParameter<double>("ewing"),
87  ps.getParameter<std::vector<int> >("RecHitFlagToBeExcluded"),
88  posCalculator_,
89  debugL,
90  ps.getParameter<bool>("dynamicEThresh"),
91  ps.getParameter<double>("eThreshA"),
92  ps.getParameter<double>("eThreshB"),
93  ps.getParameter<std::vector<int> >("RecHitSeverityToBeExcluded"),
94  //ps.getParameter<double>("severityRecHitThreshold"),
95  //ps.getParameter<int>("severitySpikeId"),
96  //ps.getParameter<double>("severitySpikeThreshold"),
97  ps.getParameter<bool>("excludeFlagged")
98  );
99 
100  bool dynamicPhiRoad = ps.getParameter<bool>("dynamicPhiRoad");
101  if (dynamicPhiRoad) {
102  edm::ParameterSet bremRecoveryPset = ps.getParameter<edm::ParameterSet>("bremRecoveryPset");
103  hybrid_p->setDynamicPhiRoad(bremRecoveryPset);
104  }
105 
106 
107  produces< reco::BasicClusterCollection >(basicclusterCollection_);
108  produces< reco::SuperClusterCollection >(superclusterCollection_);
109  nEvt_ = 0;
110 }
T getParameter(std::string const &) const
void setDynamicPhiRoad(const edm::ParameterSet &bremRecoveryPset)
EgammaHLTHybridClusterProducer::~EgammaHLTHybridClusterProducer ( )

Definition at line 113 of file EgammaHLTHybridClusterProducer.cc.

References hybrid_p.

114 {
115  delete hybrid_p;
116 }

Member Function Documentation

bool EgammaHLTHybridClusterProducer::counterExceeded ( ) const
inlineprivate
void EgammaHLTHybridClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

emItr->gctEmCand()->regionId().isForward()

emItr->gctEmCand()->regionId().isForward()

Implements edm::EDProducer.

Definition at line 119 of file EgammaHLTHybridClusterProducer.cc.

References basicclusterCollection_, gather_cfg::cout, debugL, doIsolated_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, geometry, edm::EventSetup::get(), edm::Event::getByLabel(), CaloGeometry::getSubdetectorGeometry(), hitcollection_, hitproducer_, hybrid_p, i, edm::OrphanHandleBase::isValid(), edm::HandleBase::isValid(), l1LowerThr_, l1LowerThrIgnoreIsolation_, l1TagIsolated_, l1TagNonIsolated_, l1UpperThr_, edm::InputTag::label(), HybridClusterAlgo::makeClusters(), HybridClusterAlgo::makeSuperClusters(), nEvt_, HybridClusterAlgo::pINFO, edm::Handle< T >::product(), edm::ESHandle< class >::product(), edm::PtrVector< T >::push_back(), edm::Event::put(), regionEtaMargin_, regionPhiMargin_, and superclusterCollection_.

120 {
121  // get the hit collection from the event:
123  // evt.getByType(rhcHandle);
124  evt.getByLabel(hitproducer_.label(), hitcollection_, rhcHandle);
125  if (!(rhcHandle.isValid()))
126  {
128  std::cout << "could not get a handle on the EcalRecHitCollection!" << std::endl;
129  return;
130  }
131  const EcalRecHitCollection *hit_collection = rhcHandle.product();
132 
133  // get the collection geometry:
134  edm::ESHandle<CaloGeometry> geoHandle;
135  es.get<CaloGeometryRecord>().get(geoHandle);
136  const CaloGeometry& geometry = *geoHandle;
137  const CaloSubdetectorGeometry *geometry_p;
138  std::auto_ptr<const CaloSubdetectorTopology> topology;
139 
140  //edm::ESHandle<EcalChannelStatus> chStatus;
141  //es.get<EcalChannelStatusRcd>().get(chStatus);
142  //const EcalChannelStatus* theEcalChStatus = chStatus.product();
143 
145  es.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
146  const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
147  //if (debugL == HybridClusterAlgo::pDEBUG)
148  //std::cout << "\n\n\n" << hitcollection_ << "\n\n" << std::endl;
149 
150  if(hitcollection_ == "EcalRecHitsEB") {
151  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
152  topology.reset(new EcalBarrelTopology(geoHandle));
153  } else if(hitcollection_ == "EcalRecHitsEE") {
154  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
155  topology.reset(new EcalEndcapTopology(geoHandle));
156  } else if(hitcollection_ == "EcalRecHitsPS") {
157  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
158  topology.reset(new EcalPreshowerTopology (geoHandle));
159  } else throw(std::runtime_error("\n\nHybrid Cluster Producer encountered invalied ecalhitcollection type.\n\n"));
160 
161  //Get the L1 EM Particle Collection
162  //Get the L1 EM Particle Collection
164  if(doIsolated_)
165  evt.getByLabel(l1TagIsolated_, emIsolColl);
166  //Get the L1 EM Particle Collection
168  evt.getByLabel(l1TagNonIsolated_, emNonIsolColl);
169 
170  // Get the CaloGeometry
171  edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
172  es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;
173 
174  std::vector<EcalEtaPhiRegion> regions;
175 
176  if(doIsolated_) {
177  for( l1extra::L1EmParticleCollection::const_iterator emItr = emIsolColl->begin(); emItr != emIsolColl->end() ;++emItr ){
178 
179  if (emItr->et() > l1LowerThr_ && emItr->et() < l1UpperThr_
180  //&&
182 ) {
183 
184  //bool isolated = emItr->gctEmCand()->isolated();
185  //if ((l1Isolated_ &&isolated) || (!l1Isolated_ &&!isolated)) {
186 
187  // Access the GCT hardware object corresponding to the L1Extra EM object.
188  int etaIndex = emItr->gctEmCand()->etaIndex() ;
189  int phiIndex = emItr->gctEmCand()->phiIndex() ;
190  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
191  double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
192  double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
193  double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
194  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
195 
196  int isbarl=0;
197  //Part of the region is in the barel if either the upper or lower
198  //edge of the region is within the barrel
199  if(((float)(etaLow)>-1.479 && (float)(etaLow)<1.479) ||
200  ((float)(etaHigh)>-1.479 && (float)(etaHigh)<1.479)) isbarl=1;
201 
202  //std::cout<<"Hybrid etaindex "<<etaIndex<<" low hig : "<<etaLow<<" "<<etaHigh<<" phi low hig" <<phiLow<<" " << phiHigh<<" isforw "<<emItr->gctEmCand()->regionId().isForward()<<" isforwnew" <<isforw<< std::endl;
203 
204  etaLow -= regionEtaMargin_;
205  etaHigh += regionEtaMargin_;
206  phiLow -= regionPhiMargin_;
207  phiHigh += regionPhiMargin_;
208 
209  if (etaHigh>1.479) etaHigh=1.479;
210  if (etaLow<-1.479) etaLow=-1.479;
211 
212  if(isbarl) regions.push_back(EcalEtaPhiRegion(etaLow,etaHigh,phiLow,phiHigh));
213 
214  }
215  }
216  }
217 
219  for( l1extra::L1EmParticleCollection::const_iterator emItr = emNonIsolColl->begin(); emItr != emNonIsolColl->end() ;++emItr ){
220 
221  if(doIsolated_&&emItr->et()<l1LowerThrIgnoreIsolation_) continue;
222 
223  if (emItr->et() > l1LowerThr_ && emItr->et() < l1UpperThr_
224  //&&
226 ) {
227 
228  //bool isolated = emItr->gctEmCand()->isolated();
229  //if ((l1Isolated_ &&isolated) || (!l1Isolated_ &&!isolated)) {
230 
231  // Access the GCT hardware object corresponding to the L1Extra EM object.
232  int etaIndex = emItr->gctEmCand()->etaIndex() ;
233  int phiIndex = emItr->gctEmCand()->phiIndex() ;
234  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
235  double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
236  double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
237  double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
238  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
239 
240  int isbarl=0;
241  //Part of the region is in the barel if either the upper or lower
242  //edge of the region is within the barrel
243  if(((float)(etaLow)>-1.479 && (float)(etaLow)<1.479) ||
244  ((float)(etaHigh)>-1.479 && (float)(etaHigh)<1.479)) isbarl=1;
245 
246  //std::cout<<"Hybrid etaindex "<<etaIndex<<" low hig : "<<etaLow<<" "<<etaHigh<<" phi low hig" <<phiLow<<" " << phiHigh<<" isforw "<<emItr->gctEmCand()->regionId().isForward()<<" isforwnew" <<isforw<< std::endl;
247 
248  etaLow -= regionEtaMargin_;
249  etaHigh += regionEtaMargin_;
250  phiLow -= regionPhiMargin_;
251  phiHigh += regionPhiMargin_;
252 
253  if (etaHigh>1.479) etaHigh=1.479;
254  if (etaLow<-1.479) etaLow=-1.479;
255 
256  if(isbarl) regions.push_back(EcalEtaPhiRegion(etaLow,etaHigh,phiLow,phiHigh));
257 
258  }
259  }
260  }
261 
262  // make the Basic clusters!
263  reco::BasicClusterCollection basicClusters;
264  hybrid_p->makeClusters(hit_collection, geometry_p, basicClusters, sevLevel, true, regions);
265  //if (debugL == HybridClusterAlgo::pDEBUG)
266  //std::cout << "Hybrid Finished clustering - BasicClusterCollection returned to producer..." << std::endl;
267 
268  // create an auto_ptr to a BasicClusterCollection, copy the clusters into it and put in the Event:
269  std::auto_ptr< reco::BasicClusterCollection > basicclusters_p(new reco::BasicClusterCollection);
270  basicclusters_p->assign(basicClusters.begin(), basicClusters.end());
271  edm::OrphanHandle<reco::BasicClusterCollection> bccHandle = evt.put(basicclusters_p,
273  //Basic clusters now in the event.
274  //if (debugL == HybridClusterAlgo::pDEBUG)
275  //std::cout << "Basic Clusters now put into event." << std::endl;
276 
277  //Weird though it is, get the BasicClusters back out of the event. We need the
278  //edm::Ref to these guys to make our superclusters for Hybrid.
279 // edm::Handle<reco::BasicClusterCollection> bccHandle;
280  // evt.getByLabel("clusterproducer",basicclusterCollection_, bccHandle);
281  if (!(bccHandle.isValid())) {
282  //if (debugL <= HybridClusterAlgo::pINFO)
283  //std::cout << "could not get a handle on the BasicClusterCollection!" << std::endl;
284  return;
285  }
286  reco::BasicClusterCollection clusterCollection = *bccHandle;
287  //if (debugL == HybridClusterAlgo::pDEBUG)
288  //std::cout << "Got the BasicClusterCollection" << std::endl;
289 
290  reco::CaloClusterPtrVector clusterRefVector;
291  for (unsigned int i = 0; i < clusterCollection.size(); i++){
292  clusterRefVector.push_back(reco::CaloClusterPtr(bccHandle, i));
293  }
294 
295  reco::SuperClusterCollection superClusters = hybrid_p->makeSuperClusters(clusterRefVector);
296  //if (debugL == HybridClusterAlgo::pDEBUG)
297  //std::cout << "Found: " << superClusters.size() << " superclusters." << std::endl;
298 
299  std::auto_ptr< reco::SuperClusterCollection > superclusters_p(new reco::SuperClusterCollection);
300  superclusters_p->assign(superClusters.begin(), superClusters.end());
301  evt.put(superclusters_p, superclusterCollection_);
302 
303  //if (debugL == HybridClusterAlgo::pDEBUG)
304  //std::cout << "Hybrid Clusters (Basic/Super) added to the Event! :-)" << std::endl;
305 
306  nEvt_++;
307 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
int i
Definition: DBlmapReader.cc:9
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:137
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
reco::SuperClusterCollection makeSuperClusters(const reco::CaloClusterPtrVector &)
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
T const * product() const
Definition: Handle.h:74
std::string const & label() const
Definition: InputTag.h:25
ESHandle< TrackerGeometry > geometry
tuple cout
Definition: gather_cfg.py:41
void makeClusters(const EcalRecHitCollection *, const CaloSubdetectorGeometry *geometry, reco::BasicClusterCollection &basicClusters, const EcalSeverityLevelAlgo *sevLv, bool regional=false, const std::vector< EcalEtaPhiRegion > &regions=std::vector< EcalEtaPhiRegion >())

Member Data Documentation

std::string EgammaHLTHybridClusterProducer::basicclusterCollection_
private

Definition at line 37 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer(), and produce().

HybridClusterAlgo::DebugLevel EgammaHLTHybridClusterProducer::debugL
private

Definition at line 52 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer(), and produce().

bool EgammaHLTHybridClusterProducer::doIsolated_
private

Definition at line 35 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer(), and produce().

std::string EgammaHLTHybridClusterProducer::hitcollection_
private

Definition at line 40 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer(), and produce().

edm::InputTag EgammaHLTHybridClusterProducer::hitproducer_
private

Definition at line 39 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer(), and produce().

HybridClusterAlgo* EgammaHLTHybridClusterProducer::hybrid_p
private
double EgammaHLTHybridClusterProducer::l1LowerThr_
private

Definition at line 45 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer(), and produce().

double EgammaHLTHybridClusterProducer::l1LowerThrIgnoreIsolation_
private

Definition at line 47 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer(), and produce().

edm::InputTag EgammaHLTHybridClusterProducer::l1TagIsolated_
private

Definition at line 42 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer(), and produce().

edm::InputTag EgammaHLTHybridClusterProducer::l1TagNonIsolated_
private

Definition at line 43 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer(), and produce().

double EgammaHLTHybridClusterProducer::l1UpperThr_
private

Definition at line 46 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer(), and produce().

int EgammaHLTHybridClusterProducer::nEvt_
private
int EgammaHLTHybridClusterProducer::nMaxPrintout_
private

Definition at line 32 of file EgammaHLTHybridClusterProducer.h.

Referenced by counterExceeded().

PositionCalc EgammaHLTHybridClusterProducer::posCalculator_
private

Definition at line 55 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer().

double EgammaHLTHybridClusterProducer::regionEtaMargin_
private

Definition at line 49 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer(), and produce().

double EgammaHLTHybridClusterProducer::regionPhiMargin_
private

Definition at line 50 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer(), and produce().

std::string EgammaHLTHybridClusterProducer::superclusterCollection_
private

Definition at line 38 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer(), and produce().