CMS 3D CMS Logo

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

#include <DTLocalTriggerTest.h>

Inheritance diagram for DTLocalTriggerTest:
DTLocalTriggerBaseTest DQMEDHarvester edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DTLocalTriggerTest (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~DTLocalTriggerTest () override
 Destructor. More...
 
- Public Member Functions inherited from DTLocalTriggerBaseTest
 DTLocalTriggerBaseTest ()
 Constructor. More...
 
 ~DTLocalTriggerBaseTest () override
 Destructor. More...
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester ()
 
void endJob () final
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) 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)
 

Protected Member Functions

void beginRun (const edm::Run &r, const edm::EventSetup &c) override
 BeginRun. More...
 
void Bookings (DQMStore::IBooker &, DQMStore::IGetter &)
 
void fillGlobalSummary (DQMStore::IGetter &)
 
void runClientDiagnostic (DQMStore::IBooker &, DQMStore::IGetter &) override
 Run client analysis. More...
 
- Protected Member Functions inherited from DTLocalTriggerBaseTest
void beginRun (edm::Run const &run, edm::EventSetup const &context) override
 BeginRun. More...
 
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 &) override
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
 Perform client diagnostic in online. More...
 
void endRun (edm::Run const &run, edm::EventSetup const &context) override
 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)
 

Protected Attributes

const int wheelArrayShift = 3
 
- 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
 
- Protected Attributes inherited from DQMEDHarvester
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Private Attributes

bool bookingdone
 
int nMinEvts
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

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 = false;
45 
46 }
T getUntrackedParameter(std::string const &, T const &) const
void setConfig(const edm::ParameterSet &ps, std::string name)
Set configuration variables.
DTLocalTriggerTest::~DTLocalTriggerTest ( )
override

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

BeginRun.

Definition at line 142 of file DTLocalTriggerTest.cc.

References DTLocalTriggerBaseTest::beginRun().

142  {
143 
145 
146 }
void beginRun(edm::Run const &run, edm::EventSetup const &context) override
BeginRun.
void DTLocalTriggerTest::Bookings ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
protected

Definition at line 54 of file DTLocalTriggerTest.cc.

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,"BXDistribPhiIn");
77  bookSectorHistos(ibooker,wh,sect,"QualDistribPhiIn");
78  bookSectorHistos(ibooker,wh,sect,"BXDistribPhiOut");
79  bookSectorHistos(ibooker,wh,sect,"QualDistribPhiOut");
80  }
81 
82  bookWheelHistos(ibooker,wh,"CorrectBXPhiIn");
83  bookWheelHistos(ibooker,wh,"ResidualBXPhiIn");
84  bookWheelHistos(ibooker,wh,"CorrFractionPhiIn");
85  bookWheelHistos(ibooker,wh,"2ndFractionPhiIn");
86  bookWheelHistos(ibooker,wh,"TriggerInclusivePhiIn");
87 
88  bookWheelHistos(ibooker,wh,"CorrectBXPhiOut");
89  bookWheelHistos(ibooker,wh,"ResidualBXPhiOut");
90  bookWheelHistos(ibooker,wh,"CorrFractionPhiOut");
91  bookWheelHistos(ibooker,wh,"2ndFractionPhiOut");
92  bookWheelHistos(ibooker,wh,"TriggerInclusivePhiOut");
93 
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,"CorrFractionSummaryIn","Summaries");
113  bookWheelHistos(ibooker,wh,"2ndFractionSummaryIn","Summaries");
114  bookWheelHistos(ibooker,wh,"CorrFractionSummaryOut","Summaries");
115  bookWheelHistos(ibooker,wh,"2ndFractionSummaryOut","Summaries");
116  }
117  }
118  if (hwSource=="COM") {
119 
120  bookCmsHistos(ibooker,"MatchingSummary","Summaries");
121  }
122  else {
123 
124  bookCmsHistos(ibooker,"CorrFractionSummaryIn");
125  bookCmsHistos(ibooker,"2ndFractionSummaryIn");
126  bookCmsHistos(ibooker,"CorrFractionSummaryOut");
127  bookCmsHistos(ibooker,"2ndFractionSummaryOut");
128 
129  }
130  if (hwSource=="TM") {
131 
132  bookCmsHistos(ibooker,"TrigGlbSummary","",true);
133  }
134 
135  }
136  }
137 
138  bookingdone = true;
139 }
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 550 of file DTLocalTriggerTest.cc.

