CMS 3D CMS Logo

CosmicClusterProducer Class Reference

#include <RecoEcal/EgammaClusterProducers/interface/CosmicClusterProducer.h>

Inheritance diagram for CosmicClusterProducer:

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

List of all members.

Public Member Functions

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

Private Member Functions

void clusterizeECALPart (edm::Event &evt, const edm::EventSetup &es, const std::string &hitProducer, const std::string &hitCollection, const std::string &uhitProducer, const std::string &uhitCollection, const std::string &clusterCollection, const std::string &clusterShapeAssociation, const CosmicClusterAlgo::EcalPart &ecalPart)
bool counterExceeded () const
const EcalRecHitCollectiongetCollection (edm::Event &evt, const std::string &hitProducer_, const std::string &hitCollection_)
const
EcalUncalibratedRecHitCollection
getUCollection (edm::Event &evt, const std::string &hitProducer_, const std::string &hitCollection_)
void outputValidationInfo (reco::BasicClusterRefVector &clusterRefVector)

Private Attributes

std::string barrelClusterCollection_
std::string barrelClusterShapeAssociation_
std::string barrelHitCollection_
std::string barrelHitProducer_
std::string barrelUHitCollection_
std::string barrelUHitProducer_
std::string clustershapecollectionEB_
std::string clustershapecollectionEE_
std::string endcapClusterCollection_
std::string endcapClusterShapeAssociation_
std::string endcapHitCollection_
std::string endcapHitProducer_
std::string endcapUHitCollection_
std::string endcapUHitProducer_
CosmicClusterAlgoisland_p
int nEvt_
int nMaxPrintout_
PositionCalc posCalculator_
ClusterShapeAlgo shapeAlgo_
CosmicClusterAlgo::VerbosityLevel verbosity


Detailed Description

Definition at line 26 of file CosmicClusterProducer.h.


Constructor & Destructor Documentation

CosmicClusterProducer::CosmicClusterProducer ( const edm::ParameterSet ps  ) 

Definition at line 39 of file CosmicClusterProducer.cc.

References barrelClusterCollection_, barrelClusterShapeAssociation_, barrelHitCollection_, barrelHitProducer_, barrelUHitCollection_, barrelUHitProducer_, clustershapecollectionEB_, clustershapecollectionEE_, endcapClusterCollection_, endcapClusterShapeAssociation_, endcapHitCollection_, endcapHitProducer_, endcapUHitCollection_, endcapUHitProducer_, edm::ParameterSet::getParameter(), island_p, nEvt_, CosmicClusterAlgo::pDEBUG, CosmicClusterAlgo::pERROR, CosmicClusterAlgo::pINFO, posCalculator_, CosmicClusterAlgo::pWARNING, shapeAlgo_, and verbosity.

