test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalUncalibRecHitWorkerWeights.cc
Go to the documentation of this file.
2 
6 
11 
14 
17 {
18 }
19 
20 void
22 {
23  es.get<EcalGainRatiosRcd>().get(gains);
24  es.get<EcalPedestalsRcd>().get(peds);
25  es.get<EcalWeightXtalGroupsRcd>().get(grps);
26  es.get<EcalTBWeightsRcd>().get(wgts);
27 }
28 
29 
30 bool
34 {
35  DetId detid(itdg->id());
36 
37  const EcalPedestals::Item * aped = 0;
38  const EcalMGPAGainRatio * aGain = 0;
39  const EcalXtalGroupId * gid = 0;
40  EcalTBWeights::EcalTDCId tdcid(1);
41 
42  if (detid.subdetId()==EcalEndcap) {
43  unsigned int hashedIndex = EEDetId(detid).hashedIndex();
44  aped = &peds->endcap(hashedIndex);
45  aGain = &gains->endcap(hashedIndex);
46  gid = &grps->endcap(hashedIndex);
47  } else {
48  unsigned int hashedIndex = EBDetId(detid).hashedIndex();
49  aped = &peds->barrel(hashedIndex);
50  aGain = &gains->barrel(hashedIndex);
51  gid = &grps->barrel(hashedIndex);
52  }
53 
54  pedVec[0] = aped->mean_x12;
55  pedVec[1] = aped->mean_x6;
56  pedVec[2] = aped->mean_x1;
57  pedRMSVec[0] = aped->rms_x12;
58  pedRMSVec[1] = aped->rms_x6;
59  pedRMSVec[2] = aped->rms_x1;
60  gainRatios[0] = 1.;
61  gainRatios[1] = aGain->gain12Over6();
62  gainRatios[2] = aGain->gain6Over1()*aGain->gain12Over6();
63 
64  // now lookup the correct weights in the map
65  EcalTBWeights::EcalTBWeightMap const & wgtsMap = wgts->getMap();
66  EcalTBWeights::EcalTBWeightMap::const_iterator wit;
67  wit = wgtsMap.find( std::make_pair(*gid,tdcid) );
68  if( wit == wgtsMap.end() ) {
69  edm::LogError("EcalUncalibRecHitError") << "No weights found for EcalGroupId: "
70  << gid->id() << " and EcalTDCId: " << tdcid
71  << "\n skipping digi with id: " << detid.rawId();
72 
73  return false;
74  }
75  const EcalWeightSet& wset = wit->second; // this is the EcalWeightSet
76 
79 // const EcalWeightSet::EcalChi2WeightMatrix& mat3 = wset.getChi2WeightsBeforeGainSwitch();
80 // const EcalWeightSet::EcalChi2WeightMatrix& mat4 = wset.getChi2WeightsAfterGainSwitch();
81 
82  weights[0] = &mat1;
83  weights[1] = &mat2;
84 
85 // chi2mat[0] = &mat3;
86 // chi2mat[1] = &mat4;
87 /*
88  if (detid.subdetId()==EcalEndcap) {
89  result.push_back(uncalibMaker_endcap_.makeRecHit(*itdg, pedVec, gainRatios, weights, chi2mat));
90  } else {
91  result.push_back(uncalibMaker_barrel_.makeRecHit(*itdg, pedVec, gainRatios, weights, chi2mat));
92  }
93 */
94  if (detid.subdetId()==EcalEndcap) {
96  } else {
98  }
99  return true;
100 }
101 
104 
106  return psd;
107 }
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
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
edm::ParameterSetDescription getAlgoDescription()
edm::ESHandle< EcalGainRatios > gains
EcalUncalibRecHitRecWeightsAlgo< EEDataFrame > uncalibMaker_endcap_
void push_back(T const &t)
const EcalWeightSet::EcalWeightMatrix * weights[2]
const unsigned int id() const
tuple result
Definition: mps_fire.py:83
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
bool run(const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result)
edm::ESHandle< EcalWeightXtalGroups > grps
int hashedIndex() const
Definition: EEDetId.h:182
EcalWeightMatrix & getWeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:29
const T & get() const
Definition: EventSetup.h:56
float gain12Over6() const
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:22
#define DEFINE_EDM_PLUGIN(factory, type, name)
EcalUncalibRecHitRecWeightsAlgo< EBDataFrame > uncalibMaker_barrel_