CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
DTDigiToRawModule Class Reference

#include <DTDigiToRawModule.h>

Inheritance diagram for DTDigiToRawModule:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DTDigiToRawModule (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~DTDigiToRawModule ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

int dduID
 
bool debug
 
edm::InputTag digicoll
 
int maxFEDid_
 
int minFEDid_
 
DTDigiToRawpacker
 
bool useStandardFEDid_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 12 of file DTDigiToRawModule.h.

Constructor & Destructor Documentation

DTDigiToRawModule::DTDigiToRawModule ( const edm::ParameterSet pset)

Constructor.

Definition at line 21 of file DTDigiToRawModule.cc.

References gather_cfg::cout, debug, edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

21  {
22  produces<FEDRawDataCollection>();
23 
24  dduID = ps.getUntrackedParameter<int>("dduID", 770);
25  debug = ps.getUntrackedParameter<bool>("debugMode", false);
26  digicoll = ps.getParameter<edm::InputTag>("digiColl");
27 
28  useStandardFEDid_ = ps.getUntrackedParameter<bool>("useStandardFEDid", true);
29  minFEDid_ = ps.getUntrackedParameter<int>("minFEDid", 770);
30  maxFEDid_ = ps.getUntrackedParameter<int>("maxFEDid", 775);
31 
32  packer = new DTDigiToRaw(ps);
33  if (debug) cout << "[DTDigiToRawModule]: constructor" << endl;
34 }
DTDigiToRaw * packer
edm::InputTag digicoll
tuple cout
Definition: gather_cfg.py:121
DTDigiToRawModule::~DTDigiToRawModule ( )
virtual

Destructor.

Definition at line 36 of file DTDigiToRawModule.cc.

References gather_cfg::cout, and debug.

36  {
37  delete packer;
38  if (debug) cout << "[DTDigiToRawModule]: destructor" << endl;
39 }
DTDigiToRaw * packer
tuple cout
Definition: gather_cfg.py:121

Member Function Documentation

void DTDigiToRawModule::produce ( edm::Event e,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 42 of file DTDigiToRawModule.cc.

References evf::compute_crc(), FEDRawData::data(), edm::EventID::event(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::EventBase::id(), python.multivaluedict::map(), FEDNumbering::MAXDTFEDID, FEDNumbering::MINDTFEDID, edm::Event::put(), FEDTrailer::set(), FEDHeader::set(), and FEDRawData::size().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

42  {
43 
44  auto_ptr<FEDRawDataCollection> fed_buffers(new FEDRawDataCollection);
45 
46  // Take digis from the event
48  e.getByLabel(digicoll, digis);
49 
50  // Load DTMap
52  iSetup.get<DTReadOutMappingRcd>().get( map );
53 
54  // Create the packed data
55  int FEDIDmin = 0, FEDIDMax = 0;
56  if (useStandardFEDid_){
57  FEDIDmin = FEDNumbering::MINDTFEDID;
58  FEDIDMax = FEDNumbering::MAXDTFEDID;
59  }
60  else {
61  FEDIDmin = minFEDid_;
62  FEDIDMax = maxFEDid_;
63  }
64 
65  for (int id=FEDIDmin; id<=FEDIDMax; ++id){
66 
67  packer->SetdduID(id);
68  FEDRawData* rawData = packer->createFedBuffers(*digis, map);
69 
70  FEDRawData& fedRawData = fed_buffers->FEDData(id);
71  fedRawData = *rawData;
72  delete rawData;
73 
74  FEDHeader dtFEDHeader(fedRawData.data());
75  dtFEDHeader.set(fedRawData.data(), 0, e.id().event(), 0, id);
76 
77  FEDTrailer dtFEDTrailer(fedRawData.data()+(fedRawData.size()-8));
78  dtFEDTrailer.set(fedRawData.data()+(fedRawData.size()-8), fedRawData.size()/8, evf::compute_crc(fedRawData.data(),fedRawData.size()), 0, 0);
79 
80  }
81  // Put the raw data to the event
82  e.put(fed_buffers);
83 
84 }
EventNumber_t event() const
Definition: EventID.h:44
void SetdduID(int dduid)
Definition: DTDigiToRaw.cc:203
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
DTDigiToRaw * packer
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
static void set(unsigned char *header, int evt_ty, int lvl1_ID, int bx_ID, int source_ID, int version=0, bool H=false)
Set all fields in the header.
Definition: FEDHeader.cc:40
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
Definition: CRC16.h:67
FEDRawData * createFedBuffers(const DTDigiCollection &digis, edm::ESHandle< DTReadOutMapping > &mapping)
Take a vector of digis and fill the FEDRawDataCollection.
Definition: DTDigiToRaw.cc:23
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
const T & get() const
Definition: EventSetup.h:55
edm::InputTag digicoll
edm::EventID id() const
Definition: EventBase.h:56
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28

Member Data Documentation

int DTDigiToRawModule::dduID
private

Definition at line 26 of file DTDigiToRawModule.h.

bool DTDigiToRawModule::debug
private
edm::InputTag DTDigiToRawModule::digicoll
private

Definition at line 28 of file DTDigiToRawModule.h.

int DTDigiToRawModule::maxFEDid_
private

Definition at line 32 of file DTDigiToRawModule.h.

int DTDigiToRawModule::minFEDid_
private

Definition at line 31 of file DTDigiToRawModule.h.

DTDigiToRaw* DTDigiToRawModule::packer
private

Definition at line 24 of file DTDigiToRawModule.h.

bool DTDigiToRawModule::useStandardFEDid_
private

Definition at line 30 of file DTDigiToRawModule.h.