CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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) fitter_->setVerbosity(1);
38 }
39 
40 DTVDriftMeanTimer::~DTVDriftMeanTimer() {
41  rootFile_->Close();
42  delete fitter_;
43 }
44 
45 void DTVDriftMeanTimer::setES(const edm::EventSetup& setup) {}
46 
48 
49  // Evaluate v_drift and sigma from the TMax histograms
50  DTWireId wireId(slId, 0, 0);
51  TString N = ( ( ( ( (TString)"TMax" + (long)wireId.wheel() )
52  + (long)wireId.station() )
53  + (long)wireId.sector() ) + (long)wireId.superLayer() );
54  vector<float> vDriftAndReso = fitter_->evaluateVDriftAndReso(N);
55 
56  // Don't write the constants for the SL if the vdrift was not computed
57  if(vDriftAndReso.front() == -1)
58  throw cms::Exception("DTCalibration") << "Could not compute valid vDrift value for SL " << slId << endl;
59 
60  return DTVDriftData(vDriftAndReso[0],vDriftAndReso[1]);
61 }
62 
63 } // namespace
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
int sector() const
Definition: DTChamberId.h:61
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")