CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DTtTrigDBValidation Class Reference

#include <DTtTrigDBValidation.h>

Inheritance diagram for DTtTrigDBValidation:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 Operations. More...
 
 DTtTrigDBValidation (const edm::ParameterSet &pset)
 Constructor. More...
 
 ~DTtTrigDBValidation () override
 Destructor. More...
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void bookHistos (DQMStore::IBooker &, int, int)
 
void bookHistos (DQMStore::IBooker &, int wheel)
 
int slFromBin (int bin) const
 
int stationFromBin (int bin) const
 

Private Attributes

const DTGeometrydtGeom
 
const DTTtrigDTTtrigMap
 
const DTTtrigDTTtrigRefMap
 
int higherLimit_
 
edm::ESGetToken< DTTtrig, DTTtrigRcdlabelDB_
 
edm::ESGetToken< DTTtrig, DTTtrigRcdlabelDBRef_
 
int lowerLimit_
 
std::string metname_
 
edm::ESGetToken< DTGeometry, MuonGeometryRecordmuonGeomToken_
 
std::map< std::pair< int, int >, MonitorElement * > tTrigDiffHistos_
 
std::map< int, MonitorElement * > tTrigDiffWheel_
 
std::map< DTSuperLayerId, std::pair< float, float > > tTrigMap_
 
std::map< DTSuperLayerId, std::pair< float, float > > tTrigRefMap_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 25 of file DTtTrigDBValidation.h.

Constructor & Destructor Documentation

◆ DTtTrigDBValidation()

DTtTrigDBValidation::DTtTrigDBValidation ( const edm::ParameterSet pset)

Constructor.

Definition at line 26 of file DTtTrigDBValidation.cc.

References metname_.

27  : metname_("TTrigDBValidation"),
28  labelDBRef_(esConsumes(edm::ESInputTag("", pset.getParameter<string>("labelDBRef")))),
29  labelDB_(esConsumes(edm::ESInputTag("", pset.getParameter<string>("labelDB")))),
30  lowerLimit_(pset.getUntrackedParameter<int>("lowerLimit", 1)),
31  higherLimit_(pset.getUntrackedParameter<int>("higherLimit", 3)),
33  LogVerbatim(metname_) << "[DTtTrigDBValidation] Constructor called!";
34 }
Log< level::Info, true > LogVerbatim
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
edm::ESGetToken< DTTtrig, DTTtrigRcd > labelDB_
edm::ESGetToken< DTTtrig, DTTtrigRcd > labelDBRef_

◆ ~DTtTrigDBValidation()

DTtTrigDBValidation::~DTtTrigDBValidation ( )
override

Destructor.

Definition at line 36 of file DTtTrigDBValidation.cc.

36 {}

Member Function Documentation

◆ analyze()

void DTtTrigDBValidation::analyze ( const edm::Event ,
const edm::EventSetup  
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 197 of file DTtTrigDBValidation.cc.

197 {}

◆ bookHistograms()

void DTtTrigDBValidation::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  ,
edm::EventSetup const &  setup 
)
overridevirtual

Operations.

Implements DQMEDAnalyzer.

Definition at line 38 of file DTtTrigDBValidation.cc.

References funct::abs(), DTTtrig::begin(), bookHistos(), dtGeom, DTTtrigMap, DTTtrigRefMap, DTTtrig::end(), mps_splice::entry, DTTtrig::get(), higherLimit_, dttriganalyzer_cfi::kFactor, labelDB_, labelDBRef_, LogTrace, lowerLimit_, genParticles_cff::map, metname_, muonGeomToken_, DTTimeUnits::ns, dqm::implementation::NavigatorBase::setCurrentFolder(), singleTopDQM_cfi::setup, relativeConstraints::station, tTrigDiffHistos_, tTrigDiffWheel_, tTrigMap_, tTrigRefMap_, DTTtrig::version(), and makeMuonMisalignmentScenario::wheel.

