CMS 3D CMS Logo

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

#include <DTRunConditionVar.h>

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

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 
 DTRunConditionVar (const edm::ParameterSet &pset)
 
 ~DTRunConditionVar () override
 
- 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
 
 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 bookChamberHistos (DQMStore::IBooker &, const DTChamberId &dtCh, std::string histoType, int, float, float)
 

Private Attributes

std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
 
bool debug
 
edm::EDGetTokenT< DTRecSegment4DCollectiondt4DSegmentsToken_
 
const DTGeometrydtGeom
 
double maxAnglePhiSegm
 
const DTMtimemTimeMap_
 
edm::ESGetToken< DTMtime, DTMtimeRcdmTimeToken_
 
edm::ESGetToken< DTGeometry, MuonGeometryRecordmuonGeomToken_
 
int nMinHitsPhi
 
bool readLegacyVDriftDB
 
const DTRecoConditionsvDriftMap_
 
edm::ESGetToken< DTRecoConditions, DTRecoConditionsVdriftRcdvDriftToken_
 

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

Description:

Author
: Paolo Bellan, Antonio Branca $date : 23/09/2011 15:42:04 CET $

Modification:

Definition at line 48 of file DTRunConditionVar.h.

Constructor & Destructor Documentation

◆ DTRunConditionVar()

DTRunConditionVar::DTRunConditionVar ( const edm::ParameterSet pset)

Definition at line 42 of file DTRunConditionVar.cc.

References edm::BeginRun, deDxTools::esConsumes(), mTimeToken_, readLegacyVDriftDB, and vDriftToken_.

