CMS 3D CMS Logo

EgammaHLTIslandClusterProducer Class Reference

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

Inheritance diagram for EgammaHLTIslandClusterProducer:

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

List of all members.

Public Member Functions

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

Private Member Functions

void clusterizeECALPart (edm::Event &evt, const edm::EventSetup &es, const std::string &hitProducer, const std::string &hitCollection, const std::string &clusterCollection, const std::vector< EcalEtaPhiRegion > &regions, const IslandClusterAlgo::EcalPart &ecalPart)
bool counterExceeded () const
const EcalRecHitCollectiongetCollection (edm::Event &evt, const std::string &hitProducer_, const std::string &hitCollection_)

Private Attributes

std::string barrelClusterCollection_
std::string barrelHitCollection_
edm::InputTag barrelHitProducer_
bool doBarrel_
bool doEndcaps_
bool doIsolated_
std::string endcapClusterCollection_
std::string endcapHitCollection_
edm::InputTag endcapHitProducer_
IslandClusterAlgoisland_p
double l1LowerThr_
double l1LowerThrIgnoreIsolation_
edm::InputTag l1TagIsolated_
edm::InputTag l1TagNonIsolated_
double l1UpperThr_
int nEvt_
int nMaxPrintout_
PositionCalc posCalculator_
double regionEtaMargin_
double regionPhiMargin_
IslandClusterAlgo::VerbosityLevel verbosity


Detailed Description

Definition at line 24 of file EgammaHLTIslandClusterProducer.h.


Constructor & Destructor Documentation

EgammaHLTIslandClusterProducer::EgammaHLTIslandClusterProducer ( const edm::ParameterSet ps  ) 

Definition at line 42 of file EgammaHLTIslandClusterProducer.cc.

References barrelClusterCollection_, barrelHitCollection_, barrelHitProducer_, doBarrel_, doEndcaps_, doIsolated_, endcapClusterCollection_, endcapHitCollection_, endcapHitProducer_, edm::ParameterSet::getParameter(), island_p, l1LowerThr_, l1LowerThrIgnoreIsolation_, l1TagIsolated_, l1TagNonIsolated_, l1UpperThr_, nEvt_, IslandClusterAlgo::pDEBUG, IslandClusterAlgo::pERROR, IslandClusterAlgo::pINFO, posCalculator_, IslandClusterAlgo::pWARNING, regionEtaMargin_, regionPhiMargin_, and verbosity.

