CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
EcalUncalibRecHitWorkerWeights Class Reference
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
 
- 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
 
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcdtokenGains_
 
edm::ESGetToken< EcalWeightXtalGroups, EcalWeightXtalGroupsRcdtokenGrps_
 
edm::ESGetToken< EcalPedestals, EcalPedestalsRcdtokenPeds_
 
edm::ESGetToken< EcalTBWeights, EcalTBWeightsRcdtokenWgts_
 
EcalUncalibRecHitRecWeightsAlgo< EBDataFrameuncalibMaker_barrel_
 
EcalUncalibRecHitRecWeightsAlgo< EEDataFrameuncalibMaker_endcap_
 
const EcalWeightSet::EcalWeightMatrixweights [2]
 
edm::ESHandle< EcalTBWeightswgts_
 

Detailed Description

Definition at line 29 of file EcalUncalibRecHitWorkerWeights.cc.

Constructor & Destructor Documentation

◆ EcalUncalibRecHitWorkerWeights() [1/2]

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

Definition at line 65 of file EcalUncalibRecHitWorkerWeights.cc.

72  testbeamEBShape(c) {}
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > tokenPeds_
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > tokenGains_
edm::ESGetToken< EcalTBWeights, EcalTBWeightsRcd > tokenWgts_
edm::ESGetToken< EcalWeightXtalGroups, EcalWeightXtalGroupsRcd > tokenGrps_

◆ EcalUncalibRecHitWorkerWeights() [2/2]

EcalUncalibRecHitWorkerWeights::EcalUncalibRecHitWorkerWeights ( )
default

Member Function Documentation

◆ getAlgoDescription()

edm::ParameterSetDescription EcalUncalibRecHitWorkerWeights::getAlgoDescription ( )
overridevirtual

◆ run()

bool EcalUncalibRecHitWorkerWeights::run ( const edm::Event evt,
const EcalDigiCollection::const_iterator digi,
EcalUncalibratedRecHitCollection result 
)
overridevirtual

Implements EcalUncalibRecHitWorkerRunOneDigiBase.

Definition at line 84 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, mps_fire::result, EcalUncalibratedRecHit::setFlagBit(), testbeamEBShape, testbeamEEShape, uncalibMaker_endcap_, weights, and wgts_.

86  {
87  DetId detid(itdg->id());
88 
89  const EcalPedestals::Item* aped = nullptr;
90  const EcalMGPAGainRatio* aGain = nullptr;
91  const EcalXtalGroupId* gid = nullptr;
92  EcalTBWeights::EcalTDCId tdcid(1);
93 
94  if (detid.subdetId() == EcalEndcap) {
95  unsigned int hashedIndex = EEDetId(detid).hashedIndex();
96  aped = &peds_->endcap(hashedIndex);
97  aGain = &gains_->endcap(hashedIndex);
98  gid = &grps_->endcap(hashedIndex);
99  } else {
100  unsigned int hashedIndex = EBDetId(detid).hashedIndex();
101  aped = &peds_->barrel(hashedIndex);
102  aGain = &gains_->barrel(hashedIndex);
103  gid = &grps_->barrel(hashedIndex);
104  }
105 
106  pedVec[0] = aped->mean_x12;
107  pedVec[1] = aped->mean_x6;
108  pedVec[2] = aped->mean_x1;
109  pedRMSVec[0] = aped->rms_x12;
110  pedRMSVec[1] = aped->rms_x6;
111  pedRMSVec[2] = aped->rms_x1;
112  gainRatios[0] = 1.;
113  gainRatios[1] = aGain->gain12Over6();
114  gainRatios[2] = aGain->gain6Over1() * aGain->gain12Over6();
115 
116  // now lookup the correct weights in the map
117  EcalTBWeights::EcalTBWeightMap const& wgtsMap = wgts_->getMap();
118  EcalTBWeights::EcalTBWeightMap::const_iterator wit;
119  wit = wgtsMap.find(std::make_pair(*gid, tdcid));
120  if (wit == wgtsMap.end()) {
121  edm::LogError("EcalUncalibRecHitError")
122  << "No weights found for EcalGroupId: " << gid->id() << " and EcalTDCId: " << tdcid
123  << "\n skipping digi with id: " << detid.rawId();
124 
125  return false;
126  }
127  const EcalWeightSet& wset = wit->second; // this is the EcalWeightSet
128 
131  // const EcalWeightSet::EcalChi2WeightMatrix& mat3 = wset.getChi2WeightsBeforeGainSwitch();
132  // const EcalWeightSet::EcalChi2WeightMatrix& mat4 = wset.getChi2WeightsAfterGainSwitch();
133 
134  weights[0] = &mat1;
135  weights[1] = &mat2;
136 
137  // chi2mat[0] = &mat3;
138  // chi2mat[1] = &mat4;
139  /*
140  if (detid.subdetId()==EcalEndcap) {
141  result.push_back(uncalibMaker_endcap_.makeRecHit(*itdg, pedVec, gainRatios, weights, chi2mat));
142  } else {
143  result.push_back(uncalibMaker_barrel_.makeRecHit(*itdg, pedVec, gainRatios, weights, chi2mat));
144  }
145 */
146  if (detid.subdetId() == EcalEndcap) {
149  if (((EcalDataFrame)(*itdg)).hasSwitchToGain6())
151  if (((EcalDataFrame)(*itdg)).hasSwitchToGain1())
153  result.emplace_back(rhit);
154  } else {
157  if (((EcalDataFrame)(*itdg)).hasSwitchToGain6())
159  if (((EcalDataFrame)(*itdg)).hasSwitchToGain1())
161  result.emplace_back(rhit);
162  }
163  return true;
164 }
edm::ESHandle< EcalWeightXtalGroups > grps_
const EcalTBWeightMap & getMap() const
Definition: EcalTBWeights.h:28
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: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.
unsigned int id() const
EcalWeightMatrix & getWeightsAfterGainSwitch()
Definition: EcalWeightSet.h:27
float gain12Over6() const
Definition: DetId.h:17
EcalWeightMatrix & getWeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:26
float gain6Over1() const
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
int hashedIndex() const
Definition: EEDetId.h:183
edm::ESHandle< EcalGainRatios > gains_

