CMS 3D CMS Logo

Public Member Functions | Private Attributes

EcalTBH2TDCRecInfoProducer Class Reference

#include <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(), runregparse::ranges, rawInfoCollection_, rawInfoProducer_, recInfoCollection_, EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRanges::runRanges, Ecal2004TBTDCRanges_v1_cff::tdcRanges, EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRanges::tdcZero, triggerDataCollection_, and triggerDataProducer_.

{
  rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection");
  rawInfoProducer_   = ps.getParameter<std::string>("rawInfoProducer");
  triggerDataCollection_ = ps.getParameter<std::string>("triggerDataCollection");
  triggerDataProducer_   = ps.getParameter<std::string>("triggerDataProducer");
  recInfoCollection_        = ps.getParameter<std::string>("recInfoCollection");


  std::vector<EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRanges> tdcRanges;

  typedef std::vector< edm::ParameterSet > Parameters;
  Parameters ranges=ps.getParameter<Parameters>("tdcZeros");
  for(Parameters::iterator itRanges = ranges.begin(); itRanges != ranges.end(); ++itRanges) 
    {
      EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRanges aRange;
      aRange.runRanges.first = itRanges->getParameter<int>("startRun");
      aRange.runRanges.second = itRanges->getParameter<int>("endRun");
      aRange.tdcZero = itRanges->getParameter< double >("tdcZero");
      tdcRanges.push_back(aRange);
    }
  
  produces<EcalTBTDCRecInfo>(recInfoCollection_);
  
  algo_ = new EcalTBH2TDCRecInfoAlgo(tdcRanges);
}
EcalTBH2TDCRecInfoProducer::~EcalTBH2TDCRecInfoProducer ( ) [virtual]

Definition at line 40 of file EcalTBH2TDCRecInfoProducer.cc.

References algo_.

{
  if (algo_)
    delete algo_;
}

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::EventBase::id(), edm::HandleBase::isValid(), edm::Handle< T >::product(), edm::Event::put(), rawInfoCollection_, rawInfoProducer_, recInfoCollection_, EcalTBH2TDCRecInfoAlgo::reconstruct(), edm::EventID::run(), inputsource_file_cfi::runNumber, triggerDataCollection_, triggerDataProducer_, and HcalTBTriggerData::wasBeamTrigger().

{
  int runNumber = e.id().run();
  // Get input
  edm::Handle<HcalTBTiming> ecalRawTDC;  
  const HcalTBTiming* ecalTDCRawInfo = 0;
  
  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
  e.getByLabel( rawInfoProducer_, ecalRawTDC);
  if (ecalRawTDC.isValid()) {
    ecalTDCRawInfo = ecalRawTDC.product();
  }

  
  if (! ecalTDCRawInfo )
    {
      edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str() ;
      return;
    }
  
  
  // Get input
  edm::Handle<HcalTBTriggerData> triggerData;  
  const HcalTBTriggerData* h2TriggerData = 0;
  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
  e.getByLabel(triggerDataProducer_, triggerData);
  if (triggerData.isValid()) {
    h2TriggerData = triggerData.product();
  }
  
  if (! h2TriggerData )
    {
      edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << triggerDataCollection_.c_str();
      return;
    }
  
  
  if (!h2TriggerData->wasBeamTrigger())
    {
      std::auto_ptr<EcalTBTDCRecInfo> recInfo(new EcalTBTDCRecInfo(0.5));
      e.put(recInfo,recInfoCollection_);
    }
   else
     {
       std::auto_ptr<EcalTBTDCRecInfo> recInfo(new EcalTBTDCRecInfo(algo_->reconstruct(runNumber,*ecalRawTDC)));
       e.put(recInfo,recInfoCollection_);
     }
  

} 

Member Data Documentation

Definition at line 27 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

Definition at line 26 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

Definition at line 30 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

Definition at line 29 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().

Definition at line 28 of file EcalTBH2TDCRecInfoProducer.h.

Referenced by EcalTBH2TDCRecInfoProducer(), and produce().