CMS 3D CMS Logo

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

#include <PixelSLinkDataInputSource.h>

Inheritance diagram for PixelSLinkDataInputSource:
edm::ProducerSourceFromFiles edm::ProducerSourceBase edm::FromFiles edm::IDGeneratorSourceBase< PuttableSourceBase > edm::PuttableSourceBase edm::InputSource edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 PixelSLinkDataInputSource (const edm::ParameterSet &pset, const edm::InputSourceDescription &desc)
 
 ~PixelSLinkDataInputSource () override
 
- Public Member Functions inherited from edm::ProducerSourceFromFiles
InputFileCatalogcatalog ()
 
std::vector< std::string > fileNames (unsigned iCatalog) const
 
std::vector< std::string > const & logicalFileNames () const
 
 ProducerSourceFromFiles (ParameterSet const &pset, InputSourceDescription const &desc, bool realData)
 
 ~ProducerSourceFromFiles () override
 
- Public Member Functions inherited from edm::ProducerSourceBase
 ProducerSourceBase (ParameterSet const &pset, InputSourceDescription const &desc, bool realData)
 
 ~ProducerSourceBase () noexcept(false) override
 
- Public Member Functions inherited from edm::IDGeneratorSourceBase< PuttableSourceBase >
EventNumber_t event () const
 
unsigned int eventCreationDelay () const
 
EventID const & eventID () const
 
 IDGeneratorSourceBase (ParameterSet const &pset, InputSourceDescription const &desc, bool realData)
 
LuminosityBlockNumber_t luminosityBlock () const
 
unsigned int numberEventsInLumi () const
 
unsigned int numberEventsInRun () const
 
unsigned int numberEventsInThisLumi () const
 
unsigned int numberEventsInThisRun () const
 
TimeValue_t presentTime () const
 
RunNumber_t run () const
 
unsigned int timeBetweenEvents () const
 
 ~IDGeneratorSourceBase () noexcept(false) override
 
- Public Member Functions inherited from edm::PuttableSourceBase
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
PuttableSourceBaseoperator= (const PuttableSourceBase &)=delete
 
 PuttableSourceBase (ParameterSet const &, InputSourceDescription const &)
 
 PuttableSourceBase (const PuttableSourceBase &)=delete
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
void registerProducts () final
 Register any produced products. More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
- Public Member Functions inherited from edm::InputSource
std::shared_ptr< ActivityRegistryactReg () const
 Accessor for Activity Registry. More...
 
std::shared_ptr< BranchIDListHelper const > branchIDListHelper () const
 Accessors for branchIDListHelper. More...
 
std::shared_ptr< BranchIDListHelper > & branchIDListHelper ()
 
void closeFile (FileBlock *, bool cleaningUpAfterException)
 close current file More...
 
void doBeginJob ()
 Called by framework at beginning of job. More...
 
void doEndJob ()
 Called by framework at end of job. More...
 
void fillProcessBlockHelper ()
 Fill the ProcessBlockHelper with info for the current file. More...
 
ProcessingController::ForwardState forwardState () const
 
bool goToEvent (EventID const &eventID)
 
 InputSource (ParameterSet const &, InputSourceDescription const &)
 Constructor. More...
 
 InputSource (InputSource const &)=delete
 
void issueReports (EventID const &eventID, StreamID streamID)
 issue an event report More...
 
LuminosityBlockNumber_t luminosityBlock () const
 Accessor for current luminosity block number. More...
 
std::shared_ptr< LuminosityBlockAuxiliaryluminosityBlockAuxiliary () const
 Called by the framework to merge or insert lumi in principal cache. More...
 
int maxEvents () const
 
int maxLuminosityBlocks () const
 
ModuleDescription const & moduleDescription () const
 Accessor for 'module' description. More...
 
ItemType nextItemType ()
 Advances the source to the next item. More...
 
bool nextProcessBlock (ProcessBlockPrincipal &)
 Next process block, return false if there is none, sets the processName in the principal. More...
 
InputSourceoperator= (InputSource const &)=delete
 
std::shared_ptr< ProcessBlockHelper const > processBlockHelper () const
 Accessors for processBlockHelper. More...
 
