CMS 3D CMS Logo

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

#include <DTt0DBValidation.h>

Inheritance diagram for DTt0DBValidation:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup) override
 
void beginRun (const edm::Run &run, const edm::EventSetup &setup) override
 Operations. More...
 
 DTt0DBValidation (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob () override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
 ~DTt0DBValidation () override
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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
 
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)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void bookHistos (DTLayerId lId, int firstWire, int lastWire)
 
void bookHistos (int wheel)
 

Private Attributes

DQMStoredbe_
 
edm::ESHandle< DTGeometrydtGeom_
 
std::string labelDB_
 
std::string labelDBRef_
 
std::string metname_
 
std::string outputFileName_
 
bool outputMEsInRootFile_
 
std::map< DTLayerId, MonitorElement * > t0DiffHistos_
 
std::map< DTWireId, std::vector< float > > t0Map_
 
std::map< DTWireId, std::vector< float > > t0RefMap_
 
std::string t0TestName_
 
const DTT0tZeroMap_
 
const DTT0tZeroRefMap_
 
std::map< int, MonitorElement * > wheelSummary_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 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)
 

Detailed Description

Plot the t0 from the DB

Author
G. Mila - INFN Torino

Definition at line 31 of file DTt0DBValidation.h.

Constructor & Destructor Documentation

DTt0DBValidation::DTt0DBValidation ( const edm::ParameterSet pset)

Constructor.

Definition at line 38 of file DTt0DBValidation.cc.

References dbe_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), Utilities::operator, and AlCaHLTBitMon_QueryRunRegistry::string.

