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
DTSuperLayerId
Definition: DTSuperLayerId.h:12
MessageLogger.h
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
bookConverter.compute
def compute(min, max)
Definition: bookConverter.py:106
DTSuperLayerId::superLayer
int superLayer() const
Return the superlayer number.
Definition: DTSuperLayerId.h:39
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
debug
#define debug
Definition: HDRShower.cc:19
DTWireId
Definition: DTWireId.h:12
N
#define N
Definition: blowfish.cc:9
DTGeometry.h
DTMeanTimerFitter
Definition: DTMeanTimerFitter.h:17
edm::ParameterSet
Definition: ParameterSet.h:47
DTCalibDBUtils.h
edm::EventSetup
Definition: EventSetup.h:57
dtCalibration
Definition: DTT0BaseCorrection.h:16
DTVDriftMeanTimer.h
DTChamberId::sector
int sector() const
Definition: DTChamberId.h:49
std
Definition: JetResolutionObject.h:76
DTWireId.h
EventSetup.h
CSCSkim_cfi.rootFileName
rootFileName
Definition: CSCSkim_cfi.py:9
cms::Exception
Definition: Exception.h:70
ParameterSet.h
dtCalibration::DTVDriftData
Definition: DTVDriftBaseAlgo.h:19
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
DTMeanTimerFitter.h
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27