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 &)
 
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

std::string dbLabel
 
bool foundAverage_
 
struct {
   float   aveKFactor
 
   float   aveMean
 
   float   aveSigma
 
   float   rmsMean
 
   float   rmsSigma
 
initialTTrig_
 
edm::ESHandle< DTGeometrymuonGeom_
 
const DTTtrigtTrigMap_
 

Detailed Description

Definition at line 23 of file DTTTrigFillWithAverage.h.

Constructor & Destructor Documentation

DTTTrigFillWithAverage::DTTTrigFillWithAverage ( const edm::ParameterSet pset)

Definition at line 21 of file DTTTrigFillWithAverage.cc.

References dbLabel, and edm::ParameterSet::getUntrackedParameter().

21  :foundAverage_(false) {
22  dbLabel = pset.getUntrackedParameter<string>("dbLabel", "");
23 }
T getUntrackedParameter(std::string const &, T const &) const
DTTTrigFillWithAverage::~DTTTrigFillWithAverage ( )
override

Definition at line 25 of file DTTTrigFillWithAverage.cc.

25 {}

Member Function Documentation

DTTTrigData DTTTrigFillWithAverage::correction ( const DTSuperLayerId slId)
overridevirtual

Implements dtCalibration::DTTTrigBaseCorrection.

Definition at line 37 of file DTTTrigFillWithAverage.cc.

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

37  {
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 {
44  float corrMean = initialTTrig_.aveMean;
45  float corrSigma = initialTTrig_.aveSigma;
46  float corrKFactor = initialTTrig_.aveKFactor;
47  return DTTTrigData(corrMean,corrSigma,corrKFactor); //FIXME: kFactor is not anymore a unique one
48  }
49 }
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:85
struct dtCalibration::DTTTrigFillWithAverage::@61 initialTTrig_
void DTTTrigFillWithAverage::getAverage ( )
private

Definition at line 51 of file DTTTrigFillWithAverage.cc.

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

Referenced by correction().

51  {
52  //Get the superlayers list
53  vector<const DTSuperLayer*> dtSupLylist = muonGeom_->superLayers();
54 
55  float aveMean = 0.;
56  float ave2Mean = 0.;
57  float aveSigma = 0.;
58  float ave2Sigma = 0.;
59  float aveKFactor = 0.;
60  int nIter = 0;
61 
62  for(auto sl = muonGeom_->superLayers().begin();
63  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;
72  aveKFactor += kFactor;
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;
82  rmsSigma = sqrt(rmsSigma);
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 }
T sqrt(T t)
Definition: SSEVec.h:18
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:85
struct dtCalibration::DTTTrigFillWithAverage::@61 initialTTrig_
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:107
void DTTTrigFillWithAverage::setES ( const edm::EventSetup setup)
overridevirtual

Implements dtCalibration::DTTTrigBaseCorrection.

Definition at line 27 of file DTTTrigFillWithAverage.cc.

References dbLabel, edm::EventSetup::get(), muonGeom_, and tTrigMap_.

27  {
28  // Get tTrig record from DB
29  ESHandle<DTTtrig> tTrig;
30  setup.get<DTTtrigRcd>().get(dbLabel,tTrig);
31  tTrigMap_ = &*tTrig;
32 
33  // Get geometry from Event Setup
34  setup.get<MuonGeometryRecord>().get(muonGeom_);
35 }
T get() const
Definition: EventSetup.h:62

Member Data Documentation

float dtCalibration::DTTTrigFillWithAverage::aveKFactor

Definition at line 47 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

float dtCalibration::DTTTrigFillWithAverage::aveMean

Definition at line 43 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

float dtCalibration::DTTTrigFillWithAverage::aveSigma

Definition at line 45 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

std::string dtCalibration::DTTTrigFillWithAverage::dbLabel
private

Definition at line 40 of file DTTTrigFillWithAverage.h.

Referenced by DTTTrigFillWithAverage(), and setES().

bool dtCalibration::DTTTrigFillWithAverage::foundAverage_
private

Definition at line 50 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 38 of file DTTTrigFillWithAverage.h.

Referenced by getAverage(), and setES().

float dtCalibration::DTTTrigFillWithAverage::rmsMean

Definition at line 44 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

float dtCalibration::DTTTrigFillWithAverage::rmsSigma

Definition at line 46 of file DTTTrigFillWithAverage.h.

Referenced by getAverage().

const DTTtrig* dtCalibration::DTTTrigFillWithAverage::tTrigMap_
private

Definition at line 37 of file DTTTrigFillWithAverage.h.

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