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 | Protected Attributes
EcalUncalibRecHitWorkerWeights Class Reference

#include <EcalUncalibRecHitWorkerWeights.h>

Inheritance diagram for EcalUncalibRecHitWorkerWeights:
EcalUncalibRecHitWorkerRunOneDigiBase EcalUncalibRecHitWorkerBaseClass

Public Member Functions

 EcalUncalibRecHitWorkerWeights (const edm::ParameterSet &, edm::ConsumesCollector &c)
 
 EcalUncalibRecHitWorkerWeights ()=default
 
edm::ParameterSetDescription getAlgoDescription () override
 
bool run (const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result) override
 
void set (const edm::EventSetup &es) override
 
 ~EcalUncalibRecHitWorkerWeights () override
 
- Public Member Functions inherited from EcalUncalibRecHitWorkerRunOneDigiBase
 EcalUncalibRecHitWorkerRunOneDigiBase (const edm::ParameterSet &p, edm::ConsumesCollector &c)
 
 EcalUncalibRecHitWorkerRunOneDigiBase (const edm::ParameterSet &p)
 
 EcalUncalibRecHitWorkerRunOneDigiBase ()
 
void run (const edm::Event &evt, const EcalDigiCollection &digis, EcalUncalibratedRecHitCollection &result) override
 
 ~EcalUncalibRecHitWorkerRunOneDigiBase () override
 
- Public Member Functions inherited from EcalUncalibRecHitWorkerBaseClass
 EcalUncalibRecHitWorkerBaseClass (const edm::ParameterSet &, edm::ConsumesCollector &c)
 
 EcalUncalibRecHitWorkerBaseClass (const edm::ParameterSet &)
 
 EcalUncalibRecHitWorkerBaseClass ()
 
virtual void set (const edm::Event &evt)
 
virtual ~EcalUncalibRecHitWorkerBaseClass ()
 

Protected Attributes

const
EcalWeightSet::EcalChi2WeightMatrix
chi2mat [2]
 
double gainRatios [3]
 
edm::ESHandle< EcalGainRatiosgains_
 
edm::ESHandle
< EcalWeightXtalGroups
grps_
 
double pedRMSVec [3]
 
edm::ESHandle< EcalPedestalspeds_
 
double pedVec [3]
 
EBShape testbeamEBShape
 
EEShape testbeamEEShape
 
edm::ESGetToken
< EcalGainRatios,
EcalGainRatiosRcd
tokenGains_
 
edm::ESGetToken
< EcalWeightXtalGroups,
EcalWeightXtalGroupsRcd
tokenGrps_
 
edm::ESGetToken< EcalPedestals,
EcalPedestalsRcd
tokenPeds_
 
edm::ESGetToken< EcalTBWeights,
EcalTBWeightsRcd
tokenWgts_
 
EcalUncalibRecHitRecWeightsAlgo
< EBDataFrame
uncalibMaker_barrel_
 
EcalUncalibRecHitRecWeightsAlgo
< EEDataFrame
uncalibMaker_endcap_
 
const
EcalWeightSet::EcalWeightMatrix
weights [2]
 
edm::ESHandle< EcalTBWeightswgts_
 

Detailed Description

Definition at line 34 of file EcalUncalibRecHitWorkerWeights.h.

Constructor & Destructor Documentation

EcalUncalibRecHitWorkerWeights::EcalUncalibRecHitWorkerWeights ( const edm::ParameterSet ps,
edm::ConsumesCollector c 
)

Definition at line 12 of file EcalUncalibRecHitWorkerWeights.cc.

18  testbeamEEShape(c),
19  testbeamEBShape(c) {}
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > tokenPeds_
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > tokenGains_
edm::ESGetToken< EcalTBWeights, EcalTBWeightsRcd > tokenWgts_
edm::ESGetToken< EcalWeightXtalGroups, EcalWeightXtalGroupsRcd > tokenGrps_
EcalUncalibRecHitWorkerWeights::EcalUncalibRecHitWorkerWeights ( )
default
EcalUncalibRecHitWorkerWeights::~EcalUncalibRecHitWorkerWeights ( )
inlineoverride

Definition at line 38 of file EcalUncalibRecHitWorkerWeights.h.

38 {};

Member Function Documentation

edm::ParameterSetDescription EcalUncalibRecHitWorkerWeights::getAlgoDescription ( )
overridevirtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 113 of file EcalUncalibRecHitWorkerWeights.cc.

113  {
115  return psd;
116 }
bool EcalUncalibRecHitWorkerWeights::run ( const edm::Event evt,
const EcalDigiCollection::const_iterator digi,
EcalUncalibratedRecHitCollection result 
)
overridevirtual

