-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[P. Verwilligen] Add first version of CSC digi filler
- Loading branch information
Carlo Battilana
committed
Apr 5, 2023
1 parent
fa3c362
commit 607c236
Showing
4 changed files
with
225 additions
and
0 deletions.
There are no files selected for viewing
89 changes: 89 additions & 0 deletions
89
DPGAnalysis/MuonTools/plugins/MuNtupleCSCALCTDigiFiller.cc
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,89 @@ | ||
/** \class MuDPGAnalysis/MuonDPGNtuples/plugins/MuNtupleCSCALCTDigiFiller.cc | ||
* | ||
* Helper class : the digi filler for CSC ALCT digis | ||
* (used in ZeroBias Analysis for Background Studies) | ||
* | ||
* \author P. Verwilligen (INFN BA) | ||
* | ||
* | ||
*/ | ||
|
||
#include "DPGAnalysis/MuonTools/plugins/MuNtupleCSCALCTDigiFiller.h" | ||
|
||
MuNtupleCSCALCTDigiFiller::MuNtupleCSCALCTDigiFiller(const edm::ParameterSet& config) | ||
: MuNtupleBaseFiller{config}, m_token{config, consumesCollector(), "cscALCTDigiTag"} { | ||
produces<nanoaod::FlatTable>(); | ||
} | ||
|
||
void MuNtupleCSCALCTDigiFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
|
||
desc.add<std::string>("label", "cscALCTDigis"); | ||
desc.add<edm::InputTag>("cscALCTDigiTag", edm::InputTag{"muonCSCDigis", "MuonCSCALCTDigi"}); | ||
|
||
descriptions.addWithDefaultLabel(desc); | ||
} | ||
|
||
void MuNtupleCSCALCTDigiFiller::fill(edm::Event& ev) { | ||
unsigned int nDigis{0}; | ||
|
||
std::vector<int8_t> endcap; | ||
std::vector<int8_t> station; | ||
std::vector<int8_t> ring; | ||
std::vector<int8_t> chamber; | ||
std::vector<int8_t> layer; | ||
std::vector<bool> valid; | ||
std::vector<int8_t> quality; | ||
std::vector<int8_t> accelbit; | ||
std::vector<int8_t> colpattb; | ||
std::vector<int8_t> keywiregroup; | ||
std::vector<int8_t> alctbx; | ||
|
||
auto cscALCTDigis = m_token.conditionalGet(ev); | ||
|
||
if (cscALCTDigis.isValid()) { | ||
auto cscDetIdIt = cscALCTDigis->begin(); | ||
auto cscDetIdEnd = cscALCTDigis->end(); | ||
|
||
for (; cscDetIdIt != cscDetIdEnd; ++cscDetIdIt) { | ||
const auto& [cscDetId, range] = (*cscDetIdIt); | ||
|
||
for (auto digi = range.first; digi != range.second; ++digi) { | ||
endcap.push_back(cscDetId.endcap()); | ||
station.push_back(cscDetId.station()); | ||
ring.push_back(cscDetId.ring()); | ||
chamber.push_back(cscDetId.chamber()); | ||
layer.push_back(cscDetId.layer()); | ||
keywiregroup.push_back(digi->getKeyWG()); // Fundamental | ||
valid.push_back(digi->isValid()); // Interesting for future study ... can be dropped | ||
quality.push_back(digi->getQuality()); // Interesting for future study ... can be dropped | ||
accelbit.push_back(digi->getAccelerator()); // Interesting for future study ... can be dropped | ||
colpattb.push_back(digi->getCollisionB()); // Interesting for future study ... can be dropped | ||
alctbx.push_back(digi->getBX()); // should keep this for redundancy ??? | ||
|
||
++nDigis; | ||
} | ||
} | ||
} | ||
|
||
auto table = std::make_unique<nanoaod::FlatTable>(nDigis, m_label, false, false); // CB check those falses | ||
|
||
addColumn(table, "endcap", endcap, ""); // CB has to be documented | ||
addColumn(table, "station", station, ""); // CB has to be documented | ||
addColumn(table, "ring", ring, ""); // CB has to be documented | ||
addColumn(table, "chamber", chamber, ""); // CB has to be documented | ||
addColumn(table, "layer", layer, ""); // CB has to be documented | ||
addColumn(table, "keywiregroup", keywiregroup, ""); // CB has to be documented | ||
addColumn(table, "valid", valid, ""); // CB has to be documented | ||
addColumn(table, "quality", quality, ""); // CB has to be documented | ||
addColumn(table, "accelerator", accelbit, ""); // CB has to be documented | ||
addColumn(table, "patternB", colpattb, ""); // CB has to be documented | ||
addColumn(table, "alctbx", alctbx, ""); // CB has to be documented | ||
|
||
ev.put(std::move(table)); | ||
} | ||
|
||
#include "FWCore/PluginManager/interface/ModuleDef.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
|
||
DEFINE_FWK_MODULE(MuNtupleCSCALCTDigiFiller); |
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,28 @@ | ||
#ifndef MuNtuple_MuNtupleCSCALCTDigiFiller_h | ||
#define MuNtuple_MuNtupleCSCALCTDigiFiller_h | ||
|
||
#include "DPGAnalysis/MuonTools/src/MuNtupleBaseFiller.h" | ||
|
||
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
|
||
#include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h" | ||
|
||
class MuNtupleCSCALCTDigiFiller : public MuNtupleBaseFiller { | ||
public: | ||
//Constructor | ||
MuNtupleCSCALCTDigiFiller(const edm::ParameterSet&); | ||
|
||
/// Fill descriptors | ||
static void fillDescriptions(edm::ConfigurationDescriptions&); | ||
|
||
protected: | ||
/// Fill tree branches for a given events | ||
virtual void fill(edm::Event&) final; | ||
|
||
private: | ||
/// The digi token | ||
nano_mu::EDTokenHandle<CSCALCTDigiCollection> m_token; | ||
}; | ||
|
||
#endif |
80 changes: 80 additions & 0 deletions
80
DPGAnalysis/MuonTools/plugins/MuNtupleCSCWireDigiFiller.cc
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,80 @@ | ||
/** \class MuDPGAnalysis/MuonDPGNtuples/plugins/MuNtupleCSCWireDigiFiller.cc | ||
* | ||
* Helper class : the digi filler for CSC Wire digis | ||
* (used in ZeroBias Analysis for Background Studies) | ||
* | ||
* \author P. Verwilligen (INFN BA) | ||
* | ||
* | ||
*/ | ||
|
||
#include "DPGAnalysis/MuonTools//plugins/MuNtupleCSCWireDigiFiller.h" | ||
|
||
MuNtupleCSCWireDigiFiller::MuNtupleCSCWireDigiFiller(const edm::ParameterSet& config) | ||
: MuNtupleBaseFiller{config}, m_token{config, consumesCollector(), "cscWireDigiTag"} { | ||
produces<nanoaod::FlatTable>(); | ||
} | ||
|
||
void MuNtupleCSCWireDigiFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
|
||
desc.add<std::string>("label", "cscWireDigis"); | ||
desc.add<edm::InputTag>("cscWireDigiTag", edm::InputTag{"muonCSCDigis", "MuonCSCWireDigi"}); | ||
|
||
descriptions.addWithDefaultLabel(desc); | ||
} | ||
|
||
void MuNtupleCSCWireDigiFiller::fill(edm::Event& ev) { | ||
unsigned int nDigis{0}; | ||
|
||
std::vector<int8_t> endcap; | ||
std::vector<int8_t> station; | ||
std::vector<int8_t> ring; | ||
std::vector<int8_t> chamber; | ||
std::vector<int8_t> layer; | ||
std::vector<int8_t> wiregroup; | ||
std::vector<int8_t> wgtimebin; | ||
std::vector<int8_t> wgbx; | ||
|
||
auto cscWireDigis = m_token.conditionalGet(ev); | ||
|
||
if (cscWireDigis.isValid()) { | ||
auto cscDetIdIt = cscWireDigis->begin(); | ||
auto cscDetIdEnd = cscWireDigis->end(); | ||
|
||
for (; cscDetIdIt != cscDetIdEnd; ++cscDetIdIt) { | ||
const auto& [cscDetId, range] = (*cscDetIdIt); | ||
|
||
for (auto digi = range.first; digi != range.second; ++digi) { | ||
endcap.push_back(cscDetId.endcap()); | ||
station.push_back(cscDetId.station()); | ||
ring.push_back(cscDetId.ring()); | ||
chamber.push_back(cscDetId.chamber()); | ||
layer.push_back(cscDetId.layer()); | ||
wiregroup.push_back(digi->getWireGroup()); | ||
wgtimebin.push_back(digi->getTimeBin()); | ||
wgbx.push_back(digi->getWireGroupBX()); | ||
|
||
++nDigis; | ||
} | ||
} | ||
} | ||
|
||
auto table = std::make_unique<nanoaod::FlatTable>(nDigis, m_label, false, false); // CB check those falses | ||
|
||
addColumn(table, "endcap", endcap, ""); // CB has to be documented | ||
addColumn(table, "station", station, ""); // CB has to be documented | ||
addColumn(table, "ring", ring, ""); // CB has to be documented | ||
addColumn(table, "chamber", chamber, ""); // CB has to be documented | ||
addColumn(table, "layer", layer, ""); // CB has to be documented | ||
addColumn(table, "wiregroup", wiregroup, ""); // CB has to be documented | ||
addColumn(table, "wiregrouptimebin", wgtimebin, ""); // CB has to be documented | ||
addColumn(table, "wiregroupbx", wgbx, ""); // CB has to be documented | ||
|
||
ev.put(std::move(table)); | ||
} | ||
|
||
#include "FWCore/PluginManager/interface/ModuleDef.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
|
||
DEFINE_FWK_MODULE(MuNtupleCSCWireDigiFiller); |
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,28 @@ | ||
#ifndef MuNtuple_MuNtupleCSCWireDigiFiller_h | ||
#define MuNtuple_MuNtupleCSCWireDigiFiller_h | ||
|
||
#include "DPGAnalysis/MuonTools/src/MuNtupleBaseFiller.h" | ||
|
||
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
|
||
#include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" | ||
|
||
class MuNtupleCSCWireDigiFiller : public MuNtupleBaseFiller { | ||
public: | ||
//Constructor | ||
MuNtupleCSCWireDigiFiller(const edm::ParameterSet&); | ||
|
||
/// Fill descriptors | ||
static void fillDescriptions(edm::ConfigurationDescriptions&); | ||
|
||
protected: | ||
/// Fill tree branches for a given events | ||
virtual void fill(edm::Event&) final; | ||
|
||
private: | ||
/// The digi token | ||
nano_mu::EDTokenHandle<CSCWireDigiCollection> m_token; | ||
}; | ||
|
||
#endif |