CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackingHDQMInspector.cc
Go to the documentation of this file.
5 #include <string>
6 
8 #include <TROOT.h>
9 #include <TFile.h>
10 #include <TSystem.h>
11 
12 using namespace std;
13 
18 void runTrackingInspector( const string & dbName, const string &tagName, const string & Password, const string & whiteListFile,
19  const int Start, const int End, const int nRuns )
20 {
21  // IMPORTANT SETTINGS:
22  string siStripTracker = "268435456";
23  // string condition = siStripTracker+"@Chi2oNDF_CKFTk@entries > 100";
24  string condition = siStripTracker+"@Chi2oNDF_GenTk@entries > 100"; // Use for collision data
25  //string condition = "";
26  string blackList = "109468";
27  // -------------------
28 
29  HDQMInspectorConfigTracking trackingConfig;
30  // Select quantities you want the integral of
31  vector<string> ItemsForIntegration;
32  //ItemsForIntegration.push_back("Chi2oNDF_CKFTk_entries");
33  //ItemsForIntegration.push_back("NumberOfTracks_CKFTk_entries");
34  //ItemsForIntegration.push_back("Chi2oNDF_RSTk_entries");
35  //ItemsForIntegration.push_back("NumberOfTracks_RSTk_entries");
36  //ItemsForIntegration.push_back("Chi2oNDF_CosmicTk_entries");
37  //ItemsForIntegration.push_back("NumberOfTracks_CosmicTk_entries");
38  ItemsForIntegration.push_back("Chi2oNDF_GenTk_entries");
39  ItemsForIntegration.push_back("NumberOfTracks_GenTk_entries");
40  trackingConfig.computeIntegralList(ItemsForIntegration);
41  // Create the functor
42  DQMHistoryCreateTrend makeTrend(&trackingConfig);
43 
44  // Database and output configuration
45  makeTrend.setDB(dbName,tagName,"/afs/cern.ch/cms/DB/conddb");
46  makeTrend.setDebug(1);
47  makeTrend.setDoStat(1);
48  makeTrend.setSkip99s(true);
49  makeTrend.setBlackList(blackList);
50  makeTrend.setWhiteListFromFile(whiteListFile);
51 
52  // Definition of trends
53  typedef DQMHistoryTrendsConfig Trend;
54  vector<Trend> config;
55 
56 
57  // Something you might want for collisions
58  config.push_back(Trend( siStripTracker+"@Chi2oNDF_GenTk@mean", "Chi2oNDF_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 50 ));
59  config.push_back(Trend( siStripTracker+"@NumberOfTracks_GenTk@mean", "NumberOfTracks_GenTk_mean.gif", 0, condition, "", Start, End, nRuns ));
60  //config.push_back(Trend( siStripTracker+"@NumberOfRecHitsPerTrack_GenTk@mean", "NumberOfRecHitsPerTrack_GenTk_mean.gif", 0, condition, "", Start, End, nRuns ));
61  config.push_back(Trend( siStripTracker+"@TrackPt_ImpactPoint_GenTk@mean", "TrackPt_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 200 ));
62  config.push_back(Trend( siStripTracker+"@TrackPx_ImpactPoint_GenTk@mean", "TrackPx_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 ));
63  config.push_back(Trend( siStripTracker+"@TrackPy_ImpactPoint_GenTk@mean", "TrackPy_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -100, 100 ));
64  config.push_back(Trend( siStripTracker+"@TrackPz_ImpactPoint_GenTk@mean", "TrackPz_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 ));
65  config.push_back(Trend( siStripTracker+"@TrackPhi_ImpactPoint_GenTk@mean", "TrackPhi_GenTk_mean.gif", 0, condition, "", Start, End, nRuns ));
66  config.push_back(Trend( siStripTracker+"@TrackEta_ImpactPoint_GenTk@mean", "TrackEta_GenTk_mean.gif", 0, condition, "", Start, End, nRuns ));
67  config.push_back(Trend( siStripTracker+"@DistanceOfClosestApproach_GenTk@mean", "DistanceOfClosestApproach_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -15, 15 ));
68  // Integral
69  config.push_back(Trend( siStripTracker+"@Chi2oNDF_GenTk@entries", "Chi2oNDF_GenTk_entries.gif", 0, condition, "", Start, End, nRuns ));
70  config.push_back(Trend( siStripTracker+"@NumberOfTracks_GenTk@entries", "NumberOfTracks_GenTk_entries.gif", 0, condition, "", Start, End, nRuns ));
71 
72 
73 /*
74  config.push_back(Trend( siStripTracker+"@Chi2oNDF_GenTk@mean", "Chi2oNDF_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 50 ));
75  config.push_back(Trend( siStripTracker+"@NumberOfTracks_GenTk@mean", "NumberOfTracks_GenTk_mean.gif", 0, condition, "", Start, End, nRuns ));
76  config.push_back(Trend( siStripTracker+"@NumberOfRecHitsPerTrack_GenTk@mean", "NumberOfRecHitsPerTrack_GenTk_mean.gif", 0, condition, "", Start, End, nRuns ));
77  config.push_back(Trend( siStripTracker+"@TrackPt_GenTk@mean", "TrackPt_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 200 ));
78  config.push_back(Trend( siStripTracker+"@TrackPx_GenTk@mean", "TrackPx_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 ));
79  config.push_back(Trend( siStripTracker+"@TrackPy_GenTk@mean", "TrackPy_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -100, 100 ));
80  config.push_back(Trend( siStripTracker+"@TrackPz_GenTk@mean", "TrackPz_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 ));
81  config.push_back(Trend( siStripTracker+"@TrackPhi_GenTk@mean", "TrackPhi_GenTk_mean.gif", 0, condition, "", Start, End, nRuns ));
82  config.push_back(Trend( siStripTracker+"@TrackEta_GenTk@mean", "TrackEta_GenTk_mean.gif", 0, condition, "", Start, End, nRuns ));
83  config.push_back(Trend( siStripTracker+"@DistanceOfClosestApproach_GenTk@mean", "DistanceOfClosestApproach_GenTk_mean.gif", 0, condition, "", Start, End, nRuns, -15, 15 ));
84  // Integral
85  config.push_back(Trend( siStripTracker+"@Chi2oNDF_GenTk@entries", "Chi2oNDF_GenTk_entries.gif", 0, condition, "", Start, End, nRuns ));
86  config.push_back(Trend( siStripTracker+"@NumberOfTracks_GenTk@entries", "NumberOfTracks_GenTk_entries.gif", 0, condition, "", Start, End, nRuns ));
87 
88 
89  config.push_back(Trend( siStripTracker+"@Chi2oNDF_CKFTk@mean,"
90  +siStripTracker+"@Chi2oNDF_RSTk@mean,"
91  +siStripTracker+"@Chi2oNDF_CosmicTk@mean",
92  "Chi2oNDF_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns, 0, 50 ));
93  config.push_back(Trend( siStripTracker+"@Chi2oNDF_CKFTk@mean", "Chi2oNDF_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 50 ));
94  config.push_back(Trend( siStripTracker+"@Chi2oNDF_RSTk@mean", "Chi2oNDF_RSTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 50 ));
95  config.push_back(Trend( siStripTracker+"@Chi2oNDF_CosmicTk@mean", "Chi2oNDF_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 50 ));
96 
97  config.push_back(Trend( siStripTracker+"@NumberOfTracks_CKFTk@mean,"
98  +siStripTracker+"@NumberOfTracks_RSTk@mean,"
99  +siStripTracker+"@NumberOfTracks_CosmicTk@mean",
100  "NumberOfTracks_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns ));
101  config.push_back(Trend( siStripTracker+"@NumberOfTracks_CKFTk@mean", "NumberOfTracks_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns ));
102  config.push_back(Trend( siStripTracker+"@NumberOfTracks_RSTk@mean", "NumberOfTracks_RSTk_mean.gif", 0, condition, "", Start, End, nRuns ));
103  config.push_back(Trend( siStripTracker+"@NumberOfTracks_CosmicTk@mean", "NumberOfTracks_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns ));
104 
105  config.push_back(Trend( siStripTracker+"@NumberOfRecHitsPerTrack_CKFTk@mean,"
106  +siStripTracker+"@NumberOfRecHitsPerTrack_RSTk@mean,"
107  +siStripTracker+"@NumberOfRecHitsPerTrack_CosmicTk@mean",
108  "NumberOfRecHitsPerTrack_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns ));
109  config.push_back(Trend( siStripTracker+"@NumberOfRecHitsPerTrack_CKFTk@mean", "NumberOfRecHitsPerTrack_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns ));
110  config.push_back(Trend( siStripTracker+"@NumberOfRecHitsPerTrack_RSTk@mean", "NumberOfRecHitsPerTrack_RSTk_mean.gif", 0, condition, "", Start, End, nRuns ));
111  config.push_back(Trend( siStripTracker+"@NumberOfRecHitsPerTrack_CosmicTk@mean", "NumberOfRecHitsPerTrack_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns ));
112 
113  config.push_back(Trend( siStripTracker+"@TrackPt_CKFTk@mean,"
114  +siStripTracker+"@TrackPt_RSTk@mean,"
115  +siStripTracker+"@TrackPt_CosmicTk@mean",
116  "TrackPt_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns, 0, 200 ));
117  config.push_back(Trend( siStripTracker+"@TrackPt_CKFTk@mean", "TrackPt_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 200 ));
118  config.push_back(Trend( siStripTracker+"@TrackPt_RSTk@mean", "TrackPt_RSTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 200 ));
119  config.push_back(Trend( siStripTracker+"@TrackPt_CosmicTk@mean", "TrackPt_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns, 0, 200 ));
120 
121  config.push_back(Trend( siStripTracker+"@TrackPx_CKFTk@mean,"
122  +siStripTracker+"@TrackPx_RSTk@mean,"
123  +siStripTracker+"@TrackPx_CosmicTk@mean",
124  "TrackPx_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns, -20, 20 ));
125  config.push_back(Trend( siStripTracker+"@TrackPx_CKFTk@mean", "TrackPx_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 ));
126  config.push_back(Trend( siStripTracker+"@TrackPx_RSTk@mean", "TrackPx_RSTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 ));
127  config.push_back(Trend( siStripTracker+"@TrackPx_CosmicTk@mean", "TrackPx_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 ));
128 
129  config.push_back(Trend( siStripTracker+"@TrackPy_CKFTk@mean,"
130  +siStripTracker+"@TrackPy_RSTk@mean,"
131  +siStripTracker+"@TrackPy_CosmicTk@mean",
132  "TrackPy_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns, -100, 100 ));
133  config.push_back(Trend( siStripTracker+"@TrackPy_CKFTk@mean", "TrackPy_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns, -100, 100 ));
134  config.push_back(Trend( siStripTracker+"@TrackPy_RSTk@mean", "TrackPy_RSTk_mean.gif", 0, condition, "", Start, End, nRuns, -100, 100 ));
135  config.push_back(Trend( siStripTracker+"@TrackPy_CosmicTk@mean", "TrackPy_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns, -100, 100 ));
136 
137  config.push_back(Trend( siStripTracker+"@TrackPz_CKFTk@mean,"
138  +siStripTracker+"@TrackPz_RSTk@mean,"
139  +siStripTracker+"@TrackPz_CosmicTk@mean",
140  "TrackPz_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns, -20, 20 ));
141  config.push_back(Trend( siStripTracker+"@TrackPz_CKFTk@mean", "TrackPz_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 ));
142  config.push_back(Trend( siStripTracker+"@TrackPz_RSTk@mean", "TrackPz_RSTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 ));
143  config.push_back(Trend( siStripTracker+"@TrackPz_CosmicTk@mean", "TrackPz_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns, -20, 20 ));
144 
145  config.push_back(Trend( siStripTracker+"@TrackPhi_CKFTk@mean,"
146  +siStripTracker+"@TrackPhi_RSTk@mean,"
147  +siStripTracker+"@TrackPhi_CosmicTk@mean",
148  "TrackPhi_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns ));
149  config.push_back(Trend( siStripTracker+"@TrackPhi_CKFTk@mean", "TrackPhi_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns ));
150  config.push_back(Trend( siStripTracker+"@TrackPhi_RSTk@mean", "TrackPhi_RSTk_mean.gif", 0, condition, "", Start, End, nRuns ));
151  config.push_back(Trend( siStripTracker+"@TrackPhi_CosmicTk@mean", "TrackPhi_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns ));
152 
153  config.push_back(Trend( siStripTracker+"@TrackEta_CKFTk@mean,"
154  +siStripTracker+"@TrackEta_RSTk@mean,"
155  +siStripTracker+"@TrackEta_CosmicTk@mean",
156  "TrackEta_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns ));
157  config.push_back(Trend( siStripTracker+"@TrackEta_CKFTk@mean", "TrackEta_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns ));
158  config.push_back(Trend( siStripTracker+"@TrackEta_RSTk@mean", "TrackEta_RSTk_mean.gif", 0, condition, "", Start, End, nRuns ));
159  config.push_back(Trend( siStripTracker+"@TrackEta_CosmicTk@mean", "TrackEta_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns ));
160 
161  config.push_back(Trend( siStripTracker+"@DistanceOfClosestApproach_CKFTk@mean,"
162  +siStripTracker+"@DistanceOfClosestApproach_RSTk@mean,"
163  +siStripTracker+"@DistanceOfClosestApproach_CosmicTk@mean",
164  "DistanceOfClosestApproach_mean.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns, -15, 15 ));
165  config.push_back(Trend( siStripTracker+"@DistanceOfClosestApproach_CKFTk@mean", "DistanceOfClosestApproach_CKFTk_mean.gif", 0, condition, "", Start, End, nRuns, -15, 15 ));
166  config.push_back(Trend( siStripTracker+"@DistanceOfClosestApproach_RSTk@mean", "DistanceOfClosestApproach_RSTk_mean.gif", 0, condition, "", Start, End, nRuns, -15, 15 ));
167  config.push_back(Trend( siStripTracker+"@DistanceOfClosestApproach_CosmicTk@mean", "DistanceOfClosestApproach_CosmicTk_mean.gif", 0, condition, "", Start, End, nRuns, -15, 15 ));
168 
169  // Integral
170  config.push_back(Trend( siStripTracker+"@Chi2oNDF_CKFTk@entries,"
171  +siStripTracker+"@Chi2oNDF_RSTk@entries,"
172  +siStripTracker+"@Chi2oNDF_CosmicTk@entries",
173  "Chi2oNDF_entries.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns ));
174  config.push_back(Trend( siStripTracker+"@Chi2oNDF_CKFTk@entries", "Chi2oNDF_CKFTk_entries.gif", 0, condition, "", Start, End, nRuns ));
175  config.push_back(Trend( siStripTracker+"@Chi2oNDF_RSTk@entries", "Chi2oNDF_RSTk_entries.gif", 0, condition, "", Start, End, nRuns ));
176  config.push_back(Trend( siStripTracker+"@Chi2oNDF_CosmicTk@entries", "Chi2oNDF_CosmicTk_entries.gif", 0, condition, "", Start, End, nRuns ));
177 
178  config.push_back(Trend( siStripTracker+"@NumberOfTracks_CKFTk@entries,"
179  +siStripTracker+"@NumberOfTracks_RSTk@entries,"
180  +siStripTracker+"@NumberOfTracks_CosmicTk@entries",
181  "NumberOfTracks_entries.gif", 0, condition, "CKFTk,RSTk,CosmicTk", Start, End, nRuns ));
182  config.push_back(Trend( siStripTracker+"@NumberOfTracks_CKFTk@entries", "NumberOfTracks_CKFTk_entries.gif", 0, condition, "", Start, End, nRuns ));
183  config.push_back(Trend( siStripTracker+"@NumberOfTracks_RSTk@entries", "NumberOfTracks_RSTk_entries.gif", 0, condition, "", Start, End, nRuns ));
184  config.push_back(Trend( siStripTracker+"@NumberOfTracks_CosmicTk@entries", "NumberOfTracks_CosmicTk_entries.gif", 0, condition, "", Start, End, nRuns ));
185  // config.push_back(Trend( siStripTracker+"@NumberOfTracks_CKFTk@entries", "NumberOfTracks_CKFTk_entries.gif", 0, condition, "", Start, End, nRuns ));
186  // config.push_back(Trend( siStripTracker+"@NumberOfRecHitsPerTrack_CKFTk@entries", "NumberOfRecHitsPerTrack_CKFTk_entries.gif", 0, condition, "", Start, End, nRuns ));
187 */
188 
189 
190  // Creation of trends
191  for_each(config.begin(), config.end(), makeTrend);
192 
193  // Close the output file
194  makeTrend.closeFile();
195 }
196 
197 void TrackingHDQMInspector( const string & dbName, const string & tagName, const string & password, const string & whiteListFile,
198  const int start, const int end )
199 {
200  runTrackingInspector(dbName, tagName, password, whiteListFile, start, end, 0);
201 }
202 
203 void TrackingHDQMInspector( const string & dbName, const string & tagName, const string & password, const string & whiteListFile,
204  const int nRuns )
205 {
206  runTrackingInspector(dbName, tagName, password, whiteListFile, 0, 0, nRuns);
207 }
208 
209 int main (int argc, char* argv[])
210 {
211  gSystem->Load( "libFWCoreFWLite" );
213 
214  if (argc != 6 && argc != 7) {
215  std::cerr << "Usage: " << argv[0] << " [Database] [TagName] [Password] [WhiteListFile] [NRuns] " << std::endl;
216  std::cerr << "Or: " << argv[0] << " [Database] [TagName] [Password] [WhiteListFile] [FirstRun] [LastRun] " << std::endl;
217  return 1;
218  }
219 
220  if (argc == 6) {
221  std::cout << "Creating trends for NRuns = " << argv[5] << " for tag: " << argv[2] << std::endl;
222  TrackingHDQMInspector( argv[1], argv[2], argv[3], argv[4], atoi(argv[5]) );
223  } else if(argc == 7) {
224  std::cout << "Creating trends for range: " << argv[5] << " " << argv[6] << " for tag: " << argv[1] << std::endl;
225  TrackingHDQMInspector( argv[1], argv[2], argv[3], argv[4], atoi(argv[5]), atoi(argv[6]) );
226  }
227 
228  return 0;
229 }
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
void setWhiteListFromFile(const std::string &listFileName)
void setDebug(const int i)
void TrackingHDQMInspector(const string &dbName, const string &tagName, const string &password, const string &whiteListFile, const int start, const int end)
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 ...
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
void setDoStat(const int i)