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:
DQMEDHarvester edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 DTtTrigCalibrationTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTtTrigCalibrationTest ()
 Destructor. More...
 
- Public Member Functions inherited from DQMEDHarvester
virtual void analyze (edm::Event const &, edm::EventSetup const &) final
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
 DQMEDHarvester (void)
 
virtual void endJob () final
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun. More...
 
void bookHistos (DQMStore::IBooker &, const DTChamberId &ch)
 book the new ME More...
 
void bookHistos (DQMStore::IBooker &, const DTChamberId &ch, int wh)
 book the summary histograms More...
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &)
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 DQM Client Diagnostic. More...
 
std::string getMEName (const DTSuperLayerId &slID)
 Get the ME name. More...
 
- Protected Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

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::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 46 of file DTtTrigCalibrationTest.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 40 of file DTtTrigCalibrationTest.cc.

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

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

Destructor.

Definition at line 55 of file DTtTrigCalibrationTest.cc.

References cmsHarvester::nevents.

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

Member Function Documentation

void DTtTrigCalibrationTest::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

BeginRun.

Reimplemented from DQMEDHarvester.

Definition at line 64 of file DTtTrigCalibrationTest.cc.

References edm::EventSetup::get(), and cmsHarvester::nevents.

64  {
65 
66  edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: BeginRun";
67 
68  nevents = 0;
69 
70  // Get the geometry
71  context.get<MuonGeometryRecord>().get(muonGeom);
72 
73 }
edm::ESHandle< DTGeometry > muonGeom
void DTtTrigCalibrationTest::bookHistos ( DQMStore::IBooker ibooker,
const DTChamberId ch 
)
protected

book the new ME

Definition at line 204 of file DTtTrigCalibrationTest.cc.

References DQMStore::IBooker::book1D(), hltbtagharvestinganalyzer_cfi::histoName, mergeVDriftHistosByStation::histos, DetId::rawId(), DTChamberId::sector(), DQMStore::IBooker::setCurrentFolder(), DTChamberId::station(), relativeConstraints::station, and DTChamberId::wheel().

