CMS 3D CMS Logo

EcalAnalFitUncalibRecHitProducer Class Reference

produce ECAL uncalibrated rechits from dataframes with the analytical fit method More...

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

Inheritance diagram for EcalAnalFitUncalibRecHitProducer:

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

List of all members.

Public Types

typedef std::vector< double > EcalRecoAmplitudes

Public Member Functions

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

Private Attributes

EcalUncalibRecHitRecAnalFitAlgo
< EBDataFrame
EBalgo_
edm::InputTag EBdigiCollection_
std::string EBhitCollection_
EcalUncalibRecHitRecAnalFitAlgo
< EEDataFrame
EEalgo_
edm::InputTag EEdigiCollection_
std::string EEhitCollection_


Detailed Description

produce ECAL uncalibrated rechits from dataframes with the analytical fit method

produce ECAL uncalibrated rechits from dataframes with the analytic specific fit method with alfa and beta fixed.

Id
EcalAnalFitUncalibRecHitProducer.cc,v 1.16 2007/12/21 15:35:40 ferriff Exp
Date
2007/12/21 15:35:40
Revision
1.16
Author:
Shahram Rahatlou, University of Rome & INFN, Sept 2005

A. Ghezzi, Mar 2006

Definition at line 14 of file EcalAnalFitUncalibRecHitProducer.h.


Member Typedef Documentation

typedef std::vector<double> EcalAnalFitUncalibRecHitProducer::EcalRecoAmplitudes

Definition at line 17 of file EcalAnalFitUncalibRecHitProducer.h.


Constructor & Destructor Documentation

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

Definition at line 40 of file EcalAnalFitUncalibRecHitProducer.cc.

References EBdigiCollection_, EBhitCollection_, EEdigiCollection_, EEhitCollection_, and edm::ParameterSet::getParameter().

00040                                                                                             {
00041 
00042    EBdigiCollection_ = ps.getParameter<edm::InputTag>("EBdigiCollection");
00043    EEdigiCollection_ = ps.getParameter<edm::InputTag>("EEdigiCollection");
00044    EBhitCollection_  = ps.getParameter<std::string>("EBhitCollection");
00045    EEhitCollection_  = ps.getParameter<std::string>("EEhitCollection");
00046    //   nMaxPrintout_   = ps.getUntrackedParameter<int>("nMaxPrintout",10);
00047    produces< EBUncalibratedRecHitCollection >(EBhitCollection_);
00048    produces< EEUncalibratedRecHitCollection >(EEhitCollection_);
00049    //   nEvt_ = 0; // reset local event counter
00050 }

EcalAnalFitUncalibRecHitProducer::~EcalAnalFitUncalibRecHitProducer (  ) 

Definition at line 52 of file EcalAnalFitUncalibRecHitProducer.cc.

00052                                                                     {
00053 }


Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 56 of file EcalAnalFitUncalibRecHitProducer.cc.

References EcalUncalibratedRecHit::amplitude(), edm::DataFrameContainer::begin(), EBalgo_, EBdigiCollection_, EBhitCollection_, EEalgo_, EEdigiCollection_, EEhitCollection_, EcalCondObjectContainer< T >::end(), edm::DataFrameContainer::end(), EcalCondObjectContainer< T >::find(), EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), edm::EventSetup::get(), edm::Event::getByLabel(), EcalCondObjectContainer< T >::getMap(), edm::InputTag::instance(), edm::InputTag::label(), LogDebug, EcalUncalibRecHitRecAnalFitAlgo< C >::makeRecHit(), edm::ESHandle< T >::product(), edm::Event::put(), and edm::DataFrameContainer::size().

