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 31 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 36 of file EcalUncalibRecHitWorkerWeights.h.

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

36 {};

Member Function Documentation

edm::ParameterSetDescription EcalUncalibRecHitWorkerWeights::getAlgoDescription ( )
overridevirtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 114 of file EcalUncalibRecHitWorkerWeights.cc.

References DEFINE_EDM_PLUGIN.

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

Implements EcalUncalibRecHitWorkerRunOneDigiBase.

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

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

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 23 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 55 of file EcalUncalibRecHitWorkerWeights.h.

double EcalUncalibRecHitWorkerWeights::gainRatios[3]
protected

Definition at line 52 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

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

Definition at line 46 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

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

Definition at line 47 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

double EcalUncalibRecHitWorkerWeights::pedRMSVec[3]
protected

Definition at line 51 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

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

Definition at line 45 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

double EcalUncalibRecHitWorkerWeights::pedVec[3]
protected

Definition at line 50 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

EBShape EcalUncalibRecHitWorkerWeights::testbeamEBShape
protected

Definition at line 61 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

EEShape EcalUncalibRecHitWorkerWeights::testbeamEEShape
protected

Definition at line 60 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

EcalUncalibRecHitRecWeightsAlgo<EBDataFrame> EcalUncalibRecHitWorkerWeights::uncalibMaker_barrel_
protected

Definition at line 57 of file EcalUncalibRecHitWorkerWeights.h.

EcalUncalibRecHitRecWeightsAlgo<EEDataFrame> EcalUncalibRecHitWorkerWeights::uncalibMaker_endcap_
protected

Definition at line 58 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

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

Definition at line 54 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

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

Definition at line 48 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().