Skip to content

Commit c238632

Browse files
authored
Merge pull request #48163 from patinkaew/l1scouting_nano_dev_15_1_0_pre3
Introduce L1ScoutingNanoAOD for Run3
2 parents be432bf + 7fa4b88 commit c238632

19 files changed

+1997
-2
lines changed

Configuration/PyReleaseValidation/python/relval_nano.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ def next(self, index: int = None) -> None:
225225
steps['ScoutingPFMonitor2024MINIAOD14.0'] = {'INPUT': InputInfo(location='STD', ls=lumis_Run2024D,
226226
dataSet='/ScoutingPFMonitor/Run2024D-PromptReco-v1/MINIAOD')}
227227

228+
steps['L1Scouting2024RAW14.0'] = {'INPUT': InputInfo(location='STD', ls={386873: [[1, 332]]},
229+
dataSet='/L1Scouting/Run2024I-v1/L1SCOUT')}
230+
231+
steps['L1ScoutingSelection2024RAW14.0'] = {'INPUT': InputInfo(location='STD', ls={386873: [[1, 332]]},
232+
dataSet='/L1ScoutingSelection/Run2024I-v1/L1SCOUT')}
233+
228234
steps['ZMuSkim2024RAWRECO14.0'] = {'INPUT': InputInfo(location='STD', ls=lumis_Run2024D,
229235
dataSet='/Muon0/Run2024D-ZMu-PromptReco-v1/RAW-RECO')}
230236

@@ -261,6 +267,12 @@ def next(self, index: int = None) -> None:
261267
steps['scoutingNANO_withPrompt_data14.0'] = merge([{'-s': 'NANO:@Prompt+@ScoutMonitor'},
262268
steps['NANO_data14.0']])
263269

270+
steps['l1ScoutingNANO_data14.0'] = merge([{'-s': 'NANO:@L1Scout', '-n': '1000'},
271+
steps['NANO_data14.0']])
272+
273+
steps['l1ScoutingSelectionNANO_data14.0'] = merge([{'-s': 'NANO:@L1ScoutSelect', '-n': '1000'},
274+
steps['NANO_data14.0']])
275+
264276
# DPG custom NANO
265277
steps['muDPGNANO_data14.0'] = merge([{'-s': 'RAW2DIGI,NANO:@MUDPG', '-n': '100'},
266278
steps['NANO_data14.0']])
@@ -456,6 +468,8 @@ def next(self, index: int = None) -> None:
456468
workflows[_wfn()] = ['lepTrackInfoNANOdata140Xrun3', ['MuonEG2024MINIAOD14.0', 'lepTrackInfoNANO_data14.0']]
457469
workflows[_wfn()] = ['ScoutingNANOdata140Xrun3', ['ScoutingPFRun32024RAW14.0', 'scoutingNANO_data14.0']]
458470
workflows[_wfn()] = ['ScoutingNANOwithPromptdata140Xrun3', ['ScoutingPFMonitor2024MINIAOD14.0', 'scoutingNANO_withPrompt_data14.0']]
471+
workflows[_wfn()] = ['L1ScoutingNANOdata140Xrun3', ['L1Scouting2024RAW14.0', 'l1ScoutingNANO_data14.0']]
472+
workflows[_wfn()] = ['L1ScoutingSelectionNANOdata140Xrun3', ['L1ScoutingSelection2024RAW14.0', 'l1ScoutingSelectionNANO_data14.0']]
459473

460474
# DPG custom NANOs, data
461475
_wfn.subnext()

