CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< EBDigiCollectionPh2
ebDigiCollectionToken_
 
const edm::EDPutTokenT
< EBUncalibratedRecHitCollection
ebUncalibRecHitCollectionToken_
 
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 ( 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"))) {}
const edm::EDGetTokenT< EBDigiCollectionPh2 > ebDigiCollectionToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDPutTokenT< EBUncalibratedRecHitCollection > ebUncalibRecHitCollectionToken_

Member Function Documentation

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

Definition at line 30 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, HLT_FULL_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)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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(), hgc_digi::nSamples, edm::Event::put(), compare_using_db::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
const_iterator begin() const
The iterator returned can not safely be used across threads.
const edm::EDGetTokenT< EBDigiCollectionPh2 > ebDigiCollectionToken_
static constexpr float gains[NGAINS]
Definition: EcalConstants.h:9
def move
Definition: eostools.py:511
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
constexpr size_t nSamples
Definition: DetId.h:17
int adc() const
get the ADC sample (12 bits)
const_iterator end() const
const edm::EDPutTokenT< EBUncalibratedRecHitCollection > ebUncalibRecHitCollectionToken_
int gainId() const
get the gainId (2 bits)

Member Data Documentation

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

Definition at line 26 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

Referenced by produce().

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

Definition at line 27 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

Referenced by produce().

const float EcalUncalibRecHitPhase2WeightsProducer::tFall_
private

Definition at line 23 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

const float EcalUncalibRecHitPhase2WeightsProducer::tRise_
private

Definition at line 22 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

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

Definition at line 24 of file EcalUncalibRecHitPhase2WeightsProducer.cc.

Referenced by produce().