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 std::vector< double > ampWeights_
 
const edm::EDGetTokenT< EBDigiCollectionPh2ebDigiCollectionToken_
 
const edm::EDPutTokenT< EBUncalibratedRecHitCollectionebUncalibRecHitCollectionToken_
 
const float tFall_
 
const std::vector< double > timeWeights_
 
const float tRise_
 

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

78  : tRise_(ps.getParameter<double>("tRise")),
79  tFall_(ps.getParameter<double>("tFall")),
80  ampWeights_(ps.getParameter<std::vector<double>>("ampWeights")),
81  timeWeights_(ps.getParameter<std::vector<double>>("timeWeights")),
82  ebDigiCollectionToken_(consumes<EBDigiCollectionPh2>(ps.getParameter<edm::InputTag>("BarrelDigis"))),
84  produces<EBUncalibratedRecHitCollection>(ps.getParameter<std::string>("EBhitCollection"))) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< EBDigiCollectionPh2 > ebDigiCollectionToken_
const edm::EDPutTokenT< EBUncalibratedRecHitCollection > ebUncalibRecHitCollectionToken_

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 31 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

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

31  {
33 
34  desc.add<std::string>("EBhitCollection", "EcalUncalibRecHitsEB");
35  desc.add<double>("tRise", 0.2);
36  desc.add<double>("tFall", 2.);
37  desc.add<std::vector<double>>("ampWeights",
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  desc.add<std::vector<double>>("timeWeights",
55  {0.429452,
56  0.442762,
57  0.413327,
58  0.858327,
59  4.42324,
60  2.04369,
61  -3.42426,
62  -4.16258,
63  -2.36061,
64  -0.725371,
65  0.0727267,
66  0.326005,
67  0.402035,
68  0.404287,
69  0.434207,
70  0.422775});
71 
72  desc.add<edm::InputTag>("BarrelDigis", edm::InputTag("simEcalUnsuppressedDigis", ""));
73 
74  descriptions.addWithDefaultLabel(desc);
75 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 86 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

References EcalLiteDTUSample::adc(), ampWeights_, edm::DataFrameContainer::begin(), hcalRecHitTable_cff::detId, 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(), FrontierCondition_GT_autoExpress_cfi::t0, and timeWeights_.

86  {
87  // retrieve digis
88  const EBDigiCollectionPh2* pdigis = &evt.get(ebDigiCollectionToken_);
89 
90  // prepare output
91  auto ebUncalibRechits = std::make_unique<EBUncalibratedRecHitCollection>();
92 
93  for (auto itdg = pdigis->begin(); itdg != pdigis->end(); ++itdg) {
94  EBDataFrame digi(*itdg);
95  EcalDataFrame_Ph2 dataFrame(*itdg);
96  DetId detId(digi.id());
97 
98  bool g1 = false;
99 
100  std::vector<float> timetrace;
101  std::vector<float> adctrace;
102 
103  int nSamples = digi.size();
104 
105  timetrace.reserve(nSamples);
106  adctrace.reserve(nSamples);
107 
108  float amp = 0;
109  float t0 = 0;
110  float gratio;
111 
112  for (int sample = 0; sample < nSamples; ++sample) {
113  EcalLiteDTUSample thisSample = dataFrame[sample];
114  gratio = ecalPh2::gains[thisSample.gainId()];
115  adctrace.push_back(thisSample.adc() * gratio);
116 
117  amp = amp + adctrace[sample] * ampWeights_[sample];
118 
119  t0 = t0 + adctrace[sample] * timeWeights_[sample];
120 
121  if (thisSample.gainId() == 1)
122  g1 = true;
123 
124  timetrace.push_back(sample);
125 
126  } // loop on samples
127 
128  float amp_e = 1;
129  float t0_e = 0;
130 
131  EcalUncalibratedRecHit rhit(detId, amp, 0., t0, 0., 0); // rhit(detIt, amp, pedestal, t0, chi2, flags)
132  rhit.setAmplitudeError(amp_e);
133  rhit.setJitterError(t0_e);
134  if (g1)
136 
137  ebUncalibRechits->push_back(rhit);
138 
139  } // loop on digis
140 
141  evt.put(ebUncalibRecHitCollectionToken_, std::move(ebUncalibRechits));
142 }
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:344
int adc() const
get the ADC sample (12 bits)
const edm::EDGetTokenT< EBDigiCollectionPh2 > ebDigiCollectionToken_
static constexpr const float * gains
Definition: EcalConstants.h:33
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

◆ ampWeights_

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

Definition at line 24 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

Referenced by produce().

◆ ebDigiCollectionToken_

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

Definition at line 27 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

Referenced by produce().

◆ ebUncalibRecHitCollectionToken_

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

Definition at line 28 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

Referenced by produce().

◆ tFall_

const float EcalUncalibRecHitPhase2WeightsProducer::tFall_
private

Definition at line 23 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

◆ timeWeights_

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

Definition at line 25 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

Referenced by produce().

◆ tRise_

const float EcalUncalibRecHitPhase2WeightsProducer::tRise_
private

Definition at line 22 of file EcalUncalibRecHitPhase2WeightsProducer.cc.