CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
EcalUncalibRecHitPhase2WeightsProducer Class Reference
Inheritance diagram for EcalUncalibRecHitPhase2WeightsProducer:
edm::stream::EDProducer<>

Public Member Functions

 EcalUncalibRecHitPhase2WeightsProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &evt, const edm::EventSetup &es) override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

const edm::EDGetTokenT< EBDigiCollectionPh2ebDigiCollectionToken_
 
const edm::EDPutTokenT< EBUncalibratedRecHitCollectionebUncalibRecHitCollectionToken_
 
const float tFall_
 
const float tRise_
 
const std::vector< double > weights_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 15 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

Constructor & Destructor Documentation

◆ EcalUncalibRecHitPhase2WeightsProducer()

EcalUncalibRecHitPhase2WeightsProducer::EcalUncalibRecHitPhase2WeightsProducer ( const edm::ParameterSet ps)
explicit

Definition at line 59 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

60  : tRise_(ps.getParameter<double>("tRise")),
61  tFall_(ps.getParameter<double>("tFall")),
62  weights_(ps.getParameter<std::vector<double>>("weights")),
63  ebDigiCollectionToken_(consumes<EBDigiCollectionPh2>(ps.getParameter<edm::InputTag>("BarrelDigis"))),
65  produces<EBUncalibratedRecHitCollection>(ps.getParameter<std::string>("EBhitCollection"))) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< EBDigiCollectionPh2 > ebDigiCollectionToken_
const edm::EDPutTokenT< EBUncalibratedRecHitCollection > ebUncalibRecHitCollectionToken_

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 30 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, HLT_2022v12_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

30  {
32 
33  desc.add<std::string>("EBhitCollection", "EcalUncalibRecHitsEB");
34  desc.add<double>("tRise", 0.2);
35  desc.add<double>("tFall", 2.);
36  desc.add<std::vector<double>>("weights",
37  {-0.121016,
38  -0.119899,
39  -0.120923,
40  -0.0848959,
41  0.261041,
42  0.509881,
43  0.373591,
44  0.134899,
45  -0.0233605,
46  -0.0913195,
47  -0.112452,
48  -0.118596,
49  -0.121737,
50  -0.121737,
51  -0.121737,
52  -0.121737});
53 
54  desc.add<edm::InputTag>("BarrelDigis", edm::InputTag("simEcalUnsuppressedDigis", ""));
55 
56  descriptions.addWithDefaultLabel(desc);
57 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

void EcalUncalibRecHitPhase2WeightsProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 67 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

References EcalLiteDTUSample::adc(), edm::DataFrameContainer::begin(), ebDigiCollectionToken_, ebUncalibRecHitCollectionToken_, edm::DataFrameContainer::end(), diffTwoXMLs::g1, EcalLiteDTUSample::gainId(), ecalPh2::gains, edm::Event::get(), EBDataFrame::id(), EcalUncalibratedRecHit::kHasSwitchToGain1, eostools::move(), PresampleTask_cfi::nSamples, edm::Event::put(), ecalGpuTask_cfi::sample, EcalUncalibratedRecHit::setAmplitudeError(), EcalUncalibratedRecHit::setFlagBit(), EcalUncalibratedRecHit::setJitterError(), EcalDataFrame::size(), and weights_.

67  {
68  // retrieve digis
69  const EBDigiCollectionPh2* pdigis = &evt.get(ebDigiCollectionToken_);
70 
71  // prepare output
72  auto ebUncalibRechits = std::make_unique<EBUncalibratedRecHitCollection>();
73 
74  for (auto itdg = pdigis->begin(); itdg != pdigis->end(); ++itdg) {
75  EBDataFrame digi(*itdg);
76  EcalDataFrame_Ph2 dataFrame(*itdg);
77  DetId detId(digi.id());
78 
79  bool g1 = false;
80 
81  std::vector<float> timetrace;
82  std::vector<float> adctrace;
83 
84  int nSamples = digi.size();
85 
86  timetrace.reserve(nSamples);
87  adctrace.reserve(nSamples);
88 
89  float amp = 0;
90  float gratio;
91 
92  for (int sample = 0; sample < nSamples; ++sample) {
93  EcalLiteDTUSample thisSample = dataFrame[sample];
94  gratio = ecalPh2::gains[thisSample.gainId()];
95  adctrace.push_back(thisSample.adc() * gratio);
96 
97  amp = amp + adctrace[sample] * weights_[sample];
98 
99  if (thisSample.gainId() == 1)
100  g1 = true;
101 
102  timetrace.push_back(sample);
103 
104  } // loop on samples
105 
106  float amp_e = 1;
107  float t0_e = 0;
108 
109  EcalUncalibratedRecHit rhit(detId, amp, 0., 0., 0., 0); // rhit(detIt, amp, pedestal, t0, chi2, flags)
110  rhit.setAmplitudeError(amp_e);
111  rhit.setJitterError(t0_e);
112  if (g1)
114 
115  ebUncalibRechits->push_back(rhit);
116 
117  } // loop on digis
118 
119  evt.put(ebUncalibRecHitCollectionToken_, std::move(ebUncalibRechits));
120 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
int adc() const
get the ADC sample (12 bits)
const edm::EDGetTokenT< EBDigiCollectionPh2 > ebDigiCollectionToken_
static constexpr const float * gains
Definition: EcalConstants.h:24
const_iterator end() const
int gainId() const
get the gainId (2 bits)
Definition: DetId.h:17
const_iterator begin() const
The iterator returned can not safely be used across threads.
const edm::EDPutTokenT< EBUncalibratedRecHitCollection > ebUncalibRecHitCollectionToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ ebDigiCollectionToken_

const edm::EDGetTokenT<EBDigiCollectionPh2> EcalUncalibRecHitPhase2WeightsProducer::ebDigiCollectionToken_
private

Definition at line 26 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

Referenced by produce().

◆ ebUncalibRecHitCollectionToken_

const edm::EDPutTokenT<EBUncalibratedRecHitCollection> EcalUncalibRecHitPhase2WeightsProducer::ebUncalibRecHitCollectionToken_
private

Definition at line 27 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

Referenced by produce().

◆ tFall_

const float EcalUncalibRecHitPhase2WeightsProducer::tFall_
private

Definition at line 23 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

◆ tRise_

const float EcalUncalibRecHitPhase2WeightsProducer::tRise_
private

Definition at line 22 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

◆ weights_

const std::vector<double> EcalUncalibRecHitPhase2WeightsProducer::weights_
private

Definition at line 24 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

Referenced by produce().