CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripHDQMInspector.cc
Go to the documentation of this file.
6 
7 #include <string>
8 #include <vector>
9 
11 #include <TROOT.h>
12 #include <TFile.h>
13 #include <TSystem.h>
14 
15 using namespace std;
16 
18 string multiItems(const vector<string> & subDetectors, const string & item)
19 {
20  string multiItems;
21  if( !subDetectors.empty() ) {
22  // Fill the first and then the others, prepending the rest with a ","
23  vector<string>::const_iterator subDet = subDetectors.begin();
24  multiItems.append(*subDet+"@"+item);
25  ++subDet;
26  for( ; subDet != subDetectors.end(); ++subDet ) {
27  multiItems.append(","+*subDet+"@"+item);
28  }
29  }
30  return multiItems;
31 }
32 
37 void runTrackingInspector( const string &dbName, const string &tagName, const string & Password, const string & whiteListFile,
38  const int Start, const int End, const int nRuns )
39 {
40  // IMPORTANT SETTINGS:
41  string condition = "";
42  // string condition = "369098752@Summary_TotalNumberOfClusters_OffTrack@entries > 10000 || 436207616@Summary_TotalNumberOfClusters_OffTrack@entries > 10000 || 402653184@Summary_TotalNumberOfClusters_OffTrack@entries > 10000 || 469762048@Summary_TotalNumberOfClusters_OffTrack@entries > 10000";
43  string blackList = "109468";
44 
45  // string whiteList = readListFromFile(whiteListFile);
46 
47  string siStripTracker = "268435456";
48  vector<string> subDetectors;
49  subDetectors.push_back("369098752"); // TIB (check)
50  subDetectors.push_back("436207616"); // TOB (check)
51  // subDetectors.push_back("402653184"); // TID (check)
52  subDetectors.push_back("402661376"); // TID- (check)
53  subDetectors.push_back("402669568"); // TID+ (check)
54  // subDetectors.push_back("469762048"); // TEC (check)
55  subDetectors.push_back("470024192"); // TEC- (check)
56  subDetectors.push_back("470286336"); // TEC+ (check)
57  // -------------------
58 
59  HDQMInspectorConfigSiStrip siStripConfig;
60  vector<string> ItemsForIntegration;
61  ItemsForIntegration.push_back("TotalNumberOfClusters_OnTrack_entries");
62  siStripConfig.computeIntegralList(ItemsForIntegration);
63  DQMHistoryCreateTrend makeTrend(&siStripConfig);
64 
65  // Database and output configuration
66  // makeTrend.setDB("oracle://cms_orcoff_prep/CMS_DQM_31X_OFFLINE",tagName,"cms_dqm_31x_offline", Password,"");
67  // makeTrend.setDB(dbName,tagName,"cms_dqm_31x_offline", Password,"");
68  makeTrend.setDB(dbName,tagName,"/afs/cern.ch/cms/DB/conddb");
69  // makeTrend.setDB(dbName,tagName,"CMS_COND_GENERAL_R", Password,"");
70  makeTrend.setDebug(0);
71  makeTrend.setDoStat(1);
72  makeTrend.setSkip99s(true);
73  makeTrend.setBlackList(blackList);
74  // makeTrend.setWhiteList(whiteList);
75  makeTrend.setWhiteListFromFile(whiteListFile);
76 
77  // Definition of trends
78  typedef DQMHistoryTrendsConfig Trend;
79  vector<Trend> config;
80  config.push_back(Trend( multiItems(subDetectors, "Summary_TotalNumberOfClusters_OnTrack@mean"), "OnTrackClusters_mean.gif", 0,
81  condition+"", "", Start, End, nRuns, 0 ));
82  config.push_back(Trend( multiItems(subDetectors, "Summary_TotalNumberOfClusters_OnTrack@entries"), "OnTrackClusters_entries.gif", 0,
83  condition+"&& 369098752@Summary_TotalNumberOfClusters_OnTrack@entries > 0", "", Start, End, nRuns, 0 ));
84  config.push_back(Trend( multiItems(subDetectors, "Summary_TotalNumberOfClusters_OffTrack@mean"), "TotalNumberOfClusters_OffTrack_mean.gif", 0,
85  condition+"&& 369098752@Summary_TotalNumberOfClusters_OffTrack@mean > 0", "", Start, End, nRuns, 0, 1000 ));
86  config.push_back(Trend( multiItems(subDetectors, "Summary_TotalNumberOfClusters_OffTrack@entries"), "TotalNumberOfClusters_OffTrack_entries.gif", 0,
87  condition+"&& 369098752@Summary_TotalNumberOfClusters_OffTrack@entries > 0", "", Start, End, nRuns, 0 ));
88  config.push_back(Trend( multiItems(subDetectors, "Summary_ClusterChargeCorr_OnTrack@landauPeak"), "ClusterChargeCorr_OnTrack_landau.gif", 0,
89  condition+"&& 369098752@Summary_ClusterChargeCorr_OnTrack@entries > 10000", "", Start, End, nRuns, 0 ));
90  config.push_back(Trend( multiItems(subDetectors, "Summary_ClusterCharge_OffTrack@mean"), "ClusterCharge_OffTrack_mean.gif", 0,
91  condition+"&& 369098752@Summary_ClusterCharge_OffTrack@entries > 10000", "", Start, End, nRuns, 0 ));
92  config.push_back(Trend( multiItems(subDetectors, "Summary_ClusterCharge_OffTrack@landauPeak"), "ClusterCharge_OffTrack_landau.gif", 0,
93  condition+"&& 369098752@Summary_ClusterCharge_OffTrack@entries > 10000", "", Start, End, nRuns, 0 ));
94  config.push_back(Trend( multiItems(subDetectors, "Summary_ClusterNoise_OnTrack@gaussMean"), "ClusterNoise_OnTrack_gauss.gif", 0,
95  condition+"&& 369098752@Summary_ClusterNoise_OnTrack@entries > 10000", "", Start, End, nRuns, 0 ));
96  config.push_back(Trend( multiItems(subDetectors, "Summary_ClusterNoise_OffTrack@gaussMean"), "ClusterNoise_OffTrack_gauss.gif", 0,
97  condition+"&& 369098752@Summary_ClusterNoise_OffTrack@entries > 10000", "", Start, End, nRuns, 0, 8 ));
98  config.push_back(Trend( multiItems(subDetectors, "Summary_ClusterStoNCorr_OnTrack@landauPeak"), "ClusterStoNCorr_OnTrack_landauPeak.gif", 0,
99  condition+"&& 369098752@Summary_ClusterStoNCorr_OnTrack@landauPeak > 0", "", Start, End, nRuns, 0 ));
100  config.push_back(Trend( multiItems(subDetectors, "Summary_ClusterStoNCorr_OnTrack@mean"), "ClusterStoNCorr_OnTrack_mean.gif", 0,
101  condition+"&& 369098752@Summary_ClusterStoNCorr_OnTrack@mean > 0", "", Start, End, nRuns, 0 ));
102  config.push_back(Trend( multiItems(subDetectors, "Summary_ClusterStoN_OffTrack@landauPeak"), "ClusterStoN_OffTrack_landauPeak.gif", 0,
103  condition+"&& 369098752@Summary_ClusterStoN_OffTrack@entries > 10000", "", Start, End, nRuns, 0, 60 ));
104  config.push_back(Trend( multiItems(subDetectors, "Summary_ClusterStoN_OffTrack@mean"), "ClusterStoN_OffTrack_mean.gif", 0,
105  condition+"&& 369098752@Summary_ClusterStoN_OffTrack@entries > 10000", "", Start, End, nRuns, 0, 80 ));
106  config.push_back(Trend( multiItems(subDetectors, "Summary_ClusterWidth_OnTrack@mean"), "ClusterWidth_OnTrack_mean.gif", 0,
107  condition+"&& 369098752@Summary_ClusterWidth_OnTrack@mean > 0", "", Start, End, nRuns, 0 ));
108  config.push_back(Trend( multiItems(subDetectors, "Summary_ClusterWidth_OffTrack@mean"), "ClusterWidth_OffTrack_mean.gif", 0,
109  condition+"", "", Start, End, nRuns, 0, 7 ));
110  config.push_back(Trend( multiItems(subDetectors, "TotalNumberOfClusterProfile@yMean"), "TotalNumberOfClusterProfile_ymean.gif", 0,
111  condition+"", "", Start, End, nRuns, 0, 15 ));
112 
113  // FED errors entries
114  config.push_back(Trend( siStripTracker+"@nFEDErrors@entries", "nFEDErrors.gif", 0,
115  condition, "", Start, End, nRuns ));
116  config.push_back(Trend( siStripTracker+"@nBadActiveChannelStatusBits@entries", "nBadActiveChannelStatusBits.gif", 0,
117  condition, "", Start, End, nRuns ));
118  config.push_back(Trend( siStripTracker+"@nBadChannelStatusBits@entries", "nBadChannelStatusBits.gif", 0,
119  condition, "", Start, End, nRuns ));
120  config.push_back(Trend( siStripTracker+"@nAPVAddressError@entries", "nAPVAddressError.gif", 0,
121  condition, "", Start, End, nRuns ));
122  config.push_back(Trend( siStripTracker+"@nUnlocked@entries", "nUnlocked.gif", 0,
123  condition, "", Start, End, nRuns ));
124  config.push_back(Trend( siStripTracker+"@nOutOfSync@entries", "nOutOfSync.gif", 0,
125  condition, "", Start, End, nRuns ));
126 
127  // FED errors means
128  config.push_back(Trend( siStripTracker+"@nFEDErrors@mean", "nFEDErrors_mean.gif", 0,
129  condition, "", Start, End, nRuns ));
130  config.push_back(Trend( siStripTracker+"@nBadActiveChannelStatusBits@mean", "nBadActiveChannelStatusBits_mean.gif", 0,
131  condition, "", Start, End, nRuns ));
132  config.push_back(Trend( siStripTracker+"@nBadChannelStatusBits@mean", "nBadChannelStatusBits_mean.gif", 0,
133  condition, "", Start, End, nRuns ));
134  config.push_back(Trend( siStripTracker+"@nAPVAddressError@mean", "nAPVAddressError_mean.gif", 0,
135  condition, "", Start, End, nRuns ));
136  config.push_back(Trend( siStripTracker+"@nUnlocked@mean", "nUnlocked_mean.gif", 0,
137  condition, "", Start, End, nRuns ));
138  config.push_back(Trend( siStripTracker+"@nOutOfSync@mean", "nOutOfSync_mean.gif", 0,
139  condition, "", Start, End, nRuns ));
140 
141  // Creation of trends
142  for_each(config.begin(), config.end(), makeTrend);
143 
144  // Close the output file
145  makeTrend.closeFile();
146 }
147 
148 void SiStripHDQMInspector( const string & dbName, const string & tagName, const string & password, const std::string & whiteListFile,
149  const int start, const int end )
150 {
151  runTrackingInspector(dbName, tagName, password, whiteListFile, start, end, 0);
152 }
153 
154 void SiStripHDQMInspector( const string & dbName, const string & tagName, const string & password, const std::string & whiteListFile,
155  const int nRuns )
156 {
157  runTrackingInspector(dbName, tagName, password, whiteListFile, 0, 0, nRuns);
158 }
159 
160 int main (int argc, char* argv[])
161 {
162  gSystem->Load( "libFWCoreFWLite" );
164 
165  if (argc != 6 && argc != 7) {
166  std::cerr << "Usage: " << argv[0] << " [Database] [TagName] [Password] [WhiteListFile] [NRuns] " << std::endl;
167  std::cerr << "Or: " << argv[0] << " [Database] [TagName] [Password] [WhiteListFile] [FirstRun] [LastRun] " << std::endl;
168  return 1;
169  }
170 
171  if (argc == 6) {
172  std::cout << "Creating trends for NRuns = " << argv[5] << " for tag: " << argv[2] << std::endl;
173  SiStripHDQMInspector( argv[1], argv[2], argv[3], argv[4], atoi(argv[5]) );
174  } else if(argc == 7) {
175  std::cout << "Creating trends for range: " << argv[5] << " " << argv[6] << " for tag: " << argv[2] << std::endl;
176  SiStripHDQMInspector( argv[1], argv[2], argv[3], argv[4], atoi(argv[5]), atoi(argv[6]) );
177  }
178 
179  return 0;
180 }
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
void setWhiteListFromFile(const std::string &listFileName)
void setDebug(const int i)
string dbName
Definition: EcalCondDB.py:76
void runTrackingInspector(const string &dbName, const string &tagName, const string &Password, const string &whiteListFile, const int Start, const int End, const int nRuns)
virtual bool computeIntegralList(const std::vector< std::string > &computeIntegralVector)
fills the list of names of quantities for which a summation over the runs is required ...
void SiStripHDQMInspector(const string &dbName, const string &tagName, const string &password, const std::string &whiteListFile, const int start, const int end)
int main(int argc, char **argv)
void setSkip99s(bool const in)
void setDB(std::string dbName, std::string dbTag, std::string authPath="")
#define end
Definition: vmac.h:38
void setBlackList(const std::string &listItems)
tuple argc
Definition: dir2webdir.py:41
static void enable()
enable automatic library loading
tuple cout
Definition: gather_cfg.py:121
string multiItems(const vector< string > &subDetectors, const string &item)
Simple helper function for building the string for TIB,TOB,TEC,TID items.
void setDoStat(const int i)