References taus_updatedMVAIds_cff::category, corr, DQMStore::IGetter::get(), MonitorElement::getBinContent(), MonitorElement::getFloatValue(), LogTrace, lumiPlot::lut, edm::min(), and edm::second().

550  {
551 
552  float glbPerc[5] = { 1., 0.9, 0.6, 0.3, 0.01 };
553  trigSource = "";
554  hwSource = "TM";
555 
556  int nSecReadout = 0;
557 
558  for (int wh=-2; wh<=2; ++wh) {
559  for (int sect=1; sect<=12; ++sect) {
560 
561  float maxErr = 8.;
562  int corr = cmsME.find(fullName("CorrFractionSummaryIn"))->second->getBinContent(sect,wh+wheelArrayShift);
563  int second = cmsME.find(fullName("2ndFractionSummaryIn"))->second->getBinContent(sect,wh+wheelArrayShift);
564  int lut=0;
565  MonitorElement * lutsME = igetter.get(topFolder(hwSource=="TM") + "Summaries/TrigLutSummary");
566  if (lutsME) {
567  lut = lutsME->getBinContent(sect,wh+wheelArrayShift);
568  maxErr+=4;
569  } else {
570  LogTrace(category()) << "[" << testName
571  << "Test]: TM Lut test Summary histo not found." << endl;
572  }
573  (corr <5 || second<5) && nSecReadout++;
574  int errcode = ((corr<5 ? corr : 4) + (second<5 ? second : 4) + (lut<5 ? lut : 4) );
575  errcode = min(int((errcode/maxErr + 0.01)*5),5);
576  cmsME.find("TrigGlbSummary")->second->setBinContent(sect,wh+wheelArrayShift,glbPerc[errcode]);
577 
578  }
579  }
580 
581  if (!nSecReadout)
582  cmsME.find("TrigGlbSummary")->second->Reset(); // white histo id TM is not RO
583 
584  string nEvtsName = "DT/EventInfo/Counters/nProcessedEventsTrigger";
585  MonitorElement * meProcEvts = igetter.get(nEvtsName);
586 
587  if (meProcEvts) {
588  int nProcEvts = meProcEvts->getFloatValue();
589  cmsME.find("TrigGlbSummary")->second->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
590  } else {
591  cmsME.find("TrigGlbSummary")->second->setEntries(nMinEvts + 1);
592  LogVerbatim (category()) << "[" << testName
593  << "Test]: ME: " << nEvtsName << " not found!" << endl;
594  }
595 
596 }
double getFloatValue() const
U second(std::pair< T, U > const &p)
T min(T a, T b)
Definition: MathUtil.h:58
#define LogTrace(id)
JetCorrectorParameters corr
Definition: classes.h:5
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
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 
)
overrideprotectedvirtual

Run client analysis.

Implements DTLocalTriggerBaseTest.

Definition at line 148 of file DTLocalTriggerTest.cc.

References rpcdqm::BX, end, spr::find(), DQMStore::IGetter::get(), and trackingPlots::stat.

