CMS 3D CMS Logo

HcalPulseContainmentTest.cc
Go to the documentation of this file.
1 #include <memory>
2 
7 
15 
16 #include <cassert>
17 #include <vector>
18 #include <iostream>
19 #include <iterator>
20 
21 class HcalTimeSlew;
22 
23 class HcalPulseContainmentTest : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
24 public:
25  explicit HcalPulseContainmentTest(const edm::ParameterSet& iConfig);
26  ~HcalPulseContainmentTest() override;
27 
28 private:
29  void beginJob() override;
30  void beginRun(edm::Run const&, edm::EventSetup const&) override {}
31  void analyze(edm::Event const&, edm::EventSetup const&) override;
32  void endRun(edm::Run const&, edm::EventSetup const&) override {}
33 
35 };
36 
38 
40 
42 
45  iSetup.get<HcalTimeSlewRecord>().get("HBHE", delay);
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:41
HcalPulseContainmentTest::hcalTimeSlew_delay_
const HcalTimeSlew * hcalTimeSlew_delay_
Definition: HcalPulseContainmentTest.cc:34
ESHandle.h
HcalPulseContainmentManager.h
HcalPulseContainmentTest
Definition: HcalPulseContainmentTest.cc:23
edm::Run
Definition: Run.h:45
HcalPulseContainmentTest::analyze
void analyze(edm::Event const &, edm::EventSetup const &) override
Definition: HcalPulseContainmentTest.cc:43
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:39
HcalTimeSlew
Definition: HcalTimeSlew.h:19
MakerMacros.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ESHandle
Definition: DTSurvey.h:22
benchmark_cfg.fc
fc
Definition: benchmark_cfg.py:15
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:57
HcalPulseContainmentTest::HcalPulseContainmentTest
HcalPulseContainmentTest(const edm::ParameterSet &iConfig)
Definition: HcalPulseContainmentTest.cc:37
get
#define get
HcalEndcap
Definition: HcalAssistant.h:34
Frameworkfwd.h
EventSetup.h
phase2TrackerDigitizer_cfi.delay
delay
Definition: phase2TrackerDigitizer_cfi.py:49
HcalTimeSlewRecord.h
ParameterSet.h
HcalPulseContainmentTest::endRun
void endRun(edm::Run const &, edm::EventSetup const &) override
Definition: HcalPulseContainmentTest.cc:32
edm::Event
Definition: Event.h:73
HcalPulseContainmentTest::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: HcalPulseContainmentTest.cc:30
StreamID.h