CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes
EcalUncalibRecHitWorkerWeights Class Reference

#include <EcalUncalibRecHitWorkerWeights.h>

Inheritance diagram for EcalUncalibRecHitWorkerWeights:
EcalUncalibRecHitWorkerBaseClass

Public Member Functions

 EcalUncalibRecHitWorkerWeights (const edm::ParameterSet &, edm::ConsumesCollector &c)
 
 EcalUncalibRecHitWorkerWeights ()
 
edm::ParameterSetDescription getAlgoDescription ()
 
bool run (const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result)
 
void set (const edm::EventSetup &es)
 
virtual ~EcalUncalibRecHitWorkerWeights ()
 
- 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]
 
const EBShape testbeamEBShape
 
const EEShape testbeamEEShape
 
EcalUncalibRecHitRecWeightsAlgo
< EBDataFrame
uncalibMaker_barrel_
 
EcalUncalibRecHitRecWeightsAlgo
< EEDataFrame
uncalibMaker_endcap_
 
const
EcalWeightSet::EcalWeightMatrix
weights [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

Definition at line 35 of file EcalUncalibRecHitWorkerWeights.h.

35 {};
virtual EcalUncalibRecHitWorkerWeights::~EcalUncalibRecHitWorkerWeights ( )
inlinevirtual

Definition at line 36 of file EcalUncalibRecHitWorkerWeights.h.

36 {};

Member Function Documentation

edm::ParameterSetDescription EcalUncalibRecHitWorkerWeights::getAlgoDescription ( )
virtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 111 of file EcalUncalibRecHitWorkerWeights.cc.

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

Implements EcalUncalibRecHitWorkerBaseClass.

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

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

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().

const EBShape EcalUncalibRecHitWorkerWeights::testbeamEBShape
protected

Definition at line 61 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

const EEShape EcalUncalibRecHitWorkerWeights::testbeamEEShape
protected

Definition at line 60 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

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().