CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/DQM/SiPixelHistoricInfoClient/bin/SiPixelHDQMInspector.cc

Go to the documentation of this file.
00001 #include "DQMServices/Diagnostic/interface/HDQMInspector.h"
00002 #include "DQM/SiPixelHistoricInfoClient/interface/HDQMInspectorConfigSiPixel.h"
00003 #include "DQMServices/Diagnostic/interface/DQMHistoryTrendsConfig.h"
00004 #include "DQMServices/Diagnostic/interface/DQMHistoryCreateTrend.h"
00005 #include <string>
00006 #include <vector>
00007 #include <memory>
00008 #include <algorithm>
00009 
00010 #include "FWCore/FWLite/interface/AutoLibraryLoader.h"
00011 #include <TSystem.h>
00012 
00013 using namespace std;
00014 
00015 string const Condition = "0@SUMOFF_nclusters_OffTrack@yMean > 0";
00016 string const BlackList = "";
00017 // string const WhiteList = ""; // set a runs & range such as: "123,321,456,108000-109000";
00018 
00023 void runSiPixelInspector( const string & dbName, const string &tagName, const string & Password, const string & whiteListFile,
00024                           const int Start, const int End, const int nRuns )
00025 {
00026   HDQMInspectorConfigSiPixel PixelConfig;
00027   DQMHistoryCreateTrend makeTrend(&PixelConfig);
00028 
00029   // Database and output configuration
00030   makeTrend.setDB(dbName,tagName,"/afs/cern.ch/cms/DB/conddb");
00031   makeTrend.setDebug(0);
00032   makeTrend.setDoStat(1);
00033   makeTrend.setSkip99s(true);
00034   makeTrend.setBlackList(BlackList);
00035   // makeTrend.setWhiteList(WhiteList);
00036   //makeTrend.setSeparator("@@#@@");  // TO change the seperator
00037   makeTrend.setWhiteListFromFile(whiteListFile);
00038 
00039   // Definition of trends
00040   typedef DQMHistoryTrendsConfig Trend;
00041   vector<Trend> config;
00042   config.push_back(Trend( "1@SUMOFF_adc@yMean", "adc_yMean_Barrel.gif", 0, Condition, "", Start, End, nRuns ));
00043   config.push_back(Trend( "6@SUMOFF_adc@yMean", "adc_yMean_Endcap.gif", 0, Condition, "", Start, End, nRuns ));
00044   config.push_back(Trend( "0@SUMOFF_charge_OffTrack@yMean", "charge_OffTrack_yMean.gif", 0, Condition, "", Start, End, nRuns ));
00045   config.push_back(Trend( "1@SUMOFF_charge_OnTrack@yMean", "charge_OnTrack_yMean_Barrel.gif", 0, Condition, "", Start, End, nRuns ));
00046   config.push_back(Trend( "6@SUMOFF_charge_OnTrack@yMean", "charge_OnTrack_yMean_Endcap.gif", 0, Condition, "", Start, End, nRuns ));
00047   config.push_back(Trend( "0@SUMOFF_nRecHits@yMean", "nRecHits_yMean.gif", 0, Condition, "", Start, End, nRuns ));
00048   config.push_back(Trend( "0@SUMOFF_nclusters_OffTrack@yMean", "nclusters_OffTrack_yMean.gif", 0, Condition, "", Start, End, nRuns ));
00049   config.push_back(Trend( "0@SUMOFF_nclusters_OnTrack@yMean", "nclusters_OnTrack_yMean.gif", 0, Condition, "", Start, End, nRuns ));
00050   config.push_back(Trend( "0@SUMOFF_ndigis@yMean", "ndigis_yMean.gif", 0, Condition, "", Start, End, nRuns ));
00051   config.push_back(Trend( "0@SUMOFF_size_OffTrack@yMean", "size_OffTrack_yMean.gif", 0, Condition, "", Start, End, nRuns ));
00052   config.push_back(Trend( "0@SUMOFF_size_OnTrack@yMean", "size_OnTrack_yMean.gif", 0, Condition, "", Start, End, nRuns ));
00053   config.push_back(Trend( "0@ntracks_generalTracks@NTracksPixOverAll", "NTracksPixOverAll.gif", 0, Condition, "", Start, End, nRuns ));
00054   config.push_back(Trend( "0@ntracks_generalTracks@NTracksFPixOverBPix", "NTracksFPixOverBPix.gif", 0, Condition, "", Start, End, nRuns ));
00055 
00056   config.push_back(Trend( "0@bigEventRate@yMean", "bigEventRate_yMean.gif", 0, Condition, "", Start, End, nRuns ));
00057   config.push_back(Trend( "0@bigFpixClusterEventRate@yMean", "bigFpixClusterEventRate_yMean.gif", 0, Condition, "", Start, End, nRuns ));
00058   config.push_back(Trend( "0@pixEventRate@yMean", "pixEventRate_yMean.gif", 0, Condition, "", Start, End, nRuns ));
00059 
00060   // Creation of trends
00061   for_each(config.begin(), config.end(), makeTrend);
00062 
00063   // Close the output file
00064   makeTrend.closeFile();
00065 }
00066 
00068 void SiPixelHDQMInspector( const string & dbName, const string &tagName, const string & password, const std::string & whiteListFile,
00069                            const int start, const int end )
00070 {
00071   runSiPixelInspector( dbName, tagName, password, whiteListFile, start, end, 0 );
00072 }
00073 
00075 void SiPixelHDQMInspector( const string & dbName, const string & tagName, const string & password, const std::string & whiteListFile,
00076                            const int nRuns )
00077 {
00078   runSiPixelInspector( dbName, tagName, password, whiteListFile, 0, 0, nRuns );
00079 }
00080 
00081 int main (int argc, char* argv[])
00082 {
00083   gSystem->Load( "libFWCoreFWLite" );
00084   AutoLibraryLoader::enable();
00085 
00086   if (argc != 6 && argc != 7) {
00087     cerr << "Usage: " << argv[0] << " [Database] [TagName] [Password] [WhiteListFile] [NRuns] " << endl;
00088     cerr << "Or:    " << argv[0] << " [Database] [TagName] [Password] [WhiteListFile] [FirstRun] [LastRun] " << endl;
00089     return 1;
00090   }
00091 
00092   if (argc == 6) {
00093     cout << "Creating trends for NRuns = " << argv[5] << " for tag: " << argv[2] << endl;
00094     SiPixelHDQMInspector( argv[1], argv[2], argv[3], argv[4], atoi(argv[5]) );
00095   } else if(argc == 7) {
00096     cout << "Creating trends for range:  " << argv[5] << " " << argv[6] << " for tag: " << argv[2] << endl;
00097     SiPixelHDQMInspector( argv[1], argv[2], argv[3], argv[4], atoi(argv[5]), atoi(argv[6]) );
00098   }
00099 
00100   return 0;
00101 }