CMS 3D CMS Logo

HcalPulseContainmentTest.cc
Go to the documentation of this file.
1 #include <memory>
2 
6 
14 
15 #include <cassert>
16 #include <vector>
17 #include <iostream>
18 #include <iterator>
19 
20 class HcalTimeSlew;
21 
22 class HcalPulseContainmentTest : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
23 public:
24  explicit HcalPulseContainmentTest(const edm::ParameterSet& iConfig);
25  ~HcalPulseContainmentTest() override;
26 
27 private:
28  void beginJob() override;
29  void beginRun(edm::Run const&, edm::EventSetup const&) override {}
30  void analyze(edm::Event const&, edm::EventSetup const&) override;
31  void endRun(edm::Run const&, edm::EventSetup const&) override {}
32 
35 };
36 
38  : tok_slew_(esConsumes<HcalTimeSlew, HcalTimeSlewRecord>(edm::ESInputTag{"", "HBHE"})),
39  hcalTimeSlew_delay_(nullptr) {}
40 
42 
44 
47 
48  float fixedphase_ns = 6.0;
49  float max_fracerror = 0.02;
50  std::unique_ptr<HcalPulseContainmentManager> manager;
51  manager = std::make_unique<HcalPulseContainmentManager>(max_fracerror);
52  manager->setTimeSlew(hcalTimeSlew_delay_);
53 
54  HcalDetId hb1(HcalBarrel, 1, 1, 1);
55  HcalDetId he1(HcalEndcap, 17, 1, 1);
56  double fc = 10.;
57  // test re-finding the correction
58  double corr1 = manager->correction(hb1, 4, fixedphase_ns, fc);
59  double corr2 = manager->correction(hb1, 4, fixedphase_ns, fc);
60  assert(corr1 == corr2);
61  // fewer toAdd means bigger correction
62  double corr3 = manager->correction(hb1, 2, fixedphase_ns, fc);
63  assert(corr3 > corr1);
64  // HB and HE have the same shape here
65  double corr4 = manager->correction(he1, 4, fixedphase_ns, fc);
66  assert(corr4 == corr1);
67  std::cout << corr1 << " " << corr2 << " " << corr3 << " " << corr4 << " " << std::endl;
68 }
69 
70 //define this as a plug-in
EDAnalyzer.h
HcalPulseContainmentTest::beginJob
void beginJob() override
Definition: HcalPulseContainmentTest.cc:43
HcalPulseContainmentTest::hcalTimeSlew_delay_
const HcalTimeSlew * hcalTimeSlew_delay_
Definition: HcalPulseContainmentTest.cc:34
HcalPulseContainmentManager.h
ESInputTag
HcalPulseContainmentTest
Definition: HcalPulseContainmentTest.cc:22
edm::Run
Definition: Run.h:45
HcalPulseContainmentTest::analyze
void analyze(edm::Event const &, edm::EventSetup const &) override
Definition: HcalPulseContainmentTest.cc:45
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cms::cuda::assert
assert(be >=bs)
HcalRecNumberingRecord.h
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
HcalBarrel
Definition: HcalAssistant.h:33
HcalPulseContainmentTest::~HcalPulseContainmentTest
~HcalPulseContainmentTest() override
Definition: HcalPulseContainmentTest.cc:41
HcalTimeSlew
Definition: HcalTimeSlew.h:19
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HcalTimeSlewRecord
Definition: HcalTimeSlewRecord.h:4
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
HcalDetId
Definition: HcalDetId.h:12
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
HcalPulseContainmentTest::HcalPulseContainmentTest
HcalPulseContainmentTest(const edm::ParameterSet &iConfig)
Definition: HcalPulseContainmentTest.cc:37
edm::ESGetToken< HcalTimeSlew, HcalTimeSlewRecord >
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
HcalPulseContainmentTest::tok_slew_
const edm::ESGetToken< HcalTimeSlew, HcalTimeSlewRecord > tok_slew_
Definition: HcalPulseContainmentTest.cc:33
HcalEndcap
Definition: HcalAssistant.h:34
Frameworkfwd.h
EventSetup.h
HcalTimeSlewRecord.h
ParameterSet.h
HcalPulseContainmentTest::endRun
void endRun(edm::Run const &, edm::EventSetup const &) override
Definition: HcalPulseContainmentTest.cc:31
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
HcalPulseContainmentTest::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: HcalPulseContainmentTest.cc:29
StreamID.h