00040 {
00041   // The verbosity level
00042   std::string verbosityString = ps.getParameter<std::string>("VerbosityLevel");
00043   if      (verbosityString == "DEBUG")   verbosity = CosmicClusterAlgo::pDEBUG;
00044   else if (verbosityString == "WARNING") verbosity = CosmicClusterAlgo::pWARNING;
00045   else if (verbosityString == "INFO")    verbosity = CosmicClusterAlgo::pINFO;
00046   else                                   verbosity = CosmicClusterAlgo::pERROR;
00047 
00048   
00049   // Parameters to identify the hit collections
00050   barrelHitProducer_    = ps.getParameter<std::string>("barrelHitProducer");
00051   endcapHitProducer_    = ps.getParameter<std::string>("endcapHitProducer");
00052   barrelHitCollection_  = ps.getParameter<std::string>("barrelHitCollection");
00053   endcapHitCollection_  = ps.getParameter<std::string>("endcapHitCollection");
00054   barrelUHitProducer_   = ps.getParameter<std::string>("barrelUnHitProducer");
00055   endcapUHitProducer_   = ps.getParameter<std::string>("endcapUnHitProducer");
00056   barrelUHitCollection_ = ps.getParameter<std::string>("barrelUnHitCollection");
00057   endcapUHitCollection_ = ps.getParameter<std::string>("endcapUnHitCollection");
00058 
00059   // The names of the produced cluster collections
00060   barrelClusterCollection_  = ps.getParameter<std::string>("barrelClusterCollection");
00061   endcapClusterCollection_  = ps.getParameter<std::string>("endcapClusterCollection");
00062 
00063   // Island algorithm parameters
00064   double barrelSeedThreshold        = ps.getParameter<double>("BarrelSeedThr");
00065   double barrelSingleThreshold      = ps.getParameter<double>("BarrelSingleThr");
00066   double barrelSecondThreshold      = ps.getParameter<double>("BarrelSecondThr");
00067   double barrelSupThreshold         = ps.getParameter<double>("BarrelSupThr");
00068   double endcapSeedThreshold        = ps.getParameter<double>("EndcapSeedThr");
00069   double endcapSingleThreshold      = ps.getParameter<double>("EndcapSingleThr");
00070   double endcapSecondThreshold      = ps.getParameter<double>("EndcapSecondThr");
00071   double endcapSupThreshold         = ps.getParameter<double>("EndcapSupThr");
00072 
00073   // Parameters for the position calculation:
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_barl")));
00077   providedParameters.insert(std::make_pair("T0_endc",ps.getParameter<double>("posCalc_t0_endc")));
00078   providedParameters.insert(std::make_pair("T0_endcPresh",ps.getParameter<double>("posCalc_t0_endcPresh")));
00079   providedParameters.insert(std::make_pair("W0",ps.getParameter<double>("posCalc_w0")));
00080   providedParameters.insert(std::make_pair("X0",ps.getParameter<double>("posCalc_x0")));
00081   posCalculator_ = PositionCalc(providedParameters);
00082   shapeAlgo_ = ClusterShapeAlgo(providedParameters);
00083 
00084   clustershapecollectionEB_ = ps.getParameter<std::string>("clustershapecollectionEB");
00085   clustershapecollectionEE_ = ps.getParameter<std::string>("clustershapecollectionEE");
00086 
00087   //AssociationMap
00088   barrelClusterShapeAssociation_ = ps.getParameter<std::string>("barrelShapeAssociation");
00089   endcapClusterShapeAssociation_ = ps.getParameter<std::string>("endcapShapeAssociation");
00090 
00091   // Produces a collection of barrel and a collection of endcap clusters
00092 
00093   produces< reco::ClusterShapeCollection>(clustershapecollectionEE_);
00094   produces< reco::BasicClusterCollection >(endcapClusterCollection_);
00095   produces< reco::ClusterShapeCollection>(clustershapecollectionEB_);
00096   produces< reco::BasicClusterCollection >(barrelClusterCollection_);
00097   produces< reco::BasicClusterShapeAssociationCollection >(barrelClusterShapeAssociation_);
00098   produces< reco::BasicClusterShapeAssociationCollection >(endcapClusterShapeAssociation_);
00099 
00100   island_p = new CosmicClusterAlgo(barrelSeedThreshold, barrelSingleThreshold, barrelSecondThreshold, barrelSupThreshold, endcapSeedThreshold, endcapSingleThreshold, endcapSecondThreshold, endcapSupThreshold, posCalculator_,verbosity);
00101 
00102   nEvt_ = 0;
00103 }

CosmicClusterProducer::~CosmicClusterProducer (  ) 

Definition at line 106 of file CosmicClusterProducer.cc.

References island_p.

00107 {
00108   delete island_p;
00109 }


Member Function Documentation

void CosmicClusterProducer::clusterizeECALPart ( edm::Event evt,
const edm::EventSetup es,
const std::string &  hitProducer,
const std::string &  hitCollection,
const std::string &  uhitProducer,
const std::string &  uhitCollection,
const std::string &  clusterCollection,
const std::string &  clusterShapeAssociation,
const CosmicClusterAlgo::EcalPart ecalPart 
) [private]

Definition at line 165 of file CosmicClusterProducer.cc.

References CosmicClusterAlgo::barrel, barrelClusterCollection_, ClusterShapeAlgo::Calculate(), clustershapecollectionEB_, clustershapecollectionEE_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, endcapClusterCollection_, edm::EventSetup::get(), getCollection(), getUCollection(), i, int, island_p, CosmicClusterAlgo::makeClusters(), edm::Event::put(), and shapeAlgo_.

Referenced by produce().