◆ set()

void EcalUncalibRecHitWorkerWeights::set ( const edm::EventSetup es)
overridevirtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 74 of file EcalUncalibRecHitWorkerWeights.cc.

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

74  {
79 
82 }
edm::ESHandle< EcalWeightXtalGroups > grps_
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > tokenPeds_
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > tokenGains_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
void setEventSetup(const edm::EventSetup &evtSetup)
edm::ESGetToken< EcalTBWeights, EcalTBWeightsRcd > tokenWgts_
edm::ESGetToken< EcalWeightXtalGroups, EcalWeightXtalGroupsRcd > tokenGrps_
edm::ESHandle< EcalGainRatios > gains_

Member Data Documentation

◆ chi2mat

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

Definition at line 56 of file EcalUncalibRecHitWorkerWeights.cc.

◆ gainRatios

double EcalUncalibRecHitWorkerWeights::gainRatios[3]
protected

Definition at line 53 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by run().

◆ gains_

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

Definition at line 47 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by run(), and set().

◆ grps_

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

Definition at line 48 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by run(), and set().

◆ pedRMSVec

double EcalUncalibRecHitWorkerWeights::pedRMSVec[3]
protected

Definition at line 52 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by run().

◆ peds_

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

Definition at line 46 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by run(), and set().

◆ pedVec

double EcalUncalibRecHitWorkerWeights::pedVec[3]
protected

Definition at line 51 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by run().

◆ testbeamEBShape

EBShape EcalUncalibRecHitWorkerWeights::testbeamEBShape
protected

Definition at line 62 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by run(), and set().

◆ testbeamEEShape

EEShape EcalUncalibRecHitWorkerWeights::testbeamEEShape
protected

Definition at line 61 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by run(), and set().

◆ tokenGains_

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

Definition at line 43 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by set().

◆ tokenGrps_

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

Definition at line 44 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by set().

◆ tokenPeds_

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

Definition at line 42 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by set().

◆ tokenWgts_

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

Definition at line 45 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by set().

◆ uncalibMaker_barrel_

EcalUncalibRecHitRecWeightsAlgo<EBDataFrame> EcalUncalibRecHitWorkerWeights::uncalibMaker_barrel_
protected

Definition at line 58 of file EcalUncalibRecHitWorkerWeights.cc.

◆ uncalibMaker_endcap_

EcalUncalibRecHitRecWeightsAlgo<EEDataFrame> EcalUncalibRecHitWorkerWeights::uncalibMaker_endcap_
protected

Definition at line 59 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by run().

◆ weights

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

Definition at line 55 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by run().

◆ wgts_

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

Definition at line 49 of file EcalUncalibRecHitWorkerWeights.cc.

Referenced by run(), and set().