CMS 3D CMS Logo

DTTTrigFillWithAverage.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author A. Vilela Pereira
5  */
6 
15 
16 using namespace std;
17 using namespace edm;
18 
19 namespace dtCalibration {
20 
21  DTTTrigFillWithAverage::DTTTrigFillWithAverage(const ParameterSet& pset) : foundAverage_(false) {
22  dbLabel = pset.getUntrackedParameter<string>("dbLabel", "");
23  }
24 
26 
28  // Get tTrig record from DB
30  setup.get<DTTtrigRcd>().get(dbLabel, tTrig);
31  tTrigMap_ = &*tTrig;
32 
33  // Get geometry from Event Setup
35  }
36 
38  float tTrigMean, tTrigSigma, kFactor;
39  int status = tTrigMap_->get(slId, tTrigMean, tTrigSigma, kFactor, DTTimeUnits::ns);
40  if (!status) {
41  return DTTTrigData(tTrigMean, tTrigSigma, kFactor);
42  } else {
43  if (!foundAverage_)
44  getAverage();
45  float corrMean = initialTTrig_.aveMean;
46  float corrSigma = initialTTrig_.aveSigma;
47  float corrKFactor = initialTTrig_.aveKFactor;
48  return DTTTrigData(corrMean, corrSigma, corrKFactor); //FIXME: kFactor is not anymore a unique one
49  }
50  }
51 
53  //Get the superlayers list
54  vector<const DTSuperLayer*> dtSupLylist = muonGeom_->superLayers();
55 
56  float aveMean = 0.;
57  float ave2Mean = 0.;
58  float aveSigma = 0.;
59  float ave2Sigma = 0.;
60  float aveKFactor = 0.;
61  int nIter = 0;
62 
63  for (auto sl = muonGeom_->superLayers().begin(); sl != muonGeom_->superLayers().end(); ++sl) {
64  float tTrigMean, tTrigSigma, kFactor;
65  int status = tTrigMap_->get((*sl)->id(), tTrigMean, tTrigSigma, kFactor, DTTimeUnits::ns);
66  if (!status) {
67  ++nIter;
68  aveMean += tTrigMean;
69  ave2Mean += tTrigMean * tTrigMean;
70  aveSigma += tTrigSigma;
71  ave2Sigma += tTrigSigma * tTrigSigma;
73  }
74  }
75 
76  // Compute average
77  aveMean /= nIter;
78  float rmsMean = ave2Mean / (nIter - 1) - aveMean * aveMean;
79  rmsMean = sqrt(rmsMean);
80  aveSigma /= nIter;
81  float rmsSigma = ave2Sigma / (nIter - 1) - aveSigma * aveSigma;
83  aveKFactor /= nIter;
84 
85  initialTTrig_.aveMean = aveMean;
86  initialTTrig_.rmsMean = rmsMean;
87  initialTTrig_.aveSigma = aveSigma;
88  initialTTrig_.rmsSigma = rmsSigma;
89  initialTTrig_.aveKFactor = aveKFactor;
90 
91  LogVerbatim("Calibration") << "[DTTTrigFillWithAverage] Found from " << nIter << " SL's\n"
92  << " average tTrig mean: " << aveMean << "\n"
93  << " tTrig mean RMS: " << rmsMean << "\n"
94  << " average tTrig sigma: " << aveSigma << "\n"
95  << " tTrig sigma RMS: " << rmsSigma << "\n"
96  << " kFactor mean: " << aveKFactor;
97  foundAverage_ = true;
98  }
99 
100 } // namespace dtCalibration
dtCalibration::DTTTrigFillWithAverage::tTrigMap_
const DTTtrig * tTrigMap_
Definition: DTTTrigFillWithAverage.h:37
DTSuperLayerId
Definition: DTSuperLayerId.h:12
dtCalibration::DTTTrigData
Definition: DTTTrigBaseCorrection.h:19
DTTtrigRcd.h
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
dtCalibration::DTTTrigFillWithAverage::rmsMean
float rmsMean
Definition: DTTTrigFillWithAverage.h:44
mps_update.status
status
Definition: mps_update.py:69
DTTtrigRcd
Definition: DTTtrigRcd.h:5
edm
HLT enums.
Definition: AlignableModifier.h:19
dttriganalyzer_cfi.tTrig
tTrig
Definition: dttriganalyzer_cfi.py:11
dtCalibration::DTTTrigFillWithAverage::aveSigma
float aveSigma
Definition: DTTTrigFillWithAverage.h:45
dtCalibration::DTTTrigFillWithAverage::rmsSigma
float rmsSigma
Definition: DTTTrigFillWithAverage.h:46
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
dtCalibration::DTTTrigFillWithAverage::aveMean
float aveMean
Definition: DTTTrigFillWithAverage.h:43
DTTimeUnits::ns
Definition: DTTimeUnits.h:32
edm::ESHandle< DTTtrig >
DTTtrig::get
int get(int wheelId, int stationId, int sectorId, int slId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
get content
Definition: DTTtrig.cc:59
dtCalibration::DTTTrigFillWithAverage::aveKFactor
float aveKFactor
Definition: DTTTrigFillWithAverage.h:47
dtCalibration::DTTTrigFillWithAverage::dbLabel
std::string dbLabel
Definition: DTTTrigFillWithAverage.h:40
DTGeometry.h
dtCalibration::DTTTrigFillWithAverage::initialTTrig_
struct dtCalibration::DTTTrigFillWithAverage::@62 initialTTrig_
edm::ParameterSet
Definition: ParameterSet.h:47
DTGeometry::superLayers
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:86
edm::EventSetup
Definition: EventSetup.h:57
DTTtrig.h
dtCalibration::DTTTrigFillWithAverage::setES
void setES(const edm::EventSetup &setup) override
Definition: DTTTrigFillWithAverage.cc:27
get
#define get
DTTTrigFillWithAverage.h
dtCalibration
Definition: DTT0BaseCorrection.h:16
std
Definition: JetResolutionObject.h:76
dttriganalyzer_cfi.kFactor
kFactor
Definition: dttriganalyzer_cfi.py:7
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
dtCalibration::DTTTrigFillWithAverage::foundAverage_
bool foundAverage_
Definition: DTTTrigFillWithAverage.h:50
dtCalibration::DTTTrigFillWithAverage::correction
DTTTrigData correction(const DTSuperLayerId &) override
Definition: DTTTrigFillWithAverage.cc:37
dtCalibration::DTTTrigFillWithAverage::~DTTTrigFillWithAverage
~DTTTrigFillWithAverage() override
Definition: DTTTrigFillWithAverage.cc:25
ParameterSet.h
DTSuperLayerId.h
MuonGeometryRecord.h
dtCalibration::DTTTrigFillWithAverage::muonGeom_
edm::ESHandle< DTGeometry > muonGeom_
Definition: DTTTrigFillWithAverage.h:38
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
dtCalibration::DTTTrigFillWithAverage::getAverage
void getAverage()
Definition: DTTTrigFillWithAverage.cc:52