CMS 3D CMS Logo

EcalTBH2TDCRecInfoProducer Class Reference

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

Inheritance diagram for EcalTBH2TDCRecInfoProducer:

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

List of all members.

Public Member Functions

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

Private Attributes

EcalTBH2TDCRecInfoAlgoalgo_
std::string rawInfoCollection_
std::string rawInfoProducer_
std::string recInfoCollection_
std::string triggerDataCollection_
std::string triggerDataProducer_


Detailed Description

Definition at line 16 of file EcalTBH2TDCRecInfoProducer.h.


Constructor & Destructor Documentation

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

Definition at line 13 of file EcalTBH2TDCRecInfoProducer.cc.

References algo_, edm::ParameterSet::getParameter(), ranges, rawInfoCollection_, rawInfoProducer_, recInfoCollection_, EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRanges::runRanges, Ecal2007H4TBTDCRanges_v0_cff::tdcRanges, EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRanges::tdcZero, triggerDataCollection_, and triggerDataProducer_.

00014 {
00015   rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection");
00016   rawInfoProducer_   = ps.getParameter<std::string>("rawInfoProducer");
00017   triggerDataCollection_ = ps.getParameter<std::string>("triggerDataCollection");
00018   triggerDataProducer_   = ps.getParameter<std::string>("triggerDataProducer");
00019   recInfoCollection_        = ps.getParameter<std::string>("recInfoCollection");
00020 
00021 
00022   std::vector<EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRanges> tdcRanges;
00023 
00024   typedef std::vector< edm::ParameterSet > Parameters;
00025   Parameters ranges=ps.getParameter<Parameters>("tdcZeros");
00026   for(Parameters::iterator itRanges = ranges.begin(); itRanges != ranges.end(); ++itRanges) 
00027     {
00028       EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRanges aRange;
00029       aRange.runRanges.first = itRanges->getParameter<int>("startRun");
00030       aRange.runRanges.second = itRanges->getParameter<int>("endRun");
00031       aRange.tdcZero = itRanges->getParameter< double >("tdcZero");
00032       tdcRanges.push_back(aRange);
00033     }
00034   
00035   produces<EcalTBTDCRecInfo>(recInfoCollection_);
00036   
00037   algo_ = new EcalTBH2TDCRecInfoAlgo(tdcRanges);
00038 }

EcalTBH2TDCRecInfoProducer::~EcalTBH2TDCRecInfoProducer (  )  [virtual]

Definition at line 40 of file EcalTBH2TDCRecInfoProducer.cc.

References algo_.

00041 {
00042   if (algo_)
00043     delete algo_;
00044 }


Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 46 of file EcalTBH2TDCRecInfoProducer.cc.

References algo_, edm::Event::getByLabel(), edm::Event::id(), edm::Handle< T >::isValid(), edm::Handle< T >::product(), edm::Event::put(), rawInfoCollection_, rawInfoProducer_, recInfoCollection_, EcalTBH2TDCRecInfoAlgo::reconstruct(), triggerDataCollection_, triggerDataProducer_, and HcalTBTriggerData::wasBeamTrigger().

00047 {
00048   int runNumber = e.id().run();
00049   // Get input
00050   edm::Handle<HcalTBTiming> ecalRawTDC;  
00051   const HcalTBTiming* ecalTDCRawInfo = 0;
00052   
00053   //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
00054   e.getByLabel( rawInfoProducer_, ecalRawTDC);
00055   if (ecalRawTDC.isValid()) {
00056     ecalTDCRawInfo = ecalRawTDC.product();
00057   }
00058 
00059   
00060   if (! ecalTDCRawInfo )
00061     {
00062       edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str() ;
00063       return;
00064     }
00065   
00066   
00067   // Get input
00068   edm::Handle<HcalTBTriggerData> triggerData;  
00069   const HcalTBTriggerData* h2TriggerData = 0;
00070   //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
00071   e.getByLabel(triggerDataProducer_, triggerData);
00072   if (triggerData.isValid()) {
00073     h2TriggerData = triggerData.product();
00074   }
00075   
00076   if (! h2TriggerData )
00077     {
00078       edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << triggerDataCollection_.c_str();
00079       return;
00080     }
00081   
00082   
00083   if (!h2TriggerData->wasBeamTrigger())
00084     {
00085       std::auto_ptr<EcalTBTDCRecInfo> recInfo(new EcalTBTDCRecInfo(0.5));
00086       e.put(recInfo,recInfoCollection_);
00087     }
00088    else
00089      {
00090        std::auto_ptr<EcalTBTDCRecInfo> recInfo(new EcalTBTDCRecInfo(algo_->reconstruct(runNumber,*ecalRawTDC)));
00091        e.put(recInfo,recInfoCollection_);
00092      }
00093   
00094 
00095 } 


Member Data Documentation

EcalTBH2TDCRecInfoAlgo* EcalTBH2TDCRecInfoProducer::algo_ [private]

Definition at line 32 of file EcalTBH2TDCRecInfoProducer.h.

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

std::string EcalTBH2TDCRecInfoProducer::rawInfoCollection_ [private]

Definition at line 27 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

std::string EcalTBH2TDCRecInfoProducer::rawInfoProducer_ [private]

Definition at line 26 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

std::string EcalTBH2TDCRecInfoProducer::recInfoCollection_ [private]

Definition at line 30 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

std::string EcalTBH2TDCRecInfoProducer::triggerDataCollection_ [private]

Definition at line 29 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

std::string EcalTBH2TDCRecInfoProducer::triggerDataProducer_ [private]

Definition at line 28 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().


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