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::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 ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

int dduID
 
bool debug
 
bool digibyType
 
std::string digicoll
 
int maxFEDid_
 
int minFEDid_
 
DTDigiToRawpacker
 
bool useStandardFEDid_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 11 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, 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.getUntrackedParameter<string>("digiColl", "dtunpacker");
27  digibyType = ps.getUntrackedParameter<bool>("digibytype", true);
28 
29  useStandardFEDid_ = ps.getUntrackedParameter<bool>("useStandardFEDid", true);
30  minFEDid_ = ps.getUntrackedParameter<int>("minFEDid", 770);
31  maxFEDid_ = ps.getUntrackedParameter<int>("maxFEDid", 775);
32 
33  packer = new DTDigiToRaw(ps);
34  if (debug) cout << "[DTDigiToRawModule]: constructor" << endl;
35 }
DTDigiToRaw * packer
tuple cout
Definition: gather_cfg.py:121
DTDigiToRawModule::~DTDigiToRawModule ( )
virtual

Destructor.

Definition at line 37 of file DTDigiToRawModule.cc.

References gather_cfg::cout, and debug.

37  {
38  delete packer;
39  if (debug) cout << "[DTDigiToRawModule]: destructor" << endl;
40 }
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 43 of file DTDigiToRawModule.cc.

References evf::compute_crc(), FEDRawData::data(), edm::EventID::event(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::Event::getByType(), edm::EventBase::id(), errorMatrix2Lands_multiChannel::id, Association::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().

43  {
44 
45  auto_ptr<FEDRawDataCollection> fed_buffers(new FEDRawDataCollection);
46 
47  // Take digis from the event
49  if (digibyType) {
50  e.getByType(digis);
51  }
52  else {
53  e.getByLabel(digicoll, digis);
54  }
55 
56  // Load DTMap
58  iSetup.get<DTReadOutMappingRcd>().get( map );
59 
60  // Create the packed data
61  int FEDIDmin = 0, FEDIDMax = 0;
62  if (useStandardFEDid_){
63  FEDIDmin = FEDNumbering::MINDTFEDID;
64  FEDIDMax = FEDNumbering::MAXDTFEDID;
65  }
66  else {
67  FEDIDmin = minFEDid_;
68  FEDIDMax = maxFEDid_;
69  }
70 
71  for (int id=FEDIDmin; id<=FEDIDMax; ++id){
72 
73  packer->SetdduID(id);
74  FEDRawData* rawData = packer->createFedBuffers(*digis, map);
75 
76  FEDRawData& fedRawData = fed_buffers->FEDData(id);
77  fedRawData = *rawData;
78  delete rawData;
79 
80  FEDHeader dtFEDHeader(fedRawData.data());
81  dtFEDHeader.set(fedRawData.data(), 0, e.id().event(), 0, id);
82 
83  FEDTrailer dtFEDTrailer(fedRawData.data()+(fedRawData.size()-8));
84  dtFEDTrailer.set(fedRawData.data()+(fedRawData.size()-8), fedRawData.size()/8, evf::compute_crc(fedRawData.data(),fedRawData.size()), 0, 0);
85 
86  }
87  // Put the raw data to the event
88  e.put(fed_buffers);
89 
90 }
EventNumber_t event() const
Definition: EventID.h:44
void SetdduID(int dduid)
Definition: DTDigiToRaw.cc:203
bool getByType(Handle< PROD > &result) const
Definition: Event.h:398
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
DTDigiToRaw * packer
dictionary map
Definition: Association.py:205
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
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:42
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:356
const T & get() const
Definition: EventSetup.h:55
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:29

Member Data Documentation

int DTDigiToRawModule::dduID
private

Definition at line 25 of file DTDigiToRawModule.h.

bool DTDigiToRawModule::debug
private

Definition at line 26 of file DTDigiToRawModule.h.

bool DTDigiToRawModule::digibyType
private

Definition at line 27 of file DTDigiToRawModule.h.

std::string 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 23 of file DTDigiToRawModule.h.

bool DTDigiToRawModule::useStandardFEDid_
private

Definition at line 30 of file DTDigiToRawModule.h.