CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
WriteL1TriggerObjectsTxt Class Reference

#include <Test/WriteL1TriggerObjectsTxt/plugins/WriteL1TriggerObjectsTxt.cc>

Inheritance diagram for WriteL1TriggerObjectsTxt:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 WriteL1TriggerObjectsTxt (const edm::ParameterSet &)
 
 ~WriteL1TriggerObjectsTxt () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
template<typename T >
void fillL1TrgObjsCollection (std::unique_ptr< HcalL1TriggerObjects > &l1TrgObjsCol, const HcalDbService *conditions, const HcalTopology *topo, T cell)
 

Private Attributes

std::string tagName_
 
edm::ESGetToken< HcalDbService, HcalDbRecordtok_dbservice_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 38 of file WriteL1TriggerObjectsTxt.cc.

Constructor & Destructor Documentation

◆ WriteL1TriggerObjectsTxt()

WriteL1TriggerObjectsTxt::WriteL1TriggerObjectsTxt ( const edm::ParameterSet iConfig)
explicit

Definition at line 58 of file WriteL1TriggerObjectsTxt.cc.

59  : tagName_(iConfig.getParameter<std::string>("TagName")),
60  tok_dbservice_(esConsumes<HcalDbService, HcalDbRecord>()) {}
edm::ESGetToken< HcalDbService, HcalDbRecord > tok_dbservice_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307

◆ ~WriteL1TriggerObjectsTxt()

WriteL1TriggerObjectsTxt::~WriteL1TriggerObjectsTxt ( )
override

Definition at line 62 of file WriteL1TriggerObjectsTxt.cc.

62 {}

Member Function Documentation

◆ analyze()

void WriteL1TriggerObjectsTxt::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 89 of file WriteL1TriggerObjectsTxt.cc.

References DetId::Calo, PixelBaryCentreAnalyzer_cfg::conditions, HcalDbASCIIIO::dumpObject(), HcalZDCDetId::EM, fillL1TrgObjsCollection(), edm::EventSetup::getData(), HcalZDCDetId::HAD, DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalZDCDetId::LUM, OccupancyTask_cfi::metadata, haddnano::of, EcalCondDB::outfilename, nano_mu_digi_cff::rawId, HcalZDCDetId::section(), AlCaHLTBitMon_QueryRunRegistry::string, HcalDetId::subdet(), HcalZDCDetId::SubdetectorId, tagName_, tok_dbservice_, and HcalTopology::valid().

89  {
90  using namespace edm;
91 
93 
94  const HcalLutMetadata* metadata = conditions->getHcalLutMetadata();
95  const HcalTopology* topo = metadata->topo();
96 
97  std::unique_ptr<HcalL1TriggerObjects> HcalL1TrigObjCol(new HcalL1TriggerObjects);
98 
99  for (const auto& id : metadata->getAllChannels()) {
100  if (id.det() == DetId::Hcal and topo->valid(id)) {
101  HcalDetId cell(id);
102  HcalSubdetector subdet = cell.subdet();
103  if (subdet != HcalBarrel and subdet != HcalEndcap and subdet != HcalForward)
104  continue;
105 
106  fillL1TrgObjsCollection(HcalL1TrigObjCol, conditions, topo, cell);
107 
108  } else if (id.det() == DetId::Calo && id.subdetId() == HcalZDCDetId::SubdetectorId) {
109  HcalZDCDetId cell(id.rawId());
110 
111  if (cell.section() != HcalZDCDetId::EM && cell.section() != HcalZDCDetId::HAD &&
112  cell.section() != HcalZDCDetId::LUM)
113  continue;
114 
115  fillL1TrgObjsCollection(HcalL1TrigObjCol, conditions, topo, cell);
116  }
117  }
118 
119  HcalL1TrigObjCol->setTagString(tagName_);
120  HcalL1TrigObjCol->setAlgoString("TP algo determined by HcalTPChannelParameter auxi params");
121  std::string outfilename = "Gen_L1TriggerObjects_";
123  outfilename += ".txt";
124  std::ofstream of(outfilename.c_str());
125  HcalDbASCIIIO::dumpObject(of, *HcalL1TrigObjCol);
126 }
edm::ESGetToken< HcalDbService, HcalDbRecord > tok_dbservice_
void fillL1TrgObjsCollection(std::unique_ptr< HcalL1TriggerObjects > &l1TrgObjsCol, const HcalDbService *conditions, const HcalTopology *topo, T cell)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
bool valid(const DetId &id) const override
HcalSubdetector
Definition: HcalAssistant.h:31
HLT enums.
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
static constexpr int32_t SubdetectorId
Definition: HcalZDCDetId.h:35

◆ fillDescriptions()

void WriteL1TriggerObjectsTxt::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 128 of file WriteL1TriggerObjectsTxt.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

128  {
130  desc.setUnknown();
131  descriptions.addDefault(desc);
132 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ fillL1TrgObjsCollection()

template<typename T >
void WriteL1TriggerObjectsTxt::fillL1TrgObjsCollection ( std::unique_ptr< HcalL1TriggerObjects > &  l1TrgObjsCol,
const HcalDbService conditions,
const HcalTopology topo,
T  cell 
)
private

Definition at line 65 of file WriteL1TriggerObjectsTxt.cc.

References AlignmentProducer_cff::calibrations, PixelBaryCentreAnalyzer_cfg::conditions, Hcal_Conditions_forGlobalTag_cff::gain, HcalChannelStatus::getValue(), mps_fire::i, QIE10Task_cfi::ped, and mps_update::status.

Referenced by analyze().

68  {
69  const HcalCalibrations calibrations = conditions->getHcalCalibrations(cell);
70 
71  float gain = 0.0;
72  float ped = 0.0;
73 
74  for (auto i : {0, 1, 2, 3}) {
75  gain += calibrations.LUTrespcorrgain(i);
76  ped += calibrations.effpedestal(i);
77  }
78 
79  gain /= 4.;
80  ped /= 4.;
81 
82  const HcalChannelStatus* channelStatus = conditions->getHcalChannelStatus(cell);
83  uint32_t status = channelStatus->getValue();
84  HcalL1TriggerObject l1object(cell, ped, gain, status);
85  l1TrgObjsCol->setTopo(topo);
86  l1TrgObjsCol->addValues(l1object);
87 }
uint32_t getValue() const

Member Data Documentation

◆ tagName_

std::string WriteL1TriggerObjectsTxt::tagName_
private

Definition at line 54 of file WriteL1TriggerObjectsTxt.cc.

Referenced by analyze().

◆ tok_dbservice_

edm::ESGetToken<HcalDbService, HcalDbRecord> WriteL1TriggerObjectsTxt::tok_dbservice_
private

Definition at line 55 of file WriteL1TriggerObjectsTxt.cc.

Referenced by analyze().