std::shared_ptr< ProcessBlockHelper > & processBlockHelper ()
 
ProcessConfiguration const & processConfiguration () const
 Accessor for Process Configuration. More...
 
std::string const & processGUID () const
 Accessor for global process identifier. More...
 
ProcessHistoryRegistry const & processHistoryRegistry () const
 Accessors for process history registry. More...
 
ProcessHistoryRegistryprocessHistoryRegistry ()
 
ProcessingMode processingMode () const
 RunsLumisAndEvents (default), RunsAndLumis, or Runs. More...
 
std::shared_ptr< ProductRegistry const > productRegistry () const
 Accessors for product registry. More...
 
bool randomAccess () const
 
void readAndMergeLumi (LuminosityBlockPrincipal &lbp)
 Read next luminosity block (same as a prior lumi) More...
 
void readAndMergeRun (RunPrincipal &rp)
 Read next run (same as a prior run) More...
 
void readEvent (EventPrincipal &ep, StreamContext &)
 Read next event. More...
 
bool readEvent (EventPrincipal &ep, EventID const &, StreamContext &)
 Read a specific event. More...
 
std::shared_ptr< FileBlockreadFile ()
 Read next file. More...
 
void readLuminosityBlock (LuminosityBlockPrincipal &lumiPrincipal, HistoryAppender &historyAppender)
 Read next luminosity block (new lumi) More...
 
std::shared_ptr< LuminosityBlockAuxiliaryreadLuminosityBlockAuxiliary ()
 Read next luminosity block Auxilary. More...
 
void readProcessBlock (ProcessBlockPrincipal &)
 Read next process block. More...
 
void readRun (RunPrincipal &runPrincipal, HistoryAppender &historyAppender)
 Read next run (new run) More...
 
std::shared_ptr< RunAuxiliaryreadRunAuxiliary ()
 Read next run Auxiliary. More...
 
ProcessHistoryID const & reducedProcessHistoryID () const
 
int remainingEvents () const
 
int remainingLuminosityBlocks () const
 
void repeat ()
 Reset the remaining number of events/lumis to the maximum number. More...
 
std::pair< SharedResourcesAcquirer *, std::recursive_mutex * > resourceSharedWithDelayedReader ()
 Returns nullptr if no resource shared between the Source and a DelayedReader. More...
 
ProcessingController::ReverseState reverseState () const
 
void rewind ()
 Begin again at the first event. More...
 
RunNumber_t run () const
 Accessor for current run number. More...
 
std::shared_ptr< RunAuxiliaryrunAuxiliary () const
 Called by the framework to merge or insert run in principal cache. More...
 
void setLuminosityBlockNumber_t (LuminosityBlockNumber_t lb)
 Set the luminosity block ID. More...
 
void setRunNumber (RunNumber_t r)
 Set the run number. More...
 
void skipEvents (int offset)
 
void switchTo (std::shared_ptr< ProductRegistry > iOther)
 switch to a different ProductRegistry. More...
 
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper () const
 Accessors for thinnedAssociationsHelper. More...
 
std::shared_ptr< ThinnedAssociationsHelper > & thinnedAssociationsHelper ()
 
Timestamp const & timestamp () const
 Accessor for the current time, as seen by the input source. More...
 
virtual ~InputSource () noexcept(false)
 Destructor. More...
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 

Private Member Functions

int getEventNumberFromFillWords (const std::vector< uint64_t > &data, uint32_t &totword)
 
void produce (edm::Event &event) override
 
bool setRunAndEventInfo (edm::EventID &id, edm::TimeValue_t &time, edm::EventAuxiliary::ExperimentType &) override
 
uint32_t synchronizeEvents ()
 

Private Attributes

std::unique_ptr< FEDRawDataCollectionbuffers
 
uint32_t m_currenteventnumber
 
uint32_t m_currenttriggernumber
 
uint64_t m_data
 
int32_t m_eventnumber_shift
 
int m_fedid
 
uint32_t m_fileindex
 
uint32_t m_globaleventnumber
 
int m_runnumber
 
std::unique_ptr< edm::storage::Storagestorage
 

Additional Inherited Members

