CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
l1t::L1TRawToDigi Class Reference
Inheritance diagram for l1t::L1TRawToDigi:
edm::one::EDProducer< edm::one::SharedResources, edm::one::WatchRuns, edm::one::WatchLuminosityBlocks > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1TRawToDigi (const edm::ParameterSet &)
 
 ~L1TRawToDigi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::SharedResources, edm::one::WatchRuns, edm::one::WatchLuminosityBlocks >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

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

Private Member Functions

virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
virtual void endRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

int amc13HeaderSize_
 
int amc13TrailerSize_
 
int amcHeaderSize_
 
int amcTrailerSize_
 
bool ctp7_mode_
 
edm::EDGetTokenT
< FEDRawDataCollection
fedData_
 
std::vector< int > fedIds_
 
int fwId_
 
std::auto_ptr< PackingSetupprov_
 
int slinkHeaderSize_
 
int slinkTrailerSize_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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 42 of file L1TRawToDigi.cc.

Constructor & Destructor Documentation

L1TRawToDigi::L1TRawToDigi ( const edm::ParameterSet config)
explicit

Definition at line 82 of file L1TRawToDigi.cc.

References amc13HeaderSize_, amc13TrailerSize_, amcHeaderSize_, amcTrailerSize_, edm::errors::Configuration, edm::hlt::Exception, edm::ParameterSet::exists(), fedData_, fedIds_, l1t::PackingSetupFactory::get(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), l1t::PackingSetupFactory::make(), prov_, slinkHeaderSize_, slinkTrailerSize_, and AlCaHLTBitMon_QueryRunRegistry::string.

82  :
83  fwId_(config.getUntrackedParameter<int>("FWId", -1)),
84  ctp7_mode_(config.getUntrackedParameter<bool>("CTP7", false))
85  {
86  fedData_ = consumes<FEDRawDataCollection>(config.getParameter<edm::InputTag>("InputLabel"));
87 
88  if (config.exists("FedId") and config.exists("FedIds")) {
90  << "Cannot have FedId and FedIds as parameter at the same time";
91  } else if (config.exists("FedId")) {
92  fedIds_ = {config.getParameter<int>("FedId")};
93  } else {
94  fedIds_ = config.getParameter<std::vector<int>>("FedIds");
95  }
96 
98  prov_->registerProducts(*this);
99 
100  slinkHeaderSize_ = config.getUntrackedParameter<int>("lenSlinkHeader", 8);
101  slinkTrailerSize_ = config.getUntrackedParameter<int>("lenSlinkTrailer", 8);
102  amcHeaderSize_ = config.getUntrackedParameter<int>("lenAMCHeader", 8);
103  amcTrailerSize_ = config.getUntrackedParameter<int>("lenAMCTrailer", 0);
104  amc13HeaderSize_ = config.getUntrackedParameter<int>("lenAMC13Header", 8);
105  amc13TrailerSize_ = config.getUntrackedParameter<int>("lenAMC13Trailer", 8);
106  }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::auto_ptr< PackingSetup > prov_
Definition: L1TRawToDigi.cc:62
std::auto_ptr< PackingSetup > make(const std::string &) const
Definition: PackingSetup.cc:12
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< int > fedIds_
Definition: L1TRawToDigi.cc:59
static const PackingSetupFactory * get()
Definition: PackingSetup.h:46
edm::EDGetTokenT< FEDRawDataCollection > fedData_
Definition: L1TRawToDigi.cc:55
L1TRawToDigi::~L1TRawToDigi ( )

Definition at line 109 of file L1TRawToDigi.cc.

110  {
111  }

Member Function Documentation

virtual void l1t::L1TRawToDigi::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Definition at line 54 of file L1TRawToDigi.cc.

54 {};
virtual void l1t::L1TRawToDigi::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Definition at line 52 of file L1TRawToDigi.cc.

52 {};
virtual void l1t::L1TRawToDigi::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Definition at line 55 of file L1TRawToDigi.cc.

55 {};
virtual void l1t::L1TRawToDigi::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Definition at line 53 of file L1TRawToDigi.cc.

53 {};
void L1TRawToDigi::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 236 of file L1TRawToDigi.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

