CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQM/DTMonitorClient/src/DTLocalTriggerTPTest.cc

Go to the documentation of this file.
00001 /*
00002  *  See header file for a description of this class.
00003  *
00004  *  $Date: 2010/01/05 10:15:46 $
00005  *  $Revision: 1.4 $
00006  *  \author C. Battilana S. Marcellini - INFN Bologna
00007  */
00008 
00009 
00010 // This class header
00011 #include "DQM/DTMonitorClient/src/DTLocalTriggerTPTest.h"
00012 
00013 // Framework headers
00014 #include "FWCore/Framework/interface/EventSetup.h"
00015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00016 #include "DQMServices/Core/interface/MonitorElement.h"
00017 #include "DQMServices/Core/interface/DQMStore.h"
00018 
00019 // Geometry
00020 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00021 #include "Geometry/DTGeometry/interface/DTGeometry.h"
00022 
00023 // Root
00024 #include "TF1.h"
00025 #include "TProfile.h"
00026 
00027 
00028 //C++ headers
00029 #include <iostream>
00030 #include <sstream>
00031 
00032 using namespace edm;
00033 using namespace std;
00034 
00035 
00036 DTLocalTriggerTPTest::DTLocalTriggerTPTest(const edm::ParameterSet& ps){
00037 
00038   setConfig(ps,"DTLocalTriggerTP");
00039   baseFolderDCC = "DT/11-LocalTriggerTP-DCC/";
00040   baseFolderDDU = "DT/12-LocalTriggerTP-DDU/";
00041   
00042 
00043 }
00044 
00045 
00046 DTLocalTriggerTPTest::~DTLocalTriggerTPTest(){
00047 
00048 }
00049 
00050 void DTLocalTriggerTPTest::beginJob(){
00051   
00052   DTLocalTriggerBaseTest::beginJob();
00053 
00054 
00055   vector<string>::const_iterator iTr   = trigSources.begin();
00056   vector<string>::const_iterator trEnd = trigSources.end();
00057   vector<string>::const_iterator iHw   = hwSources.begin();
00058   vector<string>::const_iterator hwEnd = hwSources.end();
00059 
00060 
00061   //Booking
00062   if(parameters.getUntrackedParameter<bool>("staticBooking", true)){
00063     for (; iTr != trEnd; ++iTr){
00064       trigSource = (*iTr);
00065       for (; iHw != hwEnd; ++iHw){
00066         hwSource = (*iHw);
00067         // Loop over the TriggerUnits
00068         for (int wh=-2; wh<=2; ++wh){
00069           bookWheelHistos(wh,"CorrectBXPhi");
00070           bookWheelHistos(wh,"ResidualBXPhi");
00071         }
00072       }
00073     }
00074   }
00075 
00076 }
00077 
00078 
00079 void DTLocalTriggerTPTest::beginRun(const edm::Run& r, const edm::EventSetup& c){
00080   
00081   DTLocalTriggerBaseTest::beginRun(r,c);
00082 
00083 }
00084 
00085 
00086 void DTLocalTriggerTPTest::runClientDiagnostic() {
00087 
00088   // Loop over Trig & Hw sources
00089   for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
00090     trigSource = (*iTr);
00091     for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
00092       hwSource = (*iHw);
00093       // Loop over the TriggerUnits
00094       for (int stat=1; stat<=4; ++stat){
00095         for (int wh=-2; wh<=2; ++wh){
00096           for (int sect=1; sect<=12; ++sect){
00097             DTChamberId chId(wh,stat,sect);
00098             // int sector_id = (wh+3)+(sect-1)*5;
00099             // uint32_t indexCh = chId.rawId();
00100             
00101 
00102             // Perform DCC/DDU common plot analysis (Phi ones)
00103             TH2F * BXvsQual      = getHisto<TH2F>(dbe->get(getMEName("BXvsQual","LocalTriggerPhi", chId)));
00104             if ( BXvsQual ) {
00105 
00106               if (BXvsQual->GetEntries()>1) {
00107               
00108                 TH1D* BX    = BXvsQual->ProjectionY();
00109                 int BXOK_bin  = BX->GetMaximumBin();
00110                 double BXMean = BX->GetMean();
00111                 double BX_OK  = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
00112                 delete BX;
00113 
00114                 if( whME[wh].find(fullName("CorrectBXPhi")) == whME[wh].end() ){
00115                   bookWheelHistos(wh,"ResidualBXPhi");
00116                   bookWheelHistos(wh,"CorrectBXPhi");
00117                 }
00118            
00119                 std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
00120                 innerME->find(fullName("CorrectBXPhi"))->second->setBinContent(sect,stat,BX_OK+0.00001);
00121                 innerME->find(fullName("ResidualBXPhi"))->second->setBinContent(sect,stat,round(25.*(BXMean-BX_OK))+0.00001);
00122               }
00123               
00124             }
00125           }
00126         }
00127       }
00128     }
00129   }     
00130 
00131 }
00132