CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
DTtTrigCalibrationTest Class Reference

#include <DTtTrigCalibrationTest.h>

Inheritance diagram for DTtTrigCalibrationTest:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DTtTrigCalibrationTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTtTrigCalibrationTest ()
 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 ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginJob ()
 BeginJob. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun. More...
 
void bookHistos (const DTChamberId &ch)
 book the new ME More...
 
void bookHistos (const DTChamberId &ch, int wh)
 book the summary histograms More...
 
void endJob ()
 Endjob. More...
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 DQM Client Diagnostic. More...
 
std::string getMEName (const DTSuperLayerId &slID)
 Get the ME name. More...
 
- 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)
 

Private Attributes

DQMStoredbe
 
std::map< uint32_t,
MonitorElement * > 
histos
 
edm::ESHandle< DTGeometrymuonGeom
 
int nevents
 
unsigned int nLumiSegs
 
edm::ParameterSet parameters
 
int percentual
 
int prescaleFactor
 
int run
 
DTTimeBoxFittertheFitter
 
edm::ESHandle< DTTtrigtTrigMap
 
std::map< int, MonitorElement * > wheelHistos
 

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 &)
 

Detailed Description

Definition at line 41 of file DTtTrigCalibrationTest.h.

Constructor & Destructor Documentation

DTtTrigCalibrationTest::DTtTrigCalibrationTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 39 of file DTtTrigCalibrationTest.cc.

References cppFunctionSkipper::operator, Parameters::parameters, and dtDQMClient_cfg::prescaleFactor.

39  {
40 
41  edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: Constructor";
42 
43  parameters = ps;
44 
46 
47  theFitter = new DTTimeBoxFitter();
48 
49  prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 3);
50 
51  percentual = parameters.getUntrackedParameter<int>("BadSLpercentual", 10);
52 
53 }
T getUntrackedParameter(std::string const &, T const &) const
DTtTrigCalibrationTest::~DTtTrigCalibrationTest ( )
virtual

Destructor.

Definition at line 56 of file DTtTrigCalibrationTest.cc.

References nevents.

56  {
57 
58  edm::LogVerbatim ("tTrigCalibration") <<"DTtTrigCalibrationTest: analyzed " << nevents << " events";
59 
60  delete theFitter;
61 
62 }

Member Function Documentation

void DTtTrigCalibrationTest::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 93 of file DTtTrigCalibrationTest.cc.

References nevents.

93  {
94 
95  nevents++;
96  edm::LogVerbatim ("tTrigCalibration") << "[DTtTrigCalibrationTest]: "<<nevents<<" events";
97 
98 }
void DTtTrigCalibrationTest::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file DTtTrigCalibrationTest.cc.

References nevents.

65  {
66 
67  edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: BeginJob";
68 
69  nevents = 0;
70 
71 }
void DTtTrigCalibrationTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 83 of file DTtTrigCalibrationTest.cc.

References edm::LuminosityBlockBase::run(), and DTTTrigCorrFirst::run.

83  {
84 
85  edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: Begin of LS transition";
86 
87  // Get the run number
88  run = lumiSeg.run();
89 
90 }
void DTtTrigCalibrationTest::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 74 of file DTtTrigCalibrationTest.cc.

References edm::EventSetup::get().

74  {
75 
76  edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: BeginRun";
77 
78  // Get the geometry
79  context.get<MuonGeometryRecord>().get(muonGeom);
80 
81 }
edm::ESHandle< DTGeometry > muonGeom
void DTtTrigCalibrationTest::bookHistos ( const DTChamberId ch)
protected

book the new ME

Definition at line 242 of file DTtTrigCalibrationTest.cc.

References mergeVDriftHistosByStation::histos, DetId::rawId(), DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, and DTChamberId::wheel().

