CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalUncalibRecHitWorkerFixedAlphaBetaFit Class Reference

#include <EcalUncalibRecHitWorkerFixedAlphaBetaFit.h>

Inheritance diagram for EcalUncalibRecHitWorkerFixedAlphaBetaFit:
EcalUncalibRecHitWorkerRunOneDigiBase EcalUncalibRecHitWorkerBaseClass

Public Member Functions

 EcalUncalibRecHitWorkerFixedAlphaBetaFit ()
 
 EcalUncalibRecHitWorkerFixedAlphaBetaFit (const edm::ParameterSet &ps, edm::ConsumesCollector &)
 
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
 
 ~EcalUncalibRecHitWorkerFixedAlphaBetaFit () override
 
- Public Member Functions inherited from EcalUncalibRecHitWorkerRunOneDigiBase
 EcalUncalibRecHitWorkerRunOneDigiBase ()
 
 EcalUncalibRecHitWorkerRunOneDigiBase (const edm::ParameterSet &p)
 
 EcalUncalibRecHitWorkerRunOneDigiBase (const edm::ParameterSet &p, edm::ConsumesCollector &c)
 
void run (const edm::Event &evt, const EcalDigiCollection &digis, EcalUncalibratedRecHitCollection &result) override
 
 ~EcalUncalibRecHitWorkerRunOneDigiBase () override
 
- Public Member Functions inherited from EcalUncalibRecHitWorkerBaseClass
 EcalUncalibRecHitWorkerBaseClass ()
 
 EcalUncalibRecHitWorkerBaseClass (const edm::ParameterSet &)
 
 EcalUncalibRecHitWorkerBaseClass (const edm::ParameterSet &, edm::ConsumesCollector &c)
 
virtual void set (const edm::Event &evt)
 
virtual ~EcalUncalibRecHitWorkerBaseClass ()
 

Private Member Functions

bool setAlphaBeta ()
 

Private Attributes

EcalUncalibRecHitFixedAlphaBetaAlgo< EBDataFramealgoEB_
 
EcalUncalibRecHitFixedAlphaBetaAlgo< EEDataFramealgoEE_
 
std::string alphabetaFilename_
 
std::vector< std::vector< std::pair< double, double > > > alphaBetaValues_
 
double alphaEB_
 
double alphaEE_
 
double AmplThrEB_
 
double AmplThrEE_
 
double betaEB_
 
double betaEE_
 
edm::ESHandle< EcalPedestalspedHandle
 
edm::ESHandle< EcalGainRatiospRatio
 
bool useAlphaBetaArray_
 

Detailed Description

Definition at line 23 of file EcalUncalibRecHitWorkerFixedAlphaBetaFit.h.

Constructor & Destructor Documentation

◆ EcalUncalibRecHitWorkerFixedAlphaBetaFit() [1/2]

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

Definition at line 34 of file EcalUncalibRecHitWorkerFixedAlphaBetaFit.cc.

37  alphaEB_ = ps.getParameter<double>("alphaEB");
38  betaEB_ = ps.getParameter<double>("betaEB");
39  alphaEE_ = ps.getParameter<double>("alphaEE");
40  betaEE_ = ps.getParameter<double>("betaEE");
41 
42  alphabetaFilename_ = ps.getUntrackedParameter<std::string>("AlphaBetaFilename");
43  useAlphaBetaArray_ = setAlphaBeta(); // set crystalwise values of alpha and beta
44  if (!useAlphaBetaArray_) {
45  edm::LogInfo("EcalUncalibRecHitError") << " No alfa-beta file found. Using the deafult values.";
46  }
47 
48  algoEB_.SetMinAmpl(ps.getParameter<double>("MinAmplBarrel"));
49  algoEE_.SetMinAmpl(ps.getParameter<double>("MinAmplEndcap"));
50 
51  bool dyn_pede = ps.getParameter<bool>("UseDynamicPedestal");
52  algoEB_.SetDynamicPedestal(dyn_pede);
53  algoEE_.SetDynamicPedestal(dyn_pede);
54 }

References algoEB_, algoEE_, alphabetaFilename_, alphaEB_, alphaEE_, betaEB_, betaEE_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), setAlphaBeta(), EcalUncalibRecHitFixedAlphaBetaAlgo< C >::SetDynamicPedestal(), EcalUncalibRecHitFixedAlphaBetaAlgo< C >::SetMinAmpl(), AlCaHLTBitMon_QueryRunRegistry::string, and useAlphaBetaArray_.

