Skip to content

Commit

Permalink
New DAQ source for L1Trigger scouting
Browse files Browse the repository at this point in the history
Implemented a new DAQSourceModel to read and merge Run3 L1 scouting data.
- Similar to the existing FRDStriped input source
- Modified EvFDaqDirector to enable the possibility of having multiple data sources per ramdisk
- Added DataFormats/L1Scouting containing Scouting Raw Data Collection
  - Vector of FEDRawData
  - Included optional argument wordSize in the FEDRawData resize methods: 8 bytes by default, can be set to 4 bytes for scouting
  - Not a real FED, using a SRDCollection since L1scouting data will never be mixed with event data
- Removed old scouting files that were used as an example
- Test script for the ScoutingRun3 daq source
  • Loading branch information
Mmiglio committed Nov 10, 2023
1 parent f0bc2a8 commit 8067ab5
Show file tree
Hide file tree
Showing 24 changed files with 521 additions and 1,156 deletions.
8 changes: 4 additions & 4 deletions DataFormats/FEDRawData/interface/FEDRawData.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class FEDRawData {

/// Ctor specifying the size to be preallocated, in bytes.
/// It is required that the size is a multiple of the size of a FED
/// word (8 bytes)
FEDRawData(size_t newsize);
/// word (8 bytes default)
FEDRawData(size_t newsize, size_t wordsize=8);

/// Copy constructor
FEDRawData(const FEDRawData &);
Expand All @@ -45,8 +45,8 @@ class FEDRawData {
size_t size() const { return data_.size(); }

/// Resize to the specified size in bytes. It is required that
/// the size is a multiple of the size of a FED word (8 bytes)
void resize(size_t newsize);
/// the size is a multiple of the size of a FED word (8 bytes default)
void resize(size_t newsize, size_t wordsize=8);

private:
Data data_;
Expand Down
14 changes: 8 additions & 6 deletions DataFormats/FEDRawData/src/FEDRawData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ using namespace std;

FEDRawData::FEDRawData() {}

FEDRawData::FEDRawData(size_t newsize) : data_(newsize) {
if (newsize % 8 != 0)
throw cms::Exception("DataCorrupt") << "FEDRawData::resize: " << newsize << " is not a multiple of 8 bytes."
FEDRawData::FEDRawData(size_t newsize, size_t wordsize) : data_(newsize) {
if (newsize % wordsize != 0)
throw cms::Exception("DataCorrupt") << "FEDRawData::resize: " << newsize << " is not a multiple of "
<< wordsize << " bytes."
<< endl;
}

Expand All @@ -25,13 +26,14 @@ const unsigned char *FEDRawData::data() const { return data_.data(); }

unsigned char *FEDRawData::data() { return data_.data(); }

void FEDRawData::resize(size_t newsize) {
void FEDRawData::resize(size_t newsize, size_t wordsize) {
if (size() == newsize)
return;

data_.resize(newsize);

if (newsize % 8 != 0)
throw cms::Exception("DataCorrupt") << "FEDRawData::resize: " << newsize << " is not a multiple of 8 bytes."
if (newsize % wordsize != 0)
throw cms::Exception("DataCorrupt") << "FEDRawData::resize: " << newsize << " is not a multiple of "
<< wordsize << " bytes."
<< endl;
}
7 changes: 7 additions & 0 deletions DataFormats/L1Scouting/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<use name="DataFormats/Candidate"/>
<use name="FWCore/Utilities"/>
<use name="DataFormats/Common"/>
<use name="DataFormats/FEDRawData"/>
<export>
<lib name="1"/>
</export>
26 changes: 26 additions & 0 deletions DataFormats/L1Scouting/interface/SDSNumbering.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef L1Scouting_SDSNumbering_h
#define L1Scouting_SDSNumbering_h

/**
*
* This class holds the Scouting Data Source (SDS)
* numbering scheme for the Level 1 scouting system
*
*/

class SDSNumbering {
public:
static constexpr int lastSDSId() { return MAXSDSID; }

enum {
NOT_A_SDSID = -1,
MAXSDSID = 32,
GmtSDSID = 1,
CaloSDSID = 2,
GtSDSID = 4,
BmtfMinSDSID = 10,
BmtfMaxSDSID = 21
};
};

#endif // L1Scouting_SDSNumbering_h
38 changes: 38 additions & 0 deletions DataFormats/L1Scouting/interface/SDSRawDataCollection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef L1Scouting_SDSRawDataCollection_h
#define L1Scouting_SDSRawDataCollection_h

#include "DataFormats/FEDRawData/interface/FEDRawData.h"
#include "DataFormats/Common/interface/traits.h"
#include "FWCore/Utilities/interface/GCCPrerequisite.h"


/**
*
* This collection holds the raw data for all the
* scouting data sources. It is a collection of FEDRawData
*
*/

class SRDCollection: public edm::DoNotRecordParents {
public:
SRDCollection();

virtual ~SRDCollection();

// retrive data for the scouting source at sourceId
const FEDRawData& FEDData(int sourceId) const;

// retrive data for the scouting source at sourceId
FEDRawData& FEDData(int sourceId);

SRDCollection(const SRDCollection&);

void swap(SRDCollection& other) { data_.swap(other.data_); }

private:
std::vector<FEDRawData> data_; // vector of raw data
};

inline void swap(SRDCollection& a, SRDCollection& b) { a.swap(b); }

#endif // L1Scouting_SDSRawDataCollection_h
12 changes: 12 additions & 0 deletions DataFormats/L1Scouting/src/SDSRawDataCollection.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <DataFormats/L1Scouting/interface/SDSRawDataCollection.h>
#include <DataFormats/L1Scouting/interface/SDSNumbering.h>

SRDCollection::SRDCollection() : data_(SDSNumbering::lastSDSId() + 1) {}

SRDCollection::SRDCollection(const SRDCollection& in) : data_(in.data_) {}

SRDCollection::~SRDCollection() {}

const FEDRawData& SRDCollection::FEDData(int sourceId) const { return data_[sourceId]; }

FEDRawData& SRDCollection::FEDData(int sourceId) { return data_[sourceId]; }
4 changes: 4 additions & 0 deletions DataFormats/L1Scouting/src/classes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include <DataFormats/Common/interface/Wrapper.h>
#include <DataFormats/Common/interface/RefProd.h>

#include <DataFormats/L1Scouting/interface/SDSRawDataCollection.h>
5 changes: 5 additions & 0 deletions DataFormats/L1Scouting/src/classes_def.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<lcgdict>
<class name="SRDCollection" />
<class name="edm::Wrapper<SRDCollection>" splitLevel="0"/>
<class name="edm::RefProd<SRDCollection>"/>
</lcgdict>
1 change: 1 addition & 0 deletions EventFilter/Utilities/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<use name="stdcxx-fs"/>
<use name="tbb"/>
<use name="DataFormats/FEDRawData"/>
<use name="DataFormats/L1Scouting"/>
<use name="DataFormats/TCDS"/>
<use name="DataFormats/L1Trigger"/>
<use name="FWCore/Framework"/>
Expand Down
4 changes: 3 additions & 1 deletion EventFilter/Utilities/interface/DAQSourceModels.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ class DataMode {
bool fileListMode) const = 0;

virtual bool isMultiDir() { return false; }
virtual void makeDirectoryEntries(std::vector<std::string> const& baseDirs, std::string const& runDir) = 0;
virtual void makeDirectoryEntries(std::vector<std::string> const& baseDirs,
std::vector<int> const& numSources,
std::string const& runDir) = 0;
void setTesting(bool testing) { testing_ = testing; }

protected:
Expand Down
8 changes: 6 additions & 2 deletions EventFilter/Utilities/interface/DAQSourceModelsFRD.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ class DataModeFRD : public DataMode {
MAXTCDSuTCAFEDID_ = MAXTCDSuTCAFEDID;
}

void makeDirectoryEntries(std::vector<std::string> const& baseDirs, std::string const& runDir) override {}
void makeDirectoryEntries(std::vector<std::string> const& baseDirs,
std::vector<int> const& numSources,
std::string const& runDir) override {}

std::pair<bool, std::vector<std::string>> defineAdditionalFiles(std::string const& primaryName, bool) const override {
return std::make_pair(true, std::vector<std::string>());
Expand Down Expand Up @@ -171,7 +173,9 @@ class DataModeFRDStriped : public DataMode {
MAXTCDSuTCAFEDID_ = MAXTCDSuTCAFEDID;
}

void makeDirectoryEntries(std::vector<std::string> const& baseDirs, std::string const& runDir) override;
void makeDirectoryEntries(std::vector<std::string> const& baseDirs,
std::vector<int> const& numSources,
std::string const& runDir) override;

std::pair<bool, std::vector<std::string>> defineAdditionalFiles(std::string const& primaryName,
bool fileListMode) const override;
Expand Down
Loading

0 comments on commit 8067ab5

Please sign in to comment.