00173 {
00174   // get the hit collection from the event:
00175 
00176   const EcalRecHitCollection *hitCollection_p = getCollection(evt, hitProducer, hitCollection);
00177   const EcalUncalibratedRecHitCollection *uhitCollection_p = getUCollection(evt, uhitProducer, uhitCollection);
00178 
00179   // get the geometry and topology from the event setup:
00180   edm::ESHandle<CaloGeometry> geoHandle;
00181   es.get<CaloGeometryRecord>().get(geoHandle);
00182 
00183   const CaloSubdetectorGeometry *geometry_p;
00184   CaloSubdetectorTopology *topology_p;
00185 
00186   std::string clustershapetag;
00187   if (ecalPart == CosmicClusterAlgo::barrel) 
00188     {
00189       geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
00190       topology_p = new EcalBarrelTopology(geoHandle);
00191     }
00192   else
00193     {
00194       geometry_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
00195       topology_p = new EcalEndcapTopology(geoHandle); 
00196    }
00197 
00198   const CaloSubdetectorGeometry *geometryES_p;
00199   geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower); 
00200   
00201   // Run the clusterization algorithm:
00202   reco::BasicClusterCollection clusters;
00203   clusters = island_p->makeClusters(hitCollection_p, uhitCollection_p, geometry_p, topology_p, geometryES_p,  ecalPart);
00204   
00205   //Create associated ClusterShape objects.
00206   std::vector <reco::ClusterShape> ClusVec;
00207  
00208   for (int erg=0;erg<int(clusters.size());++erg){
00209     reco::ClusterShape TestShape = shapeAlgo_.Calculate(clusters[erg],hitCollection_p,geometry_p,topology_p);
00210     ClusVec.push_back(TestShape);
00211   }
00212   
00213   //Put clustershapes in event, but retain a Handle on them.
00214   std::auto_ptr< reco::ClusterShapeCollection> clustersshapes_p(new reco::ClusterShapeCollection);
00215   clustersshapes_p->assign(ClusVec.begin(), ClusVec.end());
00216   edm::OrphanHandle<reco::ClusterShapeCollection> clusHandle; 
00217   if (ecalPart == CosmicClusterAlgo::barrel) 
00218     clusHandle= evt.put(clustersshapes_p, clustershapecollectionEB_);
00219   else
00220     clusHandle= evt.put(clustersshapes_p, clustershapecollectionEE_);
00221   
00222   // create an auto_ptr to a BasicClusterCollection, copy the barrel clusters into it and put in the Event:
00223   std::auto_ptr< reco::BasicClusterCollection > clusters_p(new reco::BasicClusterCollection);
00224   clusters_p->assign(clusters.begin(), clusters.end());
00225   edm::OrphanHandle<reco::BasicClusterCollection> bccHandle;
00226   
00227   if (ecalPart == CosmicClusterAlgo::barrel) 
00228     bccHandle = evt.put(clusters_p, barrelClusterCollection_);
00229   else
00230     bccHandle = evt.put(clusters_p, endcapClusterCollection_);
00231 
00232   
00233   // BasicClusterShapeAssociationMap 
00234   std::auto_ptr<reco::BasicClusterShapeAssociationCollection> shapeAssocs_p(new reco::BasicClusterShapeAssociationCollection);
00235   for (unsigned int i = 0; i < clusHandle->size(); i++){
00236     shapeAssocs_p->insert(edm::Ref<reco::BasicClusterCollection>(bccHandle,i),edm::Ref<reco::ClusterShapeCollection>(clusHandle,i));
00237   }  
00238   evt.put(shapeAssocs_p,clusterShapeAssociation);
00239   
00240   delete topology_p;
00241 }

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

Definition at line 67 of file CosmicClusterProducer.h.

References nEvt_, and nMaxPrintout_.

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

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

Definition at line 120 of file CosmicClusterProducer.cc.

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

Referenced by clusterizeECALPart().

00123 {
00124   edm::Handle<EcalRecHitCollection> rhcHandle;
00125   try
00126     {
00127       evt.getByLabel(hitProducer_, hitCollection_, rhcHandle);
00128       if (!(rhcHandle.isValid())) 
00129         {
00130           std::cout << "could not get a handle on the EcalRecHitCollection!" << std::endl;
00131           return 0;
00132         }
00133     }
00134   catch ( cms::Exception& ex ) 
00135     {
00136       edm::LogError("CosmicClusterProducerError") << "Error! can't get the product " << hitCollection_.c_str() ;
00137       return 0;
00138     }
00139   return rhcHandle.product();
00140 }