- Public Types inherited from edm::InputSource
enum  ItemType {
  IsInvalid, IsStop, IsFile, IsRun,
  IsLumi, IsEvent, IsRepeat, IsSynchronize
}
 
enum  ProcessingMode { Runs, RunsAndLumis, RunsLumisAndEvents }
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Static Public Member Functions inherited from edm::ProducerSourceFromFiles
static void fillDescription (ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from edm::IDGeneratorSourceBase< PuttableSourceBase >
static void fillDescription (ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from edm::InputSource
static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc)
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Public Attributes inherited from edm::InputSource
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> postEventReadFromSourceSignal_
 
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> preEventReadFromSourceSignal_
 
- Protected Member Functions inherited from edm::ProducerSourceFromFiles
void incrementFileIndex ()
 
- Protected Member Functions inherited from edm::IDGeneratorSourceBase< PuttableSourceBase >
void doReadEvent (EventPrincipal &eventPrincipal, F &&f)
 
void doReadEventWithDelayedReader (EventPrincipal &eventPrincipal, ProcessHistoryID const &historyID, EventSelectionIDVector eventSelectionIDs, BranchListIndexes branchListIndexes, DelayedReader *reader)
 
- Protected Member Functions inherited from edm::InputSource
void decreaseRemainingEventsBy (int iSkipped)
 
bool eventCached () const
 
bool newLumi () const
 
bool newRun () const
 
ProcessHistoryRegistryprocessHistoryRegistryForUpdate ()
 
ProductRegistryproductRegistryUpdate ()
 
void reset () const
 
void resetEventCached ()
 
void resetLuminosityBlockAuxiliary (bool isNewLumi=true) const
 
void resetNewLumi ()
 
void resetNewRun ()
 
void resetRunAuxiliary (bool isNewRun=true) const
 
void setEventCached ()
 Called by the framework to merge or ached() const {return eventCached_;}. More...
 
void setLuminosityBlockAuxiliary (LuminosityBlockAuxiliary *lbp)
 
void setNewLumi ()
 
void setNewRun ()
 
void setRunAuxiliary (RunAuxiliary *rp)
 
void setTimestamp (Timestamp const &theTime)
 To set the current time, as seen by the input source. More...
 
ItemType state () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 

Detailed Description

IORawData/SiPixelInputSources/interface/PixelSLinkDataInputSource.h

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

IORawData/SiPixelInputSources/src/PixelSLinkDataInputSource.cc

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 39 of file PixelSLinkDataInputSource.h.

Constructor & Destructor Documentation

◆ PixelSLinkDataInputSource()

PixelSLinkDataInputSource::PixelSLinkDataInputSource ( const edm::ParameterSet pset,
const edm::InputSourceDescription desc 
)
explicit

Definition at line 193 of file PixelSLinkDataInputSource.cc.

References edm::FromFiles::fileNames(), get, createfilelist::int, m_currenteventnumber, m_data, m_fileindex, m_runnumber, edm::storage::Storage::read(), runnum, findQualityFiles::size, storage, and AlCaHLTBitMon_QueryRunRegistry::string.

196  m_fedid(pset.getUntrackedParameter<int>("fedid")),
197  m_fileindex(0),
198  m_runnumber(pset.getUntrackedParameter<int>("runNumber", -1)),
202  produces<FEDRawDataCollection>();
203 
204  if (m_fileindex >= fileNames(0).size()) {
205  edm::LogInfo("") << "no more file to read " << std::endl;
206  return; // ???
207  }
208  std::string currentfilename = fileNames(0)[m_fileindex];
209  edm::LogInfo("") << "now examining file " << currentfilename;
210  m_fileindex++;
211  // reading both castor and other ('normal'/dcap) files.
212  using namespace edm::storage;
213  IOOffset size = -1;
214  StorageFactory::getToModify()->enableAccounting(true);
215 
216  edm::LogInfo("PixelSLinkDataInputSource")
217  << " unsigned long int size = " << sizeof(unsigned long int)
218  << "\n unsigned long size = " << sizeof(unsigned long)
219  << "\n unsigned long long size = " << sizeof(unsigned long long) << "\n uint32_t size = " << sizeof(uint32_t)
220  << "\n uint64_t size = " << sizeof(uint64_t) << std::endl;
221 
222  bool exists = StorageFactory::get()->check(currentfilename, &size);
223 
224  edm::LogInfo("PixelSLinkDataInputSource") << "file size " << size << std::endl;
225 
226  if (!exists) {
227  edm::LogInfo("") << "file " << currentfilename << " cannot be found.";
228  return;
229  }
230  // now open the file stream:
231  storage = StorageFactory::get()->open(currentfilename);
232  // (throw if storage is 0)
233 
234  // check run number by opening up data file...
235 
236  Storage &temp_file = *storage;
237  // IOSize n =
238  temp_file.read((char *)&m_data, 8);
239  if ((m_data >> 60) != 0x5) {
240  uint32_t runnum = m_data;
241  if (m_runnumber != -1)
242  edm::LogInfo("") << "WARNING: observed run number encoded in S-Link dump. Overwriting "
243  "run number as defined in .cfg file!!! Run number now set to "
244  << runnum << " (was " << m_runnumber << ")";
246  }
247  temp_file.read((char *)&m_data, 8);
248  m_currenteventnumber = (m_data >> 32) & 0x00ffffff;
249 }
size
Write out results.
int64_t IOOffset
Definition: IOTypes.h:20
int runnum
ProducerSourceFromFiles(ParameterSet const &pset, InputSourceDescription const &desc, bool realData)
std::unique_ptr< edm::storage::Storage > storage
Log< level::Info, false > LogInfo
unsigned long long uint64_t
Definition: Time.h:13
std::vector< std::string > fileNames(unsigned iCatalog) const
Definition: FromFiles.h:22
#define get

