CMS 3D CMS Logo

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

#include <DAQSourceModelsScouting.h>

Inheritance diagram for DataModeScoutingRun2Muon:
DataMode

Public Member Functions

bool checksumValid () override
 
bool dataBlockCompleted () const override
 
bool dataBlockInitialized () const override
 
uint64_t dataBlockSize () const override
 
 DataModeScoutingRun2Muon (DAQSource *daqSource)
 
int dataVersion () const override
 
std::pair< bool, std::vector< std::string > > defineAdditionalFiles (std::string const &primaryName, bool) const override
 
void detectVersion (unsigned char *fileBuf, uint32_t fileHeaderOffset) override
 
bool fitToBuffer () const override
 
std::string getChecksumError () const override
 
uint32_t headerSize () const override
 
bool isRealData () const override
 
std::vector< std::shared_ptr< const edm::DaqProvenanceHelper > > & makeDaqProvenanceHelpers () override
 
void makeDataBlockView (unsigned char *addr, size_t maxSize, std::vector< uint64_t > const &fileSizes, size_t fileHeaderSize) override
 
void makeDirectoryEntries (std::vector< std::string > const &baseDirs, std::string const &runDir) override
 
bool nextEventView () override
 
void readEvent (edm::EventPrincipal &eventPrincipal) override
 
char * readPayloadPos ()
 
bool requireHeader () const override
 
uint32_t run () const override
 
void setDataBlockInitialized (bool) override
 
void setTCDSSearchRange (uint16_t MINTCDSuTCAFEDID, uint16_t MAXTCDSuTCAFEDID) override
 
bool versionCheck () const override
 
 ~DataModeScoutingRun2Muon () override
 
- Public Member Functions inherited from DataMode
 DataMode (DAQSource *daqSource)
 
virtual bool isMultiDir ()
 
void setTesting (bool testing)
 
virtual ~DataMode ()=default
 

Private Member Functions

void unpackOrbit (BXVector< l1t::Muon > *muons, char *buf, size_t len)
 

Private Attributes

std::vector< std::shared_ptr< const edm::DaqProvenanceHelper > > daqProvenanceHelpers_
 
unsigned char * dataBlockAddr_ = nullptr
 
size_t dataBlockMax_ = 0
 
uint16_t detectedFRDversion_ = 0
 
std::unique_ptr< ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > > dummyLVec_
 
std::unique_ptr< FRDEventMsgViewevent_
 
bool eventCached_ = false
 
size_t headerSize_ = 0
 

Additional Inherited Members

- Protected Attributes inherited from DataMode
DAQSourcedaqSource_
 
bool testing_ = false
 

Detailed Description

Definition at line 79 of file DAQSourceModelsScouting.h.

Constructor & Destructor Documentation

◆ DataModeScoutingRun2Muon()

DataModeScoutingRun2Muon::DataModeScoutingRun2Muon ( DAQSource daqSource)
inline

Definition at line 81 of file DAQSourceModelsScouting.h.

References dummyLVec_.

81  : DataMode(daqSource) {
82  dummyLVec_ = std::make_unique<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>>();
83  }
DataMode(DAQSource *daqSource)
std::unique_ptr< ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > > dummyLVec_

◆ ~DataModeScoutingRun2Muon()

DataModeScoutingRun2Muon::~DataModeScoutingRun2Muon ( )
inlineoverride

Definition at line 85 of file DAQSourceModelsScouting.h.

85 {};

Member Function Documentation

◆ checksumValid()

bool DataModeScoutingRun2Muon::checksumValid ( )
overridevirtual

Implements DataMode.

Definition at line 130 of file DAQSourceModelsScouting.cc.

130 { return true; }

◆ dataBlockCompleted()

bool DataModeScoutingRun2Muon::dataBlockCompleted ( ) const
inlineoverridevirtual

Implements DataMode.

Definition at line 121 of file DAQSourceModelsScouting.h.

121 { return true; }

◆ dataBlockInitialized()

bool DataModeScoutingRun2Muon::dataBlockInitialized ( ) const
inlineoverridevirtual