const EcalUncalibratedRecHitCollection * CosmicClusterProducer::getUCollection ( edm::Event evt,
const std::string &  hitProducer_,
const std::string &  hitCollection_ 
) [private]

Definition at line 142 of file CosmicClusterProducer.cc.

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

Referenced by clusterizeECALPart().

00145 {
00146   edm::Handle<EcalUncalibratedRecHitCollection> rhcHandle;
00147   try
00148     {
00149       evt.getByLabel(hitProducer_, hitCollection_, rhcHandle);
00150       if (!(rhcHandle.isValid())) 
00151         {
00152           std::cout << "could not get a handle on the EcalUncalibratedRecHitCollection!" << std::endl;
00153           return 0;
00154         }
00155     }
00156   catch ( cms::Exception& ex ) 
00157     {
00158       edm::LogError("CosmicClusterProducerError") << "Error! can't get the product " << hitCollection_.c_str() ;
00159       return 0;
00160     }
00161   return rhcHandle.product();
00162 }

void CosmicClusterProducer::outputValidationInfo ( reco::BasicClusterRefVector clusterRefVector  )  [private]

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

Implements edm::EDProducer.

Definition at line 112 of file CosmicClusterProducer.cc.

References CosmicClusterAlgo::barrel, barrelClusterCollection_, barrelClusterShapeAssociation_, barrelHitCollection_, barrelHitProducer_, barrelUHitCollection_, barrelUHitProducer_, clusterizeECALPart(), CosmicClusterAlgo::endcap, endcapClusterCollection_, endcapClusterShapeAssociation_, endcapHitCollection_, endcapHitProducer_, endcapUHitCollection_, endcapUHitProducer_, and nEvt_.


Member Data Documentation

std::string CosmicClusterProducer::barrelClusterCollection_ [private]

Definition at line 53 of file CosmicClusterProducer.h.

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

std::string CosmicClusterProducer::barrelClusterShapeAssociation_ [private]

Definition at line 60 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

std::string CosmicClusterProducer::barrelHitCollection_ [private]

Definition at line 45 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

std::string CosmicClusterProducer::barrelHitProducer_ [private]

Definition at line 43 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

std::string CosmicClusterProducer::barrelUHitCollection_ [private]

Definition at line 50 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

std::string CosmicClusterProducer::barrelUHitProducer_ [private]

Definition at line 48 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

std::string CosmicClusterProducer::clustershapecollectionEB_ [private]

Definition at line 56 of file CosmicClusterProducer.h.

Referenced by clusterizeECALPart(), and CosmicClusterProducer().

std::string CosmicClusterProducer::clustershapecollectionEE_ [private]

Definition at line 57 of file CosmicClusterProducer.h.

Referenced by clusterizeECALPart(), and CosmicClusterProducer().

std::string CosmicClusterProducer::endcapClusterCollection_ [private]

Definition at line 54 of file CosmicClusterProducer.h.

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

std::string CosmicClusterProducer::endcapClusterShapeAssociation_ [private]

Definition at line 61 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

std::string CosmicClusterProducer::endcapHitCollection_ [private]

Definition at line 46 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

std::string CosmicClusterProducer::endcapHitProducer_ [private]

Definition at line 44 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

std::string CosmicClusterProducer::endcapUHitCollection_ [private]

Definition at line 51 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

std::string CosmicClusterProducer::endcapUHitProducer_ [private]

Definition at line 49 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer(), and produce().

CosmicClusterAlgo* CosmicClusterProducer::island_p [private]

Definition at line 65 of file CosmicClusterProducer.h.

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

int CosmicClusterProducer::nEvt_ [private]

Definition at line 39 of file CosmicClusterProducer.h.

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

int CosmicClusterProducer::nMaxPrintout_ [private]

Definition at line 38 of file CosmicClusterProducer.h.

Referenced by counterExceeded().

PositionCalc CosmicClusterProducer::posCalculator_ [private]

Definition at line 63 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer().

ClusterShapeAlgo CosmicClusterProducer::shapeAlgo_ [private]

Definition at line 64 of file CosmicClusterProducer.h.

Referenced by clusterizeECALPart(), and CosmicClusterProducer().

CosmicClusterAlgo::VerbosityLevel CosmicClusterProducer::verbosity [private]

Definition at line 41 of file CosmicClusterProducer.h.

Referenced by CosmicClusterProducer().


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