CMS 3D CMS Logo

DTVDriftMeanTimer.cc
Go to the documentation of this file.
1 
2 /*
3  * See header file for a description of this class.
4  *
5  * \author A. Vilela Pereira
6  */
7 
8 #include "DTVDriftMeanTimer.h"
9 
14 
17 
20 
21 #include <string>
22 #include <vector>
23 
24 #include "TFile.h"
25 #include "TString.h"
26 
27 using namespace std;
28 using namespace edm;
29 
30 namespace dtCalibration {
31 
32  DTVDriftMeanTimer::DTVDriftMeanTimer(const ParameterSet& pset) {
33  string rootFileName = pset.getParameter<string>("rootFileName");
34  rootFile_ = new TFile(rootFileName.c_str(), "READ");
35  fitter_ = new DTMeanTimerFitter(rootFile_);
36  bool debug = pset.getUntrackedParameter<bool>("debug", false);
37  if (debug)
38  fitter_->setVerbosity(1);
39  }
40 
41  DTVDriftMeanTimer::~DTVDriftMeanTimer() {
42  rootFile_->Close();
43  delete fitter_;
44  }
45 
46  void DTVDriftMeanTimer::setES(const edm::EventSetup& setup) {}
47 
49  // Evaluate v_drift and sigma from the TMax histograms
50  DTWireId wireId(slId, 0, 0);
51  TString N = (((((TString) "TMax" + (long)wireId.wheel()) + (long)wireId.station()) + (long)wireId.sector()) +
52  (long)wireId.superLayer());
53  vector<float> vDriftAndReso = fitter_->evaluateVDriftAndReso(N);
54 
55  // Don't write the constants for the SL if the vdrift was not computed
56  if (vDriftAndReso.front() == -1)
57  throw cms::Exception("DTCalibration") << "Could not compute valid vDrift value for SL " << slId << endl;
58 
59  return DTVDriftData(vDriftAndReso[0], vDriftAndReso[1]);
60  }
61 
62 } // namespace dtCalibration
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int superLayer() const
Return the superlayer number.
#define debug
Definition: HDRShower.cc:19
#define N
Definition: blowfish.cc:9
def compute(min, max)
HLT enums.
int sector() const
Definition: DTChamberId.h:49
int station() const
Return the station number.
Definition: DTChamberId.h:42
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39