Implements DataMode.

Definition at line 127 of file DAQSourceModelsScouting.h.

127 { return true; }

◆ dataBlockSize()

uint64_t DataModeScoutingRun2Muon::dataBlockSize ( ) const
inlineoverridevirtual

Implements DataMode.

Definition at line 99 of file DAQSourceModelsScouting.h.

References event_.

99 { return event_->size(); }
std::unique_ptr< FRDEventMsgView > event_

◆ dataVersion()

int DataModeScoutingRun2Muon::dataVersion ( ) const
inlineoverridevirtual

Implements DataMode.

Definition at line 90 of file DAQSourceModelsScouting.h.

References detectedFRDversion_.

◆ defineAdditionalFiles()

std::pair<bool, std::vector<std::string> > DataModeScoutingRun2Muon::defineAdditionalFiles ( std::string const &  primaryName,
bool   
) const
inlineoverridevirtual

Implements DataMode.

Definition at line 135 of file DAQSourceModelsScouting.h.

135  {
136  return std::make_pair(true, std::vector<std::string>());
137  }

◆ detectVersion()

void DataModeScoutingRun2Muon::detectVersion ( unsigned char *  fileBuf,
uint32_t  fileHeaderOffset 
)
inlineoverridevirtual

Implements DataMode.

Definition at line 91 of file DAQSourceModelsScouting.h.

References detectedFRDversion_.

91  {
92  detectedFRDversion_ = *((uint16_t*)(fileBuf + fileHeaderOffset));
93  }

◆ fitToBuffer()

bool DataModeScoutingRun2Muon::fitToBuffer ( ) const
inlineoverridevirtual

Implements DataMode.

Definition at line 125 of file DAQSourceModelsScouting.h.

125 { return true; }

◆ getChecksumError()

std::string DataModeScoutingRun2Muon::getChecksumError ( ) const
overridevirtual

◆ headerSize()

uint32_t DataModeScoutingRun2Muon::headerSize ( ) const
inlineoverridevirtual

Implements DataMode.

Definition at line 95 of file DAQSourceModelsScouting.h.

References detectedFRDversion_, and FRDHeaderVersionSize.

constexpr std::array< uint32, FRDHeaderMaxVersion+1 > FRDHeaderVersionSize

◆ isRealData()

bool DataModeScoutingRun2Muon::isRealData ( ) const
inlineoverridevirtual

Implements DataMode.

Definition at line 116 of file DAQSourceModelsScouting.h.

References event_.

116 { return event_->isRealData(); }
std::unique_ptr< FRDEventMsgView > event_

◆ makeDaqProvenanceHelpers()

std::vector< std::shared_ptr< const edm::DaqProvenanceHelper > > & DataModeScoutingRun2Muon::makeDaqProvenanceHelpers ( )
overridevirtual

Implements DataMode.

Definition at line 110 of file DAQSourceModelsScouting.cc.

110  {
111  //set FRD data collection
112  daqProvenanceHelpers_.clear();
113  daqProvenanceHelpers_.emplace_back(std::make_shared<const edm::DaqProvenanceHelper>(
114  edm::TypeID(typeid(l1t::MuonBxCollection)), "l1t::MuonBxCollection", "l1tMuonBxCollection", "DAQSource"));
115  return daqProvenanceHelpers_;
116 }
std::vector< std::shared_ptr< const edm::DaqProvenanceHelper > > daqProvenanceHelpers_

◆ makeDataBlockView()

void DataModeScoutingRun2Muon::makeDataBlockView ( unsigned char *  addr,
size_t  maxSize,
std::vector< uint64_t > const &  fileSizes,
size_t  fileHeaderSize 
)
inlineoverridevirtual

◆ makeDirectoryEntries()

void DataModeScoutingRun2Muon::makeDirectoryEntries ( std::vector< std::string > const &  baseDirs,
std::string const &  runDir 
)
inlineoverridevirtual

Implements DataMode.

Definition at line 133 of file DAQSourceModelsScouting.h.

