CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
dtCalibration::DTTTrigFillWithAverage Class Reference

#include <DTTTrigFillWithAverage.h>

Inheritance diagram for dtCalibration::DTTTrigFillWithAverage:
dtCalibration::DTTTrigBaseCorrection

Public Member Functions

DTTTrigData correction (const DTSuperLayerId &) override
 
 DTTTrigFillWithAverage (const edm::ParameterSet &, edm::ConsumesCollector)
 
void setES (const edm::EventSetup &setup) override
 
 ~DTTTrigFillWithAverage () override
 
- Public Member Functions inherited from dtCalibration::DTTTrigBaseCorrection
 DTTTrigBaseCorrection ()
 
virtual ~DTTTrigBaseCorrection ()
 

Private Member Functions

void getAverage ()
 

Private Attributes

edm::ESGetToken< DTGeometry,
MuonGeometryRecord
dtGeomToken_
 
bool foundAverage_
 
struct {
   float   aveKFactor
 
   float   aveMean
 
   float   aveSigma
 
   float   rmsMean
 
   float   rmsSigma
 
initialTTrig_
 
edm::ESHandle< DTGeometrymuonGeom_
 
const DTTtrigtTrigMap_
 
edm::ESGetToken< DTTtrig,
DTTtrigRcd
ttrigToken_
 

Detailed Description

Definition at line 26 of file DTTTrigFillWithAverage.h.

Constructor & Destructor Documentation

DTTTrigFillWithAverage::DTTTrigFillWithAverage ( const edm::ParameterSet pset,
edm::ConsumesCollector  cc 
)
DTTTrigFillWithAverage::~DTTTrigFillWithAverage ( )
override

Definition at line 28 of file DTTTrigFillWithAverage.cc.

28 {}

Member Function Documentation

DTTTrigData DTTTrigFillWithAverage::correction ( const DTSuperLayerId slId)
overridevirtual

Implements dtCalibration::DTTTrigBaseCorrection.

Definition at line 40 of file DTTTrigFillWithAverage.cc.

References foundAverage_, DTTtrig::get(), getAverage(), initialTTrig_, DTTimeUnits::ns, mps_update::status, and tTrigMap_.

40  {
41  float tTrigMean, tTrigSigma, kFactor;
42  int status = tTrigMap_->get(slId, tTrigMean, tTrigSigma, kFactor, DTTimeUnits::ns);
43  if (!status) {
44  return DTTTrigData(tTrigMean, tTrigSigma, kFactor);
45  } else {
46  if (!foundAverage_)
47  getAverage();
48  float corrMean = initialTTrig_.aveMean;
49  float corrSigma = initialTTrig_.aveSigma;
50  float corrKFactor = initialTTrig_.aveKFactor;
51  return DTTTrigData(corrMean, corrSigma, corrKFactor); //FIXME: kFactor is not anymore a unique one
52  }
53  }
list status
Definition: mps_update.py:107
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
struct dtCalibration::DTTTrigFillWithAverage::@63 initialTTrig_
void DTTTrigFillWithAverage::getAverage ( )
private

Definition at line 55 of file DTTTrigFillWithAverage.cc.

References aveKFactor, aveMean, aveSigma, foundAverage_, DTTtrig::get(), initialTTrig_, muonGeom_, DTTimeUnits::ns, rmsMean, rmsSigma, mathSSE::sqrt(), mps_update::status, and tTrigMap_.

Referenced by correction().

55  {
56  //Get the superlayers list
57  vector<const DTSuperLayer*> dtSupLylist = muonGeom_->superLayers();
58 
59  float aveMean = 0.;
60  float ave2Mean = 0.;
61  float aveSigma = 0.;
62  float ave2Sigma = 0.;
63  float aveKFactor = 0.;
64  int nIter = 0;
65 
66  for (auto sl = muonGeom_->superLayers().begin(); sl != muonGeom_->superLayers().end(); ++sl) {
67  float tTrigMean, tTrigSigma, kFactor;
68  int status = tTrigMap_->get((*sl)->id(), tTrigMean, tTrigSigma, kFactor, DTTimeUnits::ns);
69  if (!status) {
70  ++nIter;
71  aveMean += tTrigMean;
72  ave2Mean += tTrigMean * tTrigMean;
73  aveSigma += tTrigSigma;
74  ave2Sigma += tTrigSigma * tTrigSigma;
75  aveKFactor += kFactor;
76  }
77  }
78 
79  // Compute average
80  aveMean /= nIter;
81  float rmsMean = ave2Mean / (nIter - 1) - aveMean * aveMean;
82  rmsMean = sqrt(rmsMean);
83  aveSigma /= nIter;
84  float rmsSigma = ave2Sigma / (nIter - 1) - aveSigma * aveSigma;
85  rmsSigma = sqrt(rmsSigma);
86  aveKFactor /= nIter;
87 
88  initialTTrig_.aveMean = aveMean;
89  initialTTrig_.rmsMean = rmsMean;
90  initialTTrig_.aveSigma = aveSigma;
91  initialTTrig_.rmsSigma = rmsSigma;
92  initialTTrig_.aveKFactor = aveKFactor;
93 
94  LogVerbatim("Calibration") << "[DTTTrigFillWithAverage] Found from " << nIter << " SL's\n"
95  << " average tTrig mean: " << aveMean << "\n"
96  << " tTrig mean RMS: " << rmsMean << "\n"
97  << " average tTrig sigma: " << aveSigma << "\n"
98  << " tTrig sigma RMS: " << rmsSigma << "\n"
99  << " kFactor mean: " << aveKFactor;
100  foundAverage_ = true;
101  }
Log< level::Info, true > LogVerbatim
list status
Definition: mps_update.py:107
T sqrt(T t)
Definition: SSEVec.h:19
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
struct dtCalibration::DTTTrigFillWithAverage::@63 initialTTrig_
void DTTTrigFillWithAverage::setES ( const edm::EventSetup setup)
overridevirtual

Implements dtCalibration::DTTTrigBaseCorrection.

Definition at line 30 of file DTTTrigFillWithAverage.cc.

References dtGeomToken_, edm::EventSetup::getHandle(), muonGeom_, tTrigMap_, and ttrigToken_.

30  {
31  // Get tTrig record from DB
32  ESHandle<DTTtrig> tTrig;
33  tTrig = setup.getHandle(ttrigToken_);
34  tTrigMap_ = &*tTrig;
35 
36  // Get geometry from Event Setup
38  }
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
edm::ESGetToken< DTTtrig, DTTtrigRcd > ttrigToken_

Member Data Documentation

float dtCalibration::DTTTrigFillWithAverage::aveKFactor

Definition at line 51 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

float dtCalibration::DTTTrigFillWithAverage::aveMean

Definition at line 47 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

float dtCalibration::DTTTrigFillWithAverage::aveSigma

Definition at line 49 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtCalibration::DTTTrigFillWithAverage::dtGeomToken_
private

Definition at line 44 of file DTTTrigFillWithAverage.h.

Referenced by DTTTrigFillWithAverage(), and setES().

bool dtCalibration::DTTTrigFillWithAverage::foundAverage_
private

Definition at line 54 of file DTTTrigFillWithAverage.h.

Referenced by correction(), and getAverage().

struct { ... } dtCalibration::DTTTrigFillWithAverage::initialTTrig_

Referenced by correction(), and getAverage().

edm::ESHandle<DTGeometry> dtCalibration::DTTTrigFillWithAverage::muonGeom_
private

Definition at line 41 of file DTTTrigFillWithAverage.h.

Referenced by getAverage(), and setES().

float dtCalibration::DTTTrigFillWithAverage::rmsMean

Definition at line 48 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

float dtCalibration::DTTTrigFillWithAverage::rmsSigma

Definition at line 50 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

const DTTtrig* dtCalibration::DTTTrigFillWithAverage::tTrigMap_
private

Definition at line 40 of file DTTTrigFillWithAverage.h.

Referenced by correction(), getAverage(), and setES().

edm::ESGetToken<DTTtrig, DTTtrigRcd> dtCalibration::DTTTrigFillWithAverage::ttrigToken_
private

Definition at line 43 of file DTTTrigFillWithAverage.h.

Referenced by DTTTrigFillWithAverage(), and setES().