204  {
205 
206  stringstream wheel; wheel << ch.wheel();
207  stringstream station; station << ch.station();
208  stringstream sector; sector << ch.sector();
209 
210  string histoName = "tTrigTest_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
211  ibooker.setCurrentFolder("DT/Tests/DTtTrigCalibration");
212 
213  histos[ch.rawId()] = ibooker.book1D(histoName.c_str(),histoName.c_str(),3,0,2);
214 
215 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
std::map< uint32_t, MonitorElement * > histos
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
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 DTtTrigCalibrationTest::bookHistos ( DQMStore::IBooker ibooker,
const DTChamberId ch,
int  wh 
)
protected

book the summary histograms

Definition at line 217 of file DTtTrigCalibrationTest.cc.

References DQMStore::IBooker::book2D(), hltbtagharvestinganalyzer_cfi::histoName, MonitorElement::setBinLabel(), and DQMStore::IBooker::setCurrentFolder().

217  {
218 
219  ibooker.setCurrentFolder("DT/Tests/DTtTrigCalibration/SummaryPlot");
220 
221  if(wheelHistos.find(3) == wheelHistos.end()){
222  string histoName = "t_TrigSummary_testFailedByAtLeastBadSL";
223  wheelHistos[3] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2);
224  wheelHistos[3]->setBinLabel(1,"Sector1",1);
225  wheelHistos[3]->setBinLabel(1,"Sector1",1);
226  wheelHistos[3]->setBinLabel(2,"Sector2",1);
227  wheelHistos[3]->setBinLabel(3,"Sector3",1);
228  wheelHistos[3]->setBinLabel(4,"Sector4",1);
229  wheelHistos[3]->setBinLabel(5,"Sector5",1);
230  wheelHistos[3]->setBinLabel(6,"Sector6",1);
231  wheelHistos[3]->setBinLabel(7,"Sector7",1);
232  wheelHistos[3]->setBinLabel(8,"Sector8",1);
233  wheelHistos[3]->setBinLabel(9,"Sector9",1);
234  wheelHistos[3]->setBinLabel(10,"Sector10",1);
235  wheelHistos[3]->setBinLabel(11,"Sector11",1);
236  wheelHistos[3]->setBinLabel(12,"Sector12",1);
237  wheelHistos[3]->setBinLabel(13,"Sector13",1);
238  wheelHistos[3]->setBinLabel(14,"Sector14",1);
239  wheelHistos[3]->setBinLabel(1,"Wheel-2",2);
240  wheelHistos[3]->setBinLabel(2,"Wheel-1",2);
241  wheelHistos[3]->setBinLabel(3,"Wheel0",2);
242  wheelHistos[3]->setBinLabel(4,"Wheel+1",2);
243  wheelHistos[3]->setBinLabel(5,"Wheel+2",2);
244  }
245 
246  stringstream wheel; wheel <<wh;
247  string histoName = "t_TrigSummary_testFailed_W" + wheel.str();
248 
249  wheelHistos[wh] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
250  wheelHistos[wh]->setBinLabel(1,"Sector1",1);
251  wheelHistos[wh]->setBinLabel(2,"Sector2",1);
252  wheelHistos[wh]->setBinLabel(3,"Sector3",1);
253  wheelHistos[wh]->setBinLabel(4,"Sector4",1);
254  wheelHistos[wh]->setBinLabel(5,"Sector5",1);
255  wheelHistos[wh]->setBinLabel(6,"Sector6",1);
256  wheelHistos[wh]->setBinLabel(7,"Sector7",1);
257  wheelHistos[wh]->setBinLabel(8,"Sector8",1);
258  wheelHistos[wh]->setBinLabel(9,"Sector9",1);
259  wheelHistos[wh]->setBinLabel(10,"Sector10",1);
260  wheelHistos[wh]->setBinLabel(11,"Sector11",1);
261  wheelHistos[wh]->setBinLabel(12,"Sector12",1);
262  wheelHistos[wh]->setBinLabel(13,"Sector13",1);
263  wheelHistos[wh]->setBinLabel(14,"Sector14",1);
264  wheelHistos[wh]->setBinLabel(1,"MB1_SL1",2);
265  wheelHistos[wh]->setBinLabel(2,"MB1_SL2",2);
266  wheelHistos[wh]->setBinLabel(3,"MB1_SL3",2);
267  wheelHistos[wh]->setBinLabel(4,"MB2_SL1",2);
268  wheelHistos[wh]->setBinLabel(5,"MB2_SL2",2);
269  wheelHistos[wh]->setBinLabel(6,"MB2_SL3",2);
270  wheelHistos[wh]->setBinLabel(7,"MB3_SL1",2);
271  wheelHistos[wh]->setBinLabel(8,"MB3_SL2",2);
272  wheelHistos[wh]->setBinLabel(9,"MB3_SL3",2);
273  wheelHistos[wh]->setBinLabel(10,"MB4_SL1",2);
274  wheelHistos[wh]->setBinLabel(11,"MB4_SL3",2);
275 
276 }
std::map< int, MonitorElement * > wheelHistos
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
void DTtTrigCalibrationTest::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
protectedvirtual

Implements DQMEDHarvester.

Definition at line 170 of file DTtTrigCalibrationTest.cc.

170  {
171 
172  edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest] endjob called!";
173 
174 }
void DTtTrigCalibrationTest::dqmEndLuminosityBlock ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

DQM Client Diagnostic.

Reimplemented from DQMEDHarvester.

Definition at line 76 of file DTtTrigCalibrationTest.cc.

References bookHistos(), DTTimeUnits::counts, edm::EventSetup::get(), DQMStore::IGetter::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().