00056                                                                                 {
00057 
00058    using namespace edm;
00059 
00060    //   nEvt_++;
00061 
00062    Handle< EBDigiCollection > pEBDigis;
00063    Handle< EEDigiCollection > pEEDigis;
00064 
00065    const EBDigiCollection* EBdigis =0;
00066    const EEDigiCollection* EEdigis =0;
00067    
00068    if ( EBdigiCollection_.label() != "" && EBdigiCollection_.instance() != "" ) {
00069      evt.getByLabel( EBdigiCollection_, pEBDigis);
00070      //evt.getByLabel( digiProducer_, pEBDigis);
00071      if (pEBDigis.isValid()) {
00072              EBdigis = pEBDigis.product(); // get a ptr to the produc
00073              edm::LogInfo("EcalUncalibRecHitInfo") << "EcalAnalFitUncalibRecHitProducer: total # EBdigis: " << EBdigis->size() ;
00074      } else {
00075              edm::LogError("EcalUncalibRecHitError") << "Error! can't get the product " << EBdigiCollection_;
00076      }
00077    }
00078 
00079    if ( EEdigiCollection_.label() != "" && EEdigiCollection_.instance() != "" ) {
00080            evt.getByLabel( EEdigiCollection_, pEEDigis);
00081            //evt.getByLabel( digiProducer_, pEEDigis);
00082            if (pEEDigis.isValid()) {
00083                    EEdigis = pEEDigis.product(); // get a ptr to the product
00084                    edm::LogInfo("EcalUncalibRecHitInfo") << "EcalAnalFitUncalibRecHitProducer: total # EEdigis: " << EEdigis->size() ;
00085            } else {
00086                    edm::LogError("EcalUncalibRecHitError") << "Error! can't get the product " << EEdigiCollection_;
00087            }
00088    }
00089 
00090    // Gain Ratios
00091    LogDebug("EcalUncalibRecHitDebug") << "fetching gainRatios....";
00092    edm::ESHandle<EcalGainRatios> pRatio;
00093    es.get<EcalGainRatiosRcd>().get(pRatio);
00094    //const EcalGainRatios::EcalGainRatioMap& gainMap = pRatio.product()->getMap(); // map of gain ratios
00095    const EcalGainRatioMap & gainMap = pRatio.product()->getMap(); // map of gain ratios
00096 
00097 
00098    // fetch the pedestals from the cond DB via EventSetup
00099    LogDebug("EcalUncalibRecHitDebug") << "fetching pedestals....";
00100    edm::ESHandle<EcalPedestals> pedHandle;
00101    es.get<EcalPedestalsRcd>().get( pedHandle );
00102    //const EcalPedestalsMap & pedMap = pedHandle.product()->m_pedestals; // map of pedestals
00103    const EcalPedestalsMap & pedMap = pedHandle.product()->getMap(); // map of pedestals
00104    LogDebug("EcalUncalibRecHitDebug") << "done." ;
00105 
00106 //    if(!counterExceeded()) 
00107 //      {
00108 
00109 
00110 //      }
00111 
00112 
00113    // collection of reco'ed ampltudes to put in the event
00114 
00115    std::auto_ptr< EBUncalibratedRecHitCollection > EBuncalibRechits( new EBUncalibratedRecHitCollection );
00116    std::auto_ptr< EEUncalibratedRecHitCollection > EEuncalibRechits( new EEUncalibratedRecHitCollection );
00117 
00118    EcalPedestalsMapIterator pedIter; // pedestal iterator
00119    EcalPedestals::Item aped; // pedestal object for a single xtal
00120 
00121    EcalGainRatioMap::const_iterator gainIter; // gain iterator
00122    EcalMGPAGainRatio aGain; // gain object for a single xtal
00123 
00124    if (EBdigis)
00125      {
00126        for(EBDigiCollection::const_iterator itdg = EBdigis->begin(); itdg != EBdigis->end(); ++itdg) {
00127 
00128          // find pedestals for this channel
00129          LogDebug("EcalUncalibRecHitDebug") << "looking up pedestal for crystal: " << EBDetId(itdg->id()) ;
00130          pedIter = pedMap.find(itdg->id());
00131          if( pedIter != pedMap.end() ) {
00132            aped = (*pedIter);
00133          } else {
00134            edm::LogError("EcalUncalibRecHitError") << "error!! could not find pedestals for channel: " << EBDetId(itdg->id()) 
00135                                                    << "\n  no uncalib rechit will be made for this digi!"
00136              ;
00137            continue;
00138          }
00139          double pedVec[3];
00140          pedVec[0]=aped.mean_x12;pedVec[1]=aped.mean_x6;pedVec[2]=aped.mean_x1;
00141 
00142 
00143          // find gain ratios
00144          LogDebug("EcalUncalibRecHitDebug") << "looking up gainRatios for crystal: " << EBDetId(itdg->id()) ;
00145          gainIter = gainMap.find(itdg->id());
00146          if( gainIter != gainMap.end() ) {
00147            aGain = (*gainIter);
00148          } else {
00149            edm::LogError("EcalUncalibRecHitError") << "error!! could not find gain ratios for channel: " << EBDetId(itdg->id()) 
00150                                                    << "\n  no uncalib rechit will be made for this digi!"
00151              ;
00152            continue;
00153          }
00154          double gainRatios[3];
00155          gainRatios[0]=1.;gainRatios[1]=aGain.gain12Over6();gainRatios[2]=aGain.gain6Over1()*aGain.gain12Over6();
00156 
00157          EcalUncalibratedRecHit aHit =
00158            EBalgo_.makeRecHit(*itdg, pedVec, gainRatios, 0 ,0);
00159 
00160          EBuncalibRechits->push_back( aHit );
00161          
00162          if(aHit.amplitude()>0.) {
00163            LogDebug("EcalUncalibRecHitInfo") << "EcalAnalFitUncalibRecHitProducer: processed EBDataFrame with id: "
00164                                              << EBDetId(itdg->id()) << "\n"
00165                                              << "uncalib rechit amplitude: " << aHit.amplitude()
00166              ;
00167          }
00168          
00169        }
00170      }
00171 
00172    if (EEdigis)
00173      {
00174        for(EEDigiCollection::const_iterator itdg = EEdigis->begin(); itdg != EEdigis->end(); ++itdg) {
00175 
00176          // find pedestals for this channel
00177          LogDebug("EcalUncalibRecHitDebug") << "looking up pedestal for crystal: " << EEDetId(itdg->id()) ;
00178          pedIter = pedMap.find(itdg->id());
00179          if( pedIter != pedMap.end() ) {
00180            aped = (*pedIter);
00181          } else {
00182            edm::LogError("EcalUncalibRecHitError") << "error!! could not find pedestals for channel: " << EEDetId(itdg->id())
00183                                                    << "\n  no uncalib rechit will be made for this digi!"
00184              ;
00185            continue;
00186          }
00187          double pedVec[3];
00188          pedVec[0]=aped.mean_x12;pedVec[1]=aped.mean_x6;pedVec[2]=aped.mean_x1;
00189 
00190          // find gain ratios
00191          LogDebug("EcalUncalibRecHitDebug") << "looking up gainRatios for crystal: " << EEDetId(itdg->id()) ;
00192          gainIter = gainMap.find(itdg->id());
00193          if( gainIter != gainMap.end() ) {
00194            aGain = (*gainIter);
00195          } else {
00196            edm::LogError("EcalUncalibRecHitError") << "error!! could not find gain ratios for channel: " << EEDetId(itdg->id())
00197                                                    << "\n  no uncalib rechit will be made for this digi!"
00198              ;
00199            continue;
00200          }
00201          double gainRatios[3];
00202          gainRatios[0]=1.;gainRatios[1]=aGain.gain12Over6();gainRatios[2]=aGain.gain6Over1()*aGain.gain12Over6();
00203          
00204          EcalUncalibratedRecHit aHit =
00205            EEalgo_.makeRecHit(*itdg, pedVec, gainRatios, 0, 0);
00206          EEuncalibRechits->push_back( aHit );
00207          
00208          if(aHit.amplitude()>0.) {
00209            LogDebug("EcalUncalibRecHitInfo") << "EcalAnalFitUncalibRecHitProducer: processed EEDataFrame with id: "
00210                                              << EEDetId(itdg->id()) << "\n"
00211                                              << "uncalib rechit amplitude: " << aHit.amplitude()
00212              ;
00213          }
00214          
00215        }
00216      }
00217 
00218    // put the collection of recunstructed hits in the event
00219    evt.put( EBuncalibRechits, EBhitCollection_ );
00220    evt.put( EEuncalibRechits, EEhitCollection_ );
00221 }


