CMS 3D CMS Logo

WriteL1TriggerObjectsTxt.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Test/WriteL1TriggerObjectsTxt
4 // Class: WriteL1TriggerObjectsTxt
5 //
13 //
14 // Original Author: Aleko Khukhunaishvili
15 // Created: Fri, 21 Jul 2017 08:25:18 GMT
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 #include <fstream>
22 
23 // user include files
29 
37 
38 class WriteL1TriggerObjectsTxt : public edm::one::EDAnalyzer<edm::one::SharedResources> {
39 public:
41  ~WriteL1TriggerObjectsTxt() override;
42 
43  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
44 
45 private:
46  void analyze(const edm::Event&, const edm::EventSetup&) override;
47 
50 };
51 
53  : tagName_(iConfig.getParameter<std::string>("TagName")),
54  tok_dbservice_(esConsumes<HcalDbService, HcalDbRecord>()) {}
55 
57 
59  using namespace edm;
60 
62 
63  const HcalLutMetadata* metadata = conditions->getHcalLutMetadata();
64  const HcalTopology* topo = metadata->topo();
65 
66  std::unique_ptr<HcalL1TriggerObjects> HcalL1TrigObjCol(new HcalL1TriggerObjects);
67 
68  for (const auto& id : metadata->getAllChannels()) {
69  if (not(id.det() == DetId::Hcal and topo->valid(id)))
70  continue;
71 
72  HcalDetId cell(id);
73  HcalSubdetector subdet = cell.subdet();
74  if (subdet != HcalBarrel and subdet != HcalEndcap and subdet != HcalForward)
75  continue;
76 
77  HcalCalibrations calibrations = conditions->getHcalCalibrations(cell);
78 
79  float gain = 0.0;
80  float ped = 0.0;
81 
82  for (auto i : {0, 1, 2, 3}) {
83  gain += calibrations.LUTrespcorrgain(i);
84  ped += calibrations.effpedestal(i);
85  }
86 
87  gain /= 4.;
88  ped /= 4.;
89 
90  const HcalChannelStatus* channelStatus = conditions->getHcalChannelStatus(cell);
91  uint32_t status = channelStatus->getValue();
92  HcalL1TriggerObject l1object(cell, ped, gain, status);
93  HcalL1TrigObjCol->setTopo(topo);
94  HcalL1TrigObjCol->addValues(l1object);
95  }
96 
97  HcalL1TrigObjCol->setTagString(tagName_);
98  HcalL1TrigObjCol->setAlgoString("A 2-TS Peak Finder");
99  std::string outfilename = "Gen_L1TriggerObjects_";
101  outfilename += ".txt";
102  std::ofstream of(outfilename.c_str());
103  HcalDbASCIIIO::dumpObject(of, *HcalL1TrigObjCol);
104 }
105 
108  desc.setUnknown();
109  descriptions.addDefault(desc);
110 }
111 
EDAnalyzer.h
HcalCalibrations.h
mps_fire.i
i
Definition: mps_fire.py:428
mps_update.status
status
Definition: mps_update.py:68
HcalL1TriggerObjects.h
edm
HLT enums.
Definition: AlignableModifier.h:19
HcalTopology
Definition: HcalTopology.h:26
DetId::Hcal
Definition: DetId.h:28
HcalL1TriggerObject.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
WriteL1TriggerObjectsTxt::~WriteL1TriggerObjectsTxt
~WriteL1TriggerObjectsTxt() override
Definition: WriteL1TriggerObjectsTxt.cc:56
AlignmentProducer_cff.calibrations
calibrations
Definition: AlignmentProducer_cff.py:59
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
HcalBarrel
Definition: HcalAssistant.h:33
WriteL1TriggerObjectsTxt::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: WriteL1TriggerObjectsTxt.cc:58
MakerMacros.h
HcalL1TriggerObjects
Definition: HcalL1TriggerObjects.h:14
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
SiStripCommissioningSource_FromRAW_cfg.outfilename
outfilename
Definition: SiStripCommissioningSource_FromRAW_cfg.py:122
HcalChannelStatus
Definition: HcalChannelStatus.h:13
HcalDbRecord.h
HcalCalibrations
Definition: HcalCalibrations.h:9
TrackingMonitor_cfi.metadata
metadata
Definition: TrackingMonitor_cfi.py:71
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
HcalL1TriggerObject
Definition: HcalL1TriggerObject.h:13
HcalChannelStatus::getValue
uint32_t getValue() const
Definition: HcalChannelStatus.h:60
WriteL1TriggerObjectsTxt::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: WriteL1TriggerObjectsTxt.cc:106
edm::ParameterSet
Definition: ParameterSet.h:47
WriteL1TriggerObjectsTxt::tok_dbservice_
edm::ESGetToken< HcalDbService, HcalDbRecord > tok_dbservice_
Definition: WriteL1TriggerObjectsTxt.cc:49
Event.h
HcalDetId::subdet
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
HcalDetId
Definition: HcalDetId.h:12
iEvent
int iEvent
Definition: GenABIO.cc:224
WriteL1TriggerObjectsTxt::WriteL1TriggerObjectsTxt
WriteL1TriggerObjectsTxt(const edm::ParameterSet &)
Definition: WriteL1TriggerObjectsTxt.cc:52
edm::EventSetup
Definition: EventSetup.h:58
WriteL1TriggerObjectsTxt::tagName_
std::string tagName_
Definition: WriteL1TriggerObjectsTxt.cc:48
edm::ESGetToken< HcalDbService, HcalDbRecord >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
HcalSubdetector
HcalSubdetector
Definition: HcalAssistant.h:31
HcalForward
Definition: HcalAssistant.h:36
HcalTopology::valid
bool valid(const DetId &id) const override
Definition: HcalTopology.cc:225
HcalDbASCIIIO::dumpObject
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
HcalTopology.h
HcalDbService
Definition: HcalDbService.h:23
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
submitPVValidationJobs.conditions
list conditions
Definition: submitPVValidationJobs.py:674
std
Definition: JetResolutionObject.h:76
HcalLutMetadata
Definition: HcalLutMetadata.h:15
HcalDbASCIIIO.h
HcalEndcap
Definition: HcalAssistant.h:34
Frameworkfwd.h
WriteL1TriggerObjectsTxt
Definition: WriteL1TriggerObjectsTxt.cc:38
HcalDbService.h
HcalDbRecord
Definition: HcalDbRecord.h:30
ParameterSet.h
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99