77  {
78 
79  edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: End of LS transition, performing the DQM client operation";
80 
81  // counts number of lumiSegs
82  nLumiSegs = lumiSeg.id().luminosityBlock();
83 
84  // prescale factor
85  if ( nLumiSegs%prescaleFactor != 0 ) return;
86 
87  for(map<int, MonitorElement*> ::const_iterator histo = wheelHistos.begin();
88  histo != wheelHistos.end();
89  histo++) {
90  (*histo).second->Reset();
91  }
92 
93  edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: "<<nLumiSegs<<" updates";
94 
95  context.get<DTTtrigRcd>().get(tTrigMap);
96  float tTrig, tTrigRMS,kFactor;
97 
98  map <pair<int,int>, int> cmsHistos;
99  cmsHistos.clear();
100  map <pair<int,int>, bool> filled;
101  for(int i=-2; i<3; i++){
102  for(int j=1; j<15; j++){
103  filled[make_pair(i,j)]=false;
104  }
105  }
106 
107  vector<const DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
108  vector<const DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
109  for (; ch_it != ch_end; ++ch_it) {
110 
111  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
112  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
113  for(; sl_it != sl_end; ++sl_it) {
114 
115  DTSuperLayerId slID = (*sl_it)->id();
116 
117  MonitorElement * tb_histo = igetter.get(getMEName(slID));
118  if (tb_histo) {
119 
120  edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: I've got the histo!!";
121 
122  TH1F * tb_histo_root = tb_histo->getTH1F();
123 
124  pair<double, double> meanAndSigma = theFitter->fitTimeBox(tb_histo_root);
125 
126  // ttrig and rms are counts
127  tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts );
128 
129  if (histos.find((*ch_it)->id().rawId()) == histos.end()) bookHistos(ibooker,(*ch_it)->id());
130  histos.find((*ch_it)->id().rawId())->second->setBinContent(slID.superLayer(), meanAndSigma.first-tTrig);
131 
132  }
133  }
134 
135  if (histos.find((*ch_it)->id().rawId()) != histos.end()) {
136  string criterionName = parameters.getUntrackedParameter<string>("tTrigTestName","tTrigOffSet");
137  const QReport * theQReport = histos.find((*ch_it)->id().rawId())->second->getQReport(criterionName);
138  if(theQReport) {
139  vector<dqm::me_util::Channel> badChannels = theQReport->getBadChannels();
140  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
141  channel != badChannels.end(); channel++) {
142  edm::LogError ("tTrigCalibration") <<"Chamber ID : "<<(*ch_it)->id()<<" Bad channels: "<<(*channel).getBin()<<" "<<(*channel).getContents();
143 
144  if(wheelHistos.find((*ch_it)->id().wheel()) == wheelHistos.end()) bookHistos(ibooker,(*ch_it)->id(), (*ch_it)->id().wheel());
145  // fill the wheel summary histos if the SL has not passed the test
146  if(!((*ch_it)->id().station() == 4 && (*channel).getBin() == 3))
147  wheelHistos[(*ch_it)->id().wheel()]->Fill((*ch_it)->id().sector()-1,((*channel).getBin()-1)+3*((*ch_it)->id().station()-1));
148  else
149  wheelHistos[(*ch_it)->id().wheel()]->Fill((*ch_it)->id().sector()-1,10);
150  // fill the cms summary histo if the percentual of SL which have not passed the test
151  // is more than a predefined treshold
152  cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]++;
153  if(((*ch_it)->id().sector()<13 &&
154  double(cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())])/11>double(percentual)/100 &&
155  filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]==false) ||
156  ((*ch_it)->id().sector()>=13 &&
157  double(cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())])/2>double(percentual)/100 &&
158  filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]==false)){
159  filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]=true;
160  wheelHistos[3]->Fill((*ch_it)->id().sector()-1,(*ch_it)->id().wheel());
161  }
162  }
163  }
164  }
165 
166  }
167 
168 }
T getUntrackedParameter(std::string const &, T const &) const
std::string getMEName(const DTSuperLayerId &slID)
Get the ME name.
int i
Definition: DBlmapReader.cc:9
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
void bookHistos(DQMStore::IBooker &, 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
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 179 of file DTtTrigCalibrationTest.cc.

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

179  {
180 
181  stringstream wheel; wheel << slID.wheel();
182  stringstream station; station << slID.station();
183  stringstream sector; sector << slID.sector();
184  stringstream superLayer; superLayer << slID.superlayer();
185 
186  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
187  string folderTag = parameters.getUntrackedParameter<string>("folderTag", "TimeBoxes");
188  string folderName =
189  folderRoot + "DT/DTDigiTask/Wheel" + wheel.str() +
190  "/Station" + station.str() +
191  "/Sector" + sector.str() + "/" + folderTag + "/";
192 
193  string histoTag = parameters.getUntrackedParameter<string>("histoTag", "TimeBox");
194  string histoname = folderName + histoTag
195  + "_W" + wheel.str()
196  + "_St" + station.str()
197  + "_Sec" + sector.str()
198  + "_SL" + superLayer.str();
199 
200  return histoname;
201 
202 }
T getUntrackedParameter(std::string const &, T const &) const
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

Member Data Documentation

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

Definition at line 88 of file DTtTrigCalibrationTest.h.

int DTtTrigCalibrationTest::nevents
private

Definition at line 81 of file DTtTrigCalibrationTest.h.

unsigned int DTtTrigCalibrationTest::nLumiSegs
private

Definition at line 82 of file DTtTrigCalibrationTest.h.

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

Definition at line 85 of file DTtTrigCalibrationTest.h.

int DTtTrigCalibrationTest::prescaleFactor
private

Definition at line 83 of file DTtTrigCalibrationTest.h.

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

Definition at line 91 of file DTtTrigCalibrationTest.h.

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

Definition at line 89 of file DTtTrigCalibrationTest.h.

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

Definition at line 97 of file DTtTrigCalibrationTest.h.