38  {
39  LogVerbatim(metname_) << "[DTtTrigDBValidation] Parameters initialization";
40  iBooker.setCurrentFolder("DT/DtCalib/TTrigDBValidation");
41 
42  DTTtrigRefMap = &setup.getData(labelDBRef_);
43  LogVerbatim(metname_) << "[DTtTrigDBValidation] reference Ttrig version: " << DTTtrigRefMap->version();
44 
45  DTTtrigMap = &setup.getData(labelDB_);
46  LogVerbatim(metname_) << "[DTtTrigDBValidation] Ttrig to validate version: " << DTTtrigMap->version();
47 
48  // book&reset the summary histos
49  for (int wheel = -2; wheel <= 2; wheel++) {
50  bookHistos(iBooker, wheel);
51  tTrigDiffWheel_[wheel]->Reset();
52  }
53 
54  // Get the geometry
55  dtGeom = &setup.getData(muonGeomToken_);
56 
57  // Loop over Ref DB entries
58  for (DTTtrig::const_iterator it = DTTtrigRefMap->begin(); it != DTTtrigRefMap->end(); ++it) {
59  DTSuperLayerId slId((*it).first.wheelId, (*it).first.stationId, (*it).first.sectorId, (*it).first.slId);
60  float tTrigMean;
61  float tTrigRms;
62  float kFactor;
63  DTTtrigRefMap->get(slId, tTrigMean, tTrigRms, kFactor, DTTimeUnits::ns);
64  float tTrigCorr = tTrigMean + kFactor * tTrigRms;
65  LogTrace(metname_) << "Ref Superlayer: " << slId << "\n"
66  << " Ttrig mean (ns): " << tTrigMean << " Ttrig rms (ns): " << tTrigRms
67  << " Ttrig k-Factor: " << kFactor << " Ttrig value (ns): " << tTrigCorr;
68 
69  // tTrigRefMap[slId] = std::pair<float,float>(tTrigmean,tTrigrms);
70  tTrigRefMap_[slId] = pair<float, float>(tTrigCorr, tTrigRms);
71  }
72 
73  // Loop over Ref DB entries
74  for (DTTtrig::const_iterator it = DTTtrigMap->begin(); it != DTTtrigMap->end(); ++it) {
75  DTSuperLayerId slId((*it).first.wheelId, (*it).first.stationId, (*it).first.sectorId, (*it).first.slId);
76  float tTrigMean;
77  float tTrigRms;
78  float kFactor;
79  DTTtrigMap->get(slId, tTrigMean, tTrigRms, kFactor, DTTimeUnits::ns);
80  float tTrigCorr = tTrigMean + kFactor * tTrigRms;
81  LogTrace(metname_) << "Superlayer: " << slId << "\n"
82  << " Ttrig mean (ns): " << tTrigMean << " Ttrig rms (ns): " << tTrigRms
83  << " Ttrig k-Factor: " << kFactor << " Ttrig value (ns): " << tTrigCorr;
84 
85  // tTrigMap[slId] = std::pair<float,float>(tTrigmean,tTrigrms);
86  tTrigMap_[slId] = pair<float, float>(tTrigCorr, tTrigRms);
87  }
88 
89  for (map<DTSuperLayerId, pair<float, float>>::const_iterator it = tTrigRefMap_.begin(); it != tTrigRefMap_.end();
90  ++it) {
91  if (tTrigMap_.find((*it).first) == tTrigMap_.end())
92  continue;
93 
94  // compute the difference
95  float difference = tTrigMap_[(*it).first].first - (*it).second.first;
96 
97  // book histo
98  int wheel = (*it).first.chamberId().wheel();
99  int sector = (*it).first.chamberId().sector();
100  if (tTrigDiffHistos_.find(make_pair(wheel, sector)) == tTrigDiffHistos_.end())
101  bookHistos(iBooker, wheel, sector);
102 
103  LogTrace(metname_) << "Filling histos for super-layer: " << (*it).first << " difference: " << difference;
104 
105  // Fill the test histos
106  int entry = -1;
107  int station = (*it).first.chamberId().station();
108  if (station == 1)
109  entry = 0;
110  if (station == 2)
111  entry = 3;
112  if (station == 3)
113  entry = 6;
114  if (station == 4)
115  entry = 9;
116 
117  int slBin = entry + (*it).first.superLayer();
118  if (slBin == 12)
119  slBin = 11;
120 
121  tTrigDiffHistos_[make_pair(wheel, sector)]->setBinContent(slBin, difference);
122  if (abs(difference) < lowerLimit_) {
123  tTrigDiffWheel_[wheel]->setBinContent(slBin, sector, 1);
124  } else if (abs(difference) < higherLimit_) {
125  tTrigDiffWheel_[wheel]->setBinContent(slBin, sector, 2);
126  } else {
127  tTrigDiffWheel_[wheel]->setBinContent(slBin, sector, 3);
128  }
129 
130  } // Loop over the tTrig map reference
131 }
Log< level::Info, true > LogVerbatim
std::vector< std::pair< DTTtrigId, DTTtrigData > >::const_iterator const_iterator
Access methods to data.
Definition: DTTtrig.h:141
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
const std::string & version() const
access version
Definition: DTTtrig.cc:162
std::map< std::pair< int, int >, MonitorElement * > tTrigDiffHistos_
edm::ESGetToken< DTTtrig, DTTtrigRcd > labelDB_
std::map< DTSuperLayerId, std::pair< float, float > > tTrigRefMap_
#define LogTrace(id)
const_iterator begin() const
Definition: DTTtrig.cc:250
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::ESGetToken< DTTtrig, DTTtrigRcd > labelDBRef_
const DTTtrig * DTTtrigRefMap
const DTTtrig * DTTtrigMap
std::map< int, MonitorElement * > tTrigDiffWheel_
void bookHistos(DQMStore::IBooker &, int, int)
std::map< DTSuperLayerId, std::pair< float, float > > tTrigMap_
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 DTGeometry * dtGeom
const_iterator end() const
Definition: DTTtrig.cc:252