133 {}

◆ nextEventView()

bool DataModeScoutingRun2Muon::nextEventView ( )
overridevirtual

Implements DataMode.

Definition at line 118 of file DAQSourceModelsScouting.cc.

References Exception.

Referenced by makeDataBlockView().

118  {
119  if (eventCached_)
120  return true;
121  event_ = std::make_unique<FRDEventMsgView>(dataBlockAddr_);
122  if (event_->size() > dataBlockMax_) {
123  throw cms::Exception("DAQSource::getNextEvent")
124  << " event id:" << event_->event() << " lumi:" << event_->lumi() << " run:" << event_->run()
125  << " of size:" << event_->size() << " bytes does not fit into a chunk of size:" << dataBlockMax_ << " bytes";
126  }
127  return true;
128 }
std::unique_ptr< FRDEventMsgView > event_

◆ readEvent()

void DataModeScoutingRun2Muon::readEvent ( edm::EventPrincipal eventPrincipal)
overridevirtual

Implements DataMode.

Definition at line 15 of file DAQSourceModelsScouting.cc.

References printConversionInfo::aux, eostools::move(), edm::EventAuxiliary::PhysicsTrigger, edm::EventPrincipal::put(), l1tstage2_dqm_sourceclient-live_cfg::rawData, and hcalRecHitTable_cff::time.

15  {
17  timeval stv;
18  gettimeofday(&stv, nullptr);
19  time = stv.tv_sec;
20  time = (time << 32) + stv.tv_usec;
21  edm::Timestamp tstamp(time);
22 
23  std::unique_ptr<BXVector<l1t::Muon>> rawData(new BXVector<l1t::Muon>);
24  //allow any bx
25  rawData->setBXRange(0, 4000);
26 
27  unpackOrbit(rawData.get(), (char*)event_->payload(), event_->eventSize());
28 
29  uint32_t hdrEventID = event_->event();
32  eventID, daqSource_->processGUID(), tstamp, event_->isRealData(), edm::EventAuxiliary::PhysicsTrigger);
33 
34  aux.setProcessHistoryID(daqSource_->processHistoryID());
35  daqSource_->makeEventWrapper(eventPrincipal, aux);
36 
37  std::unique_ptr<edm::WrapperBase> edp(new edm::Wrapper<BXVector<l1t::Muon>>(std::move(rawData)));
38  eventPrincipal.put(
39  daqProvenanceHelpers_[0]->branchDescription(), std::move(edp), daqProvenanceHelpers_[0]->dummyProvenance());
40 }
void unpackOrbit(BXVector< l1t::Muon > *muons, char *buf, size_t len)
std::vector< std::shared_ptr< const edm::DaqProvenanceHelper > > daqProvenanceHelpers_
int currentLumiSection() const
Definition: DAQSource.h:52
void put(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance) const
std::string const & processGUID() const
Accessor for global process identifier.
Definition: InputSource.h:197
void makeEventWrapper(edm::EventPrincipal &eventPrincipal, edm::EventAuxiliary &aux)
Definition: DAQSource.h:54
edm::ProcessHistoryID & processHistoryID()
Definition: DAQSource.h:59
unsigned long long TimeValue_t
Definition: Timestamp.h:21
DAQSource * daqSource_
int eventRunNumber() const
Definition: DAQSource.h:53
def move(src, dest)
Definition: eostools.py:511
std::unique_ptr< FRDEventMsgView > event_

◆ readPayloadPos()

char* DataModeScoutingRun2Muon::readPayloadPos ( )
inline

Definition at line 139 of file DAQSourceModelsScouting.h.

References event_.

139 { return (char*)event_->payload(); }
std::unique_ptr< FRDEventMsgView > event_

◆ requireHeader()

bool DataModeScoutingRun2Muon::requireHeader ( ) const
inlineoverridevirtual

Implements DataMode.

Definition at line 123 of file DAQSourceModelsScouting.h.

123 { return true; }

◆ run()

uint32_t DataModeScoutingRun2Muon::run ( ) const
inlineoverridevirtual