38  {
39 
40  metname_ = "InterChannelSynchDBValidation";
41  LogVerbatim(metname_) << "[DTt0DBValidation] Constructor called!";
42 
43  // Get the DQM needed services
45  dbe_->setCurrentFolder("DT/DtCalib/InterChannelSynchDBValidation");
46 
47  // Get dataBase label
48  labelDBRef_ = pset.getParameter<string>("labelDBRef");
49  labelDB_ = pset.getParameter<string>("labelDB");
50 
51  t0TestName_ = "t0DifferenceInRange";
52  if( pset.exists("t0TestName") ) t0TestName_ = pset.getParameter<string>("t0TestName");
53 
54  outputMEsInRootFile_ = false;
55  if( pset.exists("OutputFileName") ){
56  outputMEsInRootFile_ = true;
57  outputFileName_ = pset.getParameter<std::string>("OutputFileName");
58  }
59 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::string metname_
std::string labelDB_
std::string labelDBRef_
std::string outputFileName_
std::string t0TestName_
DTt0DBValidation::~DTt0DBValidation ( )
override

Destructor.

Definition at line 62 of file DTt0DBValidation.cc.

62 {}

Member Function Documentation

void DTt0DBValidation::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
inlineoverride

Definition at line 44 of file DTt0DBValidation.h.

References bookHistos(), and makeMuonMisalignmentScenario::wheel.

44 {}
void DTt0DBValidation::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
override

Operations.

Definition at line 65 of file DTt0DBValidation.cc.

References bookHistos(), DTTimeUnits::counts, DTTopology::firstChannel(), edm::EventSetup::get(), DTTopology::lastChannel(), LogTrace, genParticles_cff::map, cscNeutronWriter_cfi::t0, tzero, DTT0::version(), and makeMuonMisalignmentScenario::wheel.

65  {
66 
67  metname_ = "InterChannelSynchDBValidation";
68  LogVerbatim(metname_) << "[DTt0DBValidation] Parameters initialization";
69 
70  ESHandle<DTT0> t0_Ref;
71  setup.get<DTT0Rcd>().get(labelDBRef_, t0_Ref);
72  tZeroRefMap_ = &*t0_Ref;
73  LogVerbatim(metname_) << "[DTt0DBValidation] reference T0 version: " << t0_Ref->version();
74 
76  setup.get<DTT0Rcd>().get(labelDB_, t0);
77  tZeroMap_ = &*t0;
78  LogVerbatim(metname_) << "[DTt0DBValidation] T0 to validate version: " << t0->version();
79 
80  //book&reset the summary histos
81  for(int wheel=-2; wheel<=2; wheel++){
83  wheelSummary_[wheel]->Reset();
84  }
85 
86  // Get the geometry
87  setup.get<MuonGeometryRecord>().get(dtGeom_);
88 
89  // Loop over Ref DB entries
91  tzero != tZeroRefMap_->end(); tzero++) {
92  // t0s and rms are TDC counts
93 // @@@ NEW DTT0 FORMAT
94 // DTWireId wireId((*tzero).first.wheelId,
95 // (*tzero).first.stationId,
96 // (*tzero).first.sectorId,
97 // (*tzero).first.slId,
98 // (*tzero).first.layerId,
99 // (*tzero).first.cellId);
100  int channelId = tzero->channelId;
101  if ( channelId == 0 ) continue;
102  DTWireId wireId(channelId);
103 // @@@ NEW DTT0 END
104  float t0mean;
105  float t0rms;
106  tZeroRefMap_->get( wireId, t0mean, t0rms, DTTimeUnits::counts );
107  LogTrace(metname_)<< "Ref Wire: " << wireId <<endl
108  << " T0 mean (TDC counts): " << t0mean
109  << " T0_rms (TDC counts): " << t0rms;
110 
111  t0RefMap_[wireId].push_back(t0mean);
112  t0RefMap_[wireId].push_back(t0rms);
113  }
114 
115  // Loop over Ref DB entries
117  tzero != tZeroMap_->end(); tzero++) {
118  // t0s and rms are TDC counts
119 // @@@ NEW DTT0 FORMAT
120 // DTWireId wireId((*tzero).first.wheelId,
121 // (*tzero).first.stationId,
122 // (*tzero).first.sectorId,
123 // (*tzero).first.slId,
124 // (*tzero).first.layerId,
125 // (*tzero).first.cellId);
126  int channelId = tzero->channelId;
127  if ( channelId == 0 ) continue;
128  DTWireId wireId(channelId);
129 // @@@ NEW DTT0 END
130  float t0mean;
131  float t0rms;
132  tZeroMap_->get( wireId, t0mean, t0rms, DTTimeUnits::counts );
133  LogTrace(metname_)<< "Wire: " << wireId <<endl
134  << " T0 mean (TDC counts): " << t0mean
135  << " T0_rms (TDC counts): " << t0rms;
136 
137  t0Map_[wireId].push_back(t0mean);
138  t0Map_[wireId].push_back(t0rms);
139  }
140 
141  double difference = 0;
142  for(map<DTWireId, vector<float> >::const_iterator theMap = t0RefMap_.begin();
143  theMap != t0RefMap_.end();
144  theMap++) {
145  if(t0Map_.find((*theMap).first) != t0Map_.end()) {
146 
147  // Compute the difference
148  difference = t0Map_[(*theMap).first][0]-(*theMap).second[0];
149 
150  //book histo
151  DTLayerId layerId = (*theMap).first.layerId();
152  if(t0DiffHistos_.find(layerId) == t0DiffHistos_.end()) {
153  const DTTopology& dtTopo = dtGeom_->layer(layerId)->specificTopology();
154  const int firstWire = dtTopo.firstChannel();
155  const int lastWire = dtTopo.lastChannel();
156  bookHistos(layerId, firstWire, lastWire);
157  }
158 
159  LogTrace(metname_)<< "Filling the histo for wire: "<<(*theMap).first
160  <<" difference: "<<difference;
161  t0DiffHistos_[layerId]->Fill((*theMap).first.wire(),difference);
162 
163  }
164  } // Loop over the t0 map reference
165 
166 }
const_iterator begin() const
Definition: DTT0.cc:204
const DTT0 * tZeroRefMap_
std::string metname_
std::string labelDB_
int get(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &t0mean, float &t0rms, DTTimeUnits::type unit) const
Definition: DTT0.cc:67
std::vector< DTT0Data >::const_iterator const_iterator
Access methods to data.
Definition: DTT0.h:140
std::map< int, MonitorElement * > wheelSummary_
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:78
std::string labelDBRef_
int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:80
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
std::map< DTWireId, std::vector< float > > t0RefMap_
edm::ESHandle< DTGeometry > dtGeom_
std::map< DTLayerId, MonitorElement * > t0DiffHistos_
#define LogTrace(id)
const_iterator end() const
Definition: DTT0.cc:209
const DTT0 * tZeroMap_
Definition: DTT0Rcd.h:9
std::map< DTWireId, std::vector< float > > t0Map_
T get() const
Definition: EventSetup.h:63
void bookHistos(DTLayerId lId, int firstWire, int lastWire)
static const double tzero[3]
const std::string & version() const
access version
Definition: DTT0.cc:118
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:109
void DTt0DBValidation::bookHistos ( DTLayerId  lId,
int  firstWire,
int  lastWire 
)
private

