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:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

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 one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

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

edm::ESHandle< DTGeometrydtGeom_
 
int higherLimit_
 
std::string labelDB_
 
std::string labelDBRef_
 
int lowerLimit_
 
std::string metname_
 
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_
 

Detailed Description

Definition at line 23 of file DTtTrigDBValidation.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 33 of file DTtTrigDBValidation.cc.

References metname_.

34  : metname_("TTrigDBValidation"),
35  labelDBRef_(pset.getParameter<string>("labelDBRef")),
36  labelDB_(pset.getParameter<string>("labelDB")),
37  lowerLimit_(pset.getUntrackedParameter<int>("lowerLimit", 1)),
38  higherLimit_(pset.getUntrackedParameter<int>("higherLimit", 3)) {
39  LogVerbatim(metname_) << "[DTtTrigDBValidation] Constructor called!";
40 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DTtTrigDBValidation::~DTtTrigDBValidation ( )
override

Destructor.

Definition at line 42 of file DTtTrigDBValidation.cc.

42 {}

Member Function Documentation

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

Definition at line 207 of file DTtTrigDBValidation.cc.

207 {}
void DTtTrigDBValidation::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  ,
edm::EventSetup const &  setup 
)
override

Operations.

Definition at line 44 of file DTtTrigDBValidation.cc.

References funct::abs(), DTTtrig::begin(), bookHistos(), dtGeom_, DTTtrig::end(), mps_splice::entry, edm::EventSetup::get(), DTTtrig::get(), higherLimit_, DTAnalyzerDetailed_cfi::kFactor, labelDB_, labelDBRef_, LogTrace, lowerLimit_, genParticles_cff::map, metname_, DTTimeUnits::ns, DQMStore::IBooker::setCurrentFolder(), relativeConstraints::station, tTrigDiffHistos_, tTrigDiffWheel_, tTrigMap_, tTrigRefMap_, DTTtrig::version(), and makeMuonMisalignmentScenario::wheel.

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

Definition at line 143 of file DTtTrigDBValidation.cc.

References DQMStore::IBooker::book1D(), LogTrace, metname_, DQMStore::IBooker::setCurrentFolder(), tTrigDiffHistos_, and makeMuonMisalignmentScenario::wheel.

Referenced by bookHistograms().

143  {
144  LogTrace(metname_) << " Booking histos for Wheel, Sector: " << wheel << ", " << sector;
145 
146  // Compose the chamber name
147  stringstream str_wheel;
148  str_wheel << wheel;
149  stringstream str_sector;
150  str_sector << sector;
151 
152  string lHistoName = "_W" + str_wheel.str() + "_Sec" + str_sector.str();
153 
154  iBooker.setCurrentFolder("DT/DtCalib/TTrigDBValidation/Wheel" + str_wheel.str());
155 
156  // Create the monitor elements
157  MonitorElement *hDifference;
158  hDifference = iBooker.book1D("TTrigDifference" + lHistoName, "difference between the two tTrig values", 11, 0, 11);
159 
160  pair<int, int> mypair(wheel, sector);
161  tTrigDiffHistos_[mypair] = hDifference;
162 
163  (tTrigDiffHistos_[mypair])->setBinLabel(1, "MB1_SL1", 1);
164  (tTrigDiffHistos_[mypair])->setBinLabel(2, "MB1_SL2", 1);
165  (tTrigDiffHistos_[mypair])->setBinLabel(3, "MB1_SL3", 1);
166  (tTrigDiffHistos_[mypair])->setBinLabel(4, "MB2_SL1", 1);
167  (tTrigDiffHistos_[mypair])->setBinLabel(5, "MB2_SL2", 1);
168  (tTrigDiffHistos_[mypair])->setBinLabel(6, "MB2_SL3", 1);
169  (tTrigDiffHistos_[mypair])->setBinLabel(7, "MB3_SL1", 1);
170  (tTrigDiffHistos_[mypair])->setBinLabel(8, "MB3_SL2", 1);
171  (tTrigDiffHistos_[mypair])->setBinLabel(9, "MB3_SL3", 1);
172  (tTrigDiffHistos_[mypair])->setBinLabel(10, "MB4_SL1", 1);
173  (tTrigDiffHistos_[mypair])->setBinLabel(11, "MB4_SL3", 1);
174 }
std::map< std::pair< int, int >, MonitorElement * > tTrigDiffHistos_
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
#define LogTrace(id)
void DTtTrigDBValidation::bookHistos ( DQMStore::IBooker iBooker,
int  wheel 
)
private