00043 {
00044   // The verbosity level
00045   std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
00046   if      (verbosityString == "DEBUG")   verbosity = IslandClusterAlgo::pDEBUG;
00047   else if (verbosityString == "WARNING") verbosity = IslandClusterAlgo::pWARNING;
00048   else if (verbosityString == "INFO")    verbosity = IslandClusterAlgo::pINFO;
00049   else                                   verbosity = IslandClusterAlgo::pERROR;
00050 
00051   doBarrel_   = ps.getParameter<bool>("doBarrel");
00052   doEndcaps_   = ps.getParameter<bool>("doEndcaps");
00053   doIsolated_   = ps.getParameter<bool>("doIsolated");
00054 
00055   // Parameters to identify the hit collections
00056   barrelHitProducer_   = ps.getParameter<edm::InputTag>("barrelHitProducer");
00057   endcapHitProducer_   = ps.getParameter<edm::InputTag>("endcapHitProducer");
00058   barrelHitCollection_ = ps.getParameter<std::string>("barrelHitCollection");
00059   endcapHitCollection_ = ps.getParameter<std::string>("endcapHitCollection");
00060 
00061   // The names of the produced cluster collections
00062   barrelClusterCollection_  = ps.getParameter<std::string>("barrelClusterCollection");
00063   endcapClusterCollection_  = ps.getParameter<std::string>("endcapClusterCollection");
00064 
00065   // Island algorithm parameters
00066   double barrelSeedThreshold = ps.getParameter<double>("IslandBarrelSeedThr");
00067   double endcapSeedThreshold = ps.getParameter<double>("IslandEndcapSeedThr");
00068 
00069   // L1 matching parameters
00070   l1TagIsolated_ = ps.getParameter< edm::InputTag > ("l1TagIsolated");
00071   l1TagNonIsolated_ = ps.getParameter< edm::InputTag > ("l1TagNonIsolated");
00072   l1LowerThr_ = ps.getParameter<double> ("l1LowerThr");
00073   l1UpperThr_ = ps.getParameter<double> ("l1UpperThr");
00074   l1LowerThrIgnoreIsolation_ = ps.getParameter<double> ("l1LowerThrIgnoreIsolation");
00075 
00076   regionEtaMargin_   = ps.getParameter<double>("regionEtaMargin");
00077   regionPhiMargin_   = ps.getParameter<double>("regionPhiMargin");
00078 
00079   // Parameters for the position calculation:
00080   std::map<std::string,double> providedParameters;
00081   providedParameters.insert(std::make_pair("LogWeighted",ps.getParameter<bool>("posCalc_logweight")));
00082   providedParameters.insert(std::make_pair("T0_barl",ps.getParameter<double>("posCalc_t0_barl")));
00083   providedParameters.insert(std::make_pair("T0_endc",ps.getParameter<double>("posCalc_t0_endc")));
00084   providedParameters.insert(std::make_pair("T0_endcPresh",ps.getParameter<double>("posCalc_t0_endcPresh")));
00085   providedParameters.insert(std::make_pair("W0",ps.getParameter<double>("posCalc_w0")));
00086   providedParameters.insert(std::make_pair("X0",ps.getParameter<double>("posCalc_x0")));
00087   posCalculator_ = PositionCalc(providedParameters);
00088 
00089   // Produces a collection of barrel and a collection of endcap clusters
00090 
00091   produces< reco::BasicClusterCollection >(endcapClusterCollection_);
00092   produces< reco::BasicClusterCollection >(barrelClusterCollection_);
00093 
00094   island_p = new IslandClusterAlgo(barrelSeedThreshold, endcapSeedThreshold, posCalculator_,verbosity);
00095 
00096   nEvt_ = 0;
00097 }

EgammaHLTIslandClusterProducer::~EgammaHLTIslandClusterProducer (  ) 

Definition at line 100 of file EgammaHLTIslandClusterProducer.cc.

References island_p.

00101 {
00102   delete island_p;
00103 }


Member Function Documentation

void EgammaHLTIslandClusterProducer::clusterizeECALPart ( edm::Event evt,
const edm::EventSetup es,
const std::string &  hitProducer,
const std::string &  hitCollection,
const std::string &  clusterCollection,
const std::vector< EcalEtaPhiRegion > &  regions,
const IslandClusterAlgo::EcalPart ecalPart 
) [private]

Definition at line 254 of file EgammaHLTIslandClusterProducer.cc.

References IslandClusterAlgo::barrel, barrelClusterCollection_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::EventSetup::get(), getCollection(), island_p, IslandClusterAlgo::makeClusters(), and edm::Event::put().

Referenced by produce().

00260 {
00261   // get the hit collection from the event:
00262   const EcalRecHitCollection *hitCollection_p = getCollection(evt, hitProducer, hitCollection);
00263 
00264   // get the geometry and topology from the event setup:
00265   edm::ESHandle<CaloGeometry> geoHandle;
00266   es.get<CaloGeometryRecord>().get(geoHandle);
00267 
00268   const CaloSubdetectorGeometry *geometry_p;
00269   CaloSubdetectorTopology *topology_p;
00270 
00271   if (ecalPart == IslandClusterAlgo::barrel) 
00272     {
00273       geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
00274       topology_p = new EcalBarrelTopology(geoHandle);
00275     }
00276   else
00277     {
00278       geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
00279       topology_p = new EcalEndcapTopology(geoHandle); 
00280    }
00281 
00282   const CaloSubdetectorGeometry *geometryES_p;
00283   geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
00284 
00285   // Run the clusterization algorithm:
00286   reco::BasicClusterCollection clusters;
00287   clusters = island_p->makeClusters(hitCollection_p, geometry_p, topology_p, geometryES_p, ecalPart, true, regions);
00288 
00289   // create an auto_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
00290   std::auto_ptr< reco::BasicClusterCollection > clusters_p(new reco::BasicClusterCollection);
00291   clusters_p->assign(clusters.begin(), clusters.end());
00292   edm::OrphanHandle<reco::BasicClusterCollection> bccHandle;
00293   if (ecalPart == IslandClusterAlgo::barrel) 
00294     bccHandle = evt.put(clusters_p, barrelClusterCollection_);
00295   else
00296     bccHandle = evt.put(clusters_p, endcapClusterCollection_);
00297 
00298   delete topology_p;
00299 }

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