Definition at line 209 of file DTt0DBValidation.cc.

References DTSuperLayerId::chamberId(), dbe_, DTLayerId::layer(), LogTrace, DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), DTChamberId::wheel(), and makeMuonMisalignmentScenario::wheel.

Referenced by analyze().

209  {
210 
211  LogTrace(metname_)<< " Booking histos for L: " << lId;
212 
213  // Compose the chamber name
214  stringstream wheel; wheel << lId.superlayerId().chamberId().wheel();
215  stringstream station; station << lId.superlayerId().chamberId().station();
216  stringstream sector; sector << lId.superlayerId().chamberId().sector();
217  stringstream superLayer; superLayer << lId.superlayerId().superlayer();
218  stringstream layer; layer << lId.layer();
219 
220  string lHistoName =
221  "_W" + wheel.str() +
222  "_St" + station.str() +
223  "_Sec" + sector.str() +
224  "_SL" + superLayer.str()+
225  "_L" + layer.str();
226 
227  dbe_->setCurrentFolder("DT/DtCalib/InterChannelSynchDBValidation/Wheel" + wheel.str() +
228  "/Station" + station.str() +
229  "/Sector" + sector.str() +
230  "/SuperLayer" +superLayer.str());
231  // Create the monitor elements
232  MonitorElement * hDifference;
233  hDifference = dbe_->book1D("T0Difference"+lHistoName, "difference between the two t0 values",lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
234 
235  t0DiffHistos_[lId] = hDifference;
236 }
DTChamberId chamberId() const
Return the corresponding ChamberId.
std::string metname_
int layer() const
Return the layer number.
Definition: DTLayerId.h:53
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
std::map< DTLayerId, MonitorElement * > t0DiffHistos_
#define LogTrace(id)
int superlayer() const
Return the superlayer number (deprecated method name)
int sector() const
Definition: DTChamberId.h:61
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
void DTt0DBValidation::bookHistos ( int  wheel)
private

Definition at line 239 of file DTt0DBValidation.cc.

References dbe_, and makeMuonMisalignmentScenario::wheel.

239  {
240  dbe_->setCurrentFolder("DT/DtCalib/InterChannelSynchDBValidation");
241  stringstream wh; wh << wheel;
242  wheelSummary_[wheel]= dbe_->book2D("SummaryWrongT0_W"+wh.str(), "W"+wh.str()+": summary of wrong t0 differences",44,1,45,14,1,15);
243  wheelSummary_[wheel]->setBinLabel(1,"M1L1",1);
244  wheelSummary_[wheel]->setBinLabel(2,"M1L2",1);
245  wheelSummary_[wheel]->setBinLabel(3,"M1L3",1);
246  wheelSummary_[wheel]->setBinLabel(4,"M1L4",1);
247  wheelSummary_[wheel]->setBinLabel(5,"M1L5",1);
248  wheelSummary_[wheel]->setBinLabel(6,"M1L6",1);
249  wheelSummary_[wheel]->setBinLabel(7,"M1L7",1);
250  wheelSummary_[wheel]->setBinLabel(8,"M1L8",1);
251  wheelSummary_[wheel]->setBinLabel(9,"M1L9",1);
252  wheelSummary_[wheel]->setBinLabel(10,"M1L10",1);
253  wheelSummary_[wheel]->setBinLabel(11,"M1L11",1);
254  wheelSummary_[wheel]->setBinLabel(12,"M1L12",1);
255  wheelSummary_[wheel]->setBinLabel(13,"M2L1",1);
256  wheelSummary_[wheel]->setBinLabel(14,"M2L2",1);
257  wheelSummary_[wheel]->setBinLabel(15,"M2L3",1);
258  wheelSummary_[wheel]->setBinLabel(16,"M2L4",1);
259  wheelSummary_[wheel]->setBinLabel(17,"M2L5",1);
260  wheelSummary_[wheel]->setBinLabel(18,"M2L6",1);
261  wheelSummary_[wheel]->setBinLabel(19,"M2L7",1);
262  wheelSummary_[wheel]->setBinLabel(20,"M2L8",1);
263  wheelSummary_[wheel]->setBinLabel(21,"M2L9",1);
264  wheelSummary_[wheel]->setBinLabel(22,"M2L10",1);
265  wheelSummary_[wheel]->setBinLabel(23,"M2L11",1);
266  wheelSummary_[wheel]->setBinLabel(24,"M2L12",1);
267  wheelSummary_[wheel]->setBinLabel(25,"M3L1",1);
268  wheelSummary_[wheel]->setBinLabel(26,"M3L2",1);
269  wheelSummary_[wheel]->setBinLabel(27,"M3L3",1);
270  wheelSummary_[wheel]->setBinLabel(28,"M3L4",1);
271  wheelSummary_[wheel]->setBinLabel(29,"M3L5",1);
272  wheelSummary_[wheel]->setBinLabel(30,"M3L6",1);
273  wheelSummary_[wheel]->setBinLabel(31,"M3L7",1);
274  wheelSummary_[wheel]->setBinLabel(32,"M3L8",1);
275  wheelSummary_[wheel]->setBinLabel(33,"M3L9",1);
276  wheelSummary_[wheel]->setBinLabel(34,"M3L10",1);
277  wheelSummary_[wheel]->setBinLabel(35,"M3L11",1);
278  wheelSummary_[wheel]->setBinLabel(36,"M3L12",1);
279  wheelSummary_[wheel]->setBinLabel(37,"M4L1",1);
280  wheelSummary_[wheel]->setBinLabel(38,"M4L2",1);
281  wheelSummary_[wheel]->setBinLabel(39,"M4L3",1);
282  wheelSummary_[wheel]->setBinLabel(40,"M4L4",1);
283  wheelSummary_[wheel]->setBinLabel(41,"M4L5",1);
284  wheelSummary_[wheel]->setBinLabel(42,"M4L6",1);
285  wheelSummary_[wheel]->setBinLabel(43,"M4L7",1);
286  wheelSummary_[wheel]->setBinLabel(44,"M4L8",1);
287 }
std::map< int, MonitorElement * > wheelSummary_
void DTt0DBValidation::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 203 of file DTt0DBValidation.cc.

References dbe_.

203  {
204  // Write the histos on a file
206 }
std::string outputFileName_
void DTt0DBValidation::endRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 168 of file DTt0DBValidation.cc.

References QReport::getBadChannels(), QReport::getMessage(), QReport::getQTresult(), and QReport::getStatus().

168  {
169 
170  // Check the histos
171  string testCriterionName = t0TestName_;
172  for(map<DTLayerId, MonitorElement*>::const_iterator hDiff = t0DiffHistos_.begin();
173  hDiff != t0DiffHistos_.end();
174  hDiff++) {
175 
176  const QReport * theDiffQReport = (*hDiff).second->getQReport(testCriterionName);
177  if(theDiffQReport) {
178  int xBin = ((*hDiff).first.station()-1)*12+(*hDiff).first.layer()+4*((*hDiff).first.superlayer()-1);
179  if( (*hDiff).first.station()==4 && (*hDiff).first.superlayer()==3 )
180  xBin = ((*hDiff).first.station()-1)*12+(*hDiff).first.layer()+4*((*hDiff).first.superlayer()-2);
181 
182  int qReportStatus = theDiffQReport->getStatus()/100;
183  wheelSummary_[(*hDiff).first.wheel()]->setBinContent(xBin,(*hDiff).first.sector(),qReportStatus);
184 
185  LogVerbatim(metname_) << "-------- layer: " << (*hDiff).first << " " << theDiffQReport->getMessage()
186  << " ------- " << theDiffQReport->getStatus()
187  << " ------- " << setprecision(3) << theDiffQReport->getQTresult();
188  vector<dqm::me_util::Channel> badChannels = theDiffQReport->getBadChannels();
189  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
190  channel != badChannels.end(); channel++) {
191  LogVerbatim(metname_) << "layer: " << (*hDiff).first << " Bad channel: "
192  << (*channel).getBin() << " Contents : "
193  << (*channel).getContents();
194 
195  //wheelSummary_[(*hDiff).first.wheel()]->Fill(xBin,(*hDiff).first.sector());
196  }
197  }
198 
199  }
200 
201 }
const std::vector< DQMChannel > & getBadChannels() const
Definition: QReport.h:33
std::string metname_
std::map< int, MonitorElement * > wheelSummary_
std::string t0TestName_
const std::string & getMessage() const
get message attached to test
Definition: QReport.h:24
std::map< DTLayerId, MonitorElement * > t0DiffHistos_
int getStatus() const
get test status (see Core/interface/QTestStatus.h)
Definition: QReport.h:16
float getQTresult() const
get test result i.e. prob value
Definition: QReport.h:20