Definition at line 177 of file DTtTrigDBValidation.cc.

References DQMStore::IBooker::book2D(), DQMStore::IBooker::setCurrentFolder(), tTrigDiffWheel_, and makeMuonMisalignmentScenario::wheel.

177  {
178  stringstream wh;
179  wh << wheel;
180 
181  iBooker.setCurrentFolder("DT/DtCalib/TTrigDBValidation");
182  tTrigDiffWheel_[wheel] = iBooker.book2D(
183  "TTrigDifference_W" + wh.str(), "W" + wh.str() + ": summary of tTrig differences", 11, 1, 12, 14, 1, 15);
184  tTrigDiffWheel_[wheel]->setBinLabel(1, "MB1_SL1", 1);
185  tTrigDiffWheel_[wheel]->setBinLabel(2, "MB1_SL2", 1);
186  tTrigDiffWheel_[wheel]->setBinLabel(3, "MB1_SL3", 1);
187  tTrigDiffWheel_[wheel]->setBinLabel(4, "MB2_SL1", 1);
188  tTrigDiffWheel_[wheel]->setBinLabel(5, "MB2_SL2", 1);
189  tTrigDiffWheel_[wheel]->setBinLabel(6, "MB2_SL3", 1);
190  tTrigDiffWheel_[wheel]->setBinLabel(7, "MB3_SL1", 1);
191  tTrigDiffWheel_[wheel]->setBinLabel(8, "MB3_SL2", 1);
192  tTrigDiffWheel_[wheel]->setBinLabel(9, "MB3_SL3", 1);
193  tTrigDiffWheel_[wheel]->setBinLabel(10, "MB4_SL1", 1);
194  tTrigDiffWheel_[wheel]->setBinLabel(11, "MB4_SL3", 1);
195 }
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
std::map< int, MonitorElement * > tTrigDiffWheel_
int DTtTrigDBValidation::slFromBin ( int  bin) const
private

Definition at line 199 of file DTtTrigDBValidation.cc.

199  {
200  int ret = bin % 3;
201  if (ret == 0 || bin == 11)
202  ret = 3;
203 
204  return ret;
205 }
bin
set the eta bin as selection string.
int DTtTrigDBValidation::stationFromBin ( int  bin) const
private

Definition at line 197 of file DTtTrigDBValidation.cc.

197 { return (int)(bin / 3.1) + 1; }
bin
set the eta bin as selection string.

Member Data Documentation

edm::ESHandle<DTGeometry> DTtTrigDBValidation::dtGeom_
private

Definition at line 46 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

int DTtTrigDBValidation::higherLimit_
private

Definition at line 43 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

std::string DTtTrigDBValidation::labelDB_
private

Definition at line 40 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

std::string DTtTrigDBValidation::labelDBRef_
private

Definition at line 39 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

int DTtTrigDBValidation::lowerLimit_
private

Definition at line 42 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

std::string DTtTrigDBValidation::metname_
private

Definition at line 37 of file DTtTrigDBValidation.h.

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

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

Definition at line 53 of file DTtTrigDBValidation.h.

Referenced by bookHistograms(), and bookHistos().

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

Definition at line 54 of file DTtTrigDBValidation.h.

Referenced by bookHistograms(), and bookHistos().

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

Definition at line 50 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().

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

Definition at line 49 of file DTtTrigDBValidation.h.

Referenced by bookHistograms().