◆ ~PixelSLinkDataInputSource()

PixelSLinkDataInputSource::~PixelSLinkDataInputSource ( )
override

Definition at line 252 of file PixelSLinkDataInputSource.cc.

252 {}

Member Function Documentation

◆ getEventNumberFromFillWords()

int PixelSLinkDataInputSource::getEventNumberFromFillWords ( const std::vector< uint64_t > &  data,
uint32_t &  totword 
)
private

Definition at line 34 of file PixelSLinkDataInputSource.cc.

References edmScanValgrind::buffer, officialStyle::chan, HLT_2023v12_cff::gap, GetRecoTauVFromDQM_MC_cff::kk, PixelMapPlotter::roc, and mps_update::status.

34  {
35  // buffer validity, should already be pretty clean as this is exactly what
36  // goes into the FEDRawDataobject.
37 
38  // code copied directly from A. Ryd's fill word checker in
39  // PixelFEDInterface::PwordSlink64
40 
41  int fif2cnt = 0;
42  int dumcnt = 0;
43  int gapcnt = 0;
44  uint32_t gap[9];
45  uint32_t dum[9];
46  uint32_t word[2] = {0, 0};
47  uint32_t chan = 0;
48  uint32_t roc = 0;
49 
50  const uint32_t rocmsk = 0x3e00000;
51  const uint32_t chnlmsk = 0xfc000000;
52 
53  for (int jk = 1; jk < 9; jk++)
54  gap[jk] = 0;
55  for (int jk = 1; jk < 9; jk++)
56  dum[jk] = 0;
57 
58  int fifcnt = 1;
59  for (size_t kk = 0; kk < buffer.size(); ++kk) {
60  word[0] = (uint32_t)buffer[kk];
61  word[1] = (uint32_t)(buffer[kk] >> 32);
62 
63  for (size_t iw = 0; iw < 2; iw++) {
64  chan = ((word[iw] & chnlmsk) >> 26);
65  roc = ((word[iw] & rocmsk) >> 21);
66 
67  // count non-error words
68  if (roc < 25) {
69  if ((chan > 4) && (chan < 10) && (fifcnt != 2)) {
70  fif2cnt = 0;
71  fifcnt = 2;
72  }
73  if ((chan > 9) && (chan < 14) && (fifcnt != 3)) {
74  fif2cnt = 0;
75  fifcnt = 3;
76  }
77  if ((chan > 13) && (chan < 19) && (fifcnt != 4)) {
78  fif2cnt = 0;
79  fifcnt = 4;
80  }
81  if ((chan > 18) && (chan < 23) && (fifcnt != 5)) {
82  fif2cnt = 0;
83  fifcnt = 5;
84  }
85  if ((chan > 22) && (chan < 28) && (fifcnt != 6)) {
86  fif2cnt = 0;
87  fifcnt = 6;
88  }
89  if ((chan > 27) && (chan < 32) && (fifcnt != 7)) {
90  fif2cnt = 0;
91  fifcnt = 7;
92  }
93  if ((chan > 31) && (fifcnt != 8)) {
94  fif2cnt = 0;
95  fifcnt = 8;
96  }
97  fif2cnt++;
98  }
99  if (roc == 26) {
100  gap[fifcnt] = (0x1000 + (word[iw] & 0xff));
101  gapcnt++;
102  }
103 
104  if ((roc == 27) && ((fif2cnt + dumcnt) < 6)) {
105  dumcnt++;
106  dum[fifcnt] = (0x1000 + (word[iw] & 0xff));
107  } else if ((roc == 27) && ((fif2cnt + dumcnt) > 6)) {
108  dumcnt = 1;
109  fif2cnt = 0;
110  fifcnt++;
111  }
112  }
113 
114  // word check complete
115  if (((fif2cnt + dumcnt) == 6) && (dumcnt > 0)) // done with this fifo
116  {
117  dumcnt = 0;
118  fif2cnt = 0;
119  fifcnt++;
120  }
121  if ((gapcnt > 0) && ((dumcnt + fif2cnt) > 5)) // done with this fifo
122  {
123  gapcnt = 0;
124  fifcnt++;
125  fif2cnt = 0;
126  dumcnt = 0;
127  } else if ((gapcnt > 0) && ((dumcnt + fif2cnt) < 6))
128  gapcnt = 0;
129 
130  } // end of fifo-3 word loop-see what we got!
131 
132  int status = 0;
133 
134  if (gap[1] > 0) {
135  totword = (gap[1] & 0xff);
136  status = 1;
137  } else if (gap[2] > 0) {
138  totword = (gap[2] & 0xff);
139  status = 1;
140  } else if (dum[1] > 0) {
141  totword = (dum[1] & 0xff);
142  status = 1;
143  } else if (dum[2] > 0) {
144  totword = (dum[2] & 0xff);
145  status = 1;
146  }
147 
148  if (gap[3] > 0) {
149  totword = totword | ((gap[3] & 0xff) << 8);
150  status = status | 0x2;
151  } else if (gap[4] > 0) {
152  totword = totword | ((gap[4] & 0xff) << 8);
153  status = status | 0x2;
154  } else if (dum[3] > 0) {
155  totword = totword | ((dum[3] & 0xff) << 8);
156  status = status | 0x2;
157  } else if (dum[4] > 0) {
158  totword = totword | ((dum[4] & 0xff) << 8);
159  status = status | 0x2;
160  }
161 
162  if (gap[5] > 0) {
163  totword = totword | ((gap[5] & 0xff) << 16);
164  status = status | 0x4;
165  } else if (gap[6] > 0) {
166  totword = totword | ((gap[6] & 0xff) << 16);
167  status = status | 0x4;
168  } else if (dum[5] > 0) {
169  totword = totword | ((dum[5] & 0xff) << 16);
170  status = status | 0x4;
171  } else if (dum[6] > 0) {
172  totword = totword | ((dum[6] & 0xff) << 16);
173  status = status | 0x4;
174  }
175 
176  if (gap[7] > 0) {
177  totword = totword | ((gap[7] & 0xff) << 24);
178  status = status | 0x8;
179  } else if (gap[8] > 0) {
180  totword = totword | ((gap[8] & 0xff) << 24);
181  status = status | 0x8;
182  } else if (dum[7] > 0) {
183  totword = totword | ((dum[7] & 0xff) << 24);
184  status = status | 0x8;
185  } else if (dum[8] > 0) {
186  totword = totword | ((dum[8] & 0xff) << 24);
187  status = status | 0x8;
188  }
189  return (status);
190 }
uint64_t word
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...