242  {
243 
244  stringstream wheel; wheel << ch.wheel();
245  stringstream station; station << ch.station();
246  stringstream sector; sector << ch.sector();
247 
248  string histoName = "tTrigTest_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
249 
250  dbe->setCurrentFolder("DT/Tests/DTtTrigCalibration");
251 
252  histos[ch.rawId()] = dbe->book1D(histoName.c_str(),histoName.c_str(),3,0,2);
253 
254 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
std::map< uint32_t, MonitorElement * > histos
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 DTtTrigCalibrationTest::bookHistos ( const DTChamberId ch,
int  wh 
)
protected

book the summary histograms

Definition at line 256 of file DTtTrigCalibrationTest.cc.

256  {
257 
258  dbe->setCurrentFolder("DT/Tests/DTtTrigCalibration/SummaryPlot");
259 
260  if(wheelHistos.find(3) == wheelHistos.end()){
261  string histoName = "t_TrigSummary_testFailedByAtLeastBadSL";
262  wheelHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2);
263  wheelHistos[3]->setBinLabel(1,"Sector1",1);
264  wheelHistos[3]->setBinLabel(1,"Sector1",1);
265  wheelHistos[3]->setBinLabel(2,"Sector2",1);
266  wheelHistos[3]->setBinLabel(3,"Sector3",1);
267  wheelHistos[3]->setBinLabel(4,"Sector4",1);
268  wheelHistos[3]->setBinLabel(5,"Sector5",1);
269  wheelHistos[3]->setBinLabel(6,"Sector6",1);
270  wheelHistos[3]->setBinLabel(7,"Sector7",1);
271  wheelHistos[3]->setBinLabel(8,"Sector8",1);
272  wheelHistos[3]->setBinLabel(9,"Sector9",1);
273  wheelHistos[3]->setBinLabel(10,"Sector10",1);
274  wheelHistos[3]->setBinLabel(11,"Sector11",1);
275  wheelHistos[3]->setBinLabel(12,"Sector12",1);
276  wheelHistos[3]->setBinLabel(13,"Sector13",1);
277  wheelHistos[3]->setBinLabel(14,"Sector14",1);
278  wheelHistos[3]->setBinLabel(1,"Wheel-2",2);
279  wheelHistos[3]->setBinLabel(2,"Wheel-1",2);
280  wheelHistos[3]->setBinLabel(3,"Wheel0",2);
281  wheelHistos[3]->setBinLabel(4,"Wheel+1",2);
282  wheelHistos[3]->setBinLabel(5,"Wheel+2",2);
283  }
284 
285  stringstream wheel; wheel <<wh;
286  string histoName = "t_TrigSummary_testFailed_W" + wheel.str();
287  wheelHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
288  wheelHistos[wh]->setBinLabel(1,"Sector1",1);
289  wheelHistos[wh]->setBinLabel(2,"Sector2",1);
290  wheelHistos[wh]->setBinLabel(3,"Sector3",1);
291  wheelHistos[wh]->setBinLabel(4,"Sector4",1);
292  wheelHistos[wh]->setBinLabel(5,"Sector5",1);
293  wheelHistos[wh]->setBinLabel(6,"Sector6",1);
294  wheelHistos[wh]->setBinLabel(7,"Sector7",1);
295  wheelHistos[wh]->setBinLabel(8,"Sector8",1);
296  wheelHistos[wh]->setBinLabel(9,"Sector9",1);
297  wheelHistos[wh]->setBinLabel(10,"Sector10",1);
298  wheelHistos[wh]->setBinLabel(11,"Sector11",1);
299  wheelHistos[wh]->setBinLabel(12,"Sector12",1);
300  wheelHistos[wh]->setBinLabel(13,"Sector13",1);
301  wheelHistos[wh]->setBinLabel(14,"Sector14",1);
302  wheelHistos[wh]->setBinLabel(1,"MB1_SL1",2);
303  wheelHistos[wh]->setBinLabel(2,"MB1_SL2",2);
304  wheelHistos[wh]->setBinLabel(3,"MB1_SL3",2);
305  wheelHistos[wh]->setBinLabel(4,"MB2_SL1",2);
306  wheelHistos[wh]->setBinLabel(5,"MB2_SL2",2);
307  wheelHistos[wh]->setBinLabel(6,"MB2_SL3",2);
308  wheelHistos[wh]->setBinLabel(7,"MB3_SL1",2);
309  wheelHistos[wh]->setBinLabel(8,"MB3_SL2",2);
310  wheelHistos[wh]->setBinLabel(9,"MB3_SL3",2);
311  wheelHistos[wh]->setBinLabel(10,"MB4_SL1",2);
312  wheelHistos[wh]->setBinLabel(11,"MB4_SL3",2);
313 
314 }
std::map< int, MonitorElement * > wheelHistos
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 DTtTrigCalibrationTest::endJob ( void  )
protectedvirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 205 of file DTtTrigCalibrationTest.cc.

