CMS 3D CMS Logo

EgammaHLTHybridClusterProducer Class Reference

#include <RecoEgamma/EgammaHLTProducers/interface/EgammaHLTHybridClusterProducer.h>

Inheritance diagram for EgammaHLTHybridClusterProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 EgammaHLTHybridClusterProducer (const edm::ParameterSet &ps)
virtual void produce (edm::Event &, const edm::EventSetup &)
 ~EgammaHLTHybridClusterProducer ()

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_


Detailed Description

Definition at line 19 of file EgammaHLTHybridClusterProducer.h.


Constructor & Destructor Documentation

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

Definition at line 44 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_, and superclusterCollection_.

00045 {
00046 
00047     // The debug level
00048   std::string debugString = ps.getParameter<std::string>("debugLevel");
00049   if      (debugString == "DEBUG")   debugL = HybridClusterAlgo::pDEBUG;
00050   else if (debugString == "INFO")    debugL = HybridClusterAlgo::pINFO;
00051   else                               debugL = HybridClusterAlgo::pERROR;
00052 
00053   basicclusterCollection_ = ps.getParameter<std::string>("basicclusterCollection");
00054   superclusterCollection_ = ps.getParameter<std::string>("superclusterCollection");
00055   hitproducer_ = ps.getParameter<edm::InputTag>("ecalhitproducer");
00056   hitcollection_ =ps.getParameter<std::string>("ecalhitcollection");
00057 
00058 
00059 
00060   // L1 matching parameters
00061   l1TagIsolated_ = ps.getParameter< edm::InputTag > ("l1TagIsolated");
00062   l1TagNonIsolated_ = ps.getParameter< edm::InputTag > ("l1TagNonIsolated");
00063 
00064   doIsolated_   = ps.getParameter<bool>("doIsolated");
00065 
00066   l1LowerThr_ = ps.getParameter<double> ("l1LowerThr");
00067   l1UpperThr_ = ps.getParameter<double> ("l1UpperThr");
00068   l1LowerThrIgnoreIsolation_ = ps.getParameter<double> ("l1LowerThrIgnoreIsolation");
00069 
00070   regionEtaMargin_   = ps.getParameter<double>("regionEtaMargin");
00071   regionPhiMargin_   = ps.getParameter<double>("regionPhiMargin");
00072 
00073   //Setup for core tools objects.
00074   std::map<std::string,double> providedParameters;  
00075   providedParameters.insert(std::make_pair("LogWeighted",ps.getParameter<bool>("posCalc_logweight")));
00076   providedParameters.insert(std::make_pair("T0_barl",ps.getParameter<double>("posCalc_t0")));
00077   providedParameters.insert(std::make_pair("W0",ps.getParameter<double>("posCalc_w0")));
00078   providedParameters.insert(std::make_pair("X0",ps.getParameter<double>("posCalc_x0")));
00079 
00080   posCalculator_ = PositionCalc(providedParameters);
00081 
00082   hybrid_p = new HybridClusterAlgo(ps.getParameter<double>("HybridBarrelSeedThr"), 
00083                                    ps.getParameter<int>("step"),
00084                                    ps.getParameter<double>("ethresh"),
00085                                    ps.getParameter<double>("eseed"),
00086                                    ps.getParameter<double>("ewing"),
00087                                    posCalculator_,
00088                                    debugL);
00089 
00090   produces< reco::BasicClusterCollection >(basicclusterCollection_);
00091   produces< reco::SuperClusterCollection >(superclusterCollection_);
00092   nEvt_ = 0;
00093 }

EgammaHLTHybridClusterProducer::~EgammaHLTHybridClusterProducer (  ) 

Definition at line 96 of file EgammaHLTHybridClusterProducer.cc.

References hybrid_p.

00097 {
00098   delete hybrid_p;
00099 }


Member Function Documentation

bool EgammaHLTHybridClusterProducer::counterExceeded (  )  const [inline, private]

Definition at line 57 of file EgammaHLTHybridClusterProducer.h.

References nEvt_, and nMaxPrintout_.

00057 { return ((nEvt_ > nMaxPrintout_) || (nMaxPrintout_ < 0));}

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

References basicclusterCollection_, GenMuonPlsPt100GeV_cfg::cout, debugL, doIsolated_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, lat::endl(), edm::EventSetup::get(), edm::Event::getByLabel(), CaloGeometry::getSubdetectorGeometry(), hitcollection_, hitproducer_, hybrid_p, i, edm::Handle< T >::isValid(), edm::OrphanHandle< T >::isValid(), l1LowerThr_, l1LowerThrIgnoreIsolation_, l1TagIsolated_, l1TagNonIsolated_, l1UpperThr_, edm::InputTag::label(), HybridClusterAlgo::makeClusters(), HybridClusterAlgo::makeSuperClusters(), nEvt_, HybridClusterAlgo::pINFO, edm::Handle< T >::product(), edm::RefVector< C, T, F >::push_back(), edm::Event::put(), regionEtaMargin_, regionPhiMargin_, and superclusterCollection_.