◆ produce()

void PixelSLinkDataInputSource::produce ( edm::Event event)
overrideprivatevirtual

Implements edm::ProducerSourceBase.

Definition at line 351 of file PixelSLinkDataInputSource.cc.

References buffers, and eostools::move().

351  {
352  event.put(std::move(buffers));
353  buffers.reset();
354 }
std::unique_ptr< FEDRawDataCollection > buffers
def move(src, dest)
Definition: eostools.py:511

◆ setRunAndEventInfo()

bool PixelSLinkDataInputSource::setRunAndEventInfo ( edm::EventID id,
edm::TimeValue_t time,
edm::EventAuxiliary::ExperimentType  
)
overrideprivatevirtual

Implements edm::IDGeneratorSourceBase< PuttableSourceBase >.

Definition at line 254 of file PixelSLinkDataInputSource.cc.

References edmScanValgrind::buffer, buffers, submitPVResolutionJobs::count, TauDecayModes::dec, l1t_dqm_sourceclient-live_cfg::fedRawData, mps_fire::i, L1DTConfigBti_cff::LL, edm::IDGeneratorSourceBase< PuttableSourceBase >::luminosityBlock(), m_currenteventnumber, m_currenttriggernumber, m_data, m_eventnumber_shift, m_fedid, m_runnumber, dqmiodumpmetadata::n, l1tstage2_dqm_sourceclient-live_cfg::rawData, edm::storage::Storage::read(), edm::IDGeneratorSourceBase< PuttableSourceBase >::run(), storage, and synchronizeEvents().

