CMS 3D CMS Logo

EcalRecalibRecHitProducer Class Reference

produce ECAL rechits from uncalibrated rechits More...

#include <RecoLocalCalo/EcalRecProducers/interface/EcalRecalibRecHitProducer.h>

Inheritance diagram for EcalRecalibRecHitProducer:

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

List of all members.

Public Member Functions

 EcalRecalibRecHitProducer (const edm::ParameterSet &ps)
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 ~EcalRecalibRecHitProducer ()

Private Attributes

bool doEnergyScale_
bool doIntercalib_
bool doLaserCorrections_
EcalRecHitAbsAlgoEBalgo_
std::string EBRecalibRecHitCollection_
edm::InputTag EBRecHitCollection_
EcalRecHitAbsAlgoEEalgo_
std::string EERecalibRecHitCollection_
edm::InputTag EERecHitCollection_


Detailed Description

produce ECAL rechits from uncalibrated rechits

Id
EcalRecalibRecHitProducer.h,v 1.1 2008/03/03 17:37:26 ferriff Exp
Date
2008/03/03 17:37:26
Revision
1.1
Author:
Shahram Rahatlou, University of Rome & INFN, March 2006
Id
EcalRecalibRecHitProducer.cc,v 1.5 2008/05/22 16:04:15 ferriff Exp
Date
2008/05/22 16:04:15
Revision
1.5
Author:
Shahram Rahatlou, University of Rome & INFN, March 2006

Definition at line 21 of file EcalRecalibRecHitProducer.h.


Constructor & Destructor Documentation

EcalRecalibRecHitProducer::EcalRecalibRecHitProducer ( const edm::ParameterSet ps  )  [explicit]

Definition at line 38 of file EcalRecalibRecHitProducer.cc.

References doEnergyScale_, doIntercalib_, doLaserCorrections_, EBalgo_, EBRecalibRecHitCollection_, EBRecHitCollection_, EEalgo_, EERecalibRecHitCollection_, EERecHitCollection_, and edm::ParameterSet::getParameter().

00038                                                                               {
00039 
00040    EBRecHitCollection_ = ps.getParameter<edm::InputTag>("EBRecHitCollection");
00041    EERecHitCollection_ = ps.getParameter<edm::InputTag>("EERecHitCollection");
00042    EBRecalibRecHitCollection_        = ps.getParameter<std::string>("EBRecalibRecHitCollection");
00043    EERecalibRecHitCollection_        = ps.getParameter<std::string>("EERecalibRecHitCollection");
00044    doEnergyScale_             = ps.getParameter<bool>("doEnergyScale");
00045    doIntercalib_              = ps.getParameter<bool>("doIntercalib");
00046    doLaserCorrections_        = ps.getParameter<bool>("doLaserCorrections");
00047 
00048    EBalgo_ = new EcalRecHitSimpleAlgo();
00049    EEalgo_ = new EcalRecHitSimpleAlgo();
00050 
00051    produces< EBRecHitCollection >(EBRecalibRecHitCollection_);
00052    produces< EERecHitCollection >(EERecalibRecHitCollection_);
00053 }

EcalRecalibRecHitProducer::~EcalRecalibRecHitProducer (  ) 

Definition at line 55 of file EcalRecalibRecHitProducer.cc.

References EBalgo_, and EEalgo_.

00055                                                       {
00056 
00057   if (EBalgo_) delete EBalgo_;
00058   if (EEalgo_) delete EEalgo_;
00059 
00060 }


Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 62 of file EcalRecalibRecHitProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), doEnergyScale_, doIntercalib_, doLaserCorrections_, EBRecalibRecHitCollection_, EBRecHitCollection_, EERecalibRecHitCollection_, EERecHitCollection_, EcalCondObjectContainer< T >::end(), edm::SortedCollection< T, SORT >::end(), EcalCondObjectContainer< T >::find(), edm::EventSetup::get(), edm::Event::getByLabel(), EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), EcalCondObjectContainer< T >::getMap(), edm::InputTag::instance(), it, edm::InputTag::label(), LogDebug, edm::ESHandle< T >::product(), edm::Event::put(), edm::SortedCollection< T, SORT >::size(), and edm::Event::time().