◆ EcalUncalibRecHitWorkerFixedAlphaBetaFit() [2/2]

EcalUncalibRecHitWorkerFixedAlphaBetaFit::EcalUncalibRecHitWorkerFixedAlphaBetaFit ( )
inline

Definition at line 26 of file EcalUncalibRecHitWorkerFixedAlphaBetaFit.h.

26 {};

◆ ~EcalUncalibRecHitWorkerFixedAlphaBetaFit()

EcalUncalibRecHitWorkerFixedAlphaBetaFit::~EcalUncalibRecHitWorkerFixedAlphaBetaFit ( )
inlineoverride

Definition at line 27 of file EcalUncalibRecHitWorkerFixedAlphaBetaFit.h.

27 {};

Member Function Documentation

◆ getAlgoDescription()

edm::ParameterSetDescription EcalUncalibRecHitWorkerFixedAlphaBetaFit::getAlgoDescription ( )
overridevirtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 182 of file EcalUncalibRecHitWorkerFixedAlphaBetaFit.cc.

182  {
184 
185  psd.addNode(edm::ParameterDescription<double>("alphaEB", 1.138, true) and
186  edm::ParameterDescription<double>("alphaEE", 1.89, true) and
187  edm::ParameterDescription<std::string>("AlphaBetaFilename", "NOFILE", false) and
188  edm::ParameterDescription<double>("betaEB", 1.655, true) and
189  edm::ParameterDescription<double>("MinAmplEndcap", 14.0, true) and
190  edm::ParameterDescription<double>("MinAmplBarrel", 8.0, true) and
191  edm::ParameterDescription<double>("betaEE", 1.4, true) and
192  edm::ParameterDescription<bool>("UseDynamicPedestal", true, true));
193 
194  return psd;
195 }

References edm::ParameterSetDescription::addNode().

◆ run()

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

Implements EcalUncalibRecHitWorkerRunOneDigiBase.

Definition at line 99 of file EcalUncalibRecHitWorkerFixedAlphaBetaFit.cc.

101  {
102  const EcalGainRatioMap& gainMap = pRatio.product()->getMap(); // map of gain ratios
103  EcalGainRatioMap::const_iterator gainIter; // gain iterator
104  EcalMGPAGainRatio aGain; // gain object for a single xtal
105 
106  const EcalPedestalsMap& pedMap = pedHandle.product()->getMap(); // map of pedestals
107  EcalPedestalsMapIterator pedIter; // pedestal iterator
108  EcalPedestals::Item aped; // pedestal object for a single xtal
109 
110  DetId detid(itdg->id());
111 
112  // find pedestals for this channel
113  //LogDebug("EcalUncalibRecHitDebug") << "looking up pedestal for crystal: " << itdg->id();
114  pedIter = pedMap.find(itdg->id());
115  if (pedIter != pedMap.end()) {
116  aped = (*pedIter);
117  } else {
118  edm::LogError("EcalUncalibRecHitWorkerFixedAlphaBetaFit") << "error!! could not find pedestals for channel: ";
119  if (detid.subdetId() == EcalBarrel) {
120  edm::LogError("EcalUncalibRecHitWorkerFixedAlphaBetaFit") << EBDetId(detid);
121  } else {
122  edm::LogError("EcalUncalibRecHitWorkerFixedAlphaBetaFit") << EEDetId(detid);
123  }
124  edm::LogError("EcalUncalibRecHitWorkerFixedAlphaBetaFit") << "\n no uncalib rechit will be made for this digi!";
125  return false;
126  }
127  double pedVec[3];
128  pedVec[0] = aped.mean_x12;
129  pedVec[1] = aped.mean_x6;
130  pedVec[2] = aped.mean_x1;
131 
132  // find gain ratios
133  //LogDebug("EcalUncalibRecHitDebug") << "looking up gainRatios for crystal: " << EBDetId(itdg->id()) ; // FIXME!!!!!!!!
134  gainIter = gainMap.find(itdg->id());
135  if (gainIter != gainMap.end()) {
136  aGain = (*gainIter);
137  } else {
138  edm::LogError("EcalUncalibRecHitWorkerFixedAlphaBetaFit") << "error!! could not find gain ratios for channel: ";
139  if (detid.subdetId() == EcalBarrel) {
140  edm::LogError("EcalUncalibRecHitWorkerFixedAlphaBetaFit") << EBDetId(detid);
141  } else {
142  edm::LogError("EcalUncalibRecHitWorkerFixedAlphaBetaFit") << EEDetId(detid);
143  }
144  edm::LogError("EcalUncalibRecHitWorkerFixedAlphaBetaFit") << "\n no uncalib rechit will be made for this digi!";
145  return false;
146  }
147  double gainRatios[3];
148  gainRatios[0] = 1.;
149  gainRatios[1] = aGain.gain12Over6();
150  gainRatios[2] = aGain.gain6Over1() * aGain.gain12Over6();
151 
152  if (detid.subdetId() == EcalBarrel) {
153  // Define Alpha and Beta either by stored values or by default universal values
154  EBDetId ebDetId(detid);
155  double a, b;
156  if (useAlphaBetaArray_) {
157  if (!alphaBetaValues_[ebDetId.ism() - 1].empty()) {
158  a = alphaBetaValues_[ebDetId.ism() - 1][ebDetId.ic() - 1].first;
159  b = alphaBetaValues_[ebDetId.ism() - 1][ebDetId.ic() - 1].second;
160  if ((a == -1) && (b == -1)) {
161  a = alphaEB_;
162  b = betaEB_;
163  }
164  } else {
165  a = alphaEB_;
166  b = betaEB_;
167  }
168  } else {
169  a = alphaEB_;
170  b = betaEB_;
171  }
173  result.push_back(algoEB_.makeRecHit(*itdg, pedVec, gainRatios, nullptr, nullptr));
174  } else {
175  //FIX ME load in a and b from a file
177  result.push_back(algoEE_.makeRecHit(*itdg, pedVec, gainRatios, nullptr, nullptr));
178  }
179  return true;
180 }