256  {
257  edm::storage::Storage &m_file = *storage;
258 
259  // create product (raw data)
260  buffers = std::make_unique<FEDRawDataCollection>();
261 
262  // uint32_t currenteventnumber = (m_data >> 32)&0x00ffffff;
263  uint32_t eventnumber = (m_data >> 32) & 0x00ffffff;
264 
265  do {
266  std::vector<uint64_t> buffer;
267 
268  uint16_t count = 0;
269  eventnumber = (m_data >> 32) & 0x00ffffff;
270  if (m_currenteventnumber == 0)
271  m_currenteventnumber = eventnumber;
272  edm::LogInfo("PixelSLinkDataInputSource::produce()")
273  << "**** event number = " << eventnumber << " global event number " << m_currenteventnumber << " data "
274  << std::hex << m_data << std::dec << std::endl;
275  while ((m_data >> 60) != 0x5) {
276  // std::cout << std::hex << m_data << std::dec << std::endl;
277  if (count == 0) {
278  edm::LogWarning("") << "DATA CORRUPTION!";
279  edm::LogWarning("") << "Expected to find header, but read: 0x" << std::hex << m_data << std::dec;
280  }
281 
282  count++;
283  int n = m_file.read((char *)&m_data, 8);
284  edm::LogWarning("") << "next data " << std::hex << m_data << std::dec << std::endl;
285 
286  if (n != 8) {
287  edm::LogInfo("") << "End of input file";
288  return false;
289  }
290  }
291 
292  if (count > 0) {
293  edm::LogWarning("") << "Had to read " << count << " words before finding header!" << std::endl;
294  }
295 
296  if (m_fedid > -1) {
297  m_data = (m_data & 0xfffffffffff000ffLL) | ((m_fedid & 0xfff) << 8);
298  }
299 
300  uint16_t fed_id = (m_data >> 8) & 0xfff;
301  // std::cout << "fed id = " << fed_id << std::endl;
302  buffer.push_back(m_data);
303 
304  do {
305  m_file.read((char *)&m_data, 8);
306  buffer.push_back(m_data);
307  } while ((m_data >> 60) != 0xa);
308  // std::cout << "read " << buffer.size() << " long words" << std::endl;
309 
310  auto rawData = std::make_unique<FEDRawData>(8 * buffer.size());
311  // FEDRawData * rawData = new FEDRawData(8*buffer.size());
312  unsigned char *dataptr = rawData->data();
313 
314  for (uint16_t i = 0; i < buffer.size(); i++) {
315  ((uint64_t *)dataptr)[i] = buffer[i];
316  }
317  uint32_t thetriggernumber = 0;
318  int nfillwords = 0; // getEventNumberFromFillWords(buffer,thetriggernumber);
319 
320  if (nfillwords > 0) {
321  LogInfo("") << "n fill words = " << nfillwords << ", trigger numbers: " << thetriggernumber << ","
322  << m_currenttriggernumber << std::endl;
323  m_eventnumber_shift = thetriggernumber - m_currenttriggernumber;
324  }
325  m_currenttriggernumber = thetriggernumber;
326  FEDRawData &fedRawData = buffers->FEDData(fed_id);
327  fedRawData = *rawData;
328 
329  // read the first data member of the next blob to check on event number
330  int n = m_file.read((char *)&m_data, 8);
331  if (n == 0) {
332  edm::LogInfo("") << "End of input file";
333  }
334  m_currenteventnumber = (m_data >> 32) & 0x00ffffff;
335  if (m_currenteventnumber < eventnumber)
336  LogError("PixelSLinkDataInputSource")
337  << " error, the previous event number (" << eventnumber << ") is LARGER than the next event number ("
338  << m_currenteventnumber << ")" << std::endl;
339 
340  } while (eventnumber == m_currenteventnumber);
341 
342  uint32_t realeventno = synchronizeEvents();
343  if (m_runnumber != 0)
344  id = edm::EventID(m_runnumber, id.luminosityBlock(), realeventno);
345  else
346  id = edm::EventID(id.run(), id.luminosityBlock(), realeventno);
347  return true;
348 }
Log< level::Error, false > LogError
std::unique_ptr< edm::storage::Storage > storage
std::unique_ptr< FEDRawDataCollection > buffers
Log< level::Info, false > LogInfo
unsigned long long uint64_t
Definition: Time.h:13
Log< level::Warning, false > LogWarning