Implements EcalUncalibRecHitWorkerRunOneDigiBase.

Definition at line 31 of file EcalUncalibRecHitWorkerWeights.cc.

References EcalEndcap, EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), gainRatios, gains_, EcalWeightSet::getWeightsAfterGainSwitch(), EcalWeightSet::getWeightsBeforeGainSwitch(), grps_, ecalpyutils::hashedIndex(), EBDetId::hashedIndex(), EEDetId::hashedIndex(), EcalXtalGroupId::id(), EcalUncalibratedRecHit::kHasSwitchToGain1, EcalUncalibratedRecHit::kHasSwitchToGain6, EcalUncalibRecHitRecWeightsAlgo< C >::makeRecHit(), pedRMSVec, peds_, pedVec, EcalUncalibratedRecHit::setFlagBit(), testbeamEBShape, testbeamEEShape, uncalibMaker_endcap_, weights, and wgts_.

33  {
34  DetId detid(itdg->id());
35 
36  const EcalPedestals::Item* aped = nullptr;
37  const EcalMGPAGainRatio* aGain = nullptr;
38  const EcalXtalGroupId* gid = nullptr;
39  EcalTBWeights::EcalTDCId tdcid(1);
40 
41  if (detid.subdetId() == EcalEndcap) {
42  unsigned int hashedIndex = EEDetId(detid).hashedIndex();
43  aped = &peds_->endcap(hashedIndex);
44  aGain = &gains_->endcap(hashedIndex);
45  gid = &grps_->endcap(hashedIndex);
46  } else {
47  unsigned int hashedIndex = EBDetId(detid).hashedIndex();
48  aped = &peds_->barrel(hashedIndex);
49  aGain = &gains_->barrel(hashedIndex);
50  gid = &grps_->barrel(hashedIndex);
51  }
52 
53  pedVec[0] = aped->mean_x12;
54  pedVec[1] = aped->mean_x6;
55  pedVec[2] = aped->mean_x1;
56  pedRMSVec[0] = aped->rms_x12;
57  pedRMSVec[1] = aped->rms_x6;
58  pedRMSVec[2] = aped->rms_x1;
59  gainRatios[0] = 1.;
60  gainRatios[1] = aGain->gain12Over6();
61  gainRatios[2] = aGain->gain6Over1() * aGain->gain12Over6();
62 
63  // now lookup the correct weights in the map
64  EcalTBWeights::EcalTBWeightMap const& wgtsMap = wgts_->getMap();
65  EcalTBWeights::EcalTBWeightMap::const_iterator wit;
66  wit = wgtsMap.find(std::make_pair(*gid, tdcid));
67  if (wit == wgtsMap.end()) {
68  edm::LogError("EcalUncalibRecHitError")
69  << "No weights found for EcalGroupId: " << gid->id() << " and EcalTDCId: " << tdcid
70  << "\n skipping digi with id: " << detid.rawId();
71 
72  return false;
73  }
74  const EcalWeightSet& wset = wit->second; // this is the EcalWeightSet
75 
78  // const EcalWeightSet::EcalChi2WeightMatrix& mat3 = wset.getChi2WeightsBeforeGainSwitch();
79  // const EcalWeightSet::EcalChi2WeightMatrix& mat4 = wset.getChi2WeightsAfterGainSwitch();
80 
81  weights[0] = &mat1;
82  weights[1] = &mat2;
83 
84  // chi2mat[0] = &mat3;
85  // chi2mat[1] = &mat4;
86  /*
87  if (detid.subdetId()==EcalEndcap) {
88  result.push_back(uncalibMaker_endcap_.makeRecHit(*itdg, pedVec, gainRatios, weights, chi2mat));
89  } else {
90  result.push_back(uncalibMaker_barrel_.makeRecHit(*itdg, pedVec, gainRatios, weights, chi2mat));
91  }
92 */
93  if (detid.subdetId() == EcalEndcap) {
96  if (((EcalDataFrame)(*itdg)).hasSwitchToGain6())
98  if (((EcalDataFrame)(*itdg)).hasSwitchToGain1())
100  result.emplace_back(rhit);
101  } else {
104  if (((EcalDataFrame)(*itdg)).hasSwitchToGain6())
106  if (((EcalDataFrame)(*itdg)).hasSwitchToGain1())
108  result.emplace_back(rhit);
109  }
110  return true;
111 }
edm::ESHandle< EcalWeightXtalGroups > grps_
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
std::map< std::pair< EcalXtalGroupId, EcalTDCId >, EcalWeightSet > EcalTBWeightMap
Definition: EcalTBWeights.h:18
EcalUncalibRecHitRecWeightsAlgo< EEDataFrame > uncalibMaker_endcap_
edm::ESHandle< EcalTBWeights > wgts_
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:19
Log< level::Error, false > LogError
const EcalWeightSet::EcalWeightMatrix * weights[2]
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:36
virtual EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *pedestalsRMS, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalShapeBase &testbeamPulseShape)
Compute parameters.
float gain6Over1() const
EcalWeightMatrix & getWeightsAfterGainSwitch()
Definition: EcalWeightSet.h:27
edm::ESHandle< EcalPedestals > peds_
Definition: DetId.h:17
int hashedIndex() const
Definition: EEDetId.h:183
EcalWeightMatrix & getWeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:26
unsigned int id() const
float gain12Over6() const
edm::ESHandle< EcalGainRatios > gains_
void EcalUncalibRecHitWorkerWeights::set ( const edm::EventSetup es)
overridevirtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 21 of file EcalUncalibRecHitWorkerWeights.cc.