43  : // Get the debug parameter for verbose output
44  debug(pSet.getUntrackedParameter<bool>("debug", false)),
45  nMinHitsPhi(pSet.getUntrackedParameter<int>("nMinHitsPhi")),
46  maxAnglePhiSegm(pSet.getUntrackedParameter<double>("maxAnglePhiSegm")),
47  dt4DSegmentsToken_(consumes<DTRecSegment4DCollection>(pSet.getParameter<InputTag>("recoSegments"))),
48  muonGeomToken_(esConsumes<edm::Transition::BeginRun>()),
49  readLegacyVDriftDB(pSet.getParameter<bool>("readLegacyVDriftDB")) {
50  if (readLegacyVDriftDB) {
52  } else {
54  }
55 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::EDGetTokenT< DTRecSegment4DCollection > dt4DSegmentsToken_
edm::ESGetToken< DTRecoConditions, DTRecoConditionsVdriftRcd > vDriftToken_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
edm::ESGetToken< DTMtime, DTMtimeRcd > mTimeToken_

◆ ~DTRunConditionVar()

DTRunConditionVar::~DTRunConditionVar ( )
override

Definition at line 57 of file DTRunConditionVar.cc.

References LogTrace.

57  {
58  LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar") << "DTRunConditionVar: destructor called";
59 
60  // free memory
61 }
#define LogTrace(id)

Member Function Documentation

◆ analyze()

void DTRunConditionVar::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 86 of file DTRunConditionVar.cc.

References chamberHistos, DTVelocityUnits::cm_per_ns, dt4DSegmentsToken_, options_cfi::eventSetup, Exception, HcalObjRepresent::Fill(), DTRecoConditions::get(), DTMtime::get(), LogTrace, maxAnglePhiSegm, mTimeMap_, mTimeToken_, nMinHitsPhi, Pi, DetId::rawId(), readLegacyVDriftDB, vDriftMap_, vDriftToken_, DTRecoConditions::version(), BeamSplash_cfg::version, and xdir.

86  {
87  LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar")
88  << "--- [DTRunConditionVar] Event analysed #Run: " << event.id().run() << " #Event: " << event.id().event()
89  << endl;
90 
91  // Get the map of vdrift from the setup
92  if (readLegacyVDriftDB) {
93  mTimeMap_ = &eventSetup.getData(mTimeToken_);
94  vDriftMap_ = nullptr;
95  } else {
97  mTimeMap_ = nullptr;
98  // Consistency check: no parametrization is implemented for the time being
99  int version = vDriftMap_->version();
100  if (version != 1) {
101  throw cms::Exception("Configuration") << "only version 1 is presently supported for VDriftDB";
102  }
103  }
104 
105  // Get the segment collection from the event
106  Handle<DTRecSegment4DCollection> all4DSegments;
107  event.getByToken(dt4DSegmentsToken_, all4DSegments);
108 
109  // Loop over the segments
110  for (DTRecSegment4DCollection::const_iterator segment = all4DSegments->begin(); segment != all4DSegments->end();
111  ++segment) {
112  // Get the chamber from the setup
113  DTChamberId DTid = (DTChamberId)segment->chamberId();
114  uint32_t indexCh = DTid.rawId();
115 
116  // Fill v-drift values
117  if ((*segment).hasPhi()) {
118  int nHitsPhi = (*segment).phiSegment()->degreesOfFreedom() + 2;
119  double xdir = (*segment).phiSegment()->localDirection().x();
120  double zdir = (*segment).phiSegment()->localDirection().z();
121 
122  double anglePhiSegm = fabs(atan(xdir / zdir)) * 180. / TMath::Pi();
123 
124  if (nHitsPhi >= nMinHitsPhi && anglePhiSegm <= maxAnglePhiSegm) {
125  double segmentVDrift = segment->phiSegment()->vDrift();
126 
127  DTSuperLayerId indexSLPhi1(DTid, 1);
128  DTSuperLayerId indexSLPhi2(DTid, 3);
129 
130  float vDriftPhi1(0.), vDriftPhi2(0.);
131  float ResPhi1(0.), ResPhi2(0.);
132  if (readLegacyVDriftDB) { // Legacy format
133  int status1 = mTimeMap_->get(indexSLPhi1, vDriftPhi1, ResPhi1, DTVelocityUnits::cm_per_ns);
134  int status2 = mTimeMap_->get(indexSLPhi2, vDriftPhi2, ResPhi2, DTVelocityUnits::cm_per_ns);
135 
136  if (status1 != 0 || status2 != 0) {
137  DTSuperLayerId sl = (status1 != 0) ? indexSLPhi1 : indexSLPhi2;
138  throw cms::Exception("DTRunConditionVarClient") << "Could not find vDrift entry in DB for" << sl << endl;
139  }
140  } else {
141  vDriftPhi1 = vDriftMap_->get(DTWireId(indexSLPhi1.rawId()));
142  vDriftPhi2 = vDriftMap_->get(DTWireId(indexSLPhi2.rawId()));
143  }
144 
145  float vDriftMed = (vDriftPhi1 + vDriftPhi2) / 2.;
146 
147  segmentVDrift = vDriftMed * (1. - segmentVDrift);
148 
149  double segmentT0 = segment->phiSegment()->t0();
150 
151  if (segment->phiSegment()->ist0Valid())
152  (chamberHistos[indexCh])["T0_FromSegm"]->Fill(segmentT0);
153  if (segmentVDrift != vDriftMed)
154  (chamberHistos[indexCh])["VDrift_FromSegm"]->Fill(segmentVDrift);
155  }
156  }
157 
158  } //end loop on segment
159 
160 } //end analyze
const double Pi
float get(const DTWireId &wireid, double *x=nullptr) const
Get the value correspoding to the given WireId, / using x[] as parameters of the parametrization when...
edm::EDGetTokenT< DTRecSegment4DCollection > dt4DSegmentsToken_
edm::ESGetToken< DTRecoConditions, DTRecoConditionsVdriftRcd > vDriftToken_
int version() const
Version numer specifying the structure of the payload. See .cc file for details.
int get(int wheelId, int stationId, int sectorId, int slId, float &mTime, float &mTrms, DTTimeUnits::type unit) const
Definition: DTMtime.cc:56
#define LogTrace(id)
const DTMtime * mTimeMap_
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
const DTRecoConditions * vDriftMap_
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
edm::ESGetToken< DTMtime, DTMtimeRcd > mTimeToken_

◆ bookChamberHistos()

void DTRunConditionVar::bookChamberHistos ( DQMStore::IBooker ,
const DTChamberId dtCh,
std::string  histoType,
int  ,
float  ,
float   
)
private

Definition at line 162 of file DTRunConditionVar.cc.

References dqm::implementation::IBooker::book1D(), chamberHistos, fftjetimagerecorder_cfi::histoLabel, HltBtagPostValidation_cff::histoName, dtResolutionTest_cfi::histoTag, LogTrace, SiStripPI::max, SiStripPI::min, LaserClient_cfi::nbins, DetId::rawId(), DTChamberId::sector(), dqm::implementation::NavigatorBase::setCurrentFolder(), DTChamberId::station(), relativeConstraints::station, DTChamberId::wheel(), and makeMuonMisalignmentScenario::wheel.

Referenced by bookHistograms().

163  {
164  int wh = dtCh.wheel();
165  int sc = dtCh.sector();
166  int st = dtCh.station();
167  stringstream wheel;
168  wheel << wh;
169  stringstream station;
170  station << st;
171  stringstream sector;
172  sector << sc;
173 
174  string bookingFolder = "DT/02-Segments/Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + station.str();
175  string histoTag = "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
176 
177  ibooker.setCurrentFolder(bookingFolder);
178 
179  LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar")
180  << "[DTRunConditionVar]: booking histos in " << bookingFolder << endl;
181 
182  string histoName = histoType + histoTag;
183  const string& histoLabel = histoType;
184 
185  (chamberHistos[dtCh.rawId()])[histoType] = ibooker.book1D(histoName, histoLabel, nbins, min, max);
186 }
int station() const
Return the station number.
Definition: DTChamberId.h:42
#define LogTrace(id)
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
int sector() const
Definition: DTChamberId.h:49

◆ bookHistograms()

void DTRunConditionVar::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 63 of file DTRunConditionVar.cc.

References bookChamberHistos(), LogTrace, fileinputsource_cfi::sec, and makeMuonMisalignmentScenario::wheel.

65  {
66  LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar") << "DTRunConditionVar: bookHistograms";
67 
68  for (int wheel = -2; wheel <= 2; wheel++) {
69  for (int sec = 1; sec <= 14; sec++) {
70  for (int stat = 1; stat <= 4; stat++) {
71  bookChamberHistos(ibooker, DTChamberId(wheel, stat, sec), "VDrift_FromSegm", 100, 0.0043, 0.0065);
72  bookChamberHistos(ibooker, DTChamberId(wheel, stat, sec), "T0_FromSegm", 100, -25., 25.);
73  }
74  }
75  }
76 
77  return;
78 }
#define LogTrace(id)
void bookChamberHistos(DQMStore::IBooker &, const DTChamberId &dtCh, std::string histoType, int, float, float)

◆ dqmBeginRun()

void DTRunConditionVar::dqmBeginRun ( const edm::Run run,
const edm::EventSetup setup 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 80 of file DTRunConditionVar.cc.

References dtGeom, muonGeomToken_, and singleTopDQM_cfi::setup.

80  {
81  // Get the DT Geometry
82  dtGeom = &setup.getData(muonGeomToken_);
83  return;
84 }
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
const DTGeometry * dtGeom

Member Data Documentation

◆ chamberHistos

std::map<uint32_t, std::map<std::string, MonitorElement*> > DTRunConditionVar::chamberHistos
private

Definition at line 82 of file DTRunConditionVar.h.

Referenced by analyze(), and bookChamberHistos().

◆ debug

bool DTRunConditionVar::debug
private

◆ dt4DSegmentsToken_

edm::EDGetTokenT<DTRecSegment4DCollection> DTRunConditionVar::dt4DSegmentsToken_
private

Definition at line 70 of file DTRunConditionVar.h.

Referenced by analyze().

◆ dtGeom

const DTGeometry* DTRunConditionVar::dtGeom
private

Definition at line 73 of file DTRunConditionVar.h.

Referenced by dqmBeginRun().

◆ maxAnglePhiSegm

double DTRunConditionVar::maxAnglePhiSegm
private

Definition at line 68 of file DTRunConditionVar.h.

Referenced by analyze().

◆ mTimeMap_

const DTMtime* DTRunConditionVar::mTimeMap_
private

Definition at line 76 of file DTRunConditionVar.h.

Referenced by analyze().

◆ mTimeToken_

edm::ESGetToken<DTMtime, DTMtimeRcd> DTRunConditionVar::mTimeToken_
private

Definition at line 75 of file DTRunConditionVar.h.

Referenced by analyze(), and DTRunConditionVar().

◆ muonGeomToken_

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

Definition at line 72 of file DTRunConditionVar.h.

Referenced by dqmBeginRun().

◆ nMinHitsPhi

int DTRunConditionVar::nMinHitsPhi
private

Definition at line 67 of file DTRunConditionVar.h.

Referenced by analyze().

◆ readLegacyVDriftDB

bool DTRunConditionVar::readLegacyVDriftDB
private

Definition at line 80 of file DTRunConditionVar.h.

Referenced by analyze(), and DTRunConditionVar().

◆ vDriftMap_

const DTRecoConditions* DTRunConditionVar::vDriftMap_
private

Definition at line 79 of file DTRunConditionVar.h.

Referenced by analyze().

◆ vDriftToken_

edm::ESGetToken<DTRecoConditions, DTRecoConditionsVdriftRcd> DTRunConditionVar::vDriftToken_
private

Definition at line 78 of file DTRunConditionVar.h.

Referenced by analyze(), and DTRunConditionVar().