◆ synchronizeEvents()

uint32_t PixelSLinkDataInputSource::synchronizeEvents ( )
private

Definition at line 358 of file PixelSLinkDataInputSource.cc.

References m_currenteventnumber, and mps_fire::result.

Referenced by setRunAndEventInfo().

358  {
359  int32_t result = m_currenteventnumber - 1;
360 
361  return (uint32_t)result;
362 }

Member Data Documentation

◆ buffers

std::unique_ptr<FEDRawDataCollection> PixelSLinkDataInputSource::buffers
private

Definition at line 60 of file PixelSLinkDataInputSource.h.

Referenced by produce(), and setRunAndEventInfo().

◆ m_currenteventnumber

uint32_t PixelSLinkDataInputSource::m_currenteventnumber
private

◆ m_currenttriggernumber

uint32_t PixelSLinkDataInputSource::m_currenttriggernumber
private

Definition at line 56 of file PixelSLinkDataInputSource.h.

Referenced by setRunAndEventInfo().

◆ m_data

uint64_t PixelSLinkDataInputSource::m_data
private

Definition at line 54 of file PixelSLinkDataInputSource.h.

Referenced by PixelSLinkDataInputSource(), and setRunAndEventInfo().

◆ m_eventnumber_shift

int32_t PixelSLinkDataInputSource::m_eventnumber_shift
private

Definition at line 58 of file PixelSLinkDataInputSource.h.

Referenced by setRunAndEventInfo().

◆ m_fedid

int PixelSLinkDataInputSource::m_fedid
private

Definition at line 50 of file PixelSLinkDataInputSource.h.

Referenced by setRunAndEventInfo().

◆ m_fileindex

uint32_t PixelSLinkDataInputSource::m_fileindex
private

Definition at line 51 of file PixelSLinkDataInputSource.h.

Referenced by PixelSLinkDataInputSource().

◆ m_globaleventnumber

uint32_t PixelSLinkDataInputSource::m_globaleventnumber
private

Definition at line 57 of file PixelSLinkDataInputSource.h.

◆ m_runnumber

int PixelSLinkDataInputSource::m_runnumber
private

Definition at line 53 of file PixelSLinkDataInputSource.h.

Referenced by PixelSLinkDataInputSource(), and setRunAndEventInfo().

◆ storage

std::unique_ptr<edm::storage::Storage> PixelSLinkDataInputSource::storage
private

Definition at line 52 of file PixelSLinkDataInputSource.h.

Referenced by PixelSLinkDataInputSource(), and setRunAndEventInfo().