References gains_, edm::EventSetup::getHandle(), grps_, peds_, EcalShapeBase::setEventSetup(), testbeamEBShape, testbeamEEShape, tokenGains_, tokenGrps_, tokenPeds_, tokenWgts_, and wgts_.

21  {
26 
29 }
edm::ESHandle< EcalWeightXtalGroups > grps_
edm::ESHandle< EcalTBWeights > wgts_
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > tokenPeds_
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > tokenGains_
edm::ESHandle< EcalPedestals > peds_
void setEventSetup(const edm::EventSetup &evtSetup)
edm::ESGetToken< EcalTBWeights, EcalTBWeightsRcd > tokenWgts_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
edm::ESGetToken< EcalWeightXtalGroups, EcalWeightXtalGroupsRcd > tokenGrps_
edm::ESHandle< EcalGainRatios > gains_

Member Data Documentation

const EcalWeightSet::EcalChi2WeightMatrix* EcalUncalibRecHitWorkerWeights::chi2mat[2]
protected

Definition at line 62 of file EcalUncalibRecHitWorkerWeights.h.

double EcalUncalibRecHitWorkerWeights::gainRatios[3]
protected

Definition at line 59 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

edm::ESHandle<EcalGainRatios> EcalUncalibRecHitWorkerWeights::gains_
protected

Definition at line 53 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

edm::ESHandle<EcalWeightXtalGroups> EcalUncalibRecHitWorkerWeights::grps_
protected

Definition at line 54 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

double EcalUncalibRecHitWorkerWeights::pedRMSVec[3]
protected

Definition at line 58 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

edm::ESHandle<EcalPedestals> EcalUncalibRecHitWorkerWeights::peds_
protected

Definition at line 52 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

double EcalUncalibRecHitWorkerWeights::pedVec[3]
protected

Definition at line 57 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

EBShape EcalUncalibRecHitWorkerWeights::testbeamEBShape
protected

Definition at line 68 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

EEShape EcalUncalibRecHitWorkerWeights::testbeamEEShape
protected

Definition at line 67 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

edm::ESGetToken<EcalGainRatios, EcalGainRatiosRcd> EcalUncalibRecHitWorkerWeights::tokenGains_
protected

Definition at line 49 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by set().

edm::ESGetToken<EcalWeightXtalGroups, EcalWeightXtalGroupsRcd> EcalUncalibRecHitWorkerWeights::tokenGrps_
protected

Definition at line 50 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by set().

edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> EcalUncalibRecHitWorkerWeights::tokenPeds_
protected

Definition at line 48 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by set().

edm::ESGetToken<EcalTBWeights, EcalTBWeightsRcd> EcalUncalibRecHitWorkerWeights::tokenWgts_
protected

Definition at line 51 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by set().

EcalUncalibRecHitRecWeightsAlgo<EBDataFrame> EcalUncalibRecHitWorkerWeights::uncalibMaker_barrel_
protected

Definition at line 64 of file EcalUncalibRecHitWorkerWeights.h.

EcalUncalibRecHitRecWeightsAlgo<EEDataFrame> EcalUncalibRecHitWorkerWeights::uncalibMaker_endcap_
protected

Definition at line 65 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

const EcalWeightSet::EcalWeightMatrix* EcalUncalibRecHitWorkerWeights::weights[2]
protected

Definition at line 61 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

edm::ESHandle<EcalTBWeights> EcalUncalibRecHitWorkerWeights::wgts_
protected

Definition at line 55 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().