test
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
DTLocalTriggerTest Class Reference

#include <DTLocalTriggerTest.h>

Inheritance diagram for DTLocalTriggerTest:
DTLocalTriggerBaseTest DQMEDHarvester edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 DTLocalTriggerTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTLocalTriggerTest ()
 Destructor. More...
 
- Public Member Functions inherited from DTLocalTriggerBaseTest
 DTLocalTriggerBaseTest ()
 Constructor. More...
 
virtual ~DTLocalTriggerBaseTest ()
 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
 
- 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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 Bookings (DQMStore::IBooker &, DQMStore::IGetter &)
 
void fillGlobalSummary (DQMStore::IGetter &)
 
void runClientDiagnostic (DQMStore::IBooker &, DQMStore::IGetter &)
 Run client analysis. More...
 
- Protected Member Functions inherited from DTLocalTriggerBaseTest
void bookCmsHistos (DQMStore::IBooker &, std::string hTag, std::string folder="", bool isGlb=false)
 Book the new MEs (CMS summary) More...
 
void bookSectorHistos (DQMStore::IBooker &, int wheel, int sector, std::string hTag, std::string folder="")
 Book the new MEs (for each sector) More...
 
void bookWheelHistos (DQMStore::IBooker &, int wheel, std::string hTag, std::string folder="")
 Book the new MEs (for each wheel) More...
 
std::string category ()
 Get message logger name. More...
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &)
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 Perform client diagnostic in online. More...
 
void endRun (edm::Run const &run, edm::EventSetup const &context)
 Perform client diagnostic in offline. More...
 
std::string fullName (std::string htype)
 Create fullname from histo partial name. More...
 
template<class T >
TgetHisto (MonitorElement *me)
 Convert ME to Histogram fo type T. More...
 
std::string getMEName (std::string histoTag, std::string subfolder, const DTChamberId &chambid)
 Get the ME name (by chamber) More...
 
std::string getMEName (std::string histoTag, std::string subfolder, int wh)
 Get the ME name (by wheel) More...
 
std::pair< float, float > phiRange (const DTChamberId &id)
 Calculate phi range for histograms. More...
 
void setConfig (const edm::ParameterSet &ps, std::string name)
 Set configuration variables. More...
 
std::string & topFolder (bool isTM)
 Get top folder name. More...
 
- 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

bool bookingdone
 
int nMinEvts
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from DTLocalTriggerBaseTest
std::string baseFolderDDU
 
std::string baseFolderTM
 
std::map< std::string,
MonitorElement * > 
cmsME
 
std::string hwSource
 
std::vector< std::string > hwSources
 
edm::ESHandle< DTGeometrymuonGeom
 
int nevents
 
unsigned int nLumiSegs
 
edm::ParameterSet parameters
 
int prescaleFactor
 
int run
 
bool runOnline
 
std::map< int, std::map
< std::string, MonitorElement * > > 
secME
 
std::string sourceFolder
 
std::string testName
 
std::string trigSource
 
std::vector< std::string > trigSources
 
std::map< int, std::map
< std::string, MonitorElement * > > 
whME
 

Detailed Description

Definition at line 18 of file DTLocalTriggerTest.h.

Constructor & Destructor Documentation

DTLocalTriggerTest::DTLocalTriggerTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 37 of file DTLocalTriggerTest.cc.

References edm::ParameterSet::getUntrackedParameter().

37  {
38 
39  setConfig(ps,"DTLocalTrigger");
40  baseFolderTM = "DT/03-LocalTrigger-TM/";
41  baseFolderDDU = "DT/04-LocalTrigger-DDU/";
42  nMinEvts = ps.getUntrackedParameter<int>("nEventsCert", 5000);
43 
44  bookingdone = 0;
45 
46 }
T getUntrackedParameter(std::string const &, T const &) const
void setConfig(const edm::ParameterSet &ps, std::string name)
Set configuration variables.
DTLocalTriggerTest::~DTLocalTriggerTest ( )
virtual

Destructor.

Definition at line 49 of file DTLocalTriggerTest.cc.

49  {
50 
51 }

Member Function Documentation

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

BeginRun.

Reimplemented from DTLocalTriggerBaseTest.

Definition at line 138 of file DTLocalTriggerTest.cc.

References DTLocalTriggerBaseTest::beginRun().

138  {
139 
141 
142 }
void beginRun(edm::Run const &run, edm::EventSetup const &context)
BeginRun.
void DTLocalTriggerTest::Bookings ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
protected