References a, algoEB_, algoEE_, alphaBetaValues_, alphaEB_, alphaEE_, b, betaEB_, betaEE_, EcalBarrel, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), EBDetId::ic(), EBDetId::ism(), EcalUncalibRecHitFixedAlphaBetaAlgo< C >::makeRecHit(), EcalPedestal::mean_x1, EcalPedestal::mean_x12, EcalPedestal::mean_x6, pedHandle, pRatio, mps_fire::result, EcalUncalibRecHitFixedAlphaBetaAlgo< C >::SetAlphaBeta(), and useAlphaBetaArray_.

◆ set()

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

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 56 of file EcalUncalibRecHitWorkerFixedAlphaBetaFit.cc.

56  {
57  // Gain Ratios
58  LogDebug("EcalUncalibRecHitDebug") << "fetching gainRatios....";
60  LogDebug("EcalUncalibRecHitDebug") << "done.";
61 
62  // fetch the pedestals from the cond DB via EventSetup
63  LogDebug("EcalUncalibRecHitDebug") << "fetching pedestals....";
65  LogDebug("EcalUncalibRecHitDebug") << "done.";
66 }

References edm::EventSetup::get(), get, LogDebug, pedHandle, and pRatio.

◆ setAlphaBeta()

bool EcalUncalibRecHitWorkerFixedAlphaBetaFit::setAlphaBeta ( )
private

Definition at line 69 of file EcalUncalibRecHitWorkerFixedAlphaBetaFit.cc.

69  {
70  std::ifstream file(alphabetaFilename_.c_str());
71  if (!file.is_open())
72  return false;
73 
74  alphaBetaValues_.resize(36);
75 
76  char buffer[100];
77  int sm, cry, ret;
78  float a, b;
79  std::pair<double, double> p(-1, -1);
80 
81  while (!file.getline(buffer, 100).eof()) {
82  ret = sscanf(buffer, "%d %d %f %f", &sm, &cry, &a, &b);
83  if ((ret != 4) || (sm <= 0) || (sm > 36) || (cry <= 0) || (cry > 1700)) {
84  // send warning
85  continue;
86  }
87 
88  if (alphaBetaValues_[sm - 1].empty()) {
89  alphaBetaValues_[sm - 1].resize(1700, p);
90  }
91  alphaBetaValues_[sm - 1][cry - 1].first = a;
92  alphaBetaValues_[sm - 1][cry - 1].second = b;
93  }
94 
95  file.close();
96  return true;
97 }

