forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to analyses: inclusive and selected bx paths
- Loading branch information
Showing
11 changed files
with
410 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
L1TriggerScouting/OnlineProcessing/interface/MaskOrbitBx.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#ifndef L1TriggerSccouting_OnlineProcessing_MaskOrbitBx_h | ||
#define L1TriggerSccouting_OnlineProcessing_MaskOrbitBx_h | ||
|
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/stream/EDProducer.h" | ||
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
#include "FWCore/Utilities/interface/EDGetToken.h" | ||
#include "FWCore/Utilities/interface/EDPutToken.h" | ||
#include "FWCore/Utilities/interface/Exception.h" | ||
#include "FWCore/Utilities/interface/InputTag.h" | ||
#include "FWCore/Utilities/interface/StreamID.h" | ||
#include "FWCore/Utilities/interface/Span.h" | ||
|
||
// L1 scouting | ||
#include "DataFormats/L1Scouting/interface/OrbitCollection.h" | ||
|
||
#include <vector> | ||
#include <set> | ||
|
||
template <typename T> | ||
class MaskOrbitBx : public edm::stream::EDProducer<> { | ||
public: | ||
explicit MaskOrbitBx(const edm::ParameterSet&); | ||
~MaskOrbitBx() {} | ||
static void fillDescriptions(edm::ConfigurationDescriptions&); | ||
|
||
private: | ||
void produce(edm::Event&, const edm::EventSetup&) override; | ||
|
||
std::vector<std::vector<T>> orbitBuffer_; | ||
|
||
// tokens for scouting data | ||
edm::EDGetTokenT<OrbitCollection<T>> tokenData_; | ||
|
||
// BX to be keep | ||
edm::EDGetTokenT<std::vector<unsigned>> tokenSelBxs_; | ||
|
||
std::string productLabel_; | ||
|
||
const int NBX = 3565; | ||
}; | ||
|
||
template <typename T> | ||
MaskOrbitBx<T>::MaskOrbitBx(const edm::ParameterSet& iPSet) | ||
: tokenData_(consumes<OrbitCollection<T>>(iPSet.getParameter<edm::InputTag>("dataTag"))), | ||
tokenSelBxs_(consumes<std::vector<unsigned>>(iPSet.getParameter<edm::InputTag>("selectBxs"))), | ||
productLabel_(iPSet.getParameter<std::string>("productLabel")) { | ||
// prepare module buffer | ||
orbitBuffer_ = std::vector<std::vector<T>>(NBX); | ||
|
||
// products | ||
produces<OrbitCollection<T>>(productLabel_).setBranchAlias(productLabel_ + "OrbitCollection"); | ||
} | ||
|
||
// ------------ method called for each ORBIT ------------ | ||
template <typename T> | ||
void MaskOrbitBx<T>::produce(edm::Event& iEvent, const edm::EventSetup&) { | ||
// get selected BXs | ||
edm::Handle<std::vector<unsigned>> selBxs; | ||
iEvent.getByToken(tokenSelBxs_, selBxs); | ||
|
||
// get the data | ||
edm::Handle<OrbitCollection<T>> objCollection; | ||
iEvent.getByToken(tokenData_, objCollection); | ||
|
||
// prepare new collections | ||
std::unique_ptr<OrbitCollection<T>> selectedObjs(new OrbitCollection<T>); | ||
|
||
int nObjOrbit_ = 0; | ||
|
||
// fill collections with objects | ||
for (const unsigned& bx : *selBxs) { | ||
for (const auto& obj : objCollection->bxIterator(bx)) { | ||
orbitBuffer_[bx].push_back(obj); | ||
nObjOrbit_++; | ||
} | ||
} | ||
|
||
// fill orbit collection and clear the Bx buffer vector | ||
selectedObjs->fillAndClear(orbitBuffer_, nObjOrbit_); | ||
|
||
// store collections in the event | ||
iEvent.put(std::move(selectedObjs), productLabel_); | ||
|
||
} // end produce | ||
|
||
template <typename T> | ||
void MaskOrbitBx<T>::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
desc.add<edm::InputTag>("dataTag"); | ||
desc.add<edm::InputTag>("selectBxs"); | ||
desc.add<std::string>("productLabel", ""); | ||
descriptions.addDefault(desc); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/global/EDFilter.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
#include "FWCore/Utilities/interface/EDGetToken.h" | ||
#include "FWCore/Utilities/interface/EDPutToken.h" | ||
#include "FWCore/Utilities/interface/Exception.h" | ||
#include "FWCore/Utilities/interface/InputTag.h" | ||
#include "FWCore/Utilities/interface/StreamID.h" | ||
#include "FWCore/Utilities/interface/Span.h" | ||
|
||
#include <vector> | ||
#include <set> | ||
|
||
/* | ||
* Filter orbits that don't contain at least one selected BX | ||
* from a BxSelector module and produce a vector of selected BXs | ||
*/ | ||
class GoodOrbitNBxSelector : public edm::global::EDFilter<> { | ||
public: | ||
explicit GoodOrbitNBxSelector(const edm::ParameterSet&); | ||
~GoodOrbitNBxSelector() {} | ||
static void fillDescriptions(edm::ConfigurationDescriptions&); | ||
|
||
private: | ||
bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; | ||
|
||
// tokens for BX selected by each analysis | ||
std::vector<edm::EDGetTokenT<unsigned int>> nbxTokens_; | ||
unsigned int threshold_; | ||
}; | ||
|
||
GoodOrbitNBxSelector::GoodOrbitNBxSelector(const edm::ParameterSet& iPSet) | ||
: threshold_(iPSet.getParameter<unsigned int>("nbxMin")) { | ||
// get the list of selected BXs | ||
std::vector<edm::InputTag> bxLabels = iPSet.getParameter<std::vector<edm::InputTag>>("unpackers"); | ||
for (const auto& bxLabel : bxLabels) { | ||
edm::InputTag tag{bxLabel.label(), "nbx", bxLabel.process()}; | ||
nbxTokens_.push_back(consumes<unsigned int>(tag)); | ||
} | ||
} | ||
|
||
// ------------ method called for each ORBIT ------------ | ||
bool GoodOrbitNBxSelector::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup&) const { | ||
for (const auto& token : nbxTokens_) { | ||
edm::Handle<unsigned> nbx; | ||
iEvent.getByToken(token, nbx); | ||
if (*nbx < threshold_) | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
void GoodOrbitNBxSelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
desc.add<std::vector<edm::InputTag>>("unpackers"); | ||
desc.add<unsigned int>("nbxMin", 3564); // BXs in one orbit | ||
descriptions.addDefault(desc); | ||
} | ||
|
||
DEFINE_FWK_MODULE(GoodOrbitNBxSelector); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "L1TriggerScouting/OnlineProcessing/interface/MaskOrbitBx.h" | ||
|
||
#include "DataFormats/L1TParticleFlow/interface/L1ScoutingPuppi.h" | ||
#include "DataFormats/L1TParticleFlow/interface/L1ScoutingTkEm.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
|
||
typedef MaskOrbitBx<l1Scouting::Puppi> MaskOrbitBxScoutingPuppi; | ||
typedef MaskOrbitBx<l1Scouting::TkEm> MaskOrbitBxScoutingTkEm; | ||
typedef MaskOrbitBx<l1Scouting::TkEle> MaskOrbitBxScoutingTkEle; | ||
|
||
DEFINE_FWK_MODULE(MaskOrbitBxScoutingPuppi); | ||
DEFINE_FWK_MODULE(MaskOrbitBxScoutingTkEm); | ||
DEFINE_FWK_MODULE(MaskOrbitBxScoutingTkEle); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.