205  {
206 
207  edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest] endjob called!";
208 
209  dbe->rmdir("DT/Tests/DTtTrigCalibration");
210 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2535
void DTtTrigCalibrationTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
protectedvirtual

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 101 of file DTtTrigCalibrationTest.cc.

References bookHistos(), DTTimeUnits::counts, edm::EventSetup::get(), MonitorElement::getTH1F(), timingPdfMaker::histo, mergeVDriftHistosByStation::histos, i, edm::LuminosityBlockBase::id(), j, edm::LuminosityBlockID::luminosityBlock(), Parameters::parameters, dtDQMClient_cfg::prescaleFactor, edm::second(), and DTSuperLayerId::superLayer().

101  {
102 
103 
104  // counts number of updats (online mode) or number of events (standalone mode)
105  //nevents++;
106  // if running in standalone perform diagnostic only after a reasonalbe amount of events
107  //if ( parameters.getUntrackedParameter<bool>("runningStandalone", false) &&
108  // nevents%parameters.getUntrackedParameter<int>("diagnosticPrescale", 1000) != 0 ) return;
109  //edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: "<<nevents<<" updates";
110 
111 
112  edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: End of LS transition, performing the DQM client operation";
113 
114  // counts number of lumiSegs
115  nLumiSegs = lumiSeg.id().luminosityBlock();
116 
117  // prescale factor
118  if ( nLumiSegs%prescaleFactor != 0 ) return;
119 
120  for(map<int, MonitorElement*> ::const_iterator histo = wheelHistos.begin();
121  histo != wheelHistos.end();
122  histo++) {
123  (*histo).second->Reset();
124  }
125 
126  edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: "<<nLumiSegs<<" updates";
127 
128  context.get<DTTtrigRcd>().get(tTrigMap);
129  float tTrig, tTrigRMS,kFactor;
130 
131  map <pair<int,int>, int> cmsHistos;
132  cmsHistos.clear();
133  map <pair<int,int>, bool> filled;
134  for(int i=-2; i<3; i++){
135  for(int j=1; j<15; j++){
136  filled[make_pair(i,j)]=false;
137  }
138  }
139 
140  vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
141  vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
142  for (; ch_it != ch_end; ++ch_it) {
143 
144  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
145  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
146  for(; sl_it != sl_end; ++sl_it) {
147 
148  DTSuperLayerId slID = (*sl_it)->id();
149 
150  MonitorElement * tb_histo = dbe->get(getMEName(slID));
151  if (tb_histo) {
152 
153  edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: I've got the histo!!";
154 
155  TH1F * tb_histo_root = tb_histo->getTH1F();
156 
157  pair<double, double> meanAndSigma = theFitter->fitTimeBox(tb_histo_root);
158 
159  // ttrig and rms are counts
160  tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts );
161 
162  if (histos.find((*ch_it)->id().rawId()) == histos.end()) bookHistos((*ch_it)->id());
163  histos.find((*ch_it)->id().rawId())->second->setBinContent(slID.superLayer(), meanAndSigma.first-tTrig);
164 
165  }
166  }
167 
168  if (histos.find((*ch_it)->id().rawId()) != histos.end()) {
169  string criterionName = parameters.getUntrackedParameter<string>("tTrigTestName","tTrigOffSet");
170  const QReport * theQReport = histos.find((*ch_it)->id().rawId())->second->getQReport(criterionName);
171  if(theQReport) {
172  vector<dqm::me_util::Channel> badChannels = theQReport->getBadChannels();
173  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
174  channel != badChannels.end(); channel++) {
175  edm::LogError ("tTrigCalibration") <<"Chamber ID : "<<(*ch_it)->id()<<" Bad channels: "<<(*channel).getBin()<<" "<<(*channel).getContents();
176  if(wheelHistos.find((*ch_it)->id().wheel()) == wheelHistos.end()) bookHistos((*ch_it)->id(), (*ch_it)->id().wheel());
177  // fill the wheel summary histos if the SL has not passed the test
178  if(!((*ch_it)->id().station() == 4 && (*channel).getBin() == 3))
179  wheelHistos[(*ch_it)->id().wheel()]->Fill((*ch_it)->id().sector()-1,((*channel).getBin()-1)+3*((*ch_it)->id().station()-1));
180  else
181  wheelHistos[(*ch_it)->id().wheel()]->Fill((*ch_it)->id().sector()-1,10);
182  // fill the cms summary histo if the percentual of SL which have not passed the test
183  // is more than a predefined treshold
184  cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]++;
185  if(((*ch_it)->id().sector()<13 &&
186  double(cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())])/11>double(percentual)/100 &&
187  filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]==false) ||
188  ((*ch_it)->id().sector()>=13 &&
189  double(cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())])/2>double(percentual)/100 &&
190  filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]==false)){
191  filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]=true;
192  wheelHistos[3]->Fill((*ch_it)->id().sector()-1,(*ch_it)->id().wheel());
193  }
194  }
195  // FIXME: getMessage() sometimes returns and invalid string (null pointer inside QReport data member)
196  // edm::LogWarning ("tTrigCalibration") <<"-------- "<<theQReport->getMessage()<<" ------- "<<theQReport->getStatus();
197  }
198  }
199 
200  }
201 
202 }
T getUntrackedParameter(std::string const &, T const &) const
std::string getMEName(const DTSuperLayerId &slID)
Get the ME name.
int i
Definition: DBlmapReader.cc:9
void bookHistos(const DTChamberId &ch)
book the new ME
U second(std::pair< T, U > const &p)
std::map< int, MonitorElement * > wheelHistos
edm::ESHandle< DTTtrig > tTrigMap
int superLayer() const
Return the superlayer number.
int j
Definition: DBlmapReader.cc:9
std::map< uint32_t, MonitorElement * > histos
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
edm::ESHandle< DTGeometry > muonGeom
TH1F * getTH1F(void) const
std::pair< double, double > fitTimeBox(TH1F *hTimeBox)
Fit the rising edge of the time box returning mean value and sigma (first and second respectively) ...
string DTtTrigCalibrationTest::getMEName ( const DTSuperLayerId slID)
protected