References a, alphabetaFilename_, alphaBetaValues_, b, edmScanValgrind::buffer, relativeConstraints::empty, FrontierConditions_GlobalTag_cff::file, AlCaHLTBitMon_ParallelJobs::p, and runTheMatrix::ret.

Referenced by EcalUncalibRecHitWorkerFixedAlphaBetaFit().

Member Data Documentation

◆ algoEB_

EcalUncalibRecHitFixedAlphaBetaAlgo<EBDataFrame> EcalUncalibRecHitWorkerFixedAlphaBetaFit::algoEB_
private

◆ algoEE_

EcalUncalibRecHitFixedAlphaBetaAlgo<EEDataFrame> EcalUncalibRecHitWorkerFixedAlphaBetaFit::algoEE_
private

◆ alphabetaFilename_

std::string EcalUncalibRecHitWorkerFixedAlphaBetaFit::alphabetaFilename_
private

◆ alphaBetaValues_

std::vector<std::vector<std::pair<double, double> > > EcalUncalibRecHitWorkerFixedAlphaBetaFit::alphaBetaValues_
private

Definition at line 48 of file EcalUncalibRecHitWorkerFixedAlphaBetaFit.h.

Referenced by run(), and setAlphaBeta().

◆ alphaEB_

double EcalUncalibRecHitWorkerFixedAlphaBetaFit::alphaEB_
private

◆ alphaEE_

double EcalUncalibRecHitWorkerFixedAlphaBetaFit::alphaEE_
private

◆ AmplThrEB_

double EcalUncalibRecHitWorkerFixedAlphaBetaFit::AmplThrEB_
private

Definition at line 37 of file EcalUncalibRecHitWorkerFixedAlphaBetaFit.h.

◆ AmplThrEE_

double EcalUncalibRecHitWorkerFixedAlphaBetaFit::AmplThrEE_
private

Definition at line 38 of file EcalUncalibRecHitWorkerFixedAlphaBetaFit.h.

◆ betaEB_

double EcalUncalibRecHitWorkerFixedAlphaBetaFit::betaEB_
private

◆ betaEE_

double EcalUncalibRecHitWorkerFixedAlphaBetaFit::betaEE_
private

◆ pedHandle

edm::ESHandle<EcalPedestals> EcalUncalibRecHitWorkerFixedAlphaBetaFit::pedHandle
private

Definition at line 55 of file EcalUncalibRecHitWorkerFixedAlphaBetaFit.h.

Referenced by run(), and set().

◆ pRatio

edm::ESHandle<EcalGainRatios> EcalUncalibRecHitWorkerFixedAlphaBetaFit::pRatio
private

Definition at line 54 of file EcalUncalibRecHitWorkerFixedAlphaBetaFit.h.

Referenced by run(), and set().

◆ useAlphaBetaArray_

