Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:04

0001 /*
0002  *  See header file for a description of this class.
0003  *
0004  *  \author C. Battilana S. Marcellini - INFN Bologna
0005  *
0006  *  threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my
0007  *
0008  */
0009 
0010 // This class header
0011 #include "DQM/DTMonitorClient/src/DTLocalTriggerTPTest.h"
0012 
0013 // Framework headers
0014 #include "FWCore/Framework/interface/EventSetup.h"
0015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0016 #include "DQMServices/Core/interface/DQMStore.h"
0017 
0018 // Geometry
0019 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0020 #include "Geometry/DTGeometry/interface/DTGeometry.h"
0021 
0022 // Root
0023 #include "TF1.h"
0024 #include "TProfile.h"
0025 
0026 //C++ headers
0027 #include <iostream>
0028 #include <sstream>
0029 
0030 using namespace edm;
0031 using namespace std;
0032 
0033 DTLocalTriggerTPTest::DTLocalTriggerTPTest(const edm::ParameterSet& ps) {
0034   setConfig(ps, "DTLocalTriggerTP");
0035   baseFolderTM = "DT/11-LocalTriggerTP-TM/";
0036 
0037   bookingdone = false;
0038 }
0039 
0040 DTLocalTriggerTPTest::~DTLocalTriggerTPTest() {}
0041 
0042 void DTLocalTriggerTPTest::Bookings(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) {
0043   vector<string>::const_iterator iTr = trigSources.begin();
0044   vector<string>::const_iterator trEnd = trigSources.end();
0045   vector<string>::const_iterator iHw = hwSources.begin();
0046   vector<string>::const_iterator hwEnd = hwSources.end();
0047 
0048   //Booking
0049   if (parameters.getUntrackedParameter<bool>("staticBooking", true)) {
0050     for (; iTr != trEnd; ++iTr) {
0051       trigSource = (*iTr);
0052       for (; iHw != hwEnd; ++iHw) {
0053         hwSource = (*iHw);
0054         // Loop over the TriggerUnits
0055         for (int wh = -2; wh <= 2; ++wh) {
0056           bookWheelHistos(ibooker, wh, "CorrectBXPhi");
0057           bookWheelHistos(ibooker, wh, "ResidualBXPhi");
0058         }
0059       }
0060     }
0061   }
0062 
0063   bookingdone = true;
0064 }
0065 
0066 void DTLocalTriggerTPTest::beginRun(const edm::Run& r, const edm::EventSetup& c) {
0067   DTLocalTriggerBaseTest::beginRun(r, c);
0068 }
0069 
0070 void DTLocalTriggerTPTest::runClientDiagnostic(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) {
0071   if (!bookingdone)
0072     Bookings(ibooker, igetter);
0073 
0074   // Loop over Trig & Hw sources
0075   for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr) {
0076     trigSource = (*iTr);
0077     for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw) {
0078       hwSource = (*iHw);
0079       // Loop over the TriggerUnits
0080       for (int stat = 1; stat <= 4; ++stat) {
0081         for (int wh = -2; wh <= 2; ++wh) {
0082           for (int sect = 1; sect <= 12; ++sect) {
0083             DTChamberId chId(wh, stat, sect);
0084 
0085             // Perform TM common plot analysis (Phi ones)
0086             TH2F* BXvsQual = getHisto<TH2F>(igetter.get(getMEName("BXvsQual_In", "LocalTriggerPhiIn", chId)));
0087             if (BXvsQual) {
0088               if (BXvsQual->GetEntries() > 1) {
0089                 TH1D* BX = BXvsQual->ProjectionY();
0090                 int BXOK_bin = BX->GetMaximumBin();
0091                 double BXMean = BX->GetMean();
0092                 double BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
0093                 delete BX;
0094 
0095                 if (whME[wh].find(fullName("CorrectBXPhi")) == whME[wh].end()) {
0096                   bookWheelHistos(ibooker, wh, "ResidualBXPhi");
0097                   bookWheelHistos(ibooker, wh, "CorrectBXPhi");
0098                 }
0099 
0100                 std::map<std::string, MonitorElement*>* innerME = &(whME[wh]);
0101                 innerME->find(fullName("CorrectBXPhi"))->second->setBinContent(sect, stat, BX_OK + 0.00001);
0102                 innerME->find(fullName("ResidualBXPhi"))
0103                     ->second->setBinContent(sect, stat, round(25. * (BXMean - BX_OK)) + 0.00001);
0104               }
0105             }
0106           }
0107         }
0108       }
0109     }
0110   }
0111 }