CMS 3D CMS Logo

EcalUncalibRecHitWorkerWeights.cc
Go to the documentation of this file.
2 
6 
9 
11 
18  testbeamEEShape(EEShape(true)),
19  testbeamEBShape(EBShape(true)) {}
20 
26 
29 }
30 
34  DetId detid(itdg->id());
35 
36  const EcalPedestals::Item* aped = nullptr;
37  const EcalMGPAGainRatio* aGain = nullptr;
38  const EcalXtalGroupId* gid = nullptr;
39  EcalTBWeights::EcalTDCId tdcid(1);
40 
41  if (detid.subdetId() == EcalEndcap) {
42  unsigned int hashedIndex = EEDetId(detid).hashedIndex();
43  aped = &peds_->endcap(hashedIndex);
44  aGain = &gains_->endcap(hashedIndex);
45  gid = &grps_->endcap(hashedIndex);
46  } else {
47  unsigned int hashedIndex = EBDetId(detid).hashedIndex();
48  aped = &peds_->barrel(hashedIndex);
49  aGain = &gains_->barrel(hashedIndex);
50  gid = &grps_->barrel(hashedIndex);
51  }
52 
53  pedVec[0] = aped->mean_x12;
54  pedVec[1] = aped->mean_x6;
55  pedVec[2] = aped->mean_x1;
56  pedRMSVec[0] = aped->rms_x12;
57  pedRMSVec[1] = aped->rms_x6;
58  pedRMSVec[2] = aped->rms_x1;
59  gainRatios[0] = 1.;
60  gainRatios[1] = aGain->gain12Over6();
61  gainRatios[2] = aGain->gain6Over1() * aGain->gain12Over6();
62 
63  // now lookup the correct weights in the map
64  EcalTBWeights::EcalTBWeightMap const& wgtsMap = wgts_->getMap();
65  EcalTBWeights::EcalTBWeightMap::const_iterator wit;
66  wit = wgtsMap.find(std::make_pair(*gid, tdcid));
67  if (wit == wgtsMap.end()) {
68  edm::LogError("EcalUncalibRecHitError")
69  << "No weights found for EcalGroupId: " << gid->id() << " and EcalTDCId: " << tdcid
70  << "\n skipping digi with id: " << detid.rawId();
71 
72  return false;
73  }
74  const EcalWeightSet& wset = wit->second; // this is the EcalWeightSet
75 
78  // const EcalWeightSet::EcalChi2WeightMatrix& mat3 = wset.getChi2WeightsBeforeGainSwitch();
79  // const EcalWeightSet::EcalChi2WeightMatrix& mat4 = wset.getChi2WeightsAfterGainSwitch();
80 
81  weights[0] = &mat1;
82  weights[1] = &mat2;
83 
84  // chi2mat[0] = &mat3;
85  // chi2mat[1] = &mat4;
86  /*
87  if (detid.subdetId()==EcalEndcap) {
88  result.push_back(uncalibMaker_endcap_.makeRecHit(*itdg, pedVec, gainRatios, weights, chi2mat));
89  } else {
90  result.push_back(uncalibMaker_barrel_.makeRecHit(*itdg, pedVec, gainRatios, weights, chi2mat));
91  }
92 */
93  if (detid.subdetId() == EcalEndcap) {
96  if (((EcalDataFrame)(*itdg)).hasSwitchToGain6())
98  if (((EcalDataFrame)(*itdg)).hasSwitchToGain1())
100  result.emplace_back(rhit);
101  } else {
104  if (((EcalDataFrame)(*itdg)).hasSwitchToGain6())
106  if (((EcalDataFrame)(*itdg)).hasSwitchToGain1())
108  result.emplace_back(rhit);
109  }
110  return true;
111 }
112 
115  return psd;
116 }
117 
124  "EcalUncalibRecHitWorkerWeights");
ConfigurationDescriptions.h
EcalUncalibratedRecHit::kHasSwitchToGain6
Definition: EcalUncalibratedRecHit.h:18
EcalUncalibRecHitWorkerWeights::uncalibMaker_endcap_
EcalUncalibRecHitRecWeightsAlgo< EEDataFrame > uncalibMaker_endcap_
Definition: EcalUncalibRecHitWorkerWeights.h:65
EcalUncalibRecHitWorkerWeights::testbeamEEShape
EEShape testbeamEEShape
Definition: EcalUncalibRecHitWorkerWeights.h:67
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::peds_
edm::ESHandle< EcalPedestals > peds_
Definition: EcalUncalibRecHitWorkerWeights.h:52
EcalUncalibRecHitWorkerWeights::set
void set(const edm::EventSetup &es) override
Definition: EcalUncalibRecHitWorkerWeights.cc:21
MessageLogger.h
EcalUncalibRecHitWorkerWeights
Definition: EcalUncalibRecHitWorkerWeights.h:34
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:113
EcalUncalibRecHitWorkerWeights::tokenPeds_
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > tokenPeds_
Definition: EcalUncalibRecHitWorkerWeights.h:48
EBShape
Definition: EBShape.h:6
EcalUncalibRecHitWorkerWeights::pedVec
double pedVec[3]
Definition: EcalUncalibRecHitWorkerWeights.h:57
EBDetId
Definition: EBDetId.h:17
EcalUncalibRecHitWorkerWeights::gains_
edm::ESHandle< EcalGainRatios > gains_
Definition: EcalUncalibRecHitWorkerWeights.h:53
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::SortedCollection
Definition: SortedCollection.h:49
EcalDataFrame
Definition: EcalDataFrame.h:16
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
EcalXtalGroupId
Definition: EcalXtalGroupId.h:11
EcalTBWeightsRcd
Definition: EcalTBWeightsRcd.h:5
EcalUncalibRecHitWorkerWeights::tokenGains_
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > tokenGains_
Definition: EcalUncalibRecHitWorkerWeights.h:49
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:37
EcalUncalibRecHitWorkerWeights::tokenGrps_
edm::ESGetToken< EcalWeightXtalGroups, EcalWeightXtalGroupsRcd > tokenGrps_
Definition: EcalUncalibRecHitWorkerWeights.h:50
EcalUncalibRecHitWorkerRunOneDigiBase
Definition: EcalUncalibRecHitWorkerRunOneDigiBase.h:10
EcalUncalibRecHitWorkerWeights::wgts_
edm::ESHandle< EcalTBWeights > wgts_
Definition: EcalUncalibRecHitWorkerWeights.h:55
ParameterSetDescription.h
EcalWeightSet::getWeightsAfterGainSwitch
EcalWeightMatrix & getWeightsAfterGainSwitch()
Definition: EcalWeightSet.h:27
EcalUncalibratedRecHit.h
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:59
EEDetId
Definition: EEDetId.h:14
EcalUncalibRecHitWorkerWeights::testbeamEBShape
EBShape testbeamEBShape
Definition: EcalUncalibRecHitWorkerWeights.h:68
EcalGainRatiosRcd
Definition: EcalGainRatiosRcd.h:5
EcalEndcap
Definition: EcalSubdetector.h:10
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:61
EcalTBWeights::EcalTDCId
int EcalTDCId
Definition: EcalTBWeights.h:17
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
EcalCondObjectContainer::Item
T Item
Definition: EcalCondObjectContainer.h:15
edmplugin::PluginFactory
Definition: PluginFactory.h:34
EEDetId::hashedIndex
int hashedIndex() const
Definition: EEDetId.h:183
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
EcalUncalibRecHitWorkerWeights::tokenWgts_
edm::ESGetToken< EcalTBWeights, EcalTBWeightsRcd > tokenWgts_
Definition: EcalUncalibRecHitWorkerWeights.h:51
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:31
EcalMGPAGainRatio::gain6Over1
float gain6Over1() const
Definition: EcalMGPAGainRatio.h:20
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::grps_
edm::ESHandle< EcalWeightXtalGroups > grps_
Definition: EcalUncalibRecHitWorkerWeights.h:54
EcalUncalibRecHitWorkerWeights.h
EcalXtalGroupId::id
unsigned int id() const
Definition: EcalXtalGroupId.h:22
mps_fire.result
result
Definition: mps_fire.py:311
EcalWeightXtalGroupsRcd
Definition: EcalWeightXtalGroupsRcd.h:5
EcalPedestalsRcd
Definition: EcalPedestalsRcd.h:5
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
EcalUncalibratedRecHit::kHasSwitchToGain1
Definition: EcalUncalibratedRecHit.h:19
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
ecalpyutils::hashedIndex
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:38
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
EcalTBWeights
Definition: EcalTBWeights.h:15
EcalMGPAGainRatio
Definition: EcalMGPAGainRatio.h:13
EcalUncalibRecHitWorkerWeights::pedRMSVec
double pedRMSVec[3]
Definition: EcalUncalibRecHitWorkerWeights.h:58