00063 {
00064         using namespace edm;
00065         Handle< EBRecHitCollection > pEBRecHits;
00066         Handle< EERecHitCollection > pEERecHits;
00067 
00068         const EBRecHitCollection*  EBRecHits = 0;
00069         const EERecHitCollection*  EERecHits = 0; 
00070 
00071         if ( EBRecHitCollection_.label() != "" && EBRecHitCollection_.instance() != "" ) {
00072                 evt.getByLabel( EBRecHitCollection_, pEBRecHits);
00073                 if ( pEBRecHits.isValid() ) {
00074                         EBRecHits = pEBRecHits.product(); // get a ptr to the product
00075 #ifdef DEBUG
00076                         LogDebug("EcalRecHitDebug") << "total # EB rechits to be re-calibrated: " << EBRecHits->size();
00077 #endif
00078                 } else {
00079                         edm::LogError("EcalRecHitError") << "Error! can't get the product " << EBRecHitCollection_.label() ;
00080                 }
00081         }
00082 
00083         if ( EERecHitCollection_.label() != "" && EERecHitCollection_.instance() != "" ) {
00084                 evt.getByLabel( EERecHitCollection_, pEERecHits);
00085                 if ( pEERecHits.isValid() ) {
00086                         EERecHits = pEERecHits.product(); // get a ptr to the product
00087 #ifdef DEBUG
00088                         LogDebug("EcalRecHitDebug") << "total # EE uncalibrated rechits to be re-calibrated: " << EERecHits->size();
00089 #endif
00090                 } else {
00091                         edm::LogError("EcalRecHitError") << "Error! can't get the product " << EERecHitCollection_.label() ;
00092                 }
00093         }
00094 
00095         // collection of rechits to put in the event
00096         std::auto_ptr< EBRecHitCollection > EBRecalibRecHits( new EBRecHitCollection );
00097         std::auto_ptr< EERecHitCollection > EERecalibRecHits( new EERecHitCollection );
00098 
00099         // now fetch all conditions we need to make rechits
00100         // ADC to GeV constant
00101         edm::ESHandle<EcalADCToGeVConstant> pAgc;
00102         const EcalADCToGeVConstant *agc = 0;
00103         float agc_eb = 1.;
00104         float agc_ee = 1.;
00105         if (doEnergyScale_) {
00106                 es.get<EcalADCToGeVConstantRcd>().get(pAgc);
00107                 agc = pAgc.product();
00108                 // use this value in the algorithm
00109                 agc_eb = float(agc->getEBValue());
00110                 agc_ee = float(agc->getEEValue());
00111         }
00112         // Intercalib constants
00113         edm::ESHandle<EcalIntercalibConstants> pIcal;
00114         const EcalIntercalibConstants *ical = 0;
00115         if (doIntercalib_) {
00116                 es.get<EcalIntercalibConstantsRcd>().get(pIcal);
00117                 ical = pIcal.product();
00118         }
00119         // Laser corrections
00120         edm::ESHandle<EcalLaserDbService> pLaser;
00121         es.get<EcalLaserDbRecord>().get( pLaser );
00122 
00123         if (EBRecHits) {
00124                 // loop over uncalibrated rechits to make calibrated ones
00125                 for(EBRecHitCollection::const_iterator it  = EBRecHits->begin(); it != EBRecHits->end(); ++it) {
00126 
00127                         EcalIntercalibConstant icalconst = 1.;
00128                         if (doIntercalib_) {
00129                                 // find intercalib constant for this xtal
00130                                 const EcalIntercalibConstantMap &icalMap = ical->getMap();
00131                                 EcalIntercalibConstantMap::const_iterator icalit = icalMap.find(it->id());
00132                                 if( icalit!=icalMap.end() ){
00133                                         icalconst = (*icalit);
00134                                 } else {
00135                                         edm::LogError("EcalRecHitError") << "No intercalib const found for xtal " << EBDetId(it->id()) << "! something wrong with EcalIntercalibConstants in your DB? "
00136                                                 ;
00137                                 }
00138                         }
00139                         // get laser coefficient
00140                         float lasercalib = 1;
00141                         if (doLaserCorrections_) {
00142                                 lasercalib = pLaser->getLaserCorrection( EBDetId(it->id()), evt.time() );
00143                         }
00144 
00145                         // make the rechit and put in the output collection
00146                         // must implement op= for EcalRecHit
00147                         EcalRecHit aHit( (*it).id(), (*it).energy() * agc_eb * icalconst * lasercalib, (*it).time() );
00148                         EBRecalibRecHits->push_back( aHit );
00149                 }
00150         }
00151 
00152         if (EERecHits)
00153         {
00154                 // loop over uncalibrated rechits to make calibrated ones
00155                 for(EERecHitCollection::const_iterator it  = EERecHits->begin();
00156                                 it != EERecHits->end(); ++it) {
00157 
00158                         // find intercalib constant for this xtal
00159                         EcalIntercalibConstant icalconst = 1.;
00160                         if (doIntercalib_) {
00161                                 const EcalIntercalibConstantMap &icalMap = ical->getMap();
00162                                 EcalIntercalibConstantMap::const_iterator icalit=icalMap.find(it->id());
00163                                 if( icalit!=icalMap.end() ) {
00164                                         icalconst = (*icalit);
00165                                 } else {
00166                                         edm::LogError("EcalRecHitError") << "No intercalib const found for xtal " << EEDetId(it->id()) << "! something wrong with EcalIntercalibConstants in your DB? ";
00167                                 }
00168                         }
00169                         // get laser coefficient
00170                         float lasercalib = 1;
00171                         if (doLaserCorrections_) {
00172                                 lasercalib = pLaser->getLaserCorrection( EEDetId(it->id()), evt.time() );
00173                         }
00174 
00175                         // make the rechit and put in the output collection
00176                         // must implement op= for EcalRecHit
00177                         //EcalRecHit aHit( EEalgo_->makeRecHit(*it, icalconst * lasercalib) );
00178                         EcalRecHit aHit( (*it).id(), (*it).energy() * agc_ee * icalconst * lasercalib, (*it).time() );
00179                         EERecalibRecHits->push_back( aHit );
00180                 }
00181         }
00182         // put the collection of recunstructed hits in the event   
00183         LogInfo("EcalRecalibRecHitInfo") << "total # EB re-calibrated rechits: " << EBRecalibRecHits->size();
00184         LogInfo("EcalRecalibRecHitInfo") << "total # EE re-calibrated rechits: " << EERecalibRecHits->size();
00185 
00186         evt.put( EBRecalibRecHits, EBRecalibRecHitCollection_ );
00187         evt.put( EERecalibRecHits, EERecalibRecHitCollection_ );
00188 }


