CMS 3D CMS Logo

EcalUncalibRecHitWorkerWeights.cc
Go to the documentation of this file.
2 
6 
11 
14 
16 
18  : EcalUncalibRecHitWorkerRunOneDigiBase(ps, c), testbeamEEShape(EEShape(true)), testbeamEBShape(EBShape(true)) {}
19 
25 
28 }
29 
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 }
111 
114  return psd;
115 }
116 
123  "EcalUncalibRecHitWorkerWeights");
ConfigurationDescriptions.h
EcalUncalibratedRecHit::kHasSwitchToGain6
Definition: EcalUncalibratedRecHit.h:18
EcalUncalibRecHitWorkerWeights::uncalibMaker_endcap_
EcalUncalibRecHitRecWeightsAlgo< EEDataFrame > uncalibMaker_endcap_
Definition: EcalUncalibRecHitWorkerWeights.h:56
EcalUncalibRecHitWorkerWeights::testbeamEEShape
EEShape testbeamEEShape
Definition: EcalUncalibRecHitWorkerWeights.h:58
EBDetId::hashedIndex
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
EcalTBWeights::getMap
const EcalTBWeightMap & getMap() const
Definition: EcalTBWeights.h:28
EcalShapeBase::setEventSetup
void setEventSetup(const edm::EventSetup &evtSetup)
Definition: EcalShapeBase.cc:19
EcalUncalibRecHitFillDescriptionWorkerFactory.h
EcalUncalibRecHitWorkerWeights::set
void set(const edm::EventSetup &es) override
Definition: EcalUncalibRecHitWorkerWeights.cc:20
MessageLogger.h
EcalUncalibRecHitWorkerWeights
Definition: EcalUncalibRecHitWorkerWeights.h:29
edm::DataFrameContainer::const_iterator
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
Definition: DataFrameContainer.h:61
EcalUncalibRecHitWorkerWeights::getAlgoDescription
edm::ParameterSetDescription getAlgoDescription() override
Definition: EcalUncalibRecHitWorkerWeights.cc:112
EBShape
Definition: EBShape.h:6
EcalUncalibRecHitWorkerWeights::pedVec
double pedVec[3]
Definition: EcalUncalibRecHitWorkerWeights.h:48
EBDetId
Definition: EBDetId.h:17
EcalUncalibRecHitWorkerWeights::wgts
edm::ESHandle< EcalTBWeights > wgts
Definition: EcalUncalibRecHitWorkerWeights.h:46
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::SortedCollection
Definition: SortedCollection.h:49
EcalUncalibratedRecHit.h
EcalDataFrame
Definition: EcalDataFrame.h:16
EcalXtalGroupId
Definition: EcalXtalGroupId.h:11
EcalTBWeightsRcd
Definition: EcalTBWeightsRcd.h:5
EcalUncalibratedRecHit::setFlagBit
void setFlagBit(Flags flag)
Definition: EcalUncalibratedRecHit.cc:99
EcalWeightSet::EcalWeightMatrix
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:19
DetId
Definition: DetId.h:17
MakerMacros.h
EcalUncalibRecHitWorkerWeights::EcalUncalibRecHitWorkerWeights
EcalUncalibRecHitWorkerWeights()
Definition: EcalUncalibRecHitWorkerWeights.h:32
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
EcalUncalibRecHitWorkerRunOneDigiBase
Definition: EcalUncalibRecHitWorkerRunOneDigiBase.h:10
EcalUncalibRecHitWorkerWeights::grps
edm::ESHandle< EcalWeightXtalGroups > grps
Definition: EcalUncalibRecHitWorkerWeights.h:45
ParameterSetDescription.h
EcalWeightSet::getWeightsAfterGainSwitch
EcalWeightMatrix & getWeightsAfterGainSwitch()
Definition: EcalWeightSet.h:27
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
EEShape
Definition: EEShape.h:6
EcalMGPAGainRatio::gain12Over6
float gain12Over6() const
Definition: EcalMGPAGainRatio.h:19
EcalUncalibRecHitWorkerWeights::gainRatios
double gainRatios[3]
Definition: EcalUncalibRecHitWorkerWeights.h:50
EEDetId
Definition: EEDetId.h:14
EcalUncalibRecHitWorkerWeights::testbeamEBShape
EBShape testbeamEBShape
Definition: EcalUncalibRecHitWorkerWeights.h:59
EcalGainRatiosRcd
Definition: EcalGainRatiosRcd.h:5
EcalEndcap
Definition: EcalSubdetector.h:10
EcalUncalibRecHitWorkerWeights::peds
edm::ESHandle< EcalPedestals > peds
Definition: EcalUncalibRecHitWorkerWeights.h:43
EcalWeightSet::getWeightsBeforeGainSwitch
EcalWeightMatrix & getWeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:26
funct::true
true
Definition: Factorize.h:173
EcalUncalibRecHitWorkerWeights::weights
const EcalWeightSet::EcalWeightMatrix * weights[2]
Definition: EcalUncalibRecHitWorkerWeights.h:52
EcalTBWeights::EcalTDCId
int EcalTDCId
Definition: EcalTBWeights.h:17
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
Event.h
edmplugin::PluginFactory
Definition: PluginFactory.h:34
EEDetId::hashedIndex
int hashedIndex() const
Definition: EEDetId.h:183
edm::EventSetup
Definition: EventSetup.h:57
EcalGainRatiosRcd.h
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
get
#define get
EcalTBWeights::EcalTBWeightMap
std::map< std::pair< EcalXtalGroupId, EcalTDCId >, EcalWeightSet > EcalTBWeightMap
Definition: EcalTBWeights.h:18
EcalWeightSet
Definition: EcalWeightSet.h:17
EcalUncalibratedRecHit
Definition: EcalUncalibratedRecHit.h:8
EcalUncalibRecHitWorkerFactory.h
EcalUncalibRecHitWorkerWeights::run
bool run(const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result) override
Definition: EcalUncalibRecHitWorkerWeights.cc:30
EcalMGPAGainRatio::gain6Over1
float gain6Over1() const
Definition: EcalMGPAGainRatio.h:20
EcalPedestal
Definition: EcalPedestals.h:8
EcalUncalibRecHitRecWeightsAlgo::makeRecHit
virtual EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *pedestalsRMS, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalShapeBase &testbeamPulseShape)
Compute parameters.
Definition: EcalUncalibRecHitRecWeightsAlgo.h:30
EventSetup.h
EcalUncalibRecHitWorkerWeights.h
EcalPedestalsRcd.h
EcalXtalGroupId::id
unsigned int id() const
Definition: EcalXtalGroupId.h:22
mps_fire.result
result
Definition: mps_fire.py:303
EcalWeightXtalGroupsRcd
Definition: EcalWeightXtalGroupsRcd.h:5
EcalPedestalsRcd
Definition: EcalPedestalsRcd.h:5
EcalUncalibratedRecHit::kHasSwitchToGain1
Definition: EcalUncalibratedRecHit.h:19
edm::Event
Definition: Event.h:73
ecalpyutils::hashedIndex
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:38
EcalUncalibRecHitWorkerWeights::gains
edm::ESHandle< EcalGainRatios > gains
Definition: EcalUncalibRecHitWorkerWeights.h:44
EcalWeightXtalGroupsRcd.h
EcalTBWeightsRcd.h
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
EcalMGPAGainRatio
Definition: EcalMGPAGainRatio.h:13
EcalUncalibRecHitWorkerWeights::pedRMSVec
double pedRMSVec[3]
Definition: EcalUncalibRecHitWorkerWeights.h:49