236  {
237  //The following says we do not know what parameters are allowed so do no validation
238  // Please change this to state exactly what you do use, even if it is no parameters
240  desc.setUnknown();
241  descriptions.addDefault(desc);
242  }
void addDefault(ParameterSetDescription const &psetDescription)
void L1TRawToDigi::produce ( edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements edm::one::EDProducerBase.

Definition at line 120 of file L1TRawToDigi.cc.

References amc, amc13HeaderSize_, amc13TrailerSize_, amcHeaderSize_, amcTrailerSize_, createPayload::block, FEDHeader::bxID(), FEDTrailer::check(), FEDHeader::check(), coll, FEDTrailer::crc(), ctp7_mode_, FEDRawData::data(), data, end, FEDTrailer::evtStatus(), fedData_, HLT_25ns14e33_v1_cff::fedId, fedIds_, HcalMonitorModule_cfi::feds, fwId_, FEDTrailer::lenght(), LogDebug, FEDHeader::lvl1ID(), amc13::Packet::parse(), amc13::Packet::payload(), prov_, FEDRawData::size(), slinkHeaderSize_, slinkTrailerSize_, FEDHeader::sourceID(), dqm_diff::start, FEDHeader::triggerType(), FEDTrailer::ttsBits(), dt_dqm_sourceclient_common_cff::unpackers, and FEDHeader::version().

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

121  {
122  using namespace edm;
123 
124  std::unique_ptr<UnpackerCollections> coll = prov_->getCollections(event);
125 
127  event.getByToken(fedData_, feds);
128 
129  if (!feds.isValid()) {
130  LogError("L1T") << "Cannot unpack: no collection found";
131  return;
132  }
133 
134  for (const auto& fedId: fedIds_) {
135  const FEDRawData& l1tRcd = feds->FEDData(fedId);
136 
137  LogDebug("L1T") << "Found FEDRawDataCollection with ID " << fedId << " and size " << l1tRcd.size();
138 
140  LogError("L1T") << "Cannot unpack: empty/invalid L1T raw data (size = "
141  << l1tRcd.size() << ") for ID " << fedId << ". Returning empty collections!";
142  continue;
143  //return;
144  }
145 
146  const unsigned char *data = l1tRcd.data();
147  FEDHeader header(data);
148 
149  if (header.check()) {
150  LogDebug("L1T") << "Found SLink header:"
151  << " Trigger type " << header.triggerType()
152  << " L1 event ID " << header.lvl1ID()
153  << " BX Number " << header.bxID()
154  << " FED source " << header.sourceID()
155  << " FED version " << header.version();
156  } else {
157  LogWarning("L1T") << "Did not find a SLink header!";
158  }
159 
160  FEDTrailer trailer(data + (l1tRcd.size() - slinkTrailerSize_));
161 
162  if (trailer.check()) {
163  LogDebug("L1T") << "Found SLink trailer:"
164  << " Length " << trailer.lenght()
165  << " CRC " << trailer.crc()
166  << " Status " << trailer.evtStatus()
167  << " Throttling bits " << trailer.ttsBits();
168  } else {
169  LogWarning("L1T") << "Did not find a SLink trailer!";
170  }
171 
172  amc13::Packet packet;
173  if (!packet.parse(
174  (const uint64_t*) (data + slinkHeaderSize_),
175  (l1tRcd.size() - slinkHeaderSize_ - slinkTrailerSize_) / 8)) {
176  LogError("L1T")
177  << "Could not extract AMC13 Packet.";
178  return;
179  }
180 
181  for (auto& amc: packet.payload()) {
182  auto payload64 = amc.data();
183  const uint32_t * start = (const uint32_t*) payload64.get();
184  const uint32_t * end = start + (amc.size() * 2);
185 
186  std::auto_ptr<Payload> payload;
187  if (ctp7_mode_) {
188  LogDebug("L1T") << "Using CTP7 mode";
189  payload.reset(new CTP7Payload(start, end));
190  } else {
191  LogDebug("L1T") << "Using MP7 mode";
192  payload.reset(new MP7Payload(start, end));
193  }
194  unsigned fw = payload->getFirmwareId();
195 
196  // Let parameterset value override FW version
197  if (fwId_ > 0)
198  fw = fwId_;
199 
200  unsigned board = amc.header().getBoardID();
201  unsigned amc_no = amc.header().getAMCNumber();
202 
203  auto unpackers = prov_->getUnpackers(fedId, board, amc_no, fw);
204 
205  // getBlock() returns a non-null auto_ptr on success
206  std::auto_ptr<Block> block;
207  while ((block = payload->getBlock()).get()) {
208  // skip empty filler blocks
209  if (block->header().getID() == 0 and block->header().getSize() == 0)
210  continue;
211 
212  auto unpacker = unpackers.find(block->header().getID());
213 
214  block->amc(amc.header());
215 
216  if (unpacker == unpackers.end()) {
217  LogDebug("L1T") << "Cannot find an unpacker for block ID "
218  << block->header().getID() << ", AMC # " << amc_no
219  << ", board ID " << board << ", FED ID " << fedId
220  << ", and FW ID " << fw << "!";
221  // TODO Handle error
222  } else if (!unpacker->second->unpack(*block, coll.get())) {
223  LogDebug("L1T") << "Error unpacking data for block ID "
224  << block->header().getID() << ", AMC # " << amc_no
225  << ", board ID " << board << ", FED ID " << fedId
226  << ", and FW ID " << fw << "!";
227  // TODO Handle error
228  }
229  }
230  }
231  }
232  }
#define LogDebug(id)
std::vector< amc::Packet > payload() const
Definition: AMCSpec.h:142
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
std::auto_ptr< PackingSetup > prov_
Definition: L1TRawToDigi.cc:62
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
double amc
Definition: hdecay.h:20
std::vector< int > fedIds_
Definition: L1TRawToDigi.cc:59
#define end
Definition: vmac.h:37
JetCorrectorParametersCollection coll
Definition: classes.h:10
unsigned long long uint64_t
Definition: Time.h:15
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
edm::EDGetTokenT< FEDRawDataCollection > fedData_
Definition: L1TRawToDigi.cc:55
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
bool parse(const uint64_t *, unsigned int)
Definition: AMCSpec.cc:142

