CMS 3D CMS Logo

EcalTBTDCRecInfoProducer Class Reference

#include <RecoTBCalo/EcalTBTDCReconstructor/interface/EcalTBTDCRecInfoProducer.h>

Inheritance diagram for EcalTBTDCRecInfoProducer:

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

List of all members.

Public Member Functions

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

Private Attributes

EcalTBTDCRecInfoAlgoalgo_
std::string eventHeaderCollection_
std::string eventHeaderProducer_
std::string rawInfoCollection_
std::string rawInfoProducer_
std::string recInfoCollection_
bool use2004OffsetConvention_


Detailed Description

Definition at line 16 of file EcalTBTDCRecInfoProducer.h.


Constructor & Destructor Documentation

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

Definition at line 12 of file EcalTBTDCRecInfoProducer.cc.

References algo_, eventHeaderCollection_, eventHeaderProducer_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), ranges, rawInfoCollection_, rawInfoProducer_, recInfoCollection_, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::runRanges, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMax, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMin, Ecal2007H4TBTDCRanges_v0_cff::tdcRanges, and use2004OffsetConvention_.

00013 {
00014   rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection");
00015   rawInfoProducer_   = ps.getParameter<std::string>("rawInfoProducer");
00016   eventHeaderCollection_ = ps.getParameter<std::string>("eventHeaderCollection");
00017   eventHeaderProducer_   = ps.getParameter<std::string>("eventHeaderProducer");
00018   recInfoCollection_        = ps.getParameter<std::string>("recInfoCollection");
00019 
00020 //   std::vector<double> planeShift_def;
00021 //   planeShift_def.push_back( -0.333 );
00022 //   planeShift_def.push_back( -0.333 );
00023 //   planeShift_def.push_back( -0.333 );
00024 //   planeShift_def.push_back( -0.333 );
00025 
00026 
00027 //   std::vector<double> zPosition_def;
00028 //   zPosition_def.push_back( -0.333 );
00029 //   zPosition_def.push_back( -0.333 );
00030 //   zPosition_def.push_back( -0.333 );
00031 //   zPosition_def.push_back( -0.333 );
00032   std::vector<EcalTBTDCRecInfoAlgo::EcalTBTDCRanges> tdcRanges;
00033 
00034   typedef std::vector< edm::ParameterSet > Parameters;
00035   Parameters ranges=ps.getParameter<Parameters>("tdcRanges");
00036   for(Parameters::iterator itRanges = ranges.begin(); itRanges != ranges.end(); ++itRanges) 
00037     {
00038       EcalTBTDCRecInfoAlgo::EcalTBTDCRanges aRange;
00039       aRange.runRanges.first = itRanges->getParameter<int>("startRun");
00040       aRange.runRanges.second = itRanges->getParameter<int>("endRun");
00041       aRange.tdcMin = itRanges->getParameter< std::vector<double> >("tdcMin");
00042       aRange.tdcMax = itRanges->getParameter< std::vector<double> >("tdcMax");
00043       tdcRanges.push_back(aRange);
00044     }
00045   
00046   use2004OffsetConvention_ = ps.getUntrackedParameter< bool >("use2004OffsetConvention",false);
00047 
00048   produces<EcalTBTDCRecInfo>(recInfoCollection_);
00049 
00050   algo_ = new EcalTBTDCRecInfoAlgo(tdcRanges);
00051 }

EcalTBTDCRecInfoProducer::~EcalTBTDCRecInfoProducer (  )  [virtual]

Definition at line 53 of file EcalTBTDCRecInfoProducer.cc.

References algo_.

00053                                                     {
00054   if (algo_)
00055     delete algo_;
00056 }


Member Function Documentation

void EcalTBTDCRecInfoProducer::produce ( edm::Event e,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 58 of file EcalTBTDCRecInfoProducer.cc.

References algo_, eventHeaderCollection_, eventHeaderProducer_, edm::Event::getByLabel(), edm::Handle< T >::isValid(), edm::Handle< T >::product(), edm::Event::put(), rawInfoCollection_, rawInfoProducer_, recInfoCollection_, EcalTBTDCRecInfoAlgo::reconstruct(), and use2004OffsetConvention_.

00059 {
00060   // Get input
00061    edm::Handle<EcalTBTDCRawInfo> ecalRawTDC;  
00062    const EcalTBTDCRawInfo* ecalTDCRawInfo = 0;
00063 
00064    //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
00065    e.getByLabel( rawInfoProducer_, ecalRawTDC);
00066    if (ecalRawTDC.isValid()) {
00067      ecalTDCRawInfo = ecalRawTDC.product();
00068    }
00069 
00070    if (! ecalTDCRawInfo )
00071      {
00072        edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str() ;
00073        return;
00074      }
00075 
00076    if ( (*ecalTDCRawInfo).size() < 1 )
00077      { 
00078        edm::LogError("EcalTBTDcRecInfoError") << "Less than one TDC good channel found. Aborting" << rawInfoCollection_.c_str() ;
00079        return;
00080      }
00081    // Get input
00082    edm::Handle<EcalTBEventHeader> tbEventHeader;  
00083    const EcalTBEventHeader* ecalEventHeader = 0;
00084    //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
00085    e.getByLabel( eventHeaderProducer_, tbEventHeader);
00086    if (tbEventHeader.isValid()) {
00087      ecalEventHeader = tbEventHeader.product();
00088    }
00089    
00090    if (! ecalEventHeader )
00091      {
00092        edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << eventHeaderCollection_.c_str();
00093        return;
00094      }
00095 
00096   // Create empty output
00097   std::auto_ptr<EcalTBTDCRecInfo> recInfo(new EcalTBTDCRecInfo(algo_->reconstruct(*ecalRawTDC,*tbEventHeader,use2004OffsetConvention_)));
00098   
00099   e.put(recInfo,recInfoCollection_);
00100 } 


Member Data Documentation

EcalTBTDCRecInfoAlgo* EcalTBTDCRecInfoProducer::algo_ [private]

Definition at line 33 of file EcalTBTDCRecInfoProducer.h.

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

std::string EcalTBTDCRecInfoProducer::eventHeaderCollection_ [private]

Definition at line 29 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

std::string EcalTBTDCRecInfoProducer::eventHeaderProducer_ [private]

Definition at line 28 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

std::string EcalTBTDCRecInfoProducer::rawInfoCollection_ [private]

Definition at line 27 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

std::string EcalTBTDCRecInfoProducer::rawInfoProducer_ [private]

Definition at line 26 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

std::string EcalTBTDCRecInfoProducer::recInfoCollection_ [private]

Definition at line 30 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

bool EcalTBTDCRecInfoProducer::use2004OffsetConvention_ [private]

Definition at line 31 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().


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