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_
 
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)
 
static void prevalidate (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 50 of file EgammaHLTHybridClusterProducer.cc.

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

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

Definition at line 119 of file EgammaHLTHybridClusterProducer.cc.

References hybrid_p.

120 {
121  delete hybrid_p;
122 }

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 125 of file EgammaHLTHybridClusterProducer.cc.

References basicclusterCollection_, 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_, edm::Handle< T >::product(), edm::ESHandle< class >::product(), edm::PtrVector< T >::push_back(), edm::Event::put(), regionEtaMargin_, regionPhiMargin_, and superclusterCollection_.

126 {
127  // get the hit collection from the event:
129  // evt.getByType(rhcHandle);
130  evt.getByLabel(hitproducer_.label(), hitcollection_, rhcHandle);
131  if (!(rhcHandle.isValid()))
132  {
133  edm::LogError("ProductNotFound")<< "could not get a handle on the EcalRecHitCollection!" << std::endl;
134  return;
135  }
136  const EcalRecHitCollection *hit_collection = rhcHandle.product();
137 
138  // get the collection geometry:
139  edm::ESHandle<CaloGeometry> geoHandle;
140  es.get<CaloGeometryRecord>().get(geoHandle);
141  const CaloGeometry& geometry = *geoHandle;
142  const CaloSubdetectorGeometry *geometry_p;
143  std::auto_ptr<const CaloSubdetectorTopology> topology;
144 
145  //edm::ESHandle<EcalChannelStatus> chStatus;
146  //es.get<EcalChannelStatusRcd>().get(chStatus);
147  //const EcalChannelStatus* theEcalChStatus = chStatus.product();
148 
150  es.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
151  const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
152 
153  if(hitcollection_ == "EcalRecHitsEB") {
154  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
155  topology.reset(new EcalBarrelTopology(geoHandle));
156  } else if(hitcollection_ == "EcalRecHitsEE") {
157  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
158  topology.reset(new EcalEndcapTopology(geoHandle));
159  } else if(hitcollection_ == "EcalRecHitsPS") {
160  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
161  topology.reset(new EcalPreshowerTopology (geoHandle));
162  } else throw(std::runtime_error("\n\nHybrid Cluster Producer encountered invalied ecalhitcollection type.\n\n"));
163 
164  //Get the L1 EM Particle Collection
165  //Get the L1 EM Particle Collection
167  if(doIsolated_)
168  evt.getByLabel(l1TagIsolated_, emIsolColl);
169  //Get the L1 EM Particle Collection
171  evt.getByLabel(l1TagNonIsolated_, emNonIsolColl);
172 
173  // Get the CaloGeometry
174  edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
175  es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;
176 
177  std::vector<EcalEtaPhiRegion> regions;
178 
179  if(doIsolated_) {
180  for( l1extra::L1EmParticleCollection::const_iterator emItr = emIsolColl->begin(); emItr != emIsolColl->end() ;++emItr ){
181 
182  if (emItr->et() > l1LowerThr_ && emItr->et() < l1UpperThr_
183  //&&
185 ) {
186 
187  //bool isolated = emItr->gctEmCand()->isolated();
188  //if ((l1Isolated_ &&isolated) || (!l1Isolated_ &&!isolated)) {
189 
190  // Access the GCT hardware object corresponding to the L1Extra EM object.
191  int etaIndex = emItr->gctEmCand()->etaIndex() ;
192  int phiIndex = emItr->gctEmCand()->phiIndex() ;
193  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
194  double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
195  double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
196  double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
197  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
198 
199  int isbarl=0;
200  //Part of the region is in the barel if either the upper or lower
201  //edge of the region is within the barrel
202  if(((float)(etaLow)>-1.479 && (float)(etaLow)<1.479) ||
203  ((float)(etaHigh)>-1.479 && (float)(etaHigh)<1.479)) isbarl=1;
204 
205 
206  etaLow -= regionEtaMargin_;
207  etaHigh += regionEtaMargin_;
208  phiLow -= regionPhiMargin_;
209  phiHigh += regionPhiMargin_;
210 
211  if (etaHigh>1.479) etaHigh=1.479;
212  if (etaLow<-1.479) etaLow=-1.479;
213 
214  if(isbarl) regions.push_back(EcalEtaPhiRegion(etaLow,etaHigh,phiLow,phiHigh));
215 
216  }
217  }
218  }
219 
221  for( l1extra::L1EmParticleCollection::const_iterator emItr = emNonIsolColl->begin(); emItr != emNonIsolColl->end() ;++emItr ){
222 
223  if(doIsolated_&&emItr->et()<l1LowerThrIgnoreIsolation_) continue;
224 
225  if (emItr->et() > l1LowerThr_ && emItr->et() < l1UpperThr_
226  //&&
228 ) {
229 
230  //bool isolated = emItr->gctEmCand()->isolated();
231  //if ((l1Isolated_ &&isolated) || (!l1Isolated_ &&!isolated)) {
232 
233  // Access the GCT hardware object corresponding to the L1Extra EM object.
234  int etaIndex = emItr->gctEmCand()->etaIndex() ;
235  int phiIndex = emItr->gctEmCand()->phiIndex() ;
236  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
237  double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
238  double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
239  double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
240  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
241 
242  int isbarl=0;
243  //Part of the region is in the barel if either the upper or lower
244  //edge of the region is within the barrel
245  if(((float)(etaLow)>-1.479 && (float)(etaLow)<1.479) ||
246  ((float)(etaHigh)>-1.479 && (float)(etaHigh)<1.479)) isbarl=1;
247 
248 
249  etaLow -= regionEtaMargin_;
250  etaHigh += regionEtaMargin_;
251  phiLow -= regionPhiMargin_;
252  phiHigh += regionPhiMargin_;
253 
254  if (etaHigh>1.479) etaHigh=1.479;
255  if (etaLow<-1.479) etaLow=-1.479;
256 
257  if(isbarl) regions.push_back(EcalEtaPhiRegion(etaLow,etaHigh,phiLow,phiHigh));
258 
259  }
260  }
261  }
262 
263  // make the Basic clusters!
264  reco::BasicClusterCollection basicClusters;
265  hybrid_p->makeClusters(hit_collection, geometry_p, basicClusters, sevLevel, true, regions);
266 
267  // create an auto_ptr to a BasicClusterCollection, copy the clusters into it and put in the Event:
268  std::auto_ptr< reco::BasicClusterCollection > basicclusters_p(new reco::BasicClusterCollection);
269  basicclusters_p->assign(basicClusters.begin(), basicClusters.end());
270  edm::OrphanHandle<reco::BasicClusterCollection> bccHandle = evt.put(basicclusters_p,
272  //Basic clusters now in the event.
273 
274  //Weird though it is, get the BasicClusters back out of the event. We need the
275  //edm::Ref to these guys to make our superclusters for Hybrid.
276 // edm::Handle<reco::BasicClusterCollection> bccHandle;
277  // evt.getByLabel("clusterproducer",basicclusterCollection_, bccHandle);
278  if (!(bccHandle.isValid())) {
279  return;
280  }
281  reco::BasicClusterCollection clusterCollection = *bccHandle;
282 
283  reco::CaloClusterPtrVector clusterRefVector;
284  for (unsigned int i = 0; i < clusterCollection.size(); i++){
285  clusterRefVector.push_back(reco::CaloClusterPtr(bccHandle, i));
286  }
287 
288  reco::SuperClusterCollection superClusters = hybrid_p->makeSuperClusters(clusterRefVector);
289 
290  std::auto_ptr< reco::SuperClusterCollection > superclusters_p(new reco::SuperClusterCollection);
291  superclusters_p->assign(superClusters.begin(), superClusters.end());
292  evt.put(superclusters_p, superclusterCollection_);
293 
294 
295  nEvt_++;
296 }
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:85
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:356
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
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().

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 54 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().