Member Data Documentation

int l1t::L1TRawToDigi::amc13HeaderSize_
private

Definition at line 69 of file L1TRawToDigi.cc.

Referenced by L1TRawToDigi(), and produce().

int l1t::L1TRawToDigi::amc13TrailerSize_
private

Definition at line 70 of file L1TRawToDigi.cc.

Referenced by L1TRawToDigi(), and produce().

int l1t::L1TRawToDigi::amcHeaderSize_
private

Definition at line 67 of file L1TRawToDigi.cc.

Referenced by L1TRawToDigi(), and produce().

int l1t::L1TRawToDigi::amcTrailerSize_
private

Definition at line 68 of file L1TRawToDigi.cc.

Referenced by L1TRawToDigi(), and produce().

bool l1t::L1TRawToDigi::ctp7_mode_
private

Definition at line 72 of file L1TRawToDigi.cc.

Referenced by produce().

edm::EDGetTokenT<FEDRawDataCollection> l1t::L1TRawToDigi::fedData_
private

Definition at line 55 of file L1TRawToDigi.cc.

Referenced by L1TRawToDigi(), and produce().

std::vector<int> l1t::L1TRawToDigi::fedIds_
private

Definition at line 59 of file L1TRawToDigi.cc.

Referenced by L1TRawToDigi(), and produce().

int l1t::L1TRawToDigi::fwId_
private

Definition at line 60 of file L1TRawToDigi.cc.

Referenced by produce().

std::auto_ptr<PackingSetup> l1t::L1TRawToDigi::prov_
private

Definition at line 62 of file L1TRawToDigi.cc.

Referenced by L1TRawToDigi(), and produce().

int l1t::L1TRawToDigi::slinkHeaderSize_
private

Definition at line 65 of file L1TRawToDigi.cc.

Referenced by L1TRawToDigi(), and produce().

int l1t::L1TRawToDigi::slinkTrailerSize_
private

Definition at line 66 of file L1TRawToDigi.cc.

Referenced by L1TRawToDigi(), and produce().