Implements DataMode.

Definition at line 118 of file DAQSourceModelsScouting.h.

References event_.

Referenced by Types.EventID::cppID(), and Types.LuminosityBlockID::cppID().

118 { return event_->run(); }
std::unique_ptr< FRDEventMsgView > event_

◆ setDataBlockInitialized()

void DataModeScoutingRun2Muon::setDataBlockInitialized ( bool  )
inlineoverridevirtual

Implements DataMode.

Definition at line 129 of file DAQSourceModelsScouting.h.

129 {};

◆ setTCDSSearchRange()

void DataModeScoutingRun2Muon::setTCDSSearchRange ( uint16_t  MINTCDSuTCAFEDID,
uint16_t  MAXTCDSuTCAFEDID 
)
inlineoverridevirtual

Implements DataMode.

Definition at line 131 of file DAQSourceModelsScouting.h.

131 { return; }

◆ unpackOrbit()

void DataModeScoutingRun2Muon::unpackOrbit ( BXVector< l1t::Muon > *  muons,
char *  buf,
size_t  len 
)
private

Definition at line 42 of file DAQSourceModelsScouting.cc.

References cms::cuda::assert(), visDQMUpload::buf, scouting::block::bx, nano_mu_digi_cff::bx, scouting::masks::chrg, scouting::shifts::chrg, scouting::masks::chrgv, scouting::shifts::chrgv, gather_cfg::cout, scouting::shifts::eta, scouting::shifts::etaext, scouting::masks::etaexts, scouting::masks::etaextv, scouting::masks::etas, scouting::masks::etav, scouting::muon::f, RecoTauValidation_cfi::header, mps_fire::i, hcalRecHitTable_cff::ieta, scouting::masks::index, scouting::shifts::index, hcalRecHitTable_cff::iphi, scouting::masks::iso, scouting::shifts::iso, scouting::header_shifts::mAcount, scouting::header_masks::mAcount, scouting::header_shifts::mBcount, scouting::header_masks::mBcount, scouting::block::mu, HLT_2023v12_cff::muon, PDWG_BPHSkim_cff::muons, scouting::block::orbit, scouting::masks::phi, scouting::shifts::phi, scouting::masks::phiext, scouting::shifts::phiext, scouting::masks::pt, scouting::shifts::pt, scouting::masks::qual, scouting::shifts::qual, l1tGTMenu_lepSeeds_cff::qual, and scouting::muon::s.