Definition at line 54 of file DTLocalTriggerTest.cc.

References HLT_25ns10e33_v2_cff::parameters.

54  {
55 
56  vector<string>::const_iterator iTr = trigSources.begin();
57  vector<string>::const_iterator trEnd = trigSources.end();
58  vector<string>::const_iterator iHw = hwSources.begin();
59  vector<string>::const_iterator hwEnd = hwSources.end();
60 
61  //Booking
62  if(parameters.getUntrackedParameter<bool>("staticBooking", true)){
63  for (; iTr != trEnd; ++iTr){
64  trigSource = (*iTr);
65  for (; iHw != hwEnd; ++iHw){
66  hwSource = (*iHw);
67  // Loop over the TriggerUnits
68  for (int wh=-2; wh<=2; ++wh){
69  if (hwSource=="COM") {
70 
71  bookWheelHistos(ibooker,wh,"MatchingPhi");
72  }
73  else {
74  for (int sect=1; sect<=12; ++sect){
75 
76  bookSectorHistos(ibooker,wh,sect,"BXDistribPhi");
77  bookSectorHistos(ibooker,wh,sect,"QualDistribPhi");
78  }
79 
80  bookWheelHistos(ibooker,wh,"CorrectBXPhi");
81  bookWheelHistos(ibooker,wh,"ResidualBXPhi");
82  bookWheelHistos(ibooker,wh,"CorrFractionPhi");
83  bookWheelHistos(ibooker,wh,"2ndFractionPhi");
84  bookWheelHistos(ibooker,wh,"TriggerInclusivePhi");
85  bookWheelHistos(ibooker,wh,"CorrectBXTheta");
86  // Changed after TM implementation, now we have always Theta information
87  // Changed 11/10/2916 M.C Fouz
88  /*
89  if (hwSource=="DDU") {
90  bookWheelHistos(ibooker,wh,"HFractionTheta");
91  }
92  */
93  bookWheelHistos(ibooker,wh,"HFractionTheta");
94  }
95  }
96  }
97  }
98  }
99  // Summary test histo booking (only static)
100  for (iTr = trigSources.begin(); iTr != trEnd; ++iTr){
101  trigSource = (*iTr);
102  for (iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
103  hwSource = (*iHw);
104  // Loop over the TriggerUnits
105  for (int wh=-2; wh<=2; ++wh){
106  if (hwSource=="COM") {
107 
108  bookWheelHistos(ibooker,wh,"MatchingSummary","Summaries");
109  }
110  else {
111 
112  bookWheelHistos(ibooker,wh,"CorrFractionSummary","Summaries");
113  bookWheelHistos(ibooker,wh,"2ndFractionSummary","Summaries");
114  }
115  }
116  if (hwSource=="COM") {
117 
118  bookCmsHistos(ibooker,"MatchingSummary","Summaries");
119  }
120  else {
121 
122  bookCmsHistos(ibooker,"CorrFractionSummary");
123  bookCmsHistos(ibooker,"2ndFractionSummary");
124  }
125  if (hwSource=="TM") {
126 
127  bookCmsHistos(ibooker,"TrigGlbSummary","",true);
128  bookCmsHistos(ibooker,"TrigGlbSummary","",true);
129  }
130 
131  }
132  }
133 
134  bookingdone = 1;
135 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > trigSources
void bookSectorHistos(DQMStore::IBooker &, int wheel, int sector, std::string hTag, std::string folder="")
Book the new MEs (for each sector)
std::vector< std::string > hwSources
void bookWheelHistos(DQMStore::IBooker &, int wheel, std::string hTag, std::string folder="")
Book the new MEs (for each wheel)
void bookCmsHistos(DQMStore::IBooker &, std::string hTag, std::string folder="", bool isGlb=false)
Book the new MEs (CMS summary)
void DTLocalTriggerTest::fillGlobalSummary ( DQMStore::IGetter igetter)
protected

Definition at line 421 of file DTLocalTriggerTest.cc.

References python.rootplot.argparse::category, corr, newFWLiteAna::fullName, DQMStore::IGetter::get(), MonitorElement::getBinContent(), MonitorElement::getFloatValue(), LogTrace, lumiPlot::lut, edm::min(), and edm::second().

421  {
422 
423  float glbPerc[5] = { 1., 0.9, 0.6, 0.3, 0.01 };
424  trigSource = "";
425  hwSource = "TM";
426 
427  int nSecReadout = 0;
428 
429  for (int wh=-2; wh<=2; ++wh) {
430  for (int sect=1; sect<=12; ++sect) {
431 
432  float maxErr = 8.;
433  int corr = cmsME.find(fullName("CorrFractionSummary"))->second->getBinContent(sect,wh+3);
434  int second = cmsME.find(fullName("2ndFractionSummary"))->second->getBinContent(sect,wh+3);
435  int lut=0;
436  MonitorElement * lutsME = igetter.get(topFolder(hwSource=="TM") + "Summaries/TrigLutSummary");
437  if (lutsME) {
438  lut = lutsME->getBinContent(sect,wh+3);
439  maxErr+=4;
440  } else {
441  LogTrace(category()) << "[" << testName
442  << "Test]: TM Lut test Summary histo not found." << endl;
443  }
444  (corr <5 || second<5) && nSecReadout++;
445  int errcode = ((corr<5 ? corr : 4) + (second<5 ? second : 4) + (lut<5 ? lut : 4) );
446  errcode = min(int((errcode/maxErr + 0.01)*5),5);
447  cmsME.find("TrigGlbSummary")->second->setBinContent(sect,wh+3,glbPerc[errcode]);
448 
449  }
450  }
451 
452  if (!nSecReadout)
453  cmsME.find("TrigGlbSummary")->second->Reset(); // white histo id TM is not RO
454 
455  string nEvtsName = "DT/EventInfo/Counters/nProcessedEventsTrigger";
456  MonitorElement * meProcEvts = igetter.get(nEvtsName);
457 
458  if (meProcEvts) {
459  int nProcEvts = meProcEvts->getFloatValue();
460  cmsME.find("TrigGlbSummary")->second->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
461  } else {
462  cmsME.find("TrigGlbSummary")->second->setEntries(nMinEvts + 1);
463  LogVerbatim (category()) << "[" << testName
464  << "Test]: ME: " << nEvtsName << " not found!" << endl;
465  }
466 
467 }
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:304
U second(std::pair< T, U > const &p)
double getFloatValue(void) const
tuple lut
Definition: lumiPlot.py:244
T min(T a, T b)
Definition: MathUtil.h:58
#define LogTrace(id)
JetCorrectorParameters corr
Definition: classes.h:5
std::string category()
Get message logger name.
std::string & topFolder(bool isTM)
Get top folder name.
double getBinContent(int binx) const
get content of bin (1-D)
std::map< std::string, MonitorElement * > cmsME
std::string fullName(std::string htype)
Create fullname from histo partial name.
void DTLocalTriggerTest::runClientDiagnostic ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
protectedvirtual

Run client analysis.

Implements DTLocalTriggerBaseTest.

Definition at line 144 of file DTLocalTriggerTest.cc.

References rpcdqm::BX, end, spr::find(), newFWLiteAna::fullName, DQMStore::IGetter::get(), and HLT_25ns10e33_v2_cff::parameters.

144  {
145 
146  if (!bookingdone) Bookings(ibooker,igetter);
147 
148  // Loop over Trig & Hw sources
149  for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
150  trigSource = (*iTr);
151 
152  for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
153  hwSource = (*iHw);
154  // Loop over the TriggerUnits
155  for (int stat=1; stat<=4; ++stat){
156  for (int wh=-2; wh<=2; ++wh){
157  for (int sect=1; sect<=12; ++sect){
158  DTChamberId chId(wh,stat,sect);
159  int sector_id = (wh+3)+(sect-1)*5;
160 
161  if (hwSource=="COM") {
162  // Perform TM-DDU matching test and generates summaries (Phi view)
163  TH2F * DDUvsTM = getHisto<TH2F>(igetter.get(getMEName("QualDDUvsQualTM","LocalTriggerPhiIn", chId)));
164  if (DDUvsTM) {
165 
166  int matchSummary = 1;
167 
168  if (DDUvsTM->GetEntries()>1) {
169 
170  double entries = DDUvsTM->GetEntries();
171  double corrEntries = 0;
172  for (int ibin=2; ibin<=8; ++ibin) {
173  corrEntries += DDUvsTM->GetBinContent(ibin,ibin);
174  }
175  double corrRatio = corrEntries/entries;
176 
177  if (corrRatio < parameters.getUntrackedParameter<double>("matchingFracError",.65)){
178  matchSummary = 2;
179  }
180  else if (corrRatio < parameters.getUntrackedParameter<double>("matchingFracWarning",.85)){
181  matchSummary = 3;
182  }
183  else {
184  matchSummary = 0;
185  }
186 
187  if( whME[wh].find(fullName("MatchingPhi")) == whME[wh].end() ){
188  bookWheelHistos(ibooker,wh,"MatchingPhi");
189  }
190 
191  whME[wh].find(fullName("MatchingPhi"))->second->setBinContent(sect,stat,corrRatio);
192 
193  }
194 
195  whME[wh].find(fullName("MatchingSummary"))->second->setBinContent(sect,stat,matchSummary);
196 
197  }
198  }
199  else {
200  // Changed by M.C.Fouz (11/10/2016)
201  // Perform TM/DDU common plot analysis (Phi ones)
202  // This was changed for DQM after TM IN but, in the Modules Source part, they are not defined as *_In
203  // and the histograms are not being filled, renamed with the same names as the modules
204  /*
205  TH2F * BXvsQual = getHisto<TH2F>(igetter.get(getMEName("BXvsQual_In","LocalTriggerPhiIn", chId)));
206  TH1F * BestQual = getHisto<TH1F>(igetter.get(getMEName("BestQual_In","LocalTriggerPhiIn", chId)));
207  TH2F * Flag1stvsQual = getHisto<TH2F>(igetter.get(getMEName("Flag1stvsQual_In","LocalTriggerPhiIn", chId)));
208  */
209  TH2F * BXvsQual = getHisto<TH2F>(igetter.get(getMEName("BXvsQual","LocalTriggerPhiIn", chId)));
210  TH1F * BestQual = getHisto<TH1F>(igetter.get(getMEName("BestQual","LocalTriggerPhiIn", chId)));
211  TH2F * Flag1stvsQual = getHisto<TH2F>(igetter.get(getMEName("Flag1stvsQual","LocalTriggerPhiIn", chId)));
212  if (BXvsQual && Flag1stvsQual && BestQual) {
213 
214  int corrSummary = 1;
215  int secondSummary = 1;
216 
217  if (BestQual->GetEntries()>1) {
218 
219  TH1D* BXHH = BXvsQual->ProjectionY("",6,7,"");
220  TH1D* Flag1st = Flag1stvsQual->ProjectionY();
221  int BXOK_bin = BXHH->GetEntries()>=1 ? BXHH->GetMaximumBin() : 51;
222  double BXMean = BXHH->GetEntries()>=1 ? BXHH->GetMean() : 51;
223  double BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
224  double trigsFlag2nd = Flag1st->GetBinContent(2);
225  double trigs = Flag1st->GetEntries();
226  double besttrigs = BestQual->GetEntries();
227  double besttrigsCorr = BestQual->Integral(5,7,"");
228  delete BXHH;
229  delete Flag1st;
230 
231  double corrFrac = besttrigsCorr/besttrigs;
232  double secondFrac = trigsFlag2nd/trigs;
233  if (corrFrac < parameters.getUntrackedParameter<double>("corrFracError",.5)){
234  corrSummary = 2;
235  }
236  else if (corrFrac < parameters.getUntrackedParameter<double>("corrFracWarning",.6)){
237  corrSummary = 3;
238  }
239  else {
240  corrSummary = 0;
241  }
242  if (secondFrac > parameters.getUntrackedParameter<double>("secondFracError",.2)){
243  secondSummary = 2;
244  }
245  else if (secondFrac > parameters.getUntrackedParameter<double>("secondFracWarning",.1)){
246  secondSummary = 3;
247  }
248  else {
249  secondSummary = 0;
250  }
251 
252  if( secME[sector_id].find(fullName("BXDistribPhi")) == secME[sector_id].end() ){
253  bookSectorHistos(ibooker,wh,sect,"QualDistribPhi");
254  bookSectorHistos(ibooker,wh,sect,"BXDistribPhi");
255  }
256 
257  TH1D* BXDistr = BXvsQual->ProjectionY();
258  TH1D* QualDistr = BXvsQual->ProjectionX();
259  std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
260 
261  int nbinsBX = BXDistr->GetNbinsX();
262  int firstBinCenter = static_cast<int>(BXDistr->GetBinCenter(1));
263  int lastBinCenter = static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
264  int iMin = firstBinCenter>-4 ? firstBinCenter : -4;
265  int iMax = lastBinCenter<20 ? lastBinCenter : 20;
266  for (int ibin=iMin+5;ibin<=iMax+5; ++ibin) {
267  innerME->find(fullName("BXDistribPhi"))->second->setBinContent(ibin,stat,BXDistr->GetBinContent(ibin-5-firstBinCenter+1));
268  }
269  for (int ibin=1;ibin<=7;++ibin) {
270  innerME->find(fullName("QualDistribPhi"))->second->setBinContent(ibin,stat,QualDistr->GetBinContent(ibin));
271  }
272 
273  delete BXDistr;
274  delete QualDistr;
275 
276  if( whME[wh].find(fullName("CorrectBXPhi")) == whME[wh].end() ){
277  bookWheelHistos(ibooker,wh,"ResidualBXPhi");
278  bookWheelHistos(ibooker,wh,"CorrectBXPhi");
279  bookWheelHistos(ibooker,wh,"CorrFractionPhi");
280  bookWheelHistos(ibooker,wh,"2ndFractionPhi");
281  bookWheelHistos(ibooker,wh,"TriggerInclusivePhi");
282  }
283 
284  innerME = &(whME[wh]);
285  innerME->find(fullName("CorrectBXPhi"))->second->setBinContent(sect,stat,BX_OK+0.00001);
286  innerME->find(fullName("ResidualBXPhi"))->second->setBinContent(sect,stat,round(25.*(BXMean-BX_OK))+0.00001);
287  innerME->find(fullName("CorrFractionPhi"))->second->setBinContent(sect,stat,corrFrac);
288  innerME->find(fullName("TriggerInclusivePhi"))->second->setBinContent(sect,stat,besttrigs);
289  innerME->find(fullName("2ndFractionPhi"))->second->setBinContent(sect,stat,secondFrac);
290 
291  }
292 
293  whME[wh].find(fullName("CorrFractionSummary"))->second->setBinContent(sect,stat,corrSummary);
294  whME[wh].find(fullName("2ndFractionSummary"))->second->setBinContent(sect,stat,secondSummary);
295 
296  }
297 
298  if (hwSource=="DDU") {
299  TH2F * ThetaBXvsQual = getHisto<TH2F>(igetter.get(getMEName("ThetaBXvsQual","LocalTriggerTheta", chId)));
300  TH1F * ThetaBestQual = getHisto<TH1F>(igetter.get(getMEName("ThetaBestQual","LocalTriggerTheta", chId)));
301 
302  // no theta triggers in stat 4!
303  if (ThetaBXvsQual && ThetaBestQual && stat<4 && ThetaBestQual->GetEntries()>1) {
304  TH1D* BXH = ThetaBXvsQual->ProjectionY("",4,4,"");
305  int BXOK_bin = BXH->GetEffectiveEntries()>=1 ? BXH->GetMaximumBin(): 10;
306  double BX_OK = ThetaBXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
307  double trigs = ThetaBestQual->GetEntries();
308  double trigsH = ThetaBestQual->GetBinContent(4);
309  delete BXH;
310 
311  if( whME[wh].find(fullName("HFractionTheta")) == whME[wh].end() ){
312  bookWheelHistos(ibooker,wh,"CorrectBXTheta");
313  bookWheelHistos(ibooker,wh,"HFractionTheta");
314  }
315  std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
316  innerME->find(fullName("CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
317  innerME->find(fullName("HFractionTheta"))->second->setBinContent(sect,stat,trigsH/trigs);
318 
319  }
320  }
321  else if (hwSource=="TM") {
322  // Perform TM plot analysis (Theta ones)
323  TH2F * ThetaPosvsBX = getHisto<TH2F>(igetter.get(getMEName("PositionvsBX","LocalTriggerTheta", chId)));
324 
325  // no theta triggers in stat 4!
326  if (ThetaPosvsBX && stat<4 && ThetaPosvsBX->GetEntries()>1) {
327  TH1D* BX = ThetaPosvsBX->ProjectionX();
328  int BXOK_bin = BX->GetEffectiveEntries()>=1 ? BX->GetMaximumBin(): 10;
329  double BX_OK = ThetaPosvsBX->GetXaxis()->GetBinCenter(BXOK_bin);
330  delete BX;
331 
332  if( whME[wh].find(fullName("CorrectBXTheta")) == whME[wh].end() ){
333  bookWheelHistos(ibooker,wh,"CorrectBXTheta");
334  }
335  std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
336  innerME->find(fullName("CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
337  }
338  // After TM the DDU is not used and the TM has information on the Theta Quality
339  // Adding trigger info to compute H fraction (11/10/2016) M.C.Fouz
340  TH2F * ThetaBXvsQual = getHisto<TH2F>(igetter.get(getMEName("ThetaBXvsQual","LocalTriggerTheta", chId)));
341  TH1F * ThetaBestQual = getHisto<TH1F>(igetter.get(getMEName("ThetaBestQual","LocalTriggerTheta", chId)));
342  if (ThetaBXvsQual && ThetaBestQual && stat<4 && ThetaBestQual->GetEntries()>1) {
343  double trigs = ThetaBestQual->GetEntries();
344  double trigsH = ThetaBestQual->GetBinContent(2); // Note that for the new plots H is at bin=2 and not 4 as in DDU!!!!
345  if( whME[wh].find(fullName("HFractionTheta")) == whME[wh].end() ){
346  bookWheelHistos(ibooker,wh,"HFractionTheta");
347  }
348  std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
349  innerME->find(fullName("HFractionTheta"))->second->setBinContent(sect,stat,trigsH/trigs);
350  }
351  // END ADDING H Fraction info
352  }
353  }
354 
355  }
356  }
357  }
358  }
359  }
360 
361 
362  for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
363  trigSource = (*iTr);
364  for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
365  hwSource = (*iHw);
366  for (int wh=-2; wh<=2; ++wh){
367  std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
368  if(hwSource=="COM") {
369  TH2F* matchWhSummary = getHisto<TH2F>(innerME->find(fullName("MatchingSummary"))->second);
370  for (int sect=1; sect<=12; ++sect){
371  int matchErr = 0;
372  int matchNoData = 0;
373  for (int stat=1; stat<=4; ++stat){
374  switch (static_cast<int>(matchWhSummary->GetBinContent(sect,stat))) {
375  case 1:
376  matchNoData++;
377  case 2:
378  matchErr++;
379  }
380  }
381  if (matchNoData == 4) matchErr = 5;
382  cmsME.find(fullName("MatchingSummary"))->second->setBinContent(sect,wh+3,matchErr);
383  }
384  }
385  else {
386  TH2F* corrWhSummary = getHisto<TH2F>(innerME->find(fullName("CorrFractionSummary"))->second);
387  TH2F* secondWhSummary = getHisto<TH2F>(innerME->find(fullName("2ndFractionSummary"))->second);
388  for (int sect=1; sect<=12; ++sect){
389  int corrErr = 0;
390  int secondErr = 0;
391  int corrNoData = 0;
392  int secondNoData = 0;
393  for (int stat=1; stat<=4; ++stat){
394  switch (static_cast<int>(corrWhSummary->GetBinContent(sect,stat))) {
395  case 1:
396  corrNoData++;
397  case 2:
398  corrErr++;
399  }
400  switch (static_cast<int>(secondWhSummary->GetBinContent(sect,stat))) {
401  case 1:
402  secondNoData++;
403  case 2:
404  secondErr++;
405  }
406  }
407  if (corrNoData == 4) corrErr = 5;
408  if (secondNoData == 4) secondErr = 5;
409  cmsME.find(fullName("CorrFractionSummary"))->second->setBinContent(sect,wh+3,corrErr);
410  cmsME.find(fullName("2ndFractionSummary"))->second->setBinContent(sect,wh+3,secondErr);
411  }
412  }
413  }
414  }
415  }
416 
417  fillGlobalSummary(igetter);
418 
419 }
std::map< int, std::map< std::string, MonitorElement * > > secME
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > trigSources
std::map< int, std::map< std::string, MonitorElement * > > whME
void Bookings(DQMStore::IBooker &, DQMStore::IGetter &)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:304
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
void fillGlobalSummary(DQMStore::IGetter &)
#define end
Definition: vmac.h:37
std::string getMEName(std::string histoTag, std::string subfolder, const DTChamberId &chambid)
Get the ME name (by chamber)
std::map< std::string, MonitorElement * > cmsME
void bookSectorHistos(DQMStore::IBooker &, int wheel, int sector, std::string hTag, std::string folder="")
Book the new MEs (for each sector)
std::vector< std::string > hwSources
void bookWheelHistos(DQMStore::IBooker &, int wheel, std::string hTag, std::string folder="")
Book the new MEs (for each wheel)
std::string fullName(std::string htype)
Create fullname from histo partial name.

Member Data Documentation

bool DTLocalTriggerTest::bookingdone
private

Definition at line 45 of file DTLocalTriggerTest.h.

int DTLocalTriggerTest::nMinEvts
private

Definition at line 43 of file DTLocalTriggerTest.h.