DataFormats/L1Scouting/interface/OrbitCollection.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ class OrbitCollection {
117117
T& operator[](std::size_t i) { return data_[i]; }
118118
const T& operator[](std::size_t i) const { return data_[i]; }
119119

120+
//used by OrbitFlatTable
121+
const std::vector<unsigned>& bxOffsets() const { return bxOffsets_; };
122+
120123
// used by ROOT storage
121124
CMS_CLASS_VERSION(3)
122125

DataFormats/L1Scouting/src/classes_def.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@
4646
<class name="edm::Wrapper<l1ScoutingRun3::JetOrbitCollection>"/>
4747
<class name="edm::Wrapper<l1ScoutingRun3::MuonOrbitCollection>"/>
4848
<class name="edm::Wrapper<l1ScoutingRun3::TauOrbitCollection>"/>
49-
49+
5050
</lcgdict>

DataFormats/NanoAOD/interface/FlatTable.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ namespace nanoaod {
184184
: name(aname), doc(docString), type(atype), firstIndex(anIndex) {}
185185
};
186186

187-
private:
187+
protected:
188188
template <typename T>
189189
auto beginData(unsigned int column) const {
190190
return bigVector<T>().cbegin() + columns_[column].firstIndex;
@@ -194,6 +194,7 @@ namespace nanoaod {
194194
return bigVector<T>().begin() + columns_[column].firstIndex;
195195
}
196196

197+
private:
197198
template <typename T>
198199
auto const &bigVector() const {
199200
return bigVectorImpl<T>(*this);
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#ifndef DataFormats_L1Scouting_OrbitFlatTable_h
2+
#define DataFormats_L1Scouting_OrbitFlatTable_h
3+
4+
/**
5+
* A cross-breed of a FlatTable and an OrbitCollection
6+
*/
7+
8+
#include "DataFormats/NanoAOD/interface/FlatTable.h"
9+
10+
#include <cstdint>
11+
#include <vector>
12+
#include <string>
13+
#include <type_traits>
14+
15+
namespace l1ScoutingRun3 {
16+
17+
class OrbitFlatTable : public nanoaod::FlatTable {
18+
public:
19+
static constexpr unsigned int NBX = 3564;
20+
21+
OrbitFlatTable() : nanoaod::FlatTable(), bxOffsets_(orbitBufferSize_ + 1, 0) {}
22+
23+
OrbitFlatTable(std::vector<unsigned> bxOffsets,
24+
const std::string &name,
25+
bool singleton = false,
26+
bool extension = false)
27+
: nanoaod::FlatTable(bxOffsets.back(), name, singleton, extension), bxOffsets_(bxOffsets) {
28+
if (bxOffsets.size() != orbitBufferSize_ + 1) {
29+
throw cms::Exception("LogicError") << "Mismatch between bxOffsets.size() " << bxOffsets.size()
30+
<< " and orbitBufferSize_ + 1" << (orbitBufferSize_ + 1);
31+
}
32+
}
33+
34+
~OrbitFlatTable() {}
35+
36+
using FlatTable::nRows;
37+
using FlatTable::size;
38+
39+
/// number of rows for single BX
40+
unsigned int nRows(unsigned bx) const {
41+
if (bx >= orbitBufferSize_)
42+
throwBadBx(bx);
43+
return bxOffsets_[bx + 1] - bxOffsets_[bx];
44+
};
45+
unsigned int size(unsigned bx) const { return nRows(bx); }
46+
47+
/// get a column by index (const)
48+
template <typename T>
49+
auto columnData(unsigned int column) const {
50+
return nanoaod::FlatTable::columnData<T>(column);
51+
}
52+
53+
/// get a column by index and bx (const)
54+
template <typename T>
55+
auto columnData(unsigned int column, unsigned bx) const {
56+
if (bx >= orbitBufferSize_)
57+
throwBadBx(bx);
58+
auto begin = beginData<T>(column);
59+
return std::span(begin + bxOffsets_[bx], begin + bxOffsets_[bx + 1]);
60+
}
61+
62+
/// get a column by index (non-const)
63+
template <typename T>
64+
auto columnData(unsigned int column) {
65+
return nanoaod::FlatTable::columnData<T>(column);
66+
}
67+
68+
/// get a column by index and bx (non-const)
69+
template <typename T>
70+
auto columnData(unsigned int column, unsigned bx) {
71+
if (bx >= orbitBufferSize_)
72+
throwBadBx(bx);
73+
auto begin = beginData<T>(column);
74+
return std::span(begin + bxOffsets_[bx], begin + bxOffsets_[bx + 1]);
75+
}
76+
77+
/// get a column value for singleton (const)
78+
template <typename T>
79+
const auto &columValue(unsigned int column, unsigned bx) const {
80+
if (!singleton())
81+
throw cms::Exception("LogicError", "columnValue works only for singleton tables");
82+
if (bx >= orbitBufferSize_ || bxOffsets_[bx + 1] == bxOffsets_[bx])
83+
throwBadBx(bx);
84+
auto begin = beginData<T>(column);
85+
return *(begin + bxOffsets_[bx]);
86+
}
87+
88+
private:
89+
std::vector<unsigned> bxOffsets_;
90+
91+
// there are 3564 BX in one orbtit [1,3564], one extra
92+
// count added to keep first entry of the vector
93+
static constexpr int orbitBufferSize_ = NBX + 1;
94+
95+
[[noreturn]] void throwBadBx(unsigned bx) const {
96+
throw cms::Exception("OrbitFlatTable") << "Trying to access bad bx " << bx;
97+
}
98+
};
99+
100+
} // namespace l1ScoutingRun3
101+
102+
#endif

DataFormats/NanoAOD/src/classes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "Rtypes.h"
22

33
#include "DataFormats/NanoAOD/interface/FlatTable.h"
4+
#include "DataFormats/NanoAOD/interface/OrbitFlatTable.h"
45
#include "DataFormats/NanoAOD/interface/MergeableCounterTable.h"
56
#include "DataFormats/NanoAOD/interface/UniqueString.h"
67
#include "DataFormats/Common/interface/Wrapper.h"

DataFormats/NanoAOD/src/classes_def.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,10 @@
4444
<version ClassVersion="3" checksum="2793726511"/>
4545
</class>
4646
<class name="edm::Wrapper<nanoaod::UniqueString>" />
47+
48+
<class name="l1ScoutingRun3::OrbitFlatTable" ClassVersion="3">
49+
<version ClassVersion="3" checksum="1910072015"/>
50+
</class>
51+
<class name="edm::Wrapper<l1ScoutingRun3::OrbitFlatTable>"/>
4752
</lcgdict>
4853

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
<use name="tbb"/>
12
<use name="FWCore/Framework"/>
23
<use name="FWCore/ParameterSet"/>
34
<use name="FWCore/PluginManager"/>
5+
<use name="IOPool/Provenance"/>
6+
<use name="DataFormats/Common"/>
47
<use name="DataFormats/L1Trigger"/>
58
<use name="DataFormats/L1Scouting"/>
9+
<use name="DataFormats/NanoAOD"/>
10+
<use name="PhysicsTools/NanoAOD"/>
611
<use name="EventFilter/Utilities"/>
712
<use name="L1TriggerScouting/Utilities"/>
13+
<use name="CommonTools/Utils"/>
14+
<use name="Utilities/General"/>
815
<flags EDM_PLUGIN="1"/>

0 commit comments

Comments
 (0)