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  * $Date: 2012/03/02 19:47:33 $
6  * $Revision: 1.3 $
7  * \author A. Vilela Pereira
8  */
9 
10 #include "DTVDriftMeanTimer.h"
11 
16 
19 
22 
23 #include <string>
24 #include <vector>
25 
26 #include "TFile.h"
27 #include "TString.h"
28 
29 using namespace std;
30 using namespace edm;
31 
32 namespace dtCalibration {
33 
34 DTVDriftMeanTimer::DTVDriftMeanTimer(const ParameterSet& pset) {
35  string rootFileName = pset.getParameter<string>("rootFileName");
36  rootFile_ = new TFile(rootFileName.c_str(), "READ");
37  fitter_ = new DTMeanTimerFitter(rootFile_);
38  bool debug = pset.getUntrackedParameter<bool>("debug", false);
39  if(debug) fitter_->setVerbosity(1);
40 }
41 
42 DTVDriftMeanTimer::~DTVDriftMeanTimer() {
43  rootFile_->Close();
44  delete fitter_;
45 }
46 
47 void DTVDriftMeanTimer::setES(const edm::EventSetup& setup) {}
48 
50 
51  // Evaluate v_drift and sigma from the TMax histograms
52  DTWireId wireId(slId, 0, 0);
53  TString N = ( ( ( ( (TString)"TMax" + (long)wireId.wheel() )
54  + (long)wireId.station() )
55  + (long)wireId.sector() ) + (long)wireId.superLayer() );
56  vector<float> vDriftAndReso = fitter_->evaluateVDriftAndReso(N);
57 
58  // Don't write the constants for the SL if the vdrift was not computed
59  if(vDriftAndReso.front() == -1)
60  throw cms::Exception("DTCalibration") << "Could not compute valid vDrift value for SL " << slId << endl;
61 
62  return DTVDriftData(vDriftAndReso[0],vDriftAndReso[1]);
63 }
64 
65 } // namespace
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int superLayer() const
Return the superlayer number.
#define N
Definition: blowfish.cc:9
int sector() const
Definition: DTChamberId.h:63
int station() const
Return the station number.
Definition: DTChamberId.h:53
#define debug
Definition: MEtoEDMFormat.h:34
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")