CMS 3D CMS Logo

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

#include <ProdTutorial/TcdsRawToDigi/plugins/TcdsRawToDigi.cc>

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

Public Member Functions

 TcdsRawToDigi (const edm::ParameterSet &)
 
 ~TcdsRawToDigi ()
 
- 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
 
 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< FEDRawDataCollectiondataToken_
 

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
 
- 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

Description: Producer to unpack lumi nibble from TCDS

Definition at line 50 of file TcdsRawToDigi.cc.

Constructor & Destructor Documentation

TcdsRawToDigi::TcdsRawToDigi ( const edm::ParameterSet iConfig)
explicit

Definition at line 64 of file TcdsRawToDigi.cc.

References edm::ParameterSet::getParameter().

65 {
66  edm::InputTag dataLabel = iConfig.getParameter<edm::InputTag>("InputLabel");
67  dataToken_=consumes<FEDRawDataCollection>(dataLabel);
68  produces<int>( "nibble" ).setBranchAlias( "nibble");
69  produces<int64_t>( "triggerCount" ).setBranchAlias( "triggerCount");
70  produces<BSTRecord>( "bstRecord" ).setBranchAlias( "bstRecord" );
71 }
T getParameter(std::string const &) const
edm::EDGetTokenT< FEDRawDataCollection > dataToken_
TcdsRawToDigi::~TcdsRawToDigi ( )

Definition at line 74 of file TcdsRawToDigi.cc.

75 {
76 }

Member Function Documentation

void TcdsRawToDigi::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 135 of file TcdsRawToDigi.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and DEFINE_FWK_MODULE.

135  {
136  //The following says we do not know what parameters are allowed so do no validation
137  // Please change this to state exactly what you do use, even if it is no parameters
139  desc.add<edm::InputTag>("InputLabel",edm::InputTag("rawDataCollector"));
140  descriptions.add("tcdsRawToDigi", desc);
141 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void TcdsRawToDigi::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Definition at line 84 of file TcdsRawToDigi.cc.

References FEDRawData::data(), FEDRawDataCollection::FEDData(), edm::Event::getByToken(), evf::evtn::TCDSHeader::getData(), evf::evtn::TCDSRecord::getHeader(), evf::evtn::TCDSHeader::tcdsheader::header, createfilelist::int, edm::HandleBase::isValid(), FEDNumbering::MINTCDSuTCAFEDID, evf::evtn::TCDSHeader::tcdsheader::nibble, edm::Event::put(), matplotRender::rawdata, BSTRecord::set(), and FEDRawData::size().

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

85 {
86  using namespace edm;
87 
89  iEvent.getByToken(dataToken_,rawdata);
90 
91  int nibble=-99;
92  int triggerCount = -99;
93  BSTRecord bstRecord;
94  if( rawdata.isValid() ) {
95  const FEDRawData& tcdsData = rawdata->FEDData(FEDNumbering::MINTCDSuTCAFEDID);
96  if(tcdsData.size()>0){
97  evf::evtn::TCDSRecord tcdsRecord(tcdsData.data());
98  nibble = (int)tcdsRecord.getHeader().getData().header.nibble;
99  triggerCount = (int64_t)tcdsRecord.getHeader().getData().header.triggerCount;
100  uint64_t gpsh = tcdsRecord.getBST().getBST().bst.gpstimehigh;
101  uint32_t gpsl = tcdsRecord.getBST().getBST().bst.gpstimelow;
102  unsigned long long gpstime = static_cast<unsigned long long>((gpsh << 32) + gpsl);
103  unsigned char bstMaster = static_cast<unsigned char>(tcdsRecord.getBST().getBST().bst.bstMaster_bireserved16 >> 8);
104  uint32_t turnCountHigh = tcdsRecord.getBST().getBST().bst.turnCountHigh;
105  uint16_t turnCountLow = tcdsRecord.getBST().getBST().bst.turnCountLow;
106  unsigned int turnCount = static_cast<unsigned int>((turnCountHigh << 16) + turnCountLow);
107  uint32_t lhcFillHigh = tcdsRecord.getBST().getBST().bst.lhcFillHigh;
108  uint16_t lhcFillLow = tcdsRecord.getBST().getBST().bst.lhcFillLow;
109  unsigned int lhcFill = static_cast<unsigned int>((lhcFillHigh << 16) + lhcFillLow);
110  unsigned short beamMode = static_cast<unsigned short>(tcdsRecord.getBST().getBST().bst.beamMode);
111  unsigned char particleType1 = static_cast<unsigned char>(tcdsRecord.getBST().getBST().bst.particleTypes & 0xFF);
112  unsigned char particleType2 = static_cast<unsigned char>(tcdsRecord.getBST().getBST().bst.particleTypes >> 8);
113  unsigned short beamMomentum = static_cast<unsigned short>(tcdsRecord.getBST().getBST().bst.beamMomentum);
114  unsigned int intensityBeam1 = static_cast<unsigned int>(tcdsRecord.getBST().getBST().bst.intensityBeam1);
115  unsigned int intensityBeam2 = static_cast<unsigned int>(tcdsRecord.getBST().getBST().bst.intensityBeam2);
116  bstRecord.set(gpstime, bstMaster, turnCount, lhcFill, beamMode, particleType1, particleType2, beamMomentum, intensityBeam1, intensityBeam2);
117  } else {
118  nibble=-2;
119  triggerCount=-2;
120  }
121  } else {
122  nibble=-1;
123  triggerCount=-1;
124  }
125  //std::cout<<"nibble is "<<nibble<<std::endl;
126 
127  iEvent.put(std::make_unique<int>(nibble), "nibble");
128  iEvent.put(std::make_unique<int64_t>(triggerCount), "triggerCount");
129  iEvent.put(std::make_unique<BSTRecord>(bstRecord), "bstRecord");
130 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
TCDSHeader & getHeader()
Definition: FED1024.h:159
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
void set(unsigned long long gpstime, unsigned char bstMaster, unsigned int turnCount, unsigned int lhcFill, unsigned short beamMode, unsigned char particleBeam1, unsigned char particleBeam2, unsigned short beamMomentum, unsigned int intensityBeam1, unsigned int intensityBeam2)
Definition: BSTRecord.h:22
struct evf::evtn::TCDSHeader::tcdsheader::@336 header
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
const tcdsheader & getData()
Definition: FED1024.h:84
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< FEDRawDataCollection > dataToken_
unsigned long long uint64_t
Definition: Time.h:15
HLT enums.
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28

Member Data Documentation

edm::EDGetTokenT<FEDRawDataCollection> TcdsRawToDigi::dataToken_
private

Definition at line 60 of file TcdsRawToDigi.cc.