CMS 3D CMS Logo

MaskOrbitBx.cc
Go to the documentation of this file.
14 
15 // L1 scouting
20 
21 #include <vector>
22 #include <set>
23 
24 using namespace l1ScoutingRun3;
25 
26 template <typename T>
28 public:
29  explicit MaskOrbitBx(const edm::ParameterSet&);
32 
33 private:
34  void produce(edm::Event&, const edm::EventSetup&) override;
35 
36  std::vector<std::vector<T>> orbitBuffer_;
37 
38  // tokens for scouting data
40 
41  // BX to be keep
43 
45 
46  const int NBX = 3565;
47 };
48 
49 template <typename T>
51  : tokenData_(consumes<OrbitCollection<T>>(iPSet.getParameter<edm::InputTag>("dataTag"))),
52  tokenSelBxs_(consumes<std::vector<unsigned>>(iPSet.getParameter<edm::InputTag>("selectBxs"))),
53  productLabel_(iPSet.getParameter<std::string>("productLabel")) {
54  // prepare module buffer
55  orbitBuffer_ = std::vector<std::vector<T>>(NBX);
56 
57  // products
58  produces<OrbitCollection<T>>(productLabel_).setBranchAlias(productLabel_ + "OrbitCollection");
59 }
60 
61 // ------------ method called for each ORBIT ------------
62 template <typename T>
64  // get selected BXs
66  iEvent.getByToken(tokenSelBxs_, selBxs);
67 
68  // get the data
69  edm::Handle<OrbitCollection<T>> objCollection;
70  iEvent.getByToken(tokenData_, objCollection);
71 
72  // prepare new collections
73  std::unique_ptr<OrbitCollection<T>> selectedObjs(new OrbitCollection<T>);
74 
75  int nObjOrbit_ = 0;
76 
77  // fill collections with objects
78  for (const unsigned& bx : *selBxs) {
79  for (const auto& obj : objCollection->bxIterator(bx)) {
80  orbitBuffer_[bx].push_back(obj);
81  nObjOrbit_++;
82  }
83  }
84 
85  // fill orbit collection and clear the Bx buffer vector
86  selectedObjs->fillAndClear(orbitBuffer_, nObjOrbit_);
87 
88  // store collections in the event
89  iEvent.put(std::move(selectedObjs), productLabel_);
90 
91 } // end produce
92 
93 template <typename T>
96  desc.setUnknown();
97  descriptions.addDefault(desc);
98 }
99 
106 
MaskOrbitBx< l1ScoutingRun3::Muon > MaskOrbitBxScoutingMuon
Definition: MaskOrbitBx.cc:100
edm::EDGetTokenT< OrbitCollection< T > > tokenData_
Definition: MaskOrbitBx.cc:39
MaskOrbitBx(const edm::ParameterSet &)
Definition: MaskOrbitBx.cc:50
const int NBX
Definition: MaskOrbitBx.cc:46
int iEvent
Definition: GenABIO.cc:224
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: MaskOrbitBx.cc:94
std::string productLabel_
Definition: MaskOrbitBx.cc:44
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MaskOrbitBx< l1ScoutingRun3::EGamma > MaskOrbitBxScoutingEGamma
Definition: MaskOrbitBx.cc:102
MaskOrbitBx< l1ScoutingRun3::BxSums > MaskOrbitBxScoutingBxSums
Definition: MaskOrbitBx.cc:104
MaskOrbitBx< l1ScoutingRun3::Tau > MaskOrbitBxScoutingTau
Definition: MaskOrbitBx.cc:103
MaskOrbitBx< l1ScoutingRun3::Jet > MaskOrbitBxScoutingJet
Definition: MaskOrbitBx.cc:101
std::vector< std::vector< T > > orbitBuffer_
Definition: MaskOrbitBx.cc:36
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< std::vector< unsigned > > tokenSelBxs_
Definition: MaskOrbitBx.cc:42
HLT enums.
MaskOrbitBx< l1ScoutingRun3::BMTFStub > MaskOrbitBxScoutingBMTFStub
Definition: MaskOrbitBx.cc:105
long double T
def move(src, dest)
Definition: eostools.py:511
void produce(edm::Event &, const edm::EventSetup &) override
Definition: MaskOrbitBx.cc:63