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::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 23 of file DTtTrigDBValidation.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 32 of file DTtTrigDBValidation.cc.

References metname_.

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

Destructor.

Definition at line 41 of file DTtTrigDBValidation.cc.

41 {}

Member Function Documentation

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

Definition at line 206 of file DTtTrigDBValidation.cc.

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

Operations.

Implements DQMEDAnalyzer.

Definition at line 43 of file DTtTrigDBValidation.cc.

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

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

Definition at line 142 of file DTtTrigDBValidation.cc.

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

Referenced by bookHistograms().

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

Definition at line 176 of file DTtTrigDBValidation.cc.

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

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

Definition at line 198 of file DTtTrigDBValidation.cc.

References runTheMatrix::ret.

198  {
199  int ret = bin % 3;
200  if (ret == 0 || bin == 11)
201  ret = 3;
202 
203  return ret;
204 }
ret
prodAgent to be discontinued
int DTtTrigDBValidation::stationFromBin ( int  bin) const
private

Definition at line 196 of file DTtTrigDBValidation.cc.

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

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().