Member Data Documentation

DQMStore* DTt0DBValidation::dbe_
private

Definition at line 50 of file DTt0DBValidation.h.

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

Definition at line 64 of file DTt0DBValidation.h.

std::string DTt0DBValidation::labelDB_
private

Definition at line 55 of file DTt0DBValidation.h.

std::string DTt0DBValidation::labelDBRef_
private

Definition at line 54 of file DTt0DBValidation.h.

std::string DTt0DBValidation::metname_
private

Definition at line 52 of file DTt0DBValidation.h.

std::string DTt0DBValidation::outputFileName_
private

Definition at line 59 of file DTt0DBValidation.h.

bool DTt0DBValidation::outputMEsInRootFile_
private

Definition at line 58 of file DTt0DBValidation.h.

std::map<DTLayerId, MonitorElement* > DTt0DBValidation::t0DiffHistos_
private

Definition at line 75 of file DTt0DBValidation.h.

std::map<DTWireId, std::vector<float> > DTt0DBValidation::t0Map_
private

Definition at line 72 of file DTt0DBValidation.h.

std::map<DTWireId, std::vector<float> > DTt0DBValidation::t0RefMap_
private

Definition at line 71 of file DTt0DBValidation.h.

std::string DTt0DBValidation::t0TestName_
private

Definition at line 61 of file DTt0DBValidation.h.

const DTT0* DTt0DBValidation::tZeroMap_
private

Definition at line 67 of file DTt0DBValidation.h.

const DTT0* DTt0DBValidation::tZeroRefMap_
private

Definition at line 68 of file DTt0DBValidation.h.

std::map<int, MonitorElement* > DTt0DBValidation::wheelSummary_
private

Definition at line 78 of file DTt0DBValidation.h.