42  {
43  using namespace scouting;
44  size_t pos = 0;
45  uint32_t o_test = 0;
46  while (pos < len) {
47  assert(pos + 4 <= len);
48  uint32_t header = *((uint32*)(buf + pos));
49  uint32_t mAcount = (header & header_masks::mAcount) >> header_shifts::mAcount;
50  uint32_t mBcount = (header & header_masks::mBcount) >> header_shifts::mBcount;
51 
52  block* bl = (block*)(buf + pos + 4);
53 
54  pos += 12 + (mAcount + mBcount) * 8;
55  assert(pos <= len);
56 
57  uint32_t bx = bl->bx;
58 
59  uint32_t orbit = bl->orbit;
60  o_test = orbit;
61 
62  //should cuts should be applied
63  bool excludeIntermediate = true;
64 
65  for (size_t i = 0; i < (mAcount + mBcount); i++) {
66  //unpack new muon
67  //variables: index, ietaext, ipt, qual, iphiext, iso, chrg, iphi, ieta
68 
69  // remove intermediate if required
70  // index==0 and ietaext==0 are a necessary and sufficient condition
71  uint32_t index = (bl->mu[i].s >> shifts::index) & masks::index;
72  int32_t ietaext = ((bl->mu[i].f >> shifts::etaext) & masks::etaextv);
73  if (((bl->mu[i].f >> shifts::etaext) & masks::etaexts) != 0)
74  ietaext -= 256;
75 
76  if (excludeIntermediate && index == 0 && ietaext == 0)
77  continue;
78 
79  //extract pt and quality and apply cut if required
80  uint32_t ipt = (bl->mu[i].f >> shifts::pt) & masks::pt;
81  //cuts??
82  // if((ipt-1)<ptcut) {discarded++; continue;}
83  uint32_t qual = (bl->mu[i].f >> shifts::qual) & masks::qual;
84  // if(qual < qualcut) {discarded++; continue;}
85 
86  //extract integer value for extrapolated phi
87  int32_t iphiext = ((bl->mu[i].f >> shifts::phiext) & masks::phiext);
88 
89  // extract iso bits and charge
90  uint32_t iso = (bl->mu[i].s >> shifts::iso) & masks::iso;
91  int32_t chrg = 0;
92  if (((bl->mu[i].s >> shifts::chrgv) & masks::chrgv) == 1) {
93  chrg = ((bl->mu[i].s >> shifts::chrg) & masks::chrg) == 1 ? -1 : 1;
94  }
95 
96  // extract eta and phi at muon station
97  int32_t iphi = ((bl->mu[i].s >> shifts::phi) & masks::phi);
98  int32_t ieta = (bl->mu[i].s >> shifts::eta) & masks::etav;
99  if (((bl->mu[i].s >> shifts::eta) & masks::etas) != 0)
100  ieta -= 256;
101 
102  l1t::Muon muon(
103  *dummyLVec_, ipt, ieta, iphi, qual, chrg, chrg != 0, iso, -1, 0, false, 0, 0, 0, 0, ietaext, iphiext);
104  muons->push_back(bx, muon);
105  }
106  }
107  std::cout << "end read ... " << o_test << std::endl << std::flush;
108 } //unpackOrbit
assert(be >=bs)
unsigned int uint32
Definition: MsgTools.h:13
Definition: Muon.h:21
std::unique_ptr< ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > > dummyLVec_

◆ versionCheck()

bool DataModeScoutingRun2Muon::versionCheck ( ) const
inlineoverridevirtual

Implements DataMode.

Definition at line 97 of file DAQSourceModelsScouting.h.

References detectedFRDversion_, and FRDHeaderMaxVersion.

constexpr size_t FRDHeaderMaxVersion

Member Data Documentation

◆ daqProvenanceHelpers_

std::vector<std::shared_ptr<const edm::DaqProvenanceHelper> > DataModeScoutingRun2Muon::daqProvenanceHelpers_
private

Definition at line 144 of file DAQSourceModelsScouting.h.

◆ dataBlockAddr_

unsigned char* DataModeScoutingRun2Muon::dataBlockAddr_ = nullptr
private

Definition at line 151 of file DAQSourceModelsScouting.h.

Referenced by makeDataBlockView().

◆ dataBlockMax_

size_t DataModeScoutingRun2Muon::dataBlockMax_ = 0
private

Definition at line 152 of file DAQSourceModelsScouting.h.

Referenced by makeDataBlockView().

◆ detectedFRDversion_

uint16_t DataModeScoutingRun2Muon::detectedFRDversion_ = 0
private

Definition at line 145 of file DAQSourceModelsScouting.h.

Referenced by dataVersion(), detectVersion(), headerSize(), and versionCheck().

◆ dummyLVec_

std::unique_ptr<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > > DataModeScoutingRun2Muon::dummyLVec_
private

Definition at line 149 of file DAQSourceModelsScouting.h.

Referenced by DataModeScoutingRun2Muon().

◆ event_

std::unique_ptr<FRDEventMsgView> DataModeScoutingRun2Muon::event_
private

Definition at line 147 of file DAQSourceModelsScouting.h.

Referenced by dataBlockSize(), isRealData(), readPayloadPos(), and run().

◆ eventCached_

bool DataModeScoutingRun2Muon::eventCached_ = false
private

Definition at line 153 of file DAQSourceModelsScouting.h.

Referenced by makeDataBlockView().

◆ headerSize_

size_t DataModeScoutingRun2Muon::headerSize_ = 0
private

Definition at line 146 of file DAQSourceModelsScouting.h.