CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
void beginRun (const edm::Run &run, const edm::EventSetup &setup)
 Operations. More...
 
 DTt0DBValidation (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob ()
 
void endRun (edm::Run const &, edm::EventSetup const &)
 
virtual ~DTt0DBValidation ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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

Date:
2011/08/06 13:37:52
Revision:
1.5
Author
G. Mila - INFN Torino

Definition at line 33 of file DTt0DBValidation.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 40 of file DTt0DBValidation.cc.

References dbe_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), cppFunctionSkipper::operator, DQMStore::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

40  {
41 
42  metname_ = "InterChannelSynchDBValidation";
43  LogVerbatim(metname_) << "[DTt0DBValidation] Constructor called!";
44 
45  // Get the DQM needed services
47  dbe_->setCurrentFolder("DT/DtCalib/InterChannelSynchDBValidation");
48 
49  // Get dataBase label
50  labelDBRef_ = pset.getParameter<string>("labelDBRef");
51  labelDB_ = pset.getParameter<string>("labelDB");
52 
53  t0TestName_ = "t0DifferenceInRange";
54  if( pset.exists("t0TestName") ) t0TestName_ = pset.getParameter<string>("t0TestName");
55 
56  outputMEsInRootFile_ = false;
57  if( pset.exists("OutputFileName") ){
58  outputMEsInRootFile_ = true;
59  outputFileName_ = pset.getParameter<std::string>("OutputFileName");
60  }
61 }
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_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
DTt0DBValidation::~DTt0DBValidation ( )
virtual

Destructor.

Definition at line 64 of file DTt0DBValidation.cc.

64 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 46 of file DTt0DBValidation.h.

46 {}
void DTt0DBValidation::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
virtual

Operations.

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file DTt0DBValidation.cc.

References bookHistos(), DTTimeUnits::counts, DTTopology::firstChannel(), edm::EventSetup::get(), DTTopology::lastChannel(), LogTrace, Association::map, and tzero.

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

Definition at line 211 of file DTt0DBValidation.cc.

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

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

Definition at line 241 of file DTt0DBValidation.cc.

References DQMStore::book2D(), dbe_, MonitorElement::setBinLabel(), and DQMStore::setCurrentFolder().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 205 of file DTt0DBValidation.cc.

References dbe_, and DQMStore::save().

205  {
206  // Write the histos on a file
208 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2118
std::string outputFileName_
void DTt0DBValidation::endRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 170 of file DTt0DBValidation.cc.

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

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

Member Data Documentation

DQMStore* DTt0DBValidation::dbe_
private

Definition at line 52 of file DTt0DBValidation.h.

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

Definition at line 66 of file DTt0DBValidation.h.

std::string DTt0DBValidation::labelDB_
private

Definition at line 57 of file DTt0DBValidation.h.

std::string DTt0DBValidation::labelDBRef_
private

Definition at line 56 of file DTt0DBValidation.h.

std::string DTt0DBValidation::metname_
private

Definition at line 54 of file DTt0DBValidation.h.

std::string DTt0DBValidation::outputFileName_
private

Definition at line 61 of file DTt0DBValidation.h.

bool DTt0DBValidation::outputMEsInRootFile_
private

Definition at line 60 of file DTt0DBValidation.h.

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

Definition at line 77 of file DTt0DBValidation.h.

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

Definition at line 74 of file DTt0DBValidation.h.

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

Definition at line 73 of file DTt0DBValidation.h.

std::string DTt0DBValidation::t0TestName_
private

Definition at line 63 of file DTt0DBValidation.h.

const DTT0* DTt0DBValidation::tZeroMap_
private

Definition at line 69 of file DTt0DBValidation.h.

const DTT0* DTt0DBValidation::tZeroRefMap_
private

Definition at line 70 of file DTt0DBValidation.h.

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

Definition at line 80 of file DTt0DBValidation.h.