CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DTDigiToRawModule Class Reference

#include <DTDigiToRawModule.h>

Inheritance diagram for DTDigiToRawModule:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DTDigiToRawModule (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
virtual ~DTDigiToRawModule ()
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

int dduID
 
bool debug
 
edm::EDGetTokenT< DTDigiCollectiondigicoll
 
int maxFEDid_
 
int minFEDid_
 
DTDigiToRawpacker
 
bool useStandardFEDid_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 11 of file DTDigiToRawModule.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 20 of file DTDigiToRawModule.cc.

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

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

Destructor.

Definition at line 35 of file DTDigiToRawModule.cc.

References gather_cfg::cout, and debug.

35  {
36  delete packer;
37  if (debug) cout << "[DTDigiToRawModule]: destructor" << endl;
38 }
DTDigiToRaw * packer

Member Function Documentation

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

Definition at line 41 of file DTDigiToRawModule.cc.

References evf::compute_crc(), FEDRawData::data(), edm::EventID::event(), edm::EventSetup::get(), edm::Event::getByToken(), hcalTTPDigis_cfi::id, edm::EventBase::id(), genParticles_cff::map, FEDNumbering::MAXDTFEDID, FEDNumbering::MINDTFEDID, eostools::move(), edm::Event::put(), FEDTrailer::set(), FEDHeader::set(), and FEDRawData::size().

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

41  {
42 
43  auto fed_buffers = std::make_unique<FEDRawDataCollection>();
44 
45  // Take digis from the event
47  e.getByToken(digicoll, digis);
48 
49  // Load DTMap
51  iSetup.get<DTReadOutMappingRcd>().get( map );
52 
53  // Create the packed data
54  int FEDIDmin = 0, FEDIDMax = 0;
55  if (useStandardFEDid_){
56  FEDIDmin = FEDNumbering::MINDTFEDID;
57  FEDIDMax = FEDNumbering::MAXDTFEDID;
58  }
59  else {
60  FEDIDmin = minFEDid_;
61  FEDIDMax = maxFEDid_;
62  }
63 
64  for (int id=FEDIDmin; id<=FEDIDMax; ++id){
65 
66  packer->SetdduID(id);
67  FEDRawData* rawData = packer->createFedBuffers(*digis, map);
68 
69  FEDRawData& fedRawData = fed_buffers->FEDData(id);
70  fedRawData = *rawData;
71  delete rawData;
72 
73  FEDHeader dtFEDHeader(fedRawData.data());
74  dtFEDHeader.set(fedRawData.data(), 0, e.id().event(), 0, id);
75 
76  FEDTrailer dtFEDTrailer(fedRawData.data()+(fedRawData.size()-8));
77  dtFEDTrailer.set(fedRawData.data()+(fedRawData.size()-8), fedRawData.size()/8, evf::compute_crc(fedRawData.data(),fedRawData.size()), 0, 0);
78 
79  }
80  // Put the raw data to the event
81  e.put(std::move(fed_buffers));
82 
83 }
EventNumber_t event() const
Definition: EventID.h:41
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
edm::EDGetTokenT< DTDigiCollection > digicoll
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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
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
const T & get() const
Definition: EventSetup.h:55
edm::EventID id() const
Definition: EventBase.h:60
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

int DTDigiToRawModule::dduID
private

Definition at line 25 of file DTDigiToRawModule.h.

bool DTDigiToRawModule::debug
private
edm::EDGetTokenT<DTDigiCollection> DTDigiToRawModule::digicoll
private

Definition at line 27 of file DTDigiToRawModule.h.

int DTDigiToRawModule::maxFEDid_
private

Definition at line 31 of file DTDigiToRawModule.h.

int DTDigiToRawModule::minFEDid_
private

Definition at line 30 of file DTDigiToRawModule.h.

DTDigiToRaw* DTDigiToRawModule::packer
private

Definition at line 23 of file DTDigiToRawModule.h.

bool DTDigiToRawModule::useStandardFEDid_
private

Definition at line 29 of file DTDigiToRawModule.h.