00103 {
00104   // get the hit collection from the event:
00105   edm::Handle<EcalRecHitCollection> rhcHandle;
00106   //  evt.getByType(rhcHandle);
00107   evt.getByLabel(hitproducer_.label(), hitcollection_, rhcHandle);
00108   if (!(rhcHandle.isValid())) 
00109     {
00110       if (debugL <= HybridClusterAlgo::pINFO)
00111         std::cout << "could not get a handle on the EcalRecHitCollection!" << std::endl;
00112       return;
00113     }
00114   const EcalRecHitCollection *hit_collection = rhcHandle.product();
00115 
00116   // get the collection geometry:
00117   edm::ESHandle<CaloGeometry> geoHandle;
00118   es.get<CaloGeometryRecord>().get(geoHandle);
00119   const CaloGeometry& geometry = *geoHandle;
00120   const CaloSubdetectorGeometry *geometry_p;
00121   std::auto_ptr<const CaloSubdetectorTopology> topology;
00122 
00123   //if (debugL == HybridClusterAlgo::pDEBUG)
00124   //std::cout << "\n\n\n" << hitcollection_ << "\n\n" << std::endl;
00125 
00126   if(hitcollection_ == "EcalRecHitsEB") {
00127     geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
00128     topology.reset(new EcalBarrelTopology(geoHandle));
00129   } else if(hitcollection_ == "EcalRecHitsEE") {
00130     geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
00131     topology.reset(new EcalEndcapTopology(geoHandle));
00132   } else if(hitcollection_ == "EcalRecHitsPS") {
00133     geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
00134     topology.reset(new EcalPreshowerTopology (geoHandle));
00135   } else throw(std::runtime_error("\n\nHybrid Cluster Producer encountered invalied ecalhitcollection type.\n\n"));
00136     
00137   //Get the L1 EM Particle Collection
00138   //Get the L1 EM Particle Collection
00139   edm::Handle< l1extra::L1EmParticleCollection > emIsolColl ;
00140   if(doIsolated_)
00141     evt.getByLabel(l1TagIsolated_, emIsolColl);
00142   //Get the L1 EM Particle Collection
00143   edm::Handle< l1extra::L1EmParticleCollection > emNonIsolColl ;
00144   evt.getByLabel(l1TagNonIsolated_, emNonIsolColl);
00145 
00146   // Get the CaloGeometry
00147   edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
00148   es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;
00149 
00150   std::vector<EcalEtaPhiRegion> regions;
00151 
00152   if(doIsolated_) {
00153     for( l1extra::L1EmParticleCollection::const_iterator emItr = emIsolColl->begin(); emItr != emIsolColl->end() ;++emItr ){
00154 
00155     if (emItr->et() > l1LowerThr_ && emItr->et() < l1UpperThr_
00156         //&&
00158 ) {
00159 
00160       //bool isolated = emItr->gctEmCand()->isolated();
00161       //if ((l1Isolated_ &&isolated) || (!l1Isolated_ &&!isolated)) {
00162 
00163       // Access the GCT hardware object corresponding to the L1Extra EM object.
00164       int etaIndex = emItr->gctEmCand()->etaIndex() ;
00165       int phiIndex = emItr->gctEmCand()->phiIndex() ;
00166       // Use the L1CaloGeometry to find the eta, phi bin boundaries.
00167       double etaLow  = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
00168       double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
00169       double phiLow  = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
00170       double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
00171 
00172        int isbarl=0;
00173        //Part of the region is in the barel if either the upper or lower
00174        //edge of the region is within the barrel
00175        if(((float)(etaLow)>-1.479 && (float)(etaLow)<1.479) || 
00176           ((float)(etaHigh)>-1.479 && (float)(etaHigh)<1.479)) isbarl=1;
00177 
00178         //std::cout<<"Hybrid etaindex "<<etaIndex<<" low hig : "<<etaLow<<" "<<etaHigh<<" phi low hig" <<phiLow<<" " << phiHigh<<" isforw "<<emItr->gctEmCand()->regionId().isForward()<<" isforwnew" <<isforw<< std::endl;
00179 
00180       etaLow -= regionEtaMargin_;
00181       etaHigh += regionEtaMargin_;
00182       phiLow -= regionPhiMargin_;
00183       phiHigh += regionPhiMargin_;
00184 
00185       if (etaHigh>1.479) etaHigh=1.479;
00186       if (etaLow<-1.479) etaLow=-1.479;
00187 
00188       if(isbarl) regions.push_back(EcalEtaPhiRegion(etaLow,etaHigh,phiLow,phiHigh));
00189 
00190     }
00191   }
00192   }
00193 
00194   if(!doIsolated_||l1LowerThrIgnoreIsolation_<64) {
00195     for( l1extra::L1EmParticleCollection::const_iterator emItr = emNonIsolColl->begin(); emItr != emNonIsolColl->end() ;++emItr ){
00196 
00197       if(doIsolated_&&emItr->et()<l1LowerThrIgnoreIsolation_) continue;
00198 
00199     if (emItr->et() > l1LowerThr_ && emItr->et() < l1UpperThr_
00200         //&&
00202 ) {
00203 
00204       //bool isolated = emItr->gctEmCand()->isolated();
00205       //if ((l1Isolated_ &&isolated) || (!l1Isolated_ &&!isolated)) {
00206 
00207       // Access the GCT hardware object corresponding to the L1Extra EM object.
00208       int etaIndex = emItr->gctEmCand()->etaIndex() ;
00209       int phiIndex = emItr->gctEmCand()->phiIndex() ;
00210       // Use the L1CaloGeometry to find the eta, phi bin boundaries.
00211       double etaLow  = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
00212       double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
00213       double phiLow  = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
00214       double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
00215 
00216        int isbarl=0;
00217        //Part of the region is in the barel if either the upper or lower
00218        //edge of the region is within the barrel
00219        if(((float)(etaLow)>-1.479 && (float)(etaLow)<1.479) || 
00220           ((float)(etaHigh)>-1.479 && (float)(etaHigh)<1.479)) isbarl=1;
00221 
00222         //std::cout<<"Hybrid etaindex "<<etaIndex<<" low hig : "<<etaLow<<" "<<etaHigh<<" phi low hig" <<phiLow<<" " << phiHigh<<" isforw "<<emItr->gctEmCand()->regionId().isForward()<<" isforwnew" <<isforw<< std::endl;
00223 
00224       etaLow -= regionEtaMargin_;
00225       etaHigh += regionEtaMargin_;
00226       phiLow -= regionPhiMargin_;
00227       phiHigh += regionPhiMargin_;
00228 
00229       if (etaHigh>1.479) etaHigh=1.479;
00230       if (etaLow<-1.479) etaLow=-1.479;
00231 
00232       if(isbarl) regions.push_back(EcalEtaPhiRegion(etaLow,etaHigh,phiLow,phiHigh));
00233 
00234     }
00235   }
00236   }
00237 
00238   // make the Basic clusters!
00239   reco::BasicClusterCollection basicClusters;
00240   hybrid_p->makeClusters(hit_collection, geometry_p, basicClusters, true, regions);
00241   //if (debugL == HybridClusterAlgo::pDEBUG)
00242   //std::cout << "Hybrid Finished clustering - BasicClusterCollection returned to producer..." << std::endl;
00243 
00244   // create an auto_ptr to a BasicClusterCollection, copy the clusters into it and put in the Event:
00245   std::auto_ptr< reco::BasicClusterCollection > basicclusters_p(new reco::BasicClusterCollection);
00246   basicclusters_p->assign(basicClusters.begin(), basicClusters.end());
00247   edm::OrphanHandle<reco::BasicClusterCollection> bccHandle =  evt.put(basicclusters_p, 
00248                                                                        basicclusterCollection_);
00249   //Basic clusters now in the event.
00250   //if (debugL == HybridClusterAlgo::pDEBUG)
00251   //std::cout << "Basic Clusters now put into event." << std::endl;
00252   
00253   //Weird though it is, get the BasicClusters back out of the event.  We need the
00254   //edm::Ref to these guys to make our superclusters for Hybrid.
00255 //  edm::Handle<reco::BasicClusterCollection> bccHandle;
00256  // evt.getByLabel("clusterproducer",basicclusterCollection_, bccHandle);
00257   if (!(bccHandle.isValid())) {
00258     //if (debugL <= HybridClusterAlgo::pINFO)
00259     //std::cout << "could not get a handle on the BasicClusterCollection!" << std::endl;
00260     return;
00261   }
00262   reco::BasicClusterCollection clusterCollection = *bccHandle;
00263   //if (debugL == HybridClusterAlgo::pDEBUG)
00264   //std::cout << "Got the BasicClusterCollection" << std::endl;
00265 
00266   reco::BasicClusterRefVector clusterRefVector;
00267   for (unsigned int i = 0; i < clusterCollection.size(); i++){
00268     clusterRefVector.push_back(reco::BasicClusterRef(bccHandle, i));
00269   }
00270 
00271   reco::SuperClusterCollection superClusters = hybrid_p->makeSuperClusters(clusterRefVector);
00272   //if (debugL == HybridClusterAlgo::pDEBUG)
00273   //std::cout << "Found: " << superClusters.size() << " superclusters." << std::endl;
00274 
00275   std::auto_ptr< reco::SuperClusterCollection > superclusters_p(new reco::SuperClusterCollection);
00276   superclusters_p->assign(superClusters.begin(), superClusters.end());
00277   evt.put(superclusters_p, superclusterCollection_);
00278 
00279   //if (debugL == HybridClusterAlgo::pDEBUG)
00280   //std::cout << "Hybrid Clusters (Basic/Super) added to the Event! :-)" << std::endl;
00281 
00282   nEvt_++;
00283 }


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]

Definition at line 54 of file EgammaHLTHybridClusterProducer.h.

Referenced by EgammaHLTHybridClusterProducer(), produce(), and ~EgammaHLTHybridClusterProducer().

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]

Definition at line 33 of file EgammaHLTHybridClusterProducer.h.

Referenced by counterExceeded(), EgammaHLTHybridClusterProducer(), and produce().

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:10 2009 for CMSSW by  doxygen 1.5.4