148  {
149 
150  if (!bookingdone) Bookings(ibooker,igetter);
151 
152  // Loop over Trig & Hw sources
153  for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
154  trigSource = (*iTr);
155 
156  for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
157  hwSource = (*iHw);
158  // Loop over the TriggerUnits
159  for (int stat=1; stat<=4; ++stat){
160  for (int wh=-2; wh<=2; ++wh){
161  for (int sect=1; sect<=12; ++sect){
162  DTChamberId chId(wh,stat,sect);
163  int sector_id = (wh+wheelArrayShift)+(sect-1)*5;
164 
165  if (hwSource=="COM") {
166  // Perform TM-DDU matching test and generates summaries (Phi view)
167  TH2F * DDUvsTM = getHisto<TH2F>(igetter.get(getMEName("QualDDUvsQualTM","LocalTriggerPhiIn", chId)));
168  if (DDUvsTM) {
169 
170  int matchSummary = 1;
171 
172  if (DDUvsTM->GetEntries()>1) {
173 
174  double entries = DDUvsTM->GetEntries();
175  double corrEntries = 0;
176  for (int ibin=2; ibin<=8; ++ibin) {
177  corrEntries += DDUvsTM->GetBinContent(ibin,ibin);
178  }
179  double corrRatio = corrEntries/entries;
180 
181  if (corrRatio < parameters.getUntrackedParameter<double>("matchingFracError",.65)){
182  matchSummary = 2;
183  }
184  else if (corrRatio < parameters.getUntrackedParameter<double>("matchingFracWarning",.85)){
185  matchSummary = 3;
186  }
187  else {
188  matchSummary = 0;
189  }
190 
191  if( whME[wh].find(fullName("MatchingPhi")) == whME[wh].end() ){
192  bookWheelHistos(ibooker,wh,"MatchingPhi");
193  }
194 
195  whME[wh].find(fullName("MatchingPhi"))->second->setBinContent(sect,stat,corrRatio);
196 
197  }
198 
199  whME[wh].find(fullName("MatchingSummary"))->second->setBinContent(sect,stat,matchSummary);
200 
201  }
202  } //closes COM
203  else {
204  // IN part
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  if (BXvsQual && Flag1stvsQual && BestQual) {
209  int corrSummary = 1;
210  int secondSummary = 1;
211  //default values for histograms
212  double BX_OK = 51.;
213  double BXMean = 51. ;
214  double corrFrac = 0.;
215  double secondFrac = 0.;
216  double besttrigs = 0.;
217  if (BestQual->GetEntries()>1) {
218  TH1D* BXHH = BXvsQual->ProjectionY("",6,7,"");
219  TH1D* Flag1st = Flag1stvsQual->ProjectionY();
220  int BXOK_bin = BXHH->GetEntries()>=1 ? BXHH->GetMaximumBin() : 51;
221  BXMean = BXHH->GetEntries()>=1 ? BXHH->GetMean() : 51;
222  BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
223  double trigsFlag2nd = Flag1st->GetBinContent(2);
224  double trigs = Flag1st->GetEntries();
225  besttrigs = BestQual->GetEntries();
226  double besttrigsCorr = BestQual->Integral(5,7,"");
227  delete BXHH;
228  delete Flag1st;
229 
230  corrFrac = besttrigsCorr/besttrigs;
231  secondFrac = trigsFlag2nd/trigs;
232  if (corrFrac < parameters.getUntrackedParameter<double>("corrFracError",.5)){
233  corrSummary = 2;
234  }
235  else if (corrFrac < parameters.getUntrackedParameter<double>("corrFracWarning",.6)){
236  corrSummary = 3;
237  }
238  else {
239  corrSummary = 0;
240  }
241  if (secondFrac > parameters.getUntrackedParameter<double>("secondFracError",.2)){
242  secondSummary = 2;
243  }
244  else if (secondFrac > parameters.getUntrackedParameter<double>("secondFracWarning",.1)){
245  secondSummary = 3;
246  }
247  else {
248  secondSummary = 0;
249  }
250 
251  if( secME[sector_id].find(fullName("BXDistribPhiIn")) == secME[sector_id].end() ){
252  bookSectorHistos(ibooker,wh,sect,"QualDistribPhiIn");
253  bookSectorHistos(ibooker,wh,sect,"BXDistribPhiIn");
254  }
255 
256  TH1D* BXDistr = BXvsQual->ProjectionY();
257  TH1D* QualDistr = BXvsQual->ProjectionX();
258  std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
259 
260  int nbinsBX = BXDistr->GetNbinsX();
261  int firstBinCenter = static_cast<int>(BXDistr->GetBinCenter(1));
262  int lastBinCenter = static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
263  int iMin = firstBinCenter>-4 ? firstBinCenter : -4;
264  int iMax = lastBinCenter<20 ? lastBinCenter : 20;
265  for (int ibin=iMin+5;ibin<=iMax+5; ++ibin) {
266  innerME->find(fullName("BXDistribPhiIn"))->second->setBinContent(ibin,stat,BXDistr->GetBinContent(ibin-5-firstBinCenter+1));
267  }
268  for (int ibin=1;ibin<=7;++ibin) {
269  innerME->find(fullName("QualDistribPhiIn"))->second->setBinContent(ibin,stat,QualDistr->GetBinContent(ibin));
270  }
271 
272  delete BXDistr;
273  delete QualDistr;
274  }
275 
276  std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
277 
278  if( whME[wh].find(fullName("CorrectBXPhiIn")) == whME[wh].end() ){
279  bookWheelHistos(ibooker,wh,"ResidualBXPhiIn");
280  bookWheelHistos(ibooker,wh,"CorrectBXPhiIn");
281  bookWheelHistos(ibooker,wh,"CorrFractionPhiIn");
282  bookWheelHistos(ibooker,wh,"2ndFractionPhiIn");
283  bookWheelHistos(ibooker,wh,"TriggerInclusivePhiIn");
284  }
285 
286  innerME = &(whME[wh]);
287  innerME->find(fullName("CorrectBXPhiIn"))->second->setBinContent(sect,stat,BX_OK+0.00001);
288  innerME->find(fullName("ResidualBXPhiIn"))->second->setBinContent(sect,stat,round(25.*(BXMean-BX_OK))+0.00001);
289  innerME->find(fullName("CorrFractionPhiIn"))->second->setBinContent(sect,stat,corrFrac);
290  innerME->find(fullName("TriggerInclusivePhiIn"))->second->setBinContent(sect,stat,besttrigs);
291  innerME->find(fullName("2ndFractionPhiIn"))->second->setBinContent(sect,stat,secondFrac);
292 
293 
294  whME[wh].find(fullName("CorrFractionSummaryIn"))->second->setBinContent(sect,stat,corrSummary);
295  whME[wh].find(fullName("2ndFractionSummaryIn"))->second->setBinContent(sect,stat,secondSummary);
296 
297  } // closes BXvsQual && Flag1stvsQual && BestQual
298 
299  if (hwSource=="TM"){
300  //Out part
301 
302  TH2F * BXvsQual = getHisto<TH2F>(igetter.get(getMEName("BXvsQual_Out","LocalTriggerPhiOut", chId)));
303  TH1F * BestQual = getHisto<TH1F>(igetter.get(getMEName("BestQual_Out","LocalTriggerPhiOut", chId)));
304  TH2F * Flag1stvsQual = getHisto<TH2F>(igetter.get(getMEName("Flag1stvsQual_Out","LocalTriggerPhiOut", chId)));
305  if (BXvsQual && Flag1stvsQual && BestQual) {
306  int corrSummary = 1;
307  int secondSummary = 1;
308  //default values for histograms
309  double BX_OK = 51.;
310  double BXMean = 51. ;
311  double corrFrac = 0.;
312  double secondFrac = 0.;
313  double besttrigs = 0.;
314 
315  if (BestQual->GetEntries()>1) {
316  TH1D* BXHH = BXvsQual->ProjectionY("",6,7,"");
317  TH1D* Flag1st = Flag1stvsQual->ProjectionY();
318  int BXOK_bin = BXHH->GetEntries()>=1 ? BXHH->GetMaximumBin() : 51;
319  BXMean = BXHH->GetEntries()>=1 ? BXHH->GetMean() : 51;
320  BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
321  double trigsFlag2nd = Flag1st->GetBinContent(2);
322  double trigs = Flag1st->GetEntries();
323  besttrigs = BestQual->GetEntries();
324  double besttrigsCorr = BestQual->Integral(5,7,"");
325  delete BXHH;
326  delete Flag1st;
327 
328  corrFrac = besttrigsCorr/besttrigs;
329  secondFrac = trigsFlag2nd/trigs;
330  if (corrFrac < parameters.getUntrackedParameter<double>("corrFracError",.5)){
331  corrSummary = 2;
332  }
333  else if (corrFrac < parameters.getUntrackedParameter<double>("corrFracWarning",.6)){
334  corrSummary = 3;
335  }
336  else {
337  corrSummary = 0;
338  }
339  if (secondFrac > parameters.getUntrackedParameter<double>("secondFracError",.2)){
340  secondSummary = 2;
341  }
342  else if (secondFrac > parameters.getUntrackedParameter<double>("secondFracWarning",.1)){
343  secondSummary = 3;
344  }
345  else {
346  secondSummary = 0;
347  }
348 
349  if( secME[sector_id].find(fullName("BXDistribPhiOut")) == secME[sector_id].end() ){
350  bookSectorHistos(ibooker,wh,sect,"QualDistribPhiOut");
351  bookSectorHistos(ibooker,wh,sect,"BXDistribPhiOut");
352  }
353 
354  TH1D* BXDistr = BXvsQual->ProjectionY();
355  TH1D* QualDistr = BXvsQual->ProjectionX();
356  std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
357 
358  int nbinsBX = BXDistr->GetNbinsX();
359  int firstBinCenter = static_cast<int>(BXDistr->GetBinCenter(1));
360  int lastBinCenter = static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
361  int iMin = firstBinCenter>-4 ? firstBinCenter : -4;
362  int iMax = lastBinCenter<20 ? lastBinCenter : 20;
363  for (int ibin=iMin+5;ibin<=iMax+5; ++ibin) {
364  innerME->find(fullName("BXDistribPhiOut"))->second->setBinContent(ibin,stat,BXDistr->GetBinContent(ibin-5-firstBinCenter+1));
365  }
366  for (int ibin=1;ibin<=7;++ibin) {
367  innerME->find(fullName("QualDistribPhiOut"))->second->setBinContent(ibin,stat,QualDistr->GetBinContent(ibin));
368  }
369 
370  delete BXDistr;
371  delete QualDistr;
372  }
373 
374  std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
375 
376  if( whME[wh].find(fullName("CorrectBXPhiOut")) == whME[wh].end() ){
377  bookWheelHistos(ibooker,wh,"ResidualBXPhiOut");
378  bookWheelHistos(ibooker,wh,"CorrectBXPhiOut");
379  bookWheelHistos(ibooker,wh,"CorrFractionPhiOut");
380  bookWheelHistos(ibooker,wh,"2ndFractionPhiOut");
381  bookWheelHistos(ibooker,wh,"TriggerInclusivePhiOut");
382  }
383 
384  innerME = &(whME[wh]);
385  innerME->find(fullName("CorrectBXPhiOut"))->second->setBinContent(sect,stat,BX_OK+0.00001);
386  innerME->find(fullName("ResidualBXPhiOut"))->second->setBinContent(sect,stat,round(25.*(BXMean-BX_OK))+0.00001);
387  innerME->find(fullName("CorrFractionPhiOut"))->second->setBinContent(sect,stat,corrFrac);
388  innerME->find(fullName("TriggerInclusivePhiOut"))->second->setBinContent(sect,stat,besttrigs);
389  innerME->find(fullName("2ndFractionPhiOut"))->second->setBinContent(sect,stat,secondFrac);
390 
391 
392  whME[wh].find(fullName("CorrFractionSummaryOut"))->second->setBinContent(sect,stat,corrSummary);
393  whME[wh].find(fullName("2ndFractionSummaryOut"))->second->setBinContent(sect,stat,secondSummary);
394 
395  } // closes BXvsQual && Flag1stvsQual && BestQual
396 
397  } // Check on TM source
398  //Theta part
399  if (hwSource=="DDU") {
400  TH2F * ThetaBXvsQual = getHisto<TH2F>(igetter.get(getMEName("ThetaBXvsQual","LocalTriggerTheta", chId)));
401  TH1F * ThetaBestQual = getHisto<TH1F>(igetter.get(getMEName("ThetaBestQual","LocalTriggerTheta", chId)));
402 
403  // no theta triggers in stat 4!
404  if (ThetaBXvsQual && ThetaBestQual && stat<4 && ThetaBestQual->GetEntries()>1) {
405  TH1D* BXH = ThetaBXvsQual->ProjectionY("",4,4,"");
406  int BXOK_bin = BXH->GetEffectiveEntries()>=1 ? BXH->GetMaximumBin(): 10;
407  double BX_OK = ThetaBXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
408  double trigs = ThetaBestQual->GetEntries();
409  double trigsH = ThetaBestQual->GetBinContent(4);
410  delete BXH;
411 
412  if( whME[wh].find(fullName("HFractionTheta")) == whME[wh].end() ){
413  bookWheelHistos(ibooker,wh,"CorrectBXTheta");
414  bookWheelHistos(ibooker,wh,"HFractionTheta");
415  }
416  std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
417  innerME->find(fullName("CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
418  innerME->find(fullName("HFractionTheta"))->second->setBinContent(sect,stat,trigsH/trigs);
419 
420  }
421  }
422  else if (hwSource=="TM") {
423  // Perform TM plot analysis (Theta ones)
424  TH2F * ThetaPosvsBX = getHisto<TH2F>(igetter.get(getMEName("PositionvsBX","LocalTriggerTheta", chId)));
425  double BX_OK = 48;
426  // no theta triggers in stat 4!
427  if (ThetaPosvsBX && stat<4 && ThetaPosvsBX->GetEntries()>1) {
428  TH1D* BX = ThetaPosvsBX->ProjectionX();
429  int BXOK_bin = BX->GetEffectiveEntries()>=1 ? BX->GetMaximumBin(): 10;
430  BX_OK = ThetaPosvsBX->GetXaxis()->GetBinCenter(BXOK_bin);
431  delete BX;
432 
433  if( whME[wh].find(fullName("CorrectBXTheta")) == whME[wh].end() ){
434  bookWheelHistos(ibooker,wh,"CorrectBXTheta");
435  }
436  std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
437  innerME->find(fullName("CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
438  }
439  // After TM the DDU is not used and the TM has information on the Theta Quality
440  // Adding trigger info to compute H fraction (11/10/2016) M.C.Fouz
441  TH2F * ThetaBXvsQual = getHisto<TH2F>(igetter.get(getMEName("ThetaBXvsQual","LocalTriggerTheta", chId)));
442  TH1F * ThetaBestQual = getHisto<TH1F>(igetter.get(getMEName("ThetaBestQual","LocalTriggerTheta", chId)));
443  if (ThetaBXvsQual && ThetaBestQual && stat<4 && ThetaBestQual->GetEntries()>1) {
444  double trigs = ThetaBestQual->GetEntries();
445  double trigsH = ThetaBestQual->GetBinContent(2); // Note that for the new plots H is at bin=2 and not 4 as in DDU!!!!
446  if( whME[wh].find(fullName("HFractionTheta")) == whME[wh].end() ){
447  bookWheelHistos(ibooker,wh,"HFractionTheta");
448  }
449  std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
450  innerME->find(fullName("HFractionTheta"))->second->setBinContent(sect,stat,trigsH/trigs);
451  }
452  // END ADDING H Fraction info
453  }
454  }
455 
456  }
457  }
458  }
459  }
460  }
461 
462 
463  for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
464  trigSource = (*iTr);
465  for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
466  hwSource = (*iHw);
467  for (int wh=-2; wh<=2; ++wh){
468  std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
469  if(hwSource=="COM") {
470  TH2F* matchWhSummary = getHisto<TH2F>(innerME->find(fullName("MatchingSummary"))->second);
471  for (int sect=1; sect<=12; ++sect){
472  int matchErr = 0;
473  int matchNoData = 0;
474  for (int stat=1; stat<=4; ++stat){
475  switch (static_cast<int>(matchWhSummary->GetBinContent(sect,stat))) {
476  case 1:
477  matchNoData++;
478  case 2:
479  matchErr++;
480  }
481  }
482  if (matchNoData == 4) matchErr = 5;
483  cmsME.find(fullName("MatchingSummary"))->second->setBinContent(sect,wh+wheelArrayShift,matchErr);
484  }
485  }
486  else {
487  // In part
488  TH2F* corrWhSummaryIn = getHisto<TH2F>(innerME->find(fullName("CorrFractionSummaryIn"))->second);
489  TH2F* secondWhSummaryIn = getHisto<TH2F>(innerME->find(fullName("2ndFractionSummaryIn"))->second);
490  for (int sect=1; sect<=12; ++sect){
491  int corrErr = 0;
492  int secondErr = 0;
493  int corrNoData = 0;
494  int secondNoData = 0;
495  for (int stat=1; stat<=4; ++stat){
496  switch (static_cast<int>(corrWhSummaryIn->GetBinContent(sect,stat))) {
497  case 1:
498  corrNoData++;
499  case 2:
500  corrErr++;
501  }
502  switch (static_cast<int>(secondWhSummaryIn->GetBinContent(sect,stat))) {
503  case 1:
504  secondNoData++;
505  case 2:
506  secondErr++;
507  }
508  }
509  if (corrNoData == 4) corrErr = 5;
510  if (secondNoData == 4) secondErr = 5;
511  cmsME.find(fullName("CorrFractionSummaryIn"))->second->setBinContent(sect,wh+wheelArrayShift,corrErr);
512  cmsME.find(fullName("2ndFractionSummaryIn"))->second->setBinContent(sect,wh+wheelArrayShift,secondErr);
513  }
514  // Out part
515  TH2F* corrWhSummaryOut = getHisto<TH2F>(innerME->find(fullName("CorrFractionSummaryOut"))->second);
516  TH2F* secondWhSummaryOut = getHisto<TH2F>(innerME->find(fullName("2ndFractionSummaryOut"))->second);
517  for (int sect=1; sect<=12; ++sect){
518  int corrErr = 0;
519  int secondErr = 0;
520  int corrNoData = 0;
521  int secondNoData = 0;
522  for (int stat=1; stat<=4; ++stat){
523  switch (static_cast<int>(corrWhSummaryOut->GetBinContent(sect,stat))) {
524  case 1:
525  corrNoData++;
526  case 2:
527  corrErr++;
528  }
529  switch (static_cast<int>(secondWhSummaryOut->GetBinContent(sect,stat))) {
530  case 1:
531  secondNoData++;
532  case 2:
533  secondErr++;
534  }
535  }
536  if (corrNoData == 4) corrErr = 5;
537  if (secondNoData == 4) secondErr = 5;
538  cmsME.find(fullName("CorrFractionSummaryOut"))->second->setBinContent(sect,wh+wheelArrayShift,corrErr);
539  cmsME.find(fullName("2ndFractionSummaryOut"))->second->setBinContent(sect,wh+wheelArrayShift,secondErr);
540  }
541  }
542  }
543  }
544  }
545 
546  fillGlobalSummary(igetter);
547 
548 }
std::map< int, std::map< std::string, MonitorElement * > > secME
std::vector< std::string > trigSources
std::map< int, std::map< std::string, MonitorElement * > > whME
void Bookings(DQMStore::IBooker &, DQMStore::IGetter &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
void fillGlobalSummary(DQMStore::IGetter &)
#define end
Definition: vmac.h:39
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
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 47 of file DTLocalTriggerTest.h.

int DTLocalTriggerTest::nMinEvts
private

Definition at line 45 of file DTLocalTriggerTest.h.

const int DTLocalTriggerTest::wheelArrayShift = 3
protected

Definition at line 41 of file DTLocalTriggerTest.h.