Member Data Documentation

EcalUncalibRecHitRecAnalFitAlgo<EBDataFrame> EcalAnalFitUncalibRecHitProducer::EBalgo_ [private]

Definition at line 28 of file EcalAnalFitUncalibRecHitProducer.h.

Referenced by produce().

edm::InputTag EcalAnalFitUncalibRecHitProducer::EBdigiCollection_ [private]

Definition at line 23 of file EcalAnalFitUncalibRecHitProducer.h.

Referenced by EcalAnalFitUncalibRecHitProducer(), and produce().

std::string EcalAnalFitUncalibRecHitProducer::EBhitCollection_ [private]

Definition at line 25 of file EcalAnalFitUncalibRecHitProducer.h.

Referenced by EcalAnalFitUncalibRecHitProducer(), and produce().

EcalUncalibRecHitRecAnalFitAlgo<EEDataFrame> EcalAnalFitUncalibRecHitProducer::EEalgo_ [private]

Definition at line 29 of file EcalAnalFitUncalibRecHitProducer.h.

Referenced by produce().

edm::InputTag EcalAnalFitUncalibRecHitProducer::EEdigiCollection_ [private]

Definition at line 24 of file EcalAnalFitUncalibRecHitProducer.h.

Referenced by EcalAnalFitUncalibRecHitProducer(), and produce().

std::string EcalAnalFitUncalibRecHitProducer::EEhitCollection_ [private]

Definition at line 26 of file EcalAnalFitUncalibRecHitProducer.h.

Referenced by EcalAnalFitUncalibRecHitProducer(), and produce().


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