CMS 3D CMS Logo

Public Member Functions | Private Attributes

CastorDigiToRaw Class Reference

#include <CastorDigiToRaw.h>

Inheritance diagram for CastorDigiToRaw:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Private Attributes

edm::InputTag calibTag_
edm::InputTag castorTag_
CastorCtdcPacker ctdcpacker_
CastorPacker packer_
edm::InputTag trigTag_
bool usingctdc_

Detailed Description

CastorDigiToRaw is the EDProducer subclass which runs the Castor Unpack algorithm.

Author:
Alan Campbell
Version:
1st Version April 18, 2008

Definition at line 26 of file CastorDigiToRaw.h.


Constructor & Destructor Documentation

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

Definition at line 15 of file CastorDigiToRaw.cc.

                                                            :
  castorTag_(conf.getUntrackedParameter("CASTOR",edm::InputTag())),
  calibTag_(conf.getUntrackedParameter("CALIB",edm::InputTag())),
  trigTag_(conf.getUntrackedParameter("TRIG",edm::InputTag())),
  usingctdc_(conf.getUntrackedParameter<bool>("CastorCtdc",false))

{
  produces<FEDRawDataCollection>();
}
CastorDigiToRaw::~CastorDigiToRaw ( ) [virtual]

Definition at line 26 of file CastorDigiToRaw.cc.

{ }  

Member Function Documentation

void CastorDigiToRaw::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 29 of file CastorDigiToRaw.cc.

References CastorCollections::castorCont, castorTag_, ctdcpacker_, edm::EventID::event(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::EventBase::id(), edm::InputTag::label(), FEDNumbering::MAXCASTORFEDID, FEDNumbering::MINCASTORFEDID, CastorCtdcPacker::pack(), CastorPacker::pack(), packer_, edm::Handle< T >::product(), edm::Event::put(), runTheMatrix_dev::raw, usingctdc_, and cms::Exception::what().

{
  CastorCollections colls;
 
  // Step A: Get Inputs 
  edm::Handle<CastorDigiCollection> castor;
  if (!castorTag_.label().empty()) {
    e.getByLabel(castorTag_,castor);
    colls.castorCont=castor.product();  
  }
  // get the mapping
  edm::ESHandle<CastorDbService> pSetup;
  es.get<CastorDbRecord>().get( pSetup );
  const CastorElectronicsMap* readoutMap=pSetup->getCastorMapping();
  // Step B: Create empty output
  std::auto_ptr<FEDRawDataCollection> raw=std::auto_ptr<FEDRawDataCollection>(new FEDRawDataCollection());

  const int ifed_first=FEDNumbering::MINCASTORFEDID;  //690
  const int ifed_last=FEDNumbering::MAXCASTORFEDID;   //693

  int orbitN=e.id().event();
  int bcnN=2000;

  // Step C: pack all requested FEDs
  for (int ifed=ifed_first; ifed<=ifed_last; ++ifed) {
    FEDRawData& fed = raw->FEDData(ifed);
    try {
                if ( usingctdc_ ) {
      ctdcpacker_.pack(ifed,ifed-ifed_first, e.id().event(),
                   orbitN, bcnN, colls, *readoutMap, fed);
                 } else {
      packer_.pack(ifed,ifed-ifed_first, e.id().event(),
                   orbitN, bcnN, colls, *readoutMap, fed);       }
    } catch (cms::Exception& e) {
      edm::LogWarning("Unpacking error") << e.what();
    } catch (...) {
      edm::LogWarning("Unpacking exception");
    }
  }

  e.put(raw);
}

Member Data Documentation

Definition at line 36 of file CastorDigiToRaw.h.

Definition at line 36 of file CastorDigiToRaw.h.

Referenced by produce().

Definition at line 35 of file CastorDigiToRaw.h.

Referenced by produce().

Definition at line 34 of file CastorDigiToRaw.h.

Referenced by produce().

Definition at line 36 of file CastorDigiToRaw.h.

Definition at line 37 of file CastorDigiToRaw.h.

Referenced by produce().