◆ bookHistos() [1/2]

void DTtTrigDBValidation::bookHistos ( DQMStore::IBooker iBooker,
int  wheel,
int  sector 
)
private

Definition at line 133 of file DTtTrigDBValidation.cc.

References dqm::implementation::IBooker::book1D(), LogTrace, metname_, dqm::implementation::NavigatorBase::setCurrentFolder(), tTrigDiffHistos_, and makeMuonMisalignmentScenario::wheel.

Referenced by bookHistograms().

133  {
134  LogTrace(metname_) << " Booking histos for Wheel, Sector: " << wheel << ", " << sector;
135 
136  // Compose the chamber name
137  stringstream str_wheel;
138  str_wheel << wheel;
139  stringstream str_sector;
140  str_sector << sector;
141 
142  string lHistoName = "_W" + str_wheel.str() + "_Sec" + str_sector.str();
143 
144  iBooker.setCurrentFolder("DT/DtCalib/TTrigDBValidation/Wheel" + str_wheel.str());
145 
146  // Create the monitor elements
147  MonitorElement *hDifference;
148  hDifference = iBooker.book1D("TTrigDifference" + lHistoName, "difference between the two tTrig values", 11, 0, 11);
149 
150  pair<int, int> mypair(wheel, sector);
151  tTrigDiffHistos_[mypair] = hDifference;
152 
153  (tTrigDiffHistos_[mypair])->setBinLabel(1, "MB1_SL1", 1);
154  (tTrigDiffHistos_[mypair])->setBinLabel(2, "MB1_SL2", 1);
155  (tTrigDiffHistos_[mypair])->setBinLabel(3, "MB1_SL3", 1);
156  (tTrigDiffHistos_[mypair])->setBinLabel(4, "MB2_SL1", 1);
157  (tTrigDiffHistos_[mypair])->setBinLabel(5, "MB2_SL2", 1);
158  (tTrigDiffHistos_[mypair])->setBinLabel(6, "MB2_SL3", 1);
159  (tTrigDiffHistos_[mypair])->setBinLabel(7, "MB3_SL1", 1);
160  (tTrigDiffHistos_[mypair])->setBinLabel(8, "MB3_SL2", 1);
161  (tTrigDiffHistos_[mypair])->setBinLabel(9, "MB3_SL3", 1);
162  (tTrigDiffHistos_[mypair])->setBinLabel(10, "MB4_SL1", 1);
163  (tTrigDiffHistos_[mypair])->setBinLabel(11, "MB4_SL3", 1);
164 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
std::map< std::pair< int, int >, MonitorElement * > tTrigDiffHistos_
#define LogTrace(id)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ bookHistos() [2/2]

void DTtTrigDBValidation::bookHistos ( DQMStore::IBooker iBooker,
int  wheel 
)
private

Definition at line 167 of file DTtTrigDBValidation.cc.

References dqm::implementation::IBooker::book2D(), dqm::implementation::NavigatorBase::setCurrentFolder(), tTrigDiffWheel_, and makeMuonMisalignmentScenario::wheel.

167  {
168  stringstream wh;
169  wh << wheel;
170 
171  iBooker.setCurrentFolder("DT/DtCalib/TTrigDBValidation");
172  tTrigDiffWheel_[wheel] = iBooker.book2D(
173  "TTrigDifference_W" + wh.str(), "W" + wh.str() + ": summary of tTrig differences", 11, 1, 12, 14, 1, 15);
174  tTrigDiffWheel_[wheel]->setBinLabel(1, "MB1_SL1", 1);
175  tTrigDiffWheel_[wheel]->setBinLabel(2, "MB1_SL2", 1);
176  tTrigDiffWheel_[wheel]->setBinLabel(3, "MB1_SL3", 1);
177  tTrigDiffWheel_[wheel]->setBinLabel(4, "MB2_SL1", 1);
178  tTrigDiffWheel_[wheel]->setBinLabel(5, "MB2_SL2", 1);
179  tTrigDiffWheel_[wheel]->setBinLabel(6, "MB2_SL3", 1);
180  tTrigDiffWheel_[wheel]->setBinLabel(7, "MB3_SL1", 1);
181  tTrigDiffWheel_[wheel]->setBinLabel(8, "MB3_SL2", 1);
182  tTrigDiffWheel_[wheel]->setBinLabel(9, "MB3_SL3", 1);
183  tTrigDiffWheel_[wheel]->setBinLabel(10, "MB4_SL1", 1);
184  tTrigDiffWheel_[wheel]->setBinLabel(11, "MB4_SL3", 1);
185 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
std::map< int, MonitorElement * > tTrigDiffWheel_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212

◆ slFromBin()

int DTtTrigDBValidation::slFromBin ( int  bin) const
private

Definition at line 189 of file DTtTrigDBValidation.cc.

References newFWLiteAna::bin, and runTheMatrix::ret.

189  {
190  int ret = bin % 3;
191  if (ret == 0 || bin == 11)
192  ret = 3;
193 
194  return ret;
195 }
ret
prodAgent to be discontinued

◆ stationFromBin()

int DTtTrigDBValidation::stationFromBin ( int  bin) const
private

Definition at line 187 of file DTtTrigDBValidation.cc.

References newFWLiteAna::bin.

187 { return (int)(bin / 3.1) + 1; }

Member Data Documentation

◆ dtGeom

const DTGeometry* DTtTrigDBValidation::dtGeom
private

Definition at line 51 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

◆ DTTtrigMap

const DTTtrig* DTtTrigDBValidation::DTTtrigMap
private

Definition at line 44 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

◆ DTTtrigRefMap

const DTTtrig* DTtTrigDBValidation::DTTtrigRefMap
private

Definition at line 43 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

◆ higherLimit_

int DTtTrigDBValidation::higherLimit_
private

Definition at line 47 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

◆ labelDB_

edm::ESGetToken<DTTtrig, DTTtrigRcd> DTtTrigDBValidation::labelDB_
private

Definition at line 42 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

◆ labelDBRef_

edm::ESGetToken<DTTtrig, DTTtrigRcd> DTtTrigDBValidation::labelDBRef_
private

Definition at line 41 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

◆ lowerLimit_

int DTtTrigDBValidation::lowerLimit_
private

Definition at line 46 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

◆ metname_

std::string DTtTrigDBValidation::metname_
private

Definition at line 39 of file DTtTrigDBValidation.h.

Referenced by bookHistograms(), bookHistos(), and DTtTrigDBValidation().

◆ muonGeomToken_

edm::ESGetToken<DTGeometry, MuonGeometryRecord> DTtTrigDBValidation::muonGeomToken_
private

Definition at line 50 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

◆ tTrigDiffHistos_

std::map<std::pair<int, int>, MonitorElement *> DTtTrigDBValidation::tTrigDiffHistos_
private

Definition at line 58 of file DTtTrigDBValidation.h.

Referenced by bookHistograms(), and bookHistos().

◆ tTrigDiffWheel_

std::map<int, MonitorElement *> DTtTrigDBValidation::tTrigDiffWheel_
private

Definition at line 59 of file DTtTrigDBValidation.h.

Referenced by bookHistograms(), and bookHistos().

◆ tTrigMap_

std::map<DTSuperLayerId, std::pair<float, float> > DTtTrigDBValidation::tTrigMap_
private

Definition at line 55 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

◆ tTrigRefMap_

std::map<DTSuperLayerId, std::pair<float, float> > DTtTrigDBValidation::tTrigRefMap_
private

Definition at line 54 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().