bool EcalUncalibRecHitWorkerFixedAlphaBetaFit::useAlphaBetaArray_
private
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
EcalCondObjectContainer::end
const_iterator end() const
Definition: EcalCondObjectContainer.h:76
EcalUncalibRecHitFixedAlphaBetaAlgo::SetDynamicPedestal
void SetDynamicPedestal(bool dyn_pede)
Definition: EcalUncalibRecHitFixedAlphaBetaAlgo.h:415
EcalPedestal::mean_x6
float mean_x6
Definition: EcalPedestals.h:21
EBDetId
Definition: EBDetId.h:17
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::LogInfo
Definition: MessageLogger.h:254
EcalUncalibRecHitWorkerFixedAlphaBetaFit::algoEB_
EcalUncalibRecHitFixedAlphaBetaAlgo< EBDataFrame > algoEB_
Definition: EcalUncalibRecHitWorkerFixedAlphaBetaFit.h:40
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EcalUncalibRecHitWorkerFixedAlphaBetaFit::alphaEB_
double alphaEB_
Definition: EcalUncalibRecHitWorkerFixedAlphaBetaFit.h:43
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EcalUncalibRecHitWorkerFixedAlphaBetaFit::betaEB_
double betaEB_
Definition: EcalUncalibRecHitWorkerFixedAlphaBetaFit.h:44
EcalCondObjectContainer< EcalMGPAGainRatio >
EcalBarrel
Definition: EcalSubdetector.h:10
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
EcalPedestal::mean_x1
float mean_x1
Definition: EcalPedestals.h:23
DetId
Definition: DetId.h:17
EcalUncalibRecHitFixedAlphaBetaAlgo::SetMinAmpl
void SetMinAmpl(double ampl)
Definition: EcalUncalibRecHitFixedAlphaBetaAlgo.h:411
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
EcalPedestal::mean_x12
float mean_x12
Definition: EcalPedestals.h:19
EcalUncalibRecHitFixedAlphaBetaAlgo::makeRecHit
EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalWeightSet::EcalChi2WeightMatrix **chi2Matrix) override
Compute parameters.
Definition: EcalUncalibRecHitFixedAlphaBetaAlgo.h:118
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
EcalUncalibRecHitWorkerFixedAlphaBetaFit::alphaEE_
double alphaEE_
Definition: EcalUncalibRecHitWorkerFixedAlphaBetaFit.h:45
EcalUncalibRecHitWorkerFixedAlphaBetaFit::pedHandle
edm::ESHandle< EcalPedestals > pedHandle
Definition: EcalUncalibRecHitWorkerFixedAlphaBetaFit.h:55
b
double b
Definition: hdecay.h:118
EcalMGPAGainRatio::gain12Over6
float gain12Over6() const
Definition: EcalMGPAGainRatio.h:19
EEDetId
Definition: EEDetId.h:14
EcalGainRatiosRcd
Definition: EcalGainRatiosRcd.h:5
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalUncalibRecHitWorkerFixedAlphaBetaFit::alphaBetaValues_
std::vector< std::vector< std::pair< double, double > > > alphaBetaValues_
Definition: EcalUncalibRecHitWorkerFixedAlphaBetaFit.h:48
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::LogError
Definition: MessageLogger.h:183
a
double a
Definition: hdecay.h:119
EcalPedestalsMapIterator
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
Definition: EcalPedestals.h:49
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
EcalUncalibRecHitWorkerFixedAlphaBetaFit::useAlphaBetaArray_
bool useAlphaBetaArray_
Definition: EcalUncalibRecHitWorkerFixedAlphaBetaFit.h:49
EcalUncalibRecHitWorkerFixedAlphaBetaFit::pRatio
edm::ESHandle< EcalGainRatios > pRatio
Definition: EcalUncalibRecHitWorkerFixedAlphaBetaFit.h:54
EcalUncalibRecHitWorkerRunOneDigiBase::EcalUncalibRecHitWorkerRunOneDigiBase
EcalUncalibRecHitWorkerRunOneDigiBase()
Definition: EcalUncalibRecHitWorkerRunOneDigiBase.h:15
edm::ParameterSetDescription::addNode
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
Definition: ParameterSetDescription.cc:41
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
EcalUncalibRecHitWorkerFixedAlphaBetaFit::betaEE_
double betaEE_
Definition: EcalUncalibRecHitWorkerFixedAlphaBetaFit.h:46
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
EcalMGPAGainRatio::gain6Over1
float gain6Over1() const
Definition: EcalMGPAGainRatio.h:20
EcalPedestal
Definition: EcalPedestals.h:8
EcalUncalibRecHitWorkerFixedAlphaBetaFit::algoEE_
EcalUncalibRecHitFixedAlphaBetaAlgo< EEDataFrame > algoEE_
Definition: EcalUncalibRecHitWorkerFixedAlphaBetaFit.h:41
EcalCondObjectContainer< EcalMGPAGainRatio >::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
mps_fire.result
result
Definition: mps_fire.py:303
EcalPedestalsRcd
Definition: EcalPedestalsRcd.h:5
EcalUncalibRecHitFixedAlphaBetaAlgo::SetAlphaBeta
void SetAlphaBeta(double alpha, double beta)
Definition: EcalUncalibRecHitFixedAlphaBetaAlgo.h:404
EcalUncalibRecHitWorkerFixedAlphaBetaFit::alphabetaFilename_
std::string alphabetaFilename_
Definition: EcalUncalibRecHitWorkerFixedAlphaBetaFit.h:50
edm::ParameterDescription
Definition: ParameterDescription.h:110
EcalMGPAGainRatio
Definition: EcalMGPAGainRatio.h:13
EcalUncalibRecHitWorkerFixedAlphaBetaFit::setAlphaBeta
bool setAlphaBeta()
Definition: EcalUncalibRecHitWorkerFixedAlphaBetaFit.cc:69