CMS 3D CMS Logo

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 ()
 
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::EcalChi2WeightMatrixchi2mat [2]
 
double gainRatios [3]
 
edm::ESHandle< EcalGainRatiosgains
 
edm::ESHandle< EcalWeightXtalGroupsgrps
 
double pedRMSVec [3]
 
edm::ESHandle< EcalPedestalspeds
 
double pedVec [3]
 
EBShape testbeamEBShape
 
EEShape testbeamEEShape
 
EcalUncalibRecHitRecWeightsAlgo< EBDataFrameuncalibMaker_barrel_
 
EcalUncalibRecHitRecWeightsAlgo< EEDataFrameuncalibMaker_endcap_
 
const EcalWeightSet::EcalWeightMatrixweights [2]
 
edm::ESHandle< EcalTBWeightswgts
 

Detailed Description

Definition at line 29 of file EcalUncalibRecHitWorkerWeights.h.

Constructor & Destructor Documentation

EcalUncalibRecHitWorkerWeights::EcalUncalibRecHitWorkerWeights ( const edm::ParameterSet ps,
edm::ConsumesCollector c 
)
EcalUncalibRecHitWorkerWeights::EcalUncalibRecHitWorkerWeights ( )
inline
EcalUncalibRecHitWorkerWeights::~EcalUncalibRecHitWorkerWeights ( )
inlineoverride

Definition at line 33 of file EcalUncalibRecHitWorkerWeights.h.

References mps_fire::result, and writedatasetfile::run.

33 {};

Member Function Documentation

edm::ParameterSetDescription EcalUncalibRecHitWorkerWeights::getAlgoDescription ( )
overridevirtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 112 of file EcalUncalibRecHitWorkerWeights.cc.

References DEFINE_EDM_PLUGIN.

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

Implements EcalUncalibRecHitWorkerRunOneDigiBase.

Definition at line 30 of file EcalUncalibRecHitWorkerWeights.cc.

References EcalEndcap, EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), gainRatios, gains, EcalTBWeights::getMap(), 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.

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

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 20 of file EcalUncalibRecHitWorkerWeights.cc.

References gains, edm::EventSetup::get(), grps, peds, EcalShapeBase::setEventSetup(), testbeamEBShape, testbeamEEShape, and wgts.

Member Data Documentation

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

Definition at line 53 of file EcalUncalibRecHitWorkerWeights.h.

double EcalUncalibRecHitWorkerWeights::gainRatios[3]
protected

Definition at line 50 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

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

Definition at line 44 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

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

Definition at line 45 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

double EcalUncalibRecHitWorkerWeights::pedRMSVec[3]
protected

Definition at line 49 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

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

Definition at line 43 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

double EcalUncalibRecHitWorkerWeights::pedVec[3]
protected

Definition at line 48 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

EBShape EcalUncalibRecHitWorkerWeights::testbeamEBShape
protected

Definition at line 59 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

EEShape EcalUncalibRecHitWorkerWeights::testbeamEEShape
protected

Definition at line 58 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

EcalUncalibRecHitRecWeightsAlgo<EBDataFrame> EcalUncalibRecHitWorkerWeights::uncalibMaker_barrel_
protected

Definition at line 55 of file EcalUncalibRecHitWorkerWeights.h.

EcalUncalibRecHitRecWeightsAlgo<EEDataFrame> EcalUncalibRecHitWorkerWeights::uncalibMaker_endcap_
protected

Definition at line 56 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

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

Definition at line 52 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

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

Definition at line 46 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().