CMS 3D CMS Logo

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, MuonGeometryRecorddtGeomToken_
 
bool foundAverage_
 
struct {
   float   aveKFactor
 
   float   aveMean
 
   float   aveSigma
 
   float   rmsMean
 
   float   rmsSigma
 
initialTTrig_
 
edm::ESHandle< DTGeometrymuonGeom_
 
const DTTtrigtTrigMap_
 
edm::ESGetToken< DTTtrig, DTTtrigRcdttrigToken_
 

Detailed Description

Definition at line 26 of file DTTTrigFillWithAverage.h.

Constructor & Destructor Documentation

◆ DTTTrigFillWithAverage()

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

Definition at line 21 of file DTTTrigFillWithAverage.cc.

References edm::BeginRun, gpuPixelDoublets::cc, dtGeomToken_, muonDTDigis_cfi::pset, and ttrigToken_.

22  : foundAverage_(false) {
23  ttrigToken_ =
24  cc.esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", pset.getUntrackedParameter<string>("dbLabel")));
26  }
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
edm::ESGetToken< DTTtrig, DTTtrigRcd > ttrigToken_

◆ ~DTTTrigFillWithAverage()

DTTTrigFillWithAverage::~DTTTrigFillWithAverage ( )
override

Definition at line 28 of file DTTTrigFillWithAverage.cc.

28 {}

Member Function Documentation

◆ correction()

DTTTrigData DTTTrigFillWithAverage::correction ( const DTSuperLayerId slId)
overridevirtual

Implements dtCalibration::DTTTrigBaseCorrection.

Definition at line 40 of file DTTTrigFillWithAverage.cc.

References foundAverage_, DTTtrig::get(), getAverage(), initialTTrig_, dttriganalyzer_cfi::kFactor, 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  }
struct dtCalibration::DTTTrigFillWithAverage::@65 initialTTrig_
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

◆ getAverage()

void DTTTrigFillWithAverage::getAverage ( )
private

Definition at line 55 of file DTTTrigFillWithAverage.cc.

References aveKFactor, aveMean, aveSigma, foundAverage_, DTTtrig::get(), initialTTrig_, dttriganalyzer_cfi::kFactor, muonGeom_, DTTimeUnits::ns, rmsMean, rmsSigma, mathSSE::sqrt(), mps_update::status, DTGeometry::superLayers(), 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;
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;
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
struct dtCalibration::DTTTrigFillWithAverage::@65 initialTTrig_
T sqrt(T t)
Definition: SSEVec.h:23
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
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:86

◆ setES()

void DTTTrigFillWithAverage::setES ( const edm::EventSetup setup)
overridevirtual

Implements dtCalibration::DTTTrigBaseCorrection.

Definition at line 30 of file DTTTrigFillWithAverage.cc.

References dtGeomToken_, muonGeom_, singleTopDQM_cfi::setup, dttriganalyzer_cfi::tTrig, tTrigMap_, and ttrigToken_.

30  {
31  // Get tTrig record from DB
33  tTrig = setup.getHandle(ttrigToken_);
34  tTrigMap_ = &*tTrig;
35 
36  // Get geometry from Event Setup
37  muonGeom_ = setup.getHandle(dtGeomToken_);
38  }
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
edm::ESGetToken< DTTtrig, DTTtrigRcd > ttrigToken_

Member Data Documentation

◆ aveKFactor

float dtCalibration::DTTTrigFillWithAverage::aveKFactor

Definition at line 51 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

◆ aveMean

float dtCalibration::DTTTrigFillWithAverage::aveMean

Definition at line 47 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

◆ aveSigma

float dtCalibration::DTTTrigFillWithAverage::aveSigma

Definition at line 49 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

◆ dtGeomToken_

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

Definition at line 44 of file DTTTrigFillWithAverage.h.

Referenced by DTTTrigFillWithAverage(), and setES().

◆ foundAverage_

bool dtCalibration::DTTTrigFillWithAverage::foundAverage_
private

Definition at line 54 of file DTTTrigFillWithAverage.h.

Referenced by correction(), and getAverage().

◆ initialTTrig_

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

Referenced by correction(), and getAverage().

◆ muonGeom_

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

Definition at line 41 of file DTTTrigFillWithAverage.h.

Referenced by getAverage(), and setES().

◆ rmsMean

float dtCalibration::DTTTrigFillWithAverage::rmsMean

Definition at line 48 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

◆ rmsSigma

float dtCalibration::DTTTrigFillWithAverage::rmsSigma

Definition at line 50 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

◆ tTrigMap_

const DTTtrig* dtCalibration::DTTTrigFillWithAverage::tTrigMap_
private

Definition at line 40 of file DTTTrigFillWithAverage.h.

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

◆ ttrigToken_

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

Definition at line 43 of file DTTTrigFillWithAverage.h.

Referenced by DTTTrigFillWithAverage(), and setES().