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 60 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

61  : tRise_(ps.getParameter<double>("tRise")),
62  tFall_(ps.getParameter<double>("tFall")),
63  weights_(ps.getParameter<std::vector<double>>("weights")),
64  ebDigiCollectionToken_(consumes<EBDigiCollectionPh2>(ps.getParameter<edm::InputTag>("BarrelDigis"))),
66  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_2022v15_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  // The below weights values should be kept up to date with GPU version of this module
37  desc.add<std::vector<double>>("weights",
38  {-0.121016,
39  -0.119899,
40  -0.120923,
41  -0.0848959,
42  0.261041,
43  0.509881,
44  0.373591,
45  0.134899,
46  -0.0233605,
47  -0.0913195,
48  -0.112452,
49  -0.118596,
50  -0.121737,
51  -0.121737,
52  -0.121737,
53  -0.121737});
54 
55  desc.add<edm::InputTag>("BarrelDigis", edm::InputTag("simEcalUnsuppressedDigis", ""));
56 
57  descriptions.addWithDefaultLabel(desc);
58 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 68 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_.

68  {
69  // retrieve digis
70  const EBDigiCollectionPh2* pdigis = &evt.get(ebDigiCollectionToken_);
71 
72  // prepare output
73  auto ebUncalibRechits = std::make_unique<EBUncalibratedRecHitCollection>();
74 
75  for (auto itdg = pdigis->begin(); itdg != pdigis->end(); ++itdg) {
76  EBDataFrame digi(*itdg);
77  EcalDataFrame_Ph2 dataFrame(*itdg);
78  DetId detId(digi.id());
79 
80  bool g1 = false;
81 
82  std::vector<float> timetrace;
83  std::vector<float> adctrace;
84 
85  int nSamples = digi.size();
86 
87  timetrace.reserve(nSamples);
88  adctrace.reserve(nSamples);
89 
90  float amp = 0;
91  float gratio;
92 
93  for (int sample = 0; sample < nSamples; ++sample) {
94  EcalLiteDTUSample thisSample = dataFrame[sample];
95  gratio = ecalPh2::gains[thisSample.gainId()];
96  adctrace.push_back(thisSample.adc() * gratio);
97 
98  amp = amp + adctrace[sample] * weights_[sample];
99 
100  if (thisSample.gainId() == 1)
101  g1 = true;
102 
103  timetrace.push_back(sample);
104 
105  } // loop on samples
106 
107  float amp_e = 1;
108  float t0_e = 0;
109 
110  EcalUncalibratedRecHit rhit(detId, amp, 0., 0., 0., 0); // rhit(detIt, amp, pedestal, t0, chi2, flags)
111  rhit.setAmplitudeError(amp_e);
112  rhit.setJitterError(t0_e);
113  if (g1)
115 
116  ebUncalibRechits->push_back(rhit);
117 
118  } // loop on digis
119 
120  evt.put(ebUncalibRecHitCollectionToken_, std::move(ebUncalibRechits));
121 }
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:347
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().