Definition at line 65 of file EgammaHLTIslandClusterProducer.h.

References nEvt_, and nMaxPrintout_.

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

const EcalRecHitCollection * EgammaHLTIslandClusterProducer::getCollection ( edm::Event evt,
const std::string &  hitProducer_,
const std::string &  hitCollection_ 
) [private]

Definition at line 237 of file EgammaHLTIslandClusterProducer.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::Event::getByLabel(), edm::Handle< T >::isValid(), and edm::Handle< T >::product().

Referenced by clusterizeECALPart().

00240 {
00241   edm::Handle<EcalRecHitCollection> rhcHandle;
00242 
00243   evt.getByLabel(hitProducer_, hitCollection_, rhcHandle);
00244   if (!(rhcHandle.isValid())) 
00245     {
00246       std::cout << "could not get a handle on the EcalRecHitCollection!" << std::endl;
00247       edm::LogError("EgammaHLTIslandClusterProducerError") << "Error! can't get the product " << hitCollection_.c_str() ;
00248       return 0;
00249     } 
00250   return rhcHandle.product();
00251 }

void EgammaHLTIslandClusterProducer::produce ( edm::Event evt,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 106 of file EgammaHLTIslandClusterProducer.cc.

References IslandClusterAlgo::barrel, barrelClusterCollection_, barrelHitCollection_, barrelHitProducer_, clusterizeECALPart(), doBarrel_, doEndcaps_, doIsolated_, IslandClusterAlgo::endcap, endcapClusterCollection_, endcapHitCollection_, endcapHitProducer_, edm::EventSetup::get(), edm::Event::getByLabel(), l1LowerThr_, l1LowerThrIgnoreIsolation_, l1TagIsolated_, l1TagNonIsolated_, l1UpperThr_, edm::InputTag::label(), nEvt_, regionEtaMargin_, and regionPhiMargin_.

00107 {
00108   //Get the L1 EM Particle Collection
00109   edm::Handle< l1extra::L1EmParticleCollection > emIsolColl ;
00110   if(doIsolated_)
00111     evt.getByLabel(l1TagIsolated_, emIsolColl);
00112   //Get the L1 EM Particle Collection
00113   edm::Handle< l1extra::L1EmParticleCollection > emNonIsolColl ;
00114   evt.getByLabel(l1TagNonIsolated_, emNonIsolColl);
00115   // Get the CaloGeometry
00116   edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
00117   es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;
00118 
00119   std::vector<EcalEtaPhiRegion> barrelRegions;
00120   std::vector<EcalEtaPhiRegion> endcapRegions;
00121 
00122   if(doIsolated_) {
00123     for( l1extra::L1EmParticleCollection::const_iterator emItr = emIsolColl->begin(); emItr != emIsolColl->end() ;++emItr ){
00124 
00125       if (emItr->et() > l1LowerThr_ && emItr->et() < l1UpperThr_) {
00126         
00127         // Access the GCT hardware object corresponding to the L1Extra EM object.
00128         int etaIndex = emItr->gctEmCand()->etaIndex() ;
00129         
00130         
00131         int phiIndex = emItr->gctEmCand()->phiIndex() ;
00132         // Use the L1CaloGeometry to find the eta, phi bin boundaries.
00133         double etaLow  = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
00134         double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
00135         double phiLow  = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
00136         double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
00137 
00138         //Attention isForward does not work
00139         int isforw=0;
00140         int isbarl=0;
00141         if((float)(etaHigh)>1.479 || (float)(etaLow)<-1.479) isforw=1;
00142         if(((float)(etaLow)>-1.479 && (float)(etaLow)<1.479) || 
00143            ((float)(etaHigh)>-1.479 && (float)(etaHigh)<1.479)) isbarl=1;
00144 
00145         //std::cout<<"Island etaindex "<<etaIndex<<" low hig : "<<etaLow<<" "<<etaHigh<<" phi low hig" <<phiLow<<" " << phiHigh<<" isforw "<<emItr->gctEmCand()->regionId().isForward()<<" isforwnew" <<isforw<< std::endl;
00146         
00147         etaLow -= regionEtaMargin_;
00148         etaHigh += regionEtaMargin_;
00149         phiLow -= regionPhiMargin_;
00150         phiHigh += regionPhiMargin_;
00151 
00152         //if (emItr->gctEmCand()->regionId().isForward()) {
00153         if (isforw) {
00154           if (etaHigh>-1.479 && etaHigh<1.479) etaHigh=-1.479;
00155           if ( etaLow>-1.479 &&  etaLow<1.479) etaLow=1.479;
00156           EcalEtaPhiRegion region(etaLow,etaHigh,phiLow,phiHigh);
00157           endcapRegions.push_back(region);
00158         }
00159         if (isbarl) {
00160           if (etaHigh>1.479) etaHigh=1.479;
00161           if (etaLow<-1.479) etaLow=-1.479;
00162           EcalEtaPhiRegion region(etaLow,etaHigh,phiLow,phiHigh);
00163           barrelRegions.push_back(region);
00164         }
00165         EcalEtaPhiRegion region(etaLow,etaHigh,phiLow,phiHigh);
00166         
00167       }
00168     }
00169   }
00170 
00171 
00172   if(!doIsolated_||l1LowerThrIgnoreIsolation_<64) {
00173     for( l1extra::L1EmParticleCollection::const_iterator emItr = emNonIsolColl->begin(); emItr != emNonIsolColl->end() ;++emItr ){
00174 
00175       if(doIsolated_&&emItr->et()<l1LowerThrIgnoreIsolation_) continue;
00176 
00177       if (emItr->et() > l1LowerThr_ && emItr->et() < l1UpperThr_) {
00178         
00179         // Access the GCT hardware object corresponding to the L1Extra EM object.
00180         int etaIndex = emItr->gctEmCand()->etaIndex() ;
00181         
00182         
00183         int phiIndex = emItr->gctEmCand()->phiIndex() ;
00184         // Use the L1CaloGeometry to find the eta, phi bin boundaries.
00185         double etaLow  = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
00186         double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
00187         double phiLow  = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
00188         double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
00189 
00190 
00191         int isforw=0;
00192         int isbarl=0;
00193         if((float)(etaHigh)>1.479 || (float)(etaLow)<-1.479) isforw=1;
00194         if(((float)(etaLow)>-1.479 && (float)(etaLow)<1.479) || 
00195            ((float)(etaHigh)>-1.479 && (float)(etaHigh)<1.479)) isbarl=1;
00196 
00197         //std::cout<<"Island etaindex "<<etaIndex<<" low hig : "<<etaLow<<" "<<etaHigh<<" phi low hig" <<phiLow<<" " << phiHigh<<" isforw "<<emItr->gctEmCand()->regionId().isForward()<<" isforwnew" <<isforw<< std::endl;
00198         
00199         etaLow -= regionEtaMargin_;
00200         etaHigh += regionEtaMargin_;
00201         phiLow -= regionPhiMargin_;
00202         phiHigh += regionPhiMargin_;
00203 
00204         //if (emItr->gctEmCand()->regionId().isForward()) {
00205         if (isforw) {
00206           if (etaHigh>-1.479 && etaHigh<1.479) etaHigh=-1.479;
00207           if ( etaLow>-1.479 &&  etaLow<1.479) etaLow=1.479;
00208           EcalEtaPhiRegion region(etaLow,etaHigh,phiLow,phiHigh);
00209           endcapRegions.push_back(region);
00210         }
00211         if (isbarl) {
00212           if (etaHigh>1.479) etaHigh=1.479;
00213           if (etaLow<-1.479) etaLow=-1.479;
00214           EcalEtaPhiRegion region(etaLow,etaHigh,phiLow,phiHigh);
00215           barrelRegions.push_back(region);
00216         }
00217         
00218       }
00219     }
00220   }
00221 
00222   if (doEndcaps_ 
00223       //&&endcapRegions.size()!=0
00224       ) {
00225 
00226     clusterizeECALPart(evt, es, endcapHitProducer_.label(), endcapHitCollection_, endcapClusterCollection_, endcapRegions, IslandClusterAlgo::endcap);
00227   }
00228   if (doBarrel_ 
00229       //&& barrelRegions.size()!=0
00230       ) {
00231     clusterizeECALPart(evt, es, barrelHitProducer_.label(), barrelHitCollection_, barrelClusterCollection_, barrelRegions, IslandClusterAlgo::barrel);
00232   }
00233   nEvt_++;
00234 }


Member Data Documentation

std::string EgammaHLTIslandClusterProducer::barrelClusterCollection_ [private]

Definition at line 50 of file EgammaHLTIslandClusterProducer.h.

Referenced by clusterizeECALPart(), EgammaHLTIslandClusterProducer(), and produce().

std::string EgammaHLTIslandClusterProducer::barrelHitCollection_ [private]

Definition at line 47 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer(), and produce().

edm::InputTag EgammaHLTIslandClusterProducer::barrelHitProducer_ [private]

Definition at line 45 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer(), and produce().

bool EgammaHLTIslandClusterProducer::doBarrel_ [private]

Definition at line 41 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer(), and produce().

bool EgammaHLTIslandClusterProducer::doEndcaps_ [private]

Definition at line 42 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer(), and produce().

bool EgammaHLTIslandClusterProducer::doIsolated_ [private]

Definition at line 43 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer(), and produce().

std::string EgammaHLTIslandClusterProducer::endcapClusterCollection_ [private]

Definition at line 51 of file EgammaHLTIslandClusterProducer.h.

Referenced by clusterizeECALPart(), EgammaHLTIslandClusterProducer(), and produce().

std::string EgammaHLTIslandClusterProducer::endcapHitCollection_ [private]

Definition at line 48 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer(), and produce().

edm::InputTag EgammaHLTIslandClusterProducer::endcapHitProducer_ [private]

Definition at line 46 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer(), and produce().

IslandClusterAlgo* EgammaHLTIslandClusterProducer::island_p [private]

Definition at line 63 of file EgammaHLTIslandClusterProducer.h.

Referenced by clusterizeECALPart(), EgammaHLTIslandClusterProducer(), and ~EgammaHLTIslandClusterProducer().

double EgammaHLTIslandClusterProducer::l1LowerThr_ [private]

Definition at line 55 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer(), and produce().

double EgammaHLTIslandClusterProducer::l1LowerThrIgnoreIsolation_ [private]

Definition at line 57 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer(), and produce().

edm::InputTag EgammaHLTIslandClusterProducer::l1TagIsolated_ [private]

Definition at line 53 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer(), and produce().

edm::InputTag EgammaHLTIslandClusterProducer::l1TagNonIsolated_ [private]

Definition at line 54 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer(), and produce().

double EgammaHLTIslandClusterProducer::l1UpperThr_ [private]

Definition at line 56 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer(), and produce().

int EgammaHLTIslandClusterProducer::nEvt_ [private]

Definition at line 37 of file EgammaHLTIslandClusterProducer.h.

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

int EgammaHLTIslandClusterProducer::nMaxPrintout_ [private]

Definition at line 36 of file EgammaHLTIslandClusterProducer.h.

Referenced by counterExceeded().

PositionCalc EgammaHLTIslandClusterProducer::posCalculator_ [private]

Definition at line 62 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer().

double EgammaHLTIslandClusterProducer::regionEtaMargin_ [private]

Definition at line 59 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer(), and produce().

double EgammaHLTIslandClusterProducer::regionPhiMargin_ [private]

Definition at line 60 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer(), and produce().

IslandClusterAlgo::VerbosityLevel EgammaHLTIslandClusterProducer::verbosity [private]

Definition at line 39 of file EgammaHLTIslandClusterProducer.h.

Referenced by EgammaHLTIslandClusterProducer().


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