File indexing completed on 2024-04-06 11:58:28
0001
0002
0003
0004
0005
0006
0007
0008 #include "DTVDriftMeanTimer.h"
0009
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 #include "FWCore/Framework/interface/ESHandle.h"
0012 #include "FWCore/Framework/interface/EventSetup.h"
0013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0014
0015 #include "Geometry/DTGeometry/interface/DTGeometry.h"
0016 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0017
0018 #include "CalibMuon/DTCalibration/interface/DTMeanTimerFitter.h"
0019 #include "CalibMuon/DTCalibration/interface/DTCalibDBUtils.h"
0020
0021 #include <string>
0022 #include <vector>
0023
0024 #include "TFile.h"
0025 #include "TString.h"
0026
0027 using namespace std;
0028 using namespace edm;
0029
0030 namespace dtCalibration {
0031
0032 DTVDriftMeanTimer::DTVDriftMeanTimer(const ParameterSet& pset, edm::ConsumesCollector cc) {
0033 string rootFileName = pset.getParameter<string>("rootFileName");
0034 rootFile_ = new TFile(rootFileName.c_str(), "READ");
0035 fitter_ = new DTMeanTimerFitter(rootFile_);
0036 bool debug = pset.getUntrackedParameter<bool>("debug", false);
0037 if (debug)
0038 fitter_->setVerbosity(1);
0039 }
0040
0041 DTVDriftMeanTimer::~DTVDriftMeanTimer() {
0042 rootFile_->Close();
0043 delete fitter_;
0044 }
0045
0046 void DTVDriftMeanTimer::setES(const edm::EventSetup& setup) {}
0047
0048 DTVDriftData DTVDriftMeanTimer::compute(DTSuperLayerId const& slId) {
0049
0050 DTWireId wireId(slId, 0, 0);
0051 TString N = (((((TString) "TMax" + (long)wireId.wheel()) + (long)wireId.station()) + (long)wireId.sector()) +
0052 (long)wireId.superLayer());
0053 vector<float> vDriftAndReso = fitter_->evaluateVDriftAndReso(N);
0054
0055
0056 if (vDriftAndReso.front() == -1)
0057 throw cms::Exception("DTCalibration") << "Could not compute valid vDrift value for SL " << slId << endl;
0058
0059 return DTVDriftData(vDriftAndReso[0], vDriftAndReso[1]);
0060 }
0061
0062 }