Member Data Documentation

bool EcalRecalibRecHitProducer::doEnergyScale_ [private]

Definition at line 35 of file EcalRecalibRecHitProducer.h.

Referenced by EcalRecalibRecHitProducer(), and produce().

bool EcalRecalibRecHitProducer::doIntercalib_ [private]

Definition at line 36 of file EcalRecalibRecHitProducer.h.

Referenced by EcalRecalibRecHitProducer(), and produce().

bool EcalRecalibRecHitProducer::doLaserCorrections_ [private]

Definition at line 37 of file EcalRecalibRecHitProducer.h.

Referenced by EcalRecalibRecHitProducer(), and produce().

EcalRecHitAbsAlgo* EcalRecalibRecHitProducer::EBalgo_ [private]

Definition at line 39 of file EcalRecalibRecHitProducer.h.

Referenced by EcalRecalibRecHitProducer(), and ~EcalRecalibRecHitProducer().

std::string EcalRecalibRecHitProducer::EBRecalibRecHitCollection_ [private]

Definition at line 32 of file EcalRecalibRecHitProducer.h.

Referenced by EcalRecalibRecHitProducer(), and produce().

edm::InputTag EcalRecalibRecHitProducer::EBRecHitCollection_ [private]

Definition at line 30 of file EcalRecalibRecHitProducer.h.

Referenced by EcalRecalibRecHitProducer(), and produce().

EcalRecHitAbsAlgo* EcalRecalibRecHitProducer::EEalgo_ [private]

Definition at line 40 of file EcalRecalibRecHitProducer.h.

Referenced by EcalRecalibRecHitProducer(), and ~EcalRecalibRecHitProducer().

std::string EcalRecalibRecHitProducer::EERecalibRecHitCollection_ [private]

Definition at line 33 of file EcalRecalibRecHitProducer.h.

Referenced by EcalRecalibRecHitProducer(), and produce().

edm::InputTag EcalRecalibRecHitProducer::EERecHitCollection_ [private]

Definition at line 31 of file EcalRecalibRecHitProducer.h.

Referenced by EcalRecalibRecHitProducer(), and produce().


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