00001 #include "DQMServices/Diagnostic/interface/HDQMInspector.h" 00002 #include "DQM/SiStripHistoricInfoClient/interface/HDQMInspectorConfigTracking.h" 00003 #include "DQMServices/Diagnostic/interface/DQMHistoryTrendsConfig.h" 00004 #include "DQMServices/Diagnostic/interface/DQMHistoryCreateTrend.h" 00005 #include <string> 00006 00007 #include "FWCore/FWLite/interface/AutoLibraryLoader.h" 00008 #include <TROOT.h> 00009 #include <TFile.h> 00010 #include <TSystem.h> 00011 00012 using namespace std; 00013 00018 void runTrackingInspector( const string & dbName, const string &tagName, const string & Password, const string & whiteListFile, 00019 const int Start, const int End, const int nRuns ) 00020 { 00021 // IMPORTANT SETTINGS: 00022 string siStripTracker = "268435456"; 00023 // string condition = siStripTracker+"@Chi2oNDF_CKFTk@entries > 100"; 00024 string condition = siStripTracker+"@Chi2oNDF_GenTk@entries > 100"; // Use for collision data 00025 //string condition = ""; 00026 string blackList = "109468"; 00027 // ------------------- 00028 00029 HDQMInspectorConfigTracking trackingConfig; 00030 // Select quantities you want the integral of 00031 vector<string> ItemsForIntegration; 00032 //ItemsForIntegration.push_back("Chi2oNDF_CKFTk_entries"); 00033 //ItemsForIntegration.push_back("NumberOfTracks_CKFTk_entries"); 00034 //ItemsForIntegration.push_back("Chi2oNDF_RSTk_entries"); 00035 //ItemsForIntegration.push_back("NumberOfTracks_RSTk_entries"); 00036 //ItemsForIntegration.push_back("Chi2oNDF_CosmicTk_entries"); 00037 //ItemsForIntegration.push_back("NumberOfTracks_CosmicTk_entries"); 00038 ItemsForIntegration.push_back("Chi2oNDF_GenTk_entries"); 00039 ItemsForIntegration.push_back("NumberOfTracks_GenTk_entries"); 00040 trackingConfig.computeIntegralList(ItemsForIntegration); 00041 // Create the functor 00042 DQMHistoryCreateTrend makeTrend(&trackingConfig); 00043 00044 // Database and output configuration 00045 makeTrend.setDB(dbName,tagName,"/afs/cern.ch/cms/DB/conddb"); 00046 makeTrend.setDebug(1); 00047 makeTrend.setDoStat(1); 00048 makeTrend.setSkip99s(true); 00049 makeTrend.setBlackList(blackList); 00050 makeTrend.setWhiteListFromFile(whiteListFile); 00051 00052 // Definition of trends 00053 typedef DQMHistoryTrendsConfig Trend; 00054 vector<Trend> config; 00055 00056 00057 // Something you might want for collisions 00058 config.push_back(Trend( siStripTracker+"@Chi2oNDF_GenTk@mean", "Chi2oNDF_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 50 )); 00059 config.push_back(Trend( siStripTracker+"@NumberOfTracks_GenTk@mean", "NumberOfTracks_GenTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00060 //config.push_back(Trend( siStripTracker+"@NumberOfRecHitsPerTrack_GenTk@mean", "NumberOfRecHitsPerTrack_GenTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00061 config.push_back(Trend( siStripTracker+"@TrackPt_ImpactPoint_GenTk@mean", "TrackPt_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 200 )); 00062 config.push_back(Trend( siStripTracker+"@TrackPx_ImpactPoint_GenTk@mean", "TrackPx_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 )); 00063 config.push_back(Trend( siStripTracker+"@TrackPy_ImpactPoint_GenTk@mean", "TrackPy_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -100, 100 )); 00064 config.push_back(Trend( siStripTracker+"@TrackPz_ImpactPoint_GenTk@mean", "TrackPz_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 )); 00065 config.push_back(Trend( siStripTracker+"@TrackPhi_ImpactPoint_GenTk@mean", "TrackPhi_GenTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00066 config.push_back(Trend( siStripTracker+"@TrackEta_ImpactPoint_GenTk@mean", "TrackEta_GenTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00067 config.push_back(Trend( siStripTracker+"@DistanceOfClosestApproach_GenTk@mean", "DistanceOfClosestApproach_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -15, 15 )); 00068 // Integral 00069 config.push_back(Trend( siStripTracker+"@Chi2oNDF_GenTk@entries", "Chi2oNDF_GenTk_entries.gif", 0, condition, "", Start, End, nRuns )); 00070 config.push_back(Trend( siStripTracker+"@NumberOfTracks_GenTk@entries", "NumberOfTracks_GenTk_entries.gif", 0, condition, "", Start, End, nRuns )); 00071 00072 00073 /* 00074 config.push_back(Trend( siStripTracker+"@Chi2oNDF_GenTk@mean", "Chi2oNDF_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 50 )); 00075 config.push_back(Trend( siStripTracker+"@NumberOfTracks_GenTk@mean", "NumberOfTracks_GenTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00076 config.push_back(Trend( siStripTracker+"@NumberOfRecHitsPerTrack_GenTk@mean", "NumberOfRecHitsPerTrack_GenTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00077 config.push_back(Trend( siStripTracker+"@TrackPt_GenTk@mean", "TrackPt_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 200 )); 00078 config.push_back(Trend( siStripTracker+"@TrackPx_GenTk@mean", "TrackPx_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 )); 00079 config.push_back(Trend( siStripTracker+"@TrackPy_GenTk@mean", "TrackPy_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -100, 100 )); 00080 config.push_back(Trend( siStripTracker+"@TrackPz_GenTk@mean", "TrackPz_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 )); 00081 config.push_back(Trend( siStripTracker+"@TrackPhi_GenTk@mean", "TrackPhi_GenTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00082 config.push_back(Trend( siStripTracker+"@TrackEta_GenTk@mean", "TrackEta_GenTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00083 config.push_back(Trend( siStripTracker+"@DistanceOfClosestApproach_GenTk@mean", "DistanceOfClosestApproach_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -15, 15 )); 00084 // Integral 00085 config.push_back(Trend( siStripTracker+"@Chi2oNDF_GenTk@entries", "Chi2oNDF_GenTk_entries.gif", 0, condition, "", Start, End, nRuns )); 00086 config.push_back(Trend( siStripTracker+"@NumberOfTracks_GenTk@entries", "NumberOfTracks_GenTk_entries.gif", 0, condition, "", Start, End, nRuns )); 00087 00088 00089 config.push_back(Trend( siStripTracker+"@Chi2oNDF_CKFTk@mean," 00090 +siStripTracker+"@Chi2oNDF_RSTk@mean," 00091 +siStripTracker+"@Chi2oNDF_CosmicTk@mean", 00092 "Chi2oNDF_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns, 0, 50 )); 00093 config.push_back(Trend( siStripTracker+"@Chi2oNDF_CKFTk@mean", "Chi2oNDF_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 50 )); 00094 config.push_back(Trend( siStripTracker+"@Chi2oNDF_RSTk@mean", "Chi2oNDF_RSTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 50 )); 00095 config.push_back(Trend( siStripTracker+"@Chi2oNDF_CosmicTk@mean", "Chi2oNDF_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 50 )); 00096 00097 config.push_back(Trend( siStripTracker+"@NumberOfTracks_CKFTk@mean," 00098 +siStripTracker+"@NumberOfTracks_RSTk@mean," 00099 +siStripTracker+"@NumberOfTracks_CosmicTk@mean", 00100 "NumberOfTracks_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns )); 00101 config.push_back(Trend( siStripTracker+"@NumberOfTracks_CKFTk@mean", "NumberOfTracks_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00102 config.push_back(Trend( siStripTracker+"@NumberOfTracks_RSTk@mean", "NumberOfTracks_RSTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00103 config.push_back(Trend( siStripTracker+"@NumberOfTracks_CosmicTk@mean", "NumberOfTracks_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00104 00105 config.push_back(Trend( siStripTracker+"@NumberOfRecHitsPerTrack_CKFTk@mean," 00106 +siStripTracker+"@NumberOfRecHitsPerTrack_RSTk@mean," 00107 +siStripTracker+"@NumberOfRecHitsPerTrack_CosmicTk@mean", 00108 "NumberOfRecHitsPerTrack_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns )); 00109 config.push_back(Trend( siStripTracker+"@NumberOfRecHitsPerTrack_CKFTk@mean", "NumberOfRecHitsPerTrack_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00110 config.push_back(Trend( siStripTracker+"@NumberOfRecHitsPerTrack_RSTk@mean", "NumberOfRecHitsPerTrack_RSTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00111 config.push_back(Trend( siStripTracker+"@NumberOfRecHitsPerTrack_CosmicTk@mean", "NumberOfRecHitsPerTrack_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00112 00113 config.push_back(Trend( siStripTracker+"@TrackPt_CKFTk@mean," 00114 +siStripTracker+"@TrackPt_RSTk@mean," 00115 +siStripTracker+"@TrackPt_CosmicTk@mean", 00116 "TrackPt_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns, 0, 200 )); 00117 config.push_back(Trend( siStripTracker+"@TrackPt_CKFTk@mean", "TrackPt_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 200 )); 00118 config.push_back(Trend( siStripTracker+"@TrackPt_RSTk@mean", "TrackPt_RSTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 200 )); 00119 config.push_back(Trend( siStripTracker+"@TrackPt_CosmicTk@mean", "TrackPt_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 200 )); 00120 00121 config.push_back(Trend( siStripTracker+"@TrackPx_CKFTk@mean," 00122 +siStripTracker+"@TrackPx_RSTk@mean," 00123 +siStripTracker+"@TrackPx_CosmicTk@mean", 00124 "TrackPx_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns, -20, 20 )); 00125 config.push_back(Trend( siStripTracker+"@TrackPx_CKFTk@mean", "TrackPx_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 )); 00126 config.push_back(Trend( siStripTracker+"@TrackPx_RSTk@mean", "TrackPx_RSTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 )); 00127 config.push_back(Trend( siStripTracker+"@TrackPx_CosmicTk@mean", "TrackPx_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 )); 00128 00129 config.push_back(Trend( siStripTracker+"@TrackPy_CKFTk@mean," 00130 +siStripTracker+"@TrackPy_RSTk@mean," 00131 +siStripTracker+"@TrackPy_CosmicTk@mean", 00132 "TrackPy_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns, -100, 100 )); 00133 config.push_back(Trend( siStripTracker+"@TrackPy_CKFTk@mean", "TrackPy_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns, -100, 100 )); 00134 config.push_back(Trend( siStripTracker+"@TrackPy_RSTk@mean", "TrackPy_RSTk_mean.gif", 0, condition, "", Start, End, nRuns, -100, 100 )); 00135 config.push_back(Trend( siStripTracker+"@TrackPy_CosmicTk@mean", "TrackPy_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns, -100, 100 )); 00136 00137 config.push_back(Trend( siStripTracker+"@TrackPz_CKFTk@mean," 00138 +siStripTracker+"@TrackPz_RSTk@mean," 00139 +siStripTracker+"@TrackPz_CosmicTk@mean", 00140 "TrackPz_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns, -20, 20 )); 00141 config.push_back(Trend( siStripTracker+"@TrackPz_CKFTk@mean", "TrackPz_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 )); 00142 config.push_back(Trend( siStripTracker+"@TrackPz_RSTk@mean", "TrackPz_RSTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 )); 00143 config.push_back(Trend( siStripTracker+"@TrackPz_CosmicTk@mean", "TrackPz_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 )); 00144 00145 config.push_back(Trend( siStripTracker+"@TrackPhi_CKFTk@mean," 00146 +siStripTracker+"@TrackPhi_RSTk@mean," 00147 +siStripTracker+"@TrackPhi_CosmicTk@mean", 00148 "TrackPhi_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns )); 00149 config.push_back(Trend( siStripTracker+"@TrackPhi_CKFTk@mean", "TrackPhi_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00150 config.push_back(Trend( siStripTracker+"@TrackPhi_RSTk@mean", "TrackPhi_RSTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00151 config.push_back(Trend( siStripTracker+"@TrackPhi_CosmicTk@mean", "TrackPhi_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00152 00153 config.push_back(Trend( siStripTracker+"@TrackEta_CKFTk@mean," 00154 +siStripTracker+"@TrackEta_RSTk@mean," 00155 +siStripTracker+"@TrackEta_CosmicTk@mean", 00156 "TrackEta_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns )); 00157 config.push_back(Trend( siStripTracker+"@TrackEta_CKFTk@mean", "TrackEta_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00158 config.push_back(Trend( siStripTracker+"@TrackEta_RSTk@mean", "TrackEta_RSTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00159 config.push_back(Trend( siStripTracker+"@TrackEta_CosmicTk@mean", "TrackEta_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns )); 00160 00161 config.push_back(Trend( siStripTracker+"@DistanceOfClosestApproach_CKFTk@mean," 00162 +siStripTracker+"@DistanceOfClosestApproach_RSTk@mean," 00163 +siStripTracker+"@DistanceOfClosestApproach_CosmicTk@mean", 00164 "DistanceOfClosestApproach_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns, -15, 15 )); 00165 config.push_back(Trend( siStripTracker+"@DistanceOfClosestApproach_CKFTk@mean", "DistanceOfClosestApproach_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns, -15, 15 )); 00166 config.push_back(Trend( siStripTracker+"@DistanceOfClosestApproach_RSTk@mean", "DistanceOfClosestApproach_RSTk_mean.gif", 0, condition, "", Start, End, nRuns, -15, 15 )); 00167 config.push_back(Trend( siStripTracker+"@DistanceOfClosestApproach_CosmicTk@mean", "DistanceOfClosestApproach_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns, -15, 15 )); 00168 00169 // Integral 00170 config.push_back(Trend( siStripTracker+"@Chi2oNDF_CKFTk@entries," 00171 +siStripTracker+"@Chi2oNDF_RSTk@entries," 00172 +siStripTracker+"@Chi2oNDF_CosmicTk@entries", 00173 "Chi2oNDF_entries.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns )); 00174 config.push_back(Trend( siStripTracker+"@Chi2oNDF_CKFTk@entries", "Chi2oNDF_CKFTk_entries.gif", 0, condition, "", Start, End, nRuns )); 00175 config.push_back(Trend( siStripTracker+"@Chi2oNDF_RSTk@entries", "Chi2oNDF_RSTk_entries.gif", 0, condition, "", Start, End, nRuns )); 00176 config.push_back(Trend( siStripTracker+"@Chi2oNDF_CosmicTk@entries", "Chi2oNDF_CosmicTk_entries.gif", 0, condition, "", Start, End, nRuns )); 00177 00178 config.push_back(Trend( siStripTracker+"@NumberOfTracks_CKFTk@entries," 00179 +siStripTracker+"@NumberOfTracks_RSTk@entries," 00180 +siStripTracker+"@NumberOfTracks_CosmicTk@entries", 00181 "NumberOfTracks_entries.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns )); 00182 config.push_back(Trend( siStripTracker+"@NumberOfTracks_CKFTk@entries", "NumberOfTracks_CKFTk_entries.gif", 0, condition, "", Start, End, nRuns )); 00183 config.push_back(Trend( siStripTracker+"@NumberOfTracks_RSTk@entries", "NumberOfTracks_RSTk_entries.gif", 0, condition, "", Start, End, nRuns )); 00184 config.push_back(Trend( siStripTracker+"@NumberOfTracks_CosmicTk@entries", "NumberOfTracks_CosmicTk_entries.gif", 0, condition, "", Start, End, nRuns )); 00185 // config.push_back(Trend( siStripTracker+"@NumberOfTracks_CKFTk@entries", "NumberOfTracks_CKFTk_entries.gif", 0, condition, "", Start, End, nRuns )); 00186 // config.push_back(Trend( siStripTracker+"@NumberOfRecHitsPerTrack_CKFTk@entries", "NumberOfRecHitsPerTrack_CKFTk_entries.gif", 0, condition, "", Start, End, nRuns )); 00187 */ 00188 00189 00190 // Creation of trends 00191 for_each(config.begin(), config.end(), makeTrend); 00192 00193 // Close the output file 00194 makeTrend.closeFile(); 00195 } 00196 00197 void TrackingHDQMInspector( const string & dbName, const string & tagName, const string & password, const string & whiteListFile, 00198 const int start, const int end ) 00199 { 00200 runTrackingInspector(dbName, tagName, password, whiteListFile, start, end, 0); 00201 } 00202 00203 void TrackingHDQMInspector( const string & dbName, const string & tagName, const string & password, const string & whiteListFile, 00204 const int nRuns ) 00205 { 00206 runTrackingInspector(dbName, tagName, password, whiteListFile, 0, 0, nRuns); 00207 } 00208 00209 int main (int argc, char* argv[]) 00210 { 00211 gSystem->Load( "libFWCoreFWLite" ); 00212 AutoLibraryLoader::enable(); 00213 00214 if (argc != 6 && argc != 7) { 00215 std::cerr << "Usage: " << argv[0] << " [Database] [TagName] [Password] [WhiteListFile] [NRuns] " << std::endl; 00216 std::cerr << "Or: " << argv[0] << " [Database] [TagName] [Password] [WhiteListFile] [FirstRun] [LastRun] " << std::endl; 00217 return 1; 00218 } 00219 00220 if (argc == 6) { 00221 std::cout << "Creating trends for NRuns = " << argv[5] << " for tag: " << argv[2] << std::endl; 00222 TrackingHDQMInspector( argv[1], argv[2], argv[3], argv[4], atoi(argv[5]) ); 00223 } else if(argc == 7) { 00224 std::cout << "Creating trends for range: " << argv[5] << " " << argv[6] << " for tag: " << argv[1] << std::endl; 00225 TrackingHDQMInspector( argv[1], argv[2], argv[3], argv[4], atoi(argv[5]), atoi(argv[6]) ); 00226 } 00227 00228 return 0; 00229 }