CMS 3D CMS Logo

Public Member Functions | Private Attributes

EcalTBTDCRecInfoProducer Class Reference

#include <EcalTBTDCRecInfoProducer.h>

Inheritance diagram for EcalTBTDCRecInfoProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase 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 15 of file EcalTBTDCRecInfoProducer.h.


Constructor & Destructor Documentation

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

Definition at line 11 of file EcalTBTDCRecInfoProducer.cc.

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

{
  rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection");
  rawInfoProducer_   = ps.getParameter<std::string>("rawInfoProducer");
  eventHeaderCollection_ = ps.getParameter<std::string>("eventHeaderCollection");
  eventHeaderProducer_   = ps.getParameter<std::string>("eventHeaderProducer");
  recInfoCollection_        = ps.getParameter<std::string>("recInfoCollection");

//   std::vector<double> planeShift_def;
//   planeShift_def.push_back( -0.333 );
//   planeShift_def.push_back( -0.333 );
//   planeShift_def.push_back( -0.333 );
//   planeShift_def.push_back( -0.333 );


//   std::vector<double> zPosition_def;
//   zPosition_def.push_back( -0.333 );
//   zPosition_def.push_back( -0.333 );
//   zPosition_def.push_back( -0.333 );
//   zPosition_def.push_back( -0.333 );
  std::vector<EcalTBTDCRecInfoAlgo::EcalTBTDCRanges> tdcRanges;

  typedef std::vector< edm::ParameterSet > Parameters;
  Parameters ranges=ps.getParameter<Parameters>("tdcRanges");
  for(Parameters::iterator itRanges = ranges.begin(); itRanges != ranges.end(); ++itRanges) 
    {
      EcalTBTDCRecInfoAlgo::EcalTBTDCRanges aRange;
      aRange.runRanges.first = itRanges->getParameter<int>("startRun");
      aRange.runRanges.second = itRanges->getParameter<int>("endRun");
      aRange.tdcMin = itRanges->getParameter< std::vector<double> >("tdcMin");
      aRange.tdcMax = itRanges->getParameter< std::vector<double> >("tdcMax");
      tdcRanges.push_back(aRange);
    }
  
  use2004OffsetConvention_ = ps.getUntrackedParameter< bool >("use2004OffsetConvention",false);

  produces<EcalTBTDCRecInfo>(recInfoCollection_);

  algo_ = new EcalTBTDCRecInfoAlgo(tdcRanges);
}
EcalTBTDCRecInfoProducer::~EcalTBTDCRecInfoProducer ( ) [virtual]

Definition at line 52 of file EcalTBTDCRecInfoProducer.cc.

References algo_.

                                                    {
  if (algo_)
    delete algo_;
}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 57 of file EcalTBTDCRecInfoProducer.cc.

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

{
  // Get input
   edm::Handle<EcalTBTDCRawInfo> ecalRawTDC;  
   const EcalTBTDCRawInfo* 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;
     }

   if ( (*ecalTDCRawInfo).size() < 1 )
     { 
       edm::LogError("EcalTBTDcRecInfoError") << "Less than one TDC good channel found. Aborting" << rawInfoCollection_.c_str() ;
       return;
     }
   // Get input
   edm::Handle<EcalTBEventHeader> tbEventHeader;  
   const EcalTBEventHeader* ecalEventHeader = 0;
   //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
   e.getByLabel( eventHeaderProducer_, tbEventHeader);
   if (tbEventHeader.isValid()) {
     ecalEventHeader = tbEventHeader.product();
   }
   
   if (! ecalEventHeader )
     {
       edm::LogError("EcalTBTDCRecInfoError") << "Error! can't get the product " << eventHeaderCollection_.c_str();
       return;
     }

  // Create empty output
  std::auto_ptr<EcalTBTDCRecInfo> recInfo(new EcalTBTDCRecInfo(algo_->reconstruct(*ecalRawTDC,*tbEventHeader,use2004OffsetConvention_)));
  
  e.put(recInfo,recInfoCollection_);
} 

Member Data Documentation

Definition at line 28 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

Definition at line 27 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

Definition at line 26 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

Definition at line 25 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

Definition at line 29 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().

Definition at line 30 of file EcalTBTDCRecInfoProducer.h.

Referenced by EcalTBTDCRecInfoProducer(), and produce().