Get the ME name.

Definition at line 215 of file DTtTrigCalibrationTest.cc.

References Parameters::parameters, DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), and DTChamberId::wheel().

215  {
216 
217  stringstream wheel; wheel << slID.wheel();
218  stringstream station; station << slID.station();
219  stringstream sector; sector << slID.sector();
220  stringstream superLayer; superLayer << slID.superlayer();
221 
222  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
223  string folderTag = parameters.getUntrackedParameter<string>("folderTag", "TimeBoxes");
224  string folderName =
225  folderRoot + "DT/DTDigiTask/Wheel" + wheel.str() +
226  "/Station" + station.str() +
227  "/Sector" + sector.str() + "/" + folderTag + "/";
228 
229  string histoTag = parameters.getUntrackedParameter<string>("histoTag", "TimeBox");
230  string histoname = folderName + histoTag
231  + "_W" + wheel.str()
232  + "_St" + station.str()
233  + "_Sec" + sector.str()
234  + "_SL" + superLayer.str();
235 
236  return histoname;
237 
238 }
T getUntrackedParameter(std::string const &, T const &) const
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

Member Data Documentation

DQMStore* DTtTrigCalibrationTest::dbe
private

Definition at line 90 of file DTtTrigCalibrationTest.h.

std::map< uint32_t , MonitorElement* > DTtTrigCalibrationTest::histos
private
edm::ESHandle<DTGeometry> DTtTrigCalibrationTest::muonGeom
private

Definition at line 93 of file DTtTrigCalibrationTest.h.

int DTtTrigCalibrationTest::nevents
private

Definition at line 84 of file DTtTrigCalibrationTest.h.

unsigned int DTtTrigCalibrationTest::nLumiSegs
private

Definition at line 85 of file DTtTrigCalibrationTest.h.

edm::ParameterSet DTtTrigCalibrationTest::parameters
private
int DTtTrigCalibrationTest::percentual
private

Definition at line 88 of file DTtTrigCalibrationTest.h.

int DTtTrigCalibrationTest::prescaleFactor
private

Definition at line 86 of file DTtTrigCalibrationTest.h.

int DTtTrigCalibrationTest::run
private
DTTimeBoxFitter* DTtTrigCalibrationTest::theFitter
private

Definition at line 96 of file DTtTrigCalibrationTest.h.

edm::ESHandle<DTTtrig> DTtTrigCalibrationTest::tTrigMap
private

Definition at line 94 of file DTtTrigCalibrationTest.h.

std::map< int, MonitorElement* > DTtTrigCalibrationTest::wheelHistos
private

Definition at line 102 of file DTtTrigCalibrationTest.h.