OnMonAnaHistosFEB_IsuueRates.C
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // This script makes the issue rate history plots by channel and FEB
3 // This is just a semi last resource test. This macro might been modified
4 // or attached to a pre-existing one and deleted
5 //
6 // input: OnMon files and list of APDs to watch
7 // output: Individual pixel and FEB issue rate plots to the HWwatchlist page
8 //
9 // Diana (Nov/30/2016):
10 // - Defined Pixel histograms for noisy, quiet, none reporting, loADC and HiADC
11 // - Defined FEB histograms for all the above plus dropoff
12 // - Filled Pixel histograms for adc rate
13 //
14 // ------------------------------------------------------------------------------
15 
16 #include <TFile.h>
17 #include <TTree.h>
18 #include <TChain.h>
19 #include <TMarker.h>
20 #include <TCanvas.h>
21 #include <TNtuple.h>
22 #include <TLegend.h>
23 #include <TH1.h>
24 #include <TH2.h>
25 #include <TH1F.h>
26 #include <TH2F.h>
27 #include <TSystem.h>
28 #include <TGraph.h>
29 #include <TH1D.h>
30 #include <TProfile.h>
31 #include <TColor.h>
32 #include <TMultiGraph.h>
33 #include <TPaveText.h>
34 #include <TDatime.h>
35 #include "TStyle.h"
36 #include <iostream>
37 #include <vector>
38 #include <iomanip>
39 #include <string>
40 #include <sstream>
41 #include "RateSummaryNt.h"
42 #include "DAQChannelMap/DAQChannelMap.h"
43 #include "DAQChannelMap/HardwareDisplay.h"
44 #include "NovaDAQConventions/DAQConventions.h"
45 
46 
47 void OnMonAnaHistosFEB_IssueRates(int idet, int runlo, int runhi, const std::string& OnMonFileList, const std::string& APDList, const std::string datehi, const std::string datelo, const std::string plotDir, bool archiveMode)
48 {
49  std::cout << "!!!!!!";
50 
51  // Array of 32 reasonable colors for pixel level histos
52  int colors[33];
53  colors[0] = 632; //red
54  colors[1] = 920 + 2; //gray
55  colors[2] = 632 - 7; //red
56  colors[3] = 900 + 5; //pink
57  colors[4] = 400 - 6; //yellow
58  colors[5] = 616; //mgnt
59  colors[6] = 616 + 2; //mgnt
60  colors[7] = 616 - 6; //mgnt
61  colors[8] = 800 + 10; //orange
62  colors[9] = 880 - 7; //violet
63  colors[10] = 600; //blue
64  colors[11] = 600 + 2; //blue
65  colors[12] = 600 - 3; //blue
66  colors[13] = 600 + 3; //blue
67  colors[14] = 600 - 6; //blue
68  colors[15] = 860 + 7; //azure
69  colors[16] = 432 + 1; //cyan
70  colors[17] = 880 - 5; //violet
71  colors[18] = 432 - 6; //cyan
72  colors[19] = 416; //green
73  colors[20] = 416 + 3; //green
74  colors[21] = 416 - 6; //green
75  colors[22] = 416 + 2; //green
76  colors[23] = 820 - 5; //spring
77  colors[24] = 820 - 7; //spring
78  colors[25] = 820 + 4; //spring
79  colors[26] = 400 + 2; //yellow
80  colors[27] = 400 + 3; //yellow
81  colors[28] = 800 + 7; //orange
82  colors[29] = 632 + 2; //red
83  colors[30] = 860 + 7; //azure
84  colors[31] = 900 + 6; //pink
85  colors[32] = 800 + 4; //orange
86 
87 
88  // ----------- parameters for plot details --------
89  int DB_size1;
90  int DCM_size1;
91 
92  int MapXbin;
93  int MapXmin;
94  int MapXmax;
95  int MapXsize;
96  int MapYbin;
97  int MapYmin;
98  int MapYmax;
99  int MapYdiv;
100 
101  int numberOfPixels;
102  double MapLblS;
103  double MapYoff;
105  int detMaxSR;
106 
107  double issue_rate = 500.0;
108  double noisy_rate = 500.0;
109  double quiet_rate = 10.0;
110 
111  daqchannelmap::HardwareDisplay fHardwareMapping;
112 
113  const double rateloy = -0.05;
114  const double ratehiy = 1.35;
115  char datehigh[50];
116  char datelow[50];
117 
118  sprintf(datehigh, "%s 23:59:59", datehi.c_str());
119  sprintf(datelow , "%s 00:00:01", datelo.c_str());
120 
121  std::cout << "Date High: " << datehigh << ", Date Low: " << datelow << std::endl;
122 
123  TDatime *TRangehi = new TDatime(datehigh);
124  TDatime *TRangelo = new TDatime(datelow);
125 
126  gSystem->Setenv("TZ","UTC");
127  gStyle->SetTimeOffset(0);
128 
129  // ----------- parameters are detetor dependent --------
130  // FarDet
131  if(idet==1){
132  std::cout << " far det " << std::endl;
133  detname = "FarDet";
134  DB_size1 = 16;
135  DCM_size1 = 13;
136  MapXbin = 224;
137  MapXmin = 0;
138  MapXmax = 896;
139  MapXsize = 500;
140  MapYbin = 48;
141  MapYmin = 0;
142  MapYmax = 384;
143  MapYdiv = 20;
144  MapYoff = 1;
145  MapLblS = 0.035;
146  numberOfPixels = 32;
147  detMaxSR = 64;
148 
149  fHardwareMapping.SetupDet(novadaq::cnv::kFARDET);
150  }
151  // NearDet
152  else if(idet==2){
153  std::cout << " near det " << std::endl;
154  detname = "NearDet";
155  DB_size1 = 5;
156  DCM_size1 = 5;
157  MapXbin = 64;
158  MapXmin = 0;
159  MapXmax = 256;
160  MapXsize = 300;
161  MapYbin = 16;
162  MapYmin = 0;
163  MapYmax = 128;
164  MapYdiv = 4;
165  MapYoff = 0.5;
166  MapLblS = 0.055;
167  numberOfPixels = 32;
168  detMaxSR = 24;
169 
170  fHardwareMapping.SetupDet(novadaq::cnv::kNEARDET);
171  }
172  // TestBeam
173  else if(idet==5){
174  std::cout << " test beam " << std::endl;
175  detname = "TestBeam";
176  DB_size1 = 2;
177  DCM_size1 = 4;
178  MapXbin = 16;
179  MapXmin = 0;
180  MapXmax = 64;
181  MapXsize = 300;
182  MapYbin = 12;
183  MapYmin = 0;
184  MapYmax = 96;
185  MapYdiv = 4;
186  MapYoff = 0.5;
187  MapLblS = 0.055;
188  numberOfPixels = 32;
189  detMaxSR = 24;
190 
191  fHardwareMapping.SetupDet(novadaq::cnv::kTESTBEAM);
192  }
193 
194  //----------------------------------------------------------------------------
195  // Build map of channel IDs (one per element in APD list)
196  //----------------------------------------------------------------------------
197  std::ifstream inAPD;
198  inAPD.open(APDList.c_str());
199  std::string lineAPD;
200  int N_APDs = 0;
201  std::map<int, int> fDBmap;
202  std::map<int, int> fDCMmap;
203  std::map<int, int> fFEBmap;
204  int thisDB;
205  int thisDCM;
206  int thisFEB;
207  std::vector<int> HWmapIDs;
208 
209  while(1) {
210  std::string stringDB;
211  std::stringstream stringDBs;
212  std::string stringDCM;
213  std::stringstream stringDCMs;
214  std::string stringFEB;
215  std::stringstream stringFEBs;
216  std::string mapIDstring;
217  // read channel from file and make channel ID like xxyyzz DB=xx DCM=yy FEB=zz
218  inAPD >> thisDB >> thisDCM >> thisFEB;
219  stringDBs << std::setfill('0') << std::setw(2) << thisDB;
220  stringDBs >> stringDB;
221  stringDCMs << std::setfill('0') << std::setw(2) << thisDCM;
222  stringDCMs >> stringDCM;
223  stringFEBs << std::setfill('0') << std::setw(2) << thisFEB;
224  stringFEBs >> stringFEB;
225  mapIDstring.append(stringDB);
226  mapIDstring.append(stringDCM);
227  mapIDstring.append(stringFEB);
228  int mapID = atoi(mapIDstring.c_str());
229  // fill HW address maps
230  fDBmap[mapID] = thisDB;
231  fDCMmap[mapID] = thisDCM;
232  fFEBmap[mapID] = thisFEB;
233  HWmapIDs.push_back(mapID);
234  mapIDstring = "";
235  N_APDs++;
236 
237  if (!inAPD.good()) break;
238  }
239 
240  // for debugging - check that we are reading the list correcty
241  // For every item in the APD list
242  for ( unsigned int x = 0; x < HWmapIDs.size() ; x++){
243  std::cout << "(DB, DCM, FEB) = (" << std::setw(2) << std::setfill('0') << fDBmap[HWmapIDs[x]]
244  << ", " << std::setw(2) << std::setfill('0') << fDCMmap[HWmapIDs[x]]
245  << ", " << std::setw(2) << std::setfill('0') << fFEBmap[HWmapIDs[x]]
246  << ")" <<std::endl ;
247  }
248 
249 
250  //----------------------------------------------------------------------------
251  // Loop over all OnMon files from the list and get rates for each channel
252  // in the list from the detector plots with pixel lvl info.
253  // --------------------------------------------------------------------------
254  std::ifstream in;
255  in.open(OnMonFileList.c_str());
256 
257  std::cout<<" Reading file: "<<OnMonFileList<<std::endl;
258 
259  std::vector<std::string> newfiles;
261  while(in.good()) {
262  in >> line;
263  newfiles.push_back(line);
264  }
265 
266  // we should probably get rid of this and use the variables defined above
267  const unsigned int DB_size = 16;
268  const unsigned int DCM_size = 13;
269  const unsigned int FEB_size = 64;
270  const unsigned int PIX_size = 33;
271 
272  /*
273  TH1D* PIXRatesSR[DB_size][DCM_size][FEB_size][PIX_size];
274  TH1D* PIXRatesTime[DB_size][DCM_size][FEB_size][PIX_size];
275  TH1D* PIXRatesADCSR[DB_size][DCM_size][FEB_size][PIX_size];
276  TH1D* PIXRatesADCTime[DB_size][DCM_size][FEB_size][PIX_size];
277  TH1D* PIXNoisySR[DB_size][DCM_size][FEB_size][PIX_size];
278  TH1D* PIXNoisyTime[DB_size][DCM_size][FEB_size][PIX_size];
279  TH1D* PIXQuietSR[DB_size][DCM_size][FEB_size][PIX_size];
280  TH1D* PIXQuietTime[DB_size][DCM_size][FEB_size][PIX_size];
281  TH1D* PIXNoneSR[DB_size][DCM_size][FEB_size][PIX_size];
282  TH1D* PIXNoneTime[DB_size][DCM_size][FEB_size][PIX_size];
283  TH1D* PIXLoADCSR[DB_size][DCM_size][FEB_size][PIX_size];
284  TH1D* PIXLoADCTime[DB_size][DCM_size][FEB_size][PIX_size];
285  TH1D* PIXHiADCSR[DB_size][DCM_size][FEB_size][PIX_size];
286  TH1D* PIXHiADCTime[DB_size][DCM_size][FEB_size][PIX_size];
287 */
288 
289  TH1D* FEBScoresSR[DB_size][DCM_size][FEB_size];
290  TH1D* FEBScoresTime[DB_size][DCM_size][FEB_size];
291  TH1D* FEBNoisySR[DB_size][DCM_size][FEB_size];
292  TH1D* FEBNoisyTime[DB_size][DCM_size][FEB_size];
293  TH1D* FEBQuietSR[DB_size][DCM_size][FEB_size];
294  TH1D* FEBQuietTime[DB_size][DCM_size][FEB_size];
295  TH1D* FEBNoneSR[DB_size][DCM_size][FEB_size];
296  TH1D* FEBNoneTime[DB_size][DCM_size][FEB_size];
297  TH1D* FEBLoADCSR[DB_size][DCM_size][FEB_size];
298  TH1D* FEBLoADCTime[DB_size][DCM_size][FEB_size];
299  TH1D* FEBHiADCSR[DB_size][DCM_size][FEB_size];
300  TH1D* FEBHiADCTime[DB_size][DCM_size][FEB_size];
301  TH1D* FEBDropSR[DB_size][DCM_size][FEB_size];
302  TH1D* FEBDropTime[DB_size][DCM_size][FEB_size];
303 
304  //TH1D* PIXMin[DB_size][DCM_size][FEB_size][PIX_size];
305 
306  // Plot binning for subrun numbers to be consecutive
307  int runsperbin = 1;
308  int runbins = (runhi-runlo)/runsperbin;
309  int runhitbins = (runhi-runlo)*detMaxSR;
310 
311  std::cout << "Initializing histos... " << std::endl;
312  for(unsigned int i = 0; i < DB_size; ++i) {
313  for(unsigned int j = 0; j < DCM_size; ++j) {
314  for(unsigned int k = 0; k < FEB_size; ++k) {
315  /*
316  for(unsigned int l = 0; l < PIX_size; ++l) {
317  PIXRatesSR[i][j][k][l] = 0;
318  PIXRatesTime[i][j][k][l] = 0;
319  PIXRatesADCSR[i][j][k][l] = 0;
320  PIXRatesADCTime[i][j][k][l] = 0;
321  PIXNoisySR[i][j][k][l] = 0;
322  PIXNoisyTime[i][j][k][l] = 0;
323  PIXQuietSR[i][j][k][l] = 0;
324  PIXQuietTime[i][j][k][l] = 0;
325  PIXNoneSR[i][j][k][l] = 0;
326  PIXNoneTime[i][j][k][l] = 0;
327  PIXLoADCSR[i][j][k][l] = 0;
328  PIXLoADCTime[i][j][k][l] = 0;
329  PIXHiADCSR[i][j][k][l] = 0;
330  PIXHiADCTime[i][j][k][l] = 0;
331  }
332  */
333 
334  std::cout << "DB[" << i << "] DCM[" << j << "] FEB[" << k << "]" << std::endl;
335  FEBScoresSR[i][j][k] = 0;
336  FEBScoresTime[i][j][k] = 0;
337  FEBNoisySR[i][j][k] = 0;
338  FEBNoisyTime[i][j][k] = 0;
339  FEBQuietSR[i][j][k] = 0;
340  FEBQuietTime[i][j][k] = 0;
341  FEBNoneSR[i][j][k] = 0;
342  FEBNoneTime[i][j][k] = 0;
343  FEBLoADCSR[i][j][k] = 0;
344  FEBLoADCTime[i][j][k] = 0;
345  FEBHiADCSR[i][j][k] = 0;
346  FEBHiADCTime[i][j][k] = 0;
347  FEBDropSR[i][j][k] = 0;
348  FEBDropTime[i][j][k] = 0;
349 
350  }
351  }
352  }
353 
354  // Initialize only the histograms we need (one per pixel per APD in map)
355  // For every item in the APD list
356  std::cout << " " << std::endl;
357  std::cout << "Naming histograms" << std::endl;
358  std::cout << " " << std::endl;
359 
360  for ( unsigned int x = 0; x < HWmapIDs.size(); x++ ){
361  for ( int y = 0; y < numberOfPixels; y++ ){
362  int x_db = fDBmap[HWmapIDs[x]];
363  int x_dcm = fDCMmap[HWmapIDs[x]];
364  int x_feb = fFEBmap[HWmapIDs[x]];
365 
366  if(FEBScoresTime[x_db][x_dcm][x_feb] == 0){
367  char febhistoname[30];
368  sprintf(febhistoname, "ScoreFEBSR_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
369  FEBScoresSR[x_db][x_dcm][x_feb] = new TH1D(febhistoname, "Issue Rates;run;Score", runhitbins, runlo, runhi);
370  sprintf(febhistoname, "NoisyFEBSR_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
371  FEBNoisySR[x_db][x_dcm][x_feb] = new TH1D(febhistoname, "Noisy Pixels per FEB;run;Score", runhitbins, runlo, runhi);
372  sprintf(febhistoname, "QuietFEBSR_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
373  FEBQuietSR[x_db][x_dcm][x_feb] = new TH1D(febhistoname, "Quiet Pixels per FEB;run;Score", runhitbins, runlo, runhi);
374  sprintf(febhistoname, "NoneFEBSR_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
375  FEBNoneSR[x_db][x_dcm][x_feb] = new TH1D(febhistoname, "None reporting Pixels per FEB;run;Score", runhitbins, runlo, runhi);
376  sprintf(febhistoname, "LoADCFEBSR_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
377  FEBLoADCSR[x_db][x_dcm][x_feb] = new TH1D(febhistoname, "Low ADC Pixels per FEB;run;Score", runhitbins, runlo, runhi);
378  sprintf(febhistoname, "HiADCFEBSR_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
379  FEBHiADCSR[x_db][x_dcm][x_feb] = new TH1D(febhistoname, "High ADC Pixels per FEB;run;Score", runhitbins, runlo, runhi);
380  sprintf(febhistoname, "DropFEBSR_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
381  FEBDropSR[x_db][x_dcm][x_feb] = new TH1D(febhistoname, "Dropoffs;run;Score", runhitbins, runlo, runhi);
382 
383  char febhistonamedos[30];
384  sprintf(febhistonamedos, "ScoreFEBTime_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
385  FEBScoresTime[x_db][x_dcm][x_feb] = new TH1D(febhistonamedos, "Issue Rates;date;Score", runhitbins, TRangelo->Convert(), TRangehi->Convert());
386  sprintf(febhistonamedos, "NoisyFEBTime_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
387  FEBNoisyTime[x_db][x_dcm][x_feb] = new TH1D(febhistonamedos, "Number of Noisy Pixels;date;Score", runhitbins, TRangelo->Convert(), TRangehi->Convert());
388  sprintf(febhistonamedos, "QuietFEBTime_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
389  FEBQuietTime[x_db][x_dcm][x_feb] = new TH1D(febhistonamedos, "Number of Quiet Pixels;date;Score", runhitbins, TRangelo->Convert(), TRangehi->Convert());
390  sprintf(febhistonamedos, "NoneFEBTime_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
391  FEBNoneTime[x_db][x_dcm][x_feb] = new TH1D(febhistonamedos, "Number of None Reporting Pixels;date;Score", runhitbins, TRangelo->Convert(), TRangehi->Convert());
392  sprintf(febhistonamedos, "LoADCFEBTime_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
393  FEBLoADCTime[x_db][x_dcm][x_feb] = new TH1D(febhistonamedos, "Number of Low ADC Pixels;date;Score", runhitbins, TRangelo->Convert(), TRangehi->Convert());
394  sprintf(febhistonamedos, "HiADCFEBTime_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
395  FEBHiADCTime[x_db][x_dcm][x_feb] = new TH1D(febhistonamedos, "Number of High ADC Pixels;date;Score", runhitbins, TRangelo->Convert(), TRangehi->Convert());
396  sprintf(febhistonamedos, "DropFEBTime_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
397  FEBDropTime[x_db][x_dcm][x_feb] = new TH1D(febhistonamedos, "Number of Dropoffs;date;Score", runhitbins, TRangelo->Convert(), TRangehi->Convert());
398  }// feb histos
399 
400  /*
401  if(PIXRatesSR[x_db][x_dcm][x_feb][y] == 0){
402  char histoname[30];
403  sprintf(histoname, "RatePIXSR_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
404  PIXRatesSR[x_db][x_dcm][x_feb][y] = new TH1D(histoname, "Hit Rate in Pixels;run;rate (Hz)", runhitbins, runlo, runhi);
405  sprintf(histoname, "RateADCPIXSR_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
406  PIXRatesADCSR[x_db][x_dcm][x_feb][y] = new TH1D(histoname, "ADC Rate in Pixels;run;rate (Hz)", runhitbins, runlo, runhi);
407  sprintf(histoname, "NoisyPIXSR_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
408  PIXNoisySR[x_db][x_dcm][x_feb][y] = new TH1D(histoname, "Noisy Pixels;run;Status", runhitbins, runlo, runhi);
409  sprintf(histoname, "QuietPIXSR_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
410  PIXQuietSR[x_db][x_dcm][x_feb][y] = new TH1D(histoname, "Quiet Pixels;run;Status", runhitbins, runlo, runhi);
411  sprintf(histoname, "NonePIXSR_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
412  PIXNoneSR[x_db][x_dcm][x_feb][y] = new TH1D(histoname, "None reporting Pixels;run;Status", runhitbins, runlo, runhi);
413  sprintf(histoname, "LoADCPIXSR_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
414  PIXLoADCSR[x_db][x_dcm][x_feb][y] = new TH1D(histoname, "Low ADC Pixels;run;Status", runhitbins, runlo, runhi);
415  sprintf(histoname, "HiADCPIXSR_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
416  PIXHiADCSR[x_db][x_dcm][x_feb][y] = new TH1D(histoname, "High ADC Pixels;run;Status", runhitbins, runlo, runhi);
417 
418  char histonamedos[30];
419  sprintf(histonamedos, "RatePIXTime_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
420  PIXRatesTime[x_db][x_dcm][x_feb][y] = new TH1D(histonamedos, "Hit Rate in Pixels;date;rate (Hz)", runhitbins, TRangelo->Convert(), TRangehi->Convert());
421  sprintf(histonamedos, "RateADCPIXTime_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
422  PIXRatesADCTime[x_db][x_dcm][x_feb][y] = new TH1D(histonamedos, "ADC Rate in Pixels;date;rate (Hz)", runhitbins, TRangelo->Convert(), TRangehi->Convert());
423  sprintf(histonamedos, "NoisyPIXTime_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
424  PIXNoisyTime[x_db][x_dcm][x_feb][y] = new TH1D(histonamedos, "Noisy Pixels;date;Status", runhitbins, TRangelo->Convert(), TRangehi->Convert());
425  sprintf(histonamedos, "QuietPIXTime_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
426  PIXQuietTime[x_db][x_dcm][x_feb][y] = new TH1D(histonamedos, "Quiet Pixels;date;Status", runhitbins, TRangelo->Convert(), TRangehi->Convert());
427  sprintf(histonamedos, "NonePIXTime_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
428  PIXNoneTime[x_db][x_dcm][x_feb][y] = new TH1D(histonamedos, "None reporting Pixels;date;Status", runhitbins, TRangelo->Convert(), TRangehi->Convert());
429  sprintf(histonamedos, "LoADCPIXTime_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
430  PIXLoADCTime[x_db][x_dcm][x_feb][y] = new TH1D(histonamedos, "Low ADC Pixels;date;Status", runhitbins, TRangelo->Convert(), TRangehi->Convert());
431  sprintf(histonamedos, "HiADCPIXTime_%.2u_%.2u_%.2u_%.2u", x_db, x_dcm, x_feb, y);
432  PIXHiADCTime[x_db][x_dcm][x_feb][y] = new TH1D(histonamedos, "High ADC Pixels;date;Status", runhitbins, TRangelo->Convert(), TRangehi->Convert());
433  }// pixel histos
434  */
435 
436  }// y_pix
437  }// x
438 
439 
440  TH1D* AllRates = new TH1D("AllPixelHitRates", "Rate in all Pixels;log10(rate (Hz));pixels*subrun", 70, -1, 6);
441  TH2D* RatesPerRun = new TH2D("RatesPerRun", "Rate in all Pixels per run;run;log10(rate (Hz))",runbins, runlo, runhi, 70, -1, 7);
442 
443  unsigned int xdb, ydb, xdcm, ydcm, xfeb, yfeb, xpix, ypix;
444  double pixhitrate;
445  double pixadcrate;
446  double pixloadc;
447  double pixhiadc;
448  double pixdrop;
449  double runSR;
450  UInt_t run;
451  UInt_t subrun;
452  UShort_t startmonth;
453  UInt_t startyear;
454  UShort_t startday;
455  double starthour;
456 
457  for(unsigned int ifile=0; ifile<newfiles.size()-1; ifile++){
458  // Open file
459  char filename[120];
460  sprintf(filename, "%s", newfiles[ifile].c_str());
461  TFile *thisfile = new TFile(filename, "READ");
462  // Get run, subrun and datime from the header
463  TTree *header = (TTree*)thisfile->Get("Header");
464  if(header != 0){
465  header->SetBranchAddress("Run", &run);
466  header->SetBranchAddress("Subrun", &subrun);
467  header->SetBranchAddress("StartYear", &startyear);
468  header->SetBranchAddress("StartMonth", &startmonth);
469  header->SetBranchAddress("StartDay", &startday);
470  header->SetBranchAddress("StartHour", &starthour);
471  header->GetEntry(0);
472  }
473  runSR = (double)run + ((double)subrun / detMaxSR);
474  Int_t srhour;
475  Int_t srmin;
476  Int_t srsec;
477  std::cout << "Run: " << run << " Subrun: " << std::setw(2) << std::setfill('0') << subrun
478  << " (" << ifile << " of " << newfiles.size()-2 << " complete)" << std::endl;
479 
480  //Example of time:
481  //starthour = 12.32645
482  //srhour = trunc(12.32645) = 12
483  //srmin = trunc((12.32645-12)*60) = trunc(19.587) = 19
484  //srsec = trunc((19.587-19)*60) = trunc(35.22) = 35
485  //Time: 12:19:35 PM
486 
487  srhour = (Int_t)trunc(starthour);
488  srmin = (Int_t)trunc((starthour-srhour)*60);
489  srsec = (Int_t)trunc((((starthour-srhour)*60)-srmin)*60);
490 
491  TDatime *subruntime = new TDatime(startyear, startmonth, startday, srhour, srmin, srsec);
492 
493  // Get hitrate from OnMon plot
494  std::cout << " " << std::endl;
495  std::cout << "FindObjectAny from the OnMons ..." << std::endl;
496  std::cout << " " << std::endl;
497  TH2D* HitRateHist = (TH2D*)thisfile->FindObjectAny("PixelHitRateMap");
498  TH2D* HitRateADCHist = (TH2D*)thisfile->FindObjectAny("PixelHitRateMapMipADC");
499  TH2D* HitLoADCHist = (TH2D*)thisfile->FindObjectAny("PixelHitRateMapLowADC");
500  TH2D* HitHiADCHist = (TH2D*)thisfile->FindObjectAny("PixelHitRateMapHighADC");
501  TH2D* FEBDropHist = (TH2D*)thisfile->FindObjectAny("FEBShutOff");
502 
503  // first figure out plot(x,y) for this db-dcm-feb-pix
504  // For every item in the APD list
505  std::cout << "Entering loop for every item in the APD list... " << std::endl;
506  std::cout << " " << std::endl;
507 
508  for ( unsigned int xID = 0; xID < HWmapIDs.size(); xID++ ){
509  std::cout << "In" << std::endl;
510  int x_db = fDBmap[HWmapIDs[xID]];
511  int x_dcm = fDCMmap[HWmapIDs[xID]];
512  int x_feb = fFEBmap[HWmapIDs[xID]];
513  fHardwareMapping.DiblockXY(x_db,&xdb,&ydb);
514  fHardwareMapping.DCMXY(x_dcm,&xdcm,&ydcm);
515  fHardwareMapping.FEBXY(x_feb,&xfeb,&yfeb);
516  for( int y = 0; y < numberOfPixels; y++){
517  if( y == 0 || y == numberOfPixels-1){
518  fHardwareMapping.PixXY(y,&xpix,&ypix);
519  std::cout << "GetBinContent from HitRateHist" << std::endl;
520  pixhitrate = HitRateHist->GetBinContent(HitRateHist->FindFixBin(xdb+xdcm+xfeb+xpix,ydb+ydcm+yfeb+ypix));
521  std::cout << "GetBinContent from HitRateADCHist" << std::endl;
522  pixadcrate = HitRateADCHist->GetBinContent(HitRateADCHist->FindFixBin(xdb+xdcm+xfeb+xpix,ydb+ydcm+yfeb+ypix));
523  std::cout << "GetBinContent from HitLoADCHist" << std::endl;
524  pixloadc = HitLoADCHist->GetBinContent(HitLoADCHist->FindFixBin(xdb+xdcm+xfeb+xpix,ydb+ydcm+yfeb+ypix));
525  std::cout << "GetBinContent from HitHiADCHist" << std::endl;
526  pixhiadc = HitHiADCHist->GetBinContent(HitHiADCHist->FindFixBin(xdb+xdcm+xfeb+xpix,ydb+ydcm+yfeb+ypix));
527  std::cout << "GetBinContent from FEBDropHist" << std::endl;
528  pixdrop = FEBDropHist->GetBinContent(FEBDropHist->FindFixBin(xdb+xdcm+xfeb+xpix,ydb+ydcm+yfeb+ypix));
529  }
530 
531  /*
532  PIXRatesSR[x_db][x_dcm][x_feb][y] ->Fill(runSR, pixhitrate);
533  PIXRatesTime[x_db][x_dcm][x_feb][y]->Fill(subruntime->Convert(), pixhitrate);
534  PIXRatesADCSR[x_db][x_dcm][x_feb][y] ->Fill(runSR, pixadcrate + pixloadc + pixhiadc);
535  PIXRatesADCTime[x_db][x_dcm][x_feb][y]->Fill(subruntime->Convert(), pixadcrate + pixloadc + pixhiadc);
536  */
537  if ( pixhitrate >= noisy_rate){
538  //PIXNoisySR[x_db][x_dcm][x_feb][y] ->Fill(runSR, 1);
539  //PIXNoisyTime[x_db][x_dcm][x_feb][y] ->Fill(subruntime->Convert(), 1);
540  FEBNoisySR[x_db][x_dcm][x_feb] ->Fill(runSR, 1.0/32.0);
541  FEBNoisyTime[x_db][x_dcm][x_feb] ->Fill(subruntime->Convert(), 1.0/32.0);
542  }//noisy rate
543  if ( pixhitrate <= quiet_rate && pixhitrate > 0){
544  //PIXQuietSR[x_db][x_dcm][x_feb][y]->Fill(runSR, 1);
545  //PIXQuietTime[x_db][x_dcm][x_feb][y]->Fill(subruntime->Convert(), 1.0);
546  FEBQuietSR[x_db][x_dcm][x_feb] ->Fill(runSR, 1.0/32.0);
547  FEBQuietTime[x_db][x_dcm][x_feb] ->Fill(subruntime->Convert(), 1.0/32.0);
548  }//quiet rate
549  if ( pixhitrate == 0){
550  //PIXNoneSR[x_db][x_dcm][x_feb][y]->Fill(runSR, 1);
551  //PIXNoneTime[x_db][x_dcm][x_feb][y]->Fill(subruntime->Convert(), 1);
552  FEBNoneSR[x_db][x_dcm][x_feb] ->Fill(runSR, 1.0/32.0);
553  FEBNoneTime[x_db][x_dcm][x_feb] ->Fill(subruntime->Convert(), 1.0/32.0);
554  }//none reporting
555  if ( pixloadc != 0){
556  //PIXLoADCSR[x_db][x_dcm][x_feb][y]->Fill(runSR, 1);
557  //PIXLoADCTime[x_db][x_dcm][x_feb][y]->Fill(subruntime->Convert(), 1.0);
558  FEBLoADCSR[x_db][x_dcm][x_feb] ->Fill(runSR, 1.0/32);
559  FEBLoADCTime[x_db][x_dcm][x_feb] ->Fill(subruntime->Convert(), 1.0/32);
560  }//lo adc
561  if ( pixhiadc != 0){
562  //PIXHiADCSR[x_db][x_dcm][x_feb][y]->Fill(runSR, 1);
563  //PIXHiADCTime[x_db][x_dcm][x_feb][y]->Fill(subruntime->Convert(), 1);
564  FEBHiADCSR[x_db][x_dcm][x_feb] ->Fill(runSR, 1.0/32);
565  FEBHiADCTime[x_db][x_dcm][x_feb] ->Fill(subruntime->Convert(), 1.0/32);
566  }//hi adc
567  if ( pixdrop > 0 ){
568  FEBDropSR[x_db][x_dcm][x_feb] ->Fill(runSR, 1.0/32.0);
569  FEBDropTime[x_db][x_dcm][x_feb] ->Fill(subruntime->Convert(), 1.0/32.0);
570  }//drop off
571 
572  if ( pixhitrate >= issue_rate){
573  FEBScoresSR[x_db][x_dcm][x_feb]->Fill(runSR, 1.0/32.0);
574  FEBScoresTime[x_db][x_dcm][x_feb]->Fill(subruntime->Convert(), 1.0/32.0);
575  }
576 
577  }//y_pix
578  }//x_mapID
579  delete thisfile;
580  }// ifiles
581 
582 
583  //-------------------------------------------------------------------------
584  // Make output histogram file and draw plots
585  //-------------------------------------------------------------------------
586 
587 
588  // Save histos in output file
589  char outfilename[100];
590  sprintf(outfilename, "/nusoft/app/web/htdoc/nova/datacheck/nearline/HardwareWatchList/Onmon_ana-HistosPIXMin-run%.2u-%.2u.root",
591  runlo, runhi-1);
592  TFile* out_file = new TFile(outfilename, "RECREATE");
593 
594  /*
595  out_file->mkdir("PIXPlots");
596  std::cout << "Writing " << outfilename << std::endl;
597  out_file->cd("PIXPlots");
598  for(unsigned int i = 1; i < DB_size; ++i) {
599  for(unsigned int j = 1; j < DCM_size; ++j) {
600  for(unsigned int k = 0; k < FEB_size; ++k) {
601  for(unsigned int l = 0; l < PIX_size; ++l) {
602  if( PIXRatesSR[i][j][k][l] !=0) {
603  PIXRatesSR[i][j][k][l]->SetLineColor(colors[l]);
604  PIXRatesSR[i][j][k][l]->SetMarkerStyle(34);
605  PIXRatesSR[i][j][k][l]->SetMarkerColor(colors[l]);
606  PIXRatesSR[i][j][k][l]->SetAxisRange(0.01,1000000,"Y");
607  PIXRatesSR[i][j][k][l]->Write();
608  PIXRatesTime[i][j][k][l]->SetLineColor(colors[l]);
609  PIXRatesTime[i][j][k][l]->SetMarkerStyle(34);
610  PIXRatesTime[i][j][k][l]->SetMarkerColor(colors[l]);
611  PIXRatesTime[i][j][k][l]->SetAxisRange(0.01,1000000,"Y");
612  PIXRatesTime[i][j][k][l]->SetNdivisions(-7,"X");
613  PIXRatesTime[i][j][k][l]->GetXaxis()->SetNdivisions(-7);
614  PIXRatesTime[i][j][k][l]->GetXaxis()->SetTimeDisplay(1);
615  PIXRatesTime[i][j][k][l]->GetXaxis()->SetTimeFormat("%m/%d");
616  //PIXRatesTime[i][j][k][l]->SetNdivisions(5);
617  PIXRatesTime[i][j][k][l]->SetNdivisions(-7,"X");
618  PIXRatesTime[i][j][k][l]->GetXaxis()->SetNdivisions(-7);
619  PIXRatesTime[i][j][k][l]->Write();
620  }
621  }
622  }
623  }
624  }
625  out_file->Close();
626  */
627  // Surpress info during png file production
628  //gROOT->ProcessLine("gErrorIgnoreLevel = 1001;")
629 
630 
631 
632  // Make plots to publish on the web
633  // For every item in the APD list
634  for(unsigned int x = 0; x < HWmapIDs.size(); ++x){
635  char name[30];
636  sprintf(name, "PIXratesRunFEB_%.2u", HWmapIDs[x]);
637  int x_db = fDBmap[HWmapIDs[x]];
638  int x_dcm = fDCMmap[HWmapIDs[x]];
639  int x_feb = fFEBmap[HWmapIDs[x]];
640  std::cout << std::endl << "------------------------------------------"<< std::endl;
641  std::cout << "Now creating plots for HWmapID: " << HWmapIDs[x]
642  << " (" << x << " of " << HWmapIDs.size() << " complete)" << std::endl;
643  std::cout << "-------------------------------------------------------"<< std::endl;
644 
645  /*
646  // For pixels
647  TCanvas* CanvasP = new TCanvas(name,name,1167,335);
648  CanvasP->SetLogy();
649  for(int y = 0; y <numberOfPixels; y++){
650  PIXRatesSR[x_db][x_dcm][x_feb][y]->SetMarkerStyle(34);
651  PIXRatesSR[x_db][x_dcm][x_feb][y]->SetAxisRange(0.01,1000000,"Y");
652  PIXRatesSR[x_db][x_dcm][x_feb][y]->SetMarkerSize(.5);
653  PIXRatesSR[x_db][x_dcm][x_feb][y]->SetMarkerColor(colors[y]);
654  PIXRatesSR[x_db][x_dcm][x_feb][y]->Draw("same, P");
655  PIXRatesSR[x_db][x_dcm][x_feb][y]->GetYaxis()->SetTitleOffset(0.75);
656  PIXRatesSR[x_db][x_dcm][x_feb][y]->SetStats(0);
657 
658  TPaveText *pt = new TPaveText(0.12, 0.78, 0.25, 0.89, "NDC");
659  pt->AddText("Hit Rate in Pixels");
660  char address[30];
661  sprintf(address, "DB%.2u DCM%.2u FEB%.2u", x_db, x_dcm, x_feb);
662  pt->AddText(address);
663  pt->SetLineColor(kWhite);
664  pt->SetShadowColor(kWhite);
665  pt->SetFillColor(kWhite);
666  pt->Draw();
667  pt->SetTextFont(42);
668  }
669  // Print png to file
670  char pngFile[128];
671  if(archiveMode){
672  sprintf(pngFile, "%s/pixratesrunfeb-%s_%.2u_%.2u_%.2u.png", plotDir.c_str(), datelo.c_str(), x_db, x_dcm, x_feb);
673  }
674  else {
675  sprintf(pngFile, "%s/pixratesrunfeb-%.2u_%.2u_%.2u.png", plotDir.c_str(), x_db, x_dcm, x_feb);
676  }
677  CanvasP->Print(pngFile);
678 
679 
680  char name2[30];
681  sprintf(name2, "PIXratesDateFEB_%.2u", HWmapIDs[x]);
682  TCanvas* CanvasP2 = new TCanvas(name2,name2,1167,335);
683  CanvasP2->SetLogy();
684  for(int y = 0; y <numberOfPixels; y++){
685  PIXRatesTime[x_db][x_dcm][x_feb][y]->SetMarkerStyle(34);
686  PIXRatesTime[x_db][x_dcm][x_feb][y]->SetAxisRange(0.01,1000000,"Y");
687  PIXRatesTime[x_db][x_dcm][x_feb][y]->SetMarkerSize(.5);
688  PIXRatesTime[x_db][x_dcm][x_feb][y]->SetMarkerColor(colors[y]);
689  PIXRatesTime[x_db][x_dcm][x_feb][y]->Draw("same, P");
690  PIXRatesTime[x_db][x_dcm][x_feb][y]->GetYaxis()->SetTitleOffset(0.75);
691  PIXRatesTime[x_db][x_dcm][x_feb][y]->SetStats(0);
692  //PIXRatesTime[x_db][x_dcm][x_feb][y]->SetTimeDisplay(1);
693  TPaveText *pt2 = new TPaveText(0.12, 0.78, 0.25, 0.89, "NDC");
694  pt2->AddText("Hit Rate in Pixels");
695  char address2[30];
696  sprintf(address2, "DB%.2u DCM%.2u FEB%.2u", x_db, x_dcm, x_feb);
697  pt2->AddText(address2);
698  pt2->SetLineColor(kWhite);
699  pt2->SetShadowColor(kWhite);
700  pt2->SetFillColor(kWhite);
701  pt2->Draw();
702  pt2->SetTextFont(42);
703  }
704  char pngFile2[128];
705  if(archiveMode){
706  sprintf(pngFile2, "%s/pixratesdatefeb-%s_%.2u_%.2u_%.2u.png", plotDir.c_str(), datelo.c_str(), x_db, x_dcm, x_feb);
707  }
708  else {
709  sprintf(pngFile2, "%s/pixratesdatefeb-%.2u_%.2u_%.2u.png", plotDir.c_str(), x_db, x_dcm, x_feb);
710  }
711  CanvasP2->Print(pngFile2);
712 
713 
714  std::cout << "Canvas3 " << std::endl;
715  std::cout << " " << std::endl;
716  char name3[30];
717  sprintf(name3, "FEBscoresDateFEB_%.2u", HWmapIDs[x]);
718  TCanvas* CanvasP3 = new TCanvas(name3,name3,1167,335);
719  FEBScoresTime[x_db][x_dcm][x_feb]->SetMarkerStyle(34);
720  FEBScoresTime[x_db][x_dcm][x_feb]->SetAxisRange(0,1,"Y");
721  FEBScoresTime[x_db][x_dcm][x_feb]->SetMarkerSize(.5);
722  FEBScoresTime[x_db][x_dcm][x_feb]->SetLineColor(kRed-3);
723  FEBScoresTime[x_db][x_dcm][x_feb]->SetMarkerColor(kRed-3);
724  FEBScoresTime[x_db][x_dcm][x_feb]->Draw("same, P");
725  FEBScoresTime[x_db][x_dcm][x_feb]->GetYaxis()->SetTitleOffset(0.75);
726  FEBScoresTime[x_db][x_dcm][x_feb]->SetStats(0);
727  //FEBScoresTime[x_db][x_dcm][x_feb]->SetTimeDisplay(1);
728 
729  TPaveText *pt3 = new TPaveText(0.12, 0.78, 0.25, 0.89, "NDC");
730  pt3->AddText("Issue Scores");
731  char address2[30];
732  sprintf(address2, "DB%.2u DCM%.2u FEB%.2u", x_db, x_dcm, x_feb);
733  pt3->AddText(address2);
734  pt3->SetLineColor(kWhite);
735  pt3->SetShadowColor(kWhite);
736  pt3->SetFillColor(kWhite);
737  pt3->Draw();
738  pt3->SetTextFont(42);
739  char pngFile3[128];
740  if(archiveMode){
741  sprintf(pngFile3, "%s/febscoresdatefeb-%s_%.2u_%.2u_%.2u.png", plotDir.c_str(), datelo.c_str(), x_db, x_dcm, x_feb);
742  }
743  else {
744  sprintf(pngFile3, "%s/febscoresdatefeb-%.2u_%.2u_%.2u.png", plotDir.c_str(), x_db, x_dcm, x_feb);
745  }
746  CanvasP3->Print(pngFile3);
747 
748  */
749 
750  //Adding FEB issues: noise, quiet, non reporting, lo adc and hi adc
751  std::cout << "Canvas5: FEBscoresall_Date" << std::endl;
752  std::cout << " " << std::endl;
753  char name5[30];
754  sprintf(name5, "FEBscoresallDateFEB_%.2u", HWmapIDs[x]);
755  TCanvas* CanvasP5 = new TCanvas(name5,name5,1167,335);
756  FEBNoisyTime[x_db][x_dcm][x_feb]->SetTitle("Issue Rates");
757  FEBNoisyTime[x_db][x_dcm][x_feb]->SetMarkerStyle(21);
758  FEBNoisyTime[x_db][x_dcm][x_feb]->SetAxisRange(rateloy,ratehiy,"Y");
759  FEBNoisyTime[x_db][x_dcm][x_feb]->SetNdivisions(-7,"X");
760  FEBNoisyTime[x_db][x_dcm][x_feb]->GetXaxis()->SetNdivisions(-7);
761  FEBNoisyTime[x_db][x_dcm][x_feb]->GetXaxis()->SetTimeDisplay(1);
762  FEBNoisyTime[x_db][x_dcm][x_feb]->GetXaxis()->SetTimeFormat("%m/%d");
763  FEBNoisyTime[x_db][x_dcm][x_feb]->SetNdivisions(-7,"X");
764  FEBNoisyTime[x_db][x_dcm][x_feb]->GetXaxis()->SetNdivisions(-7);
765  FEBNoisyTime[x_db][x_dcm][x_feb]->SetMarkerSize(.5);
766  FEBNoisyTime[x_db][x_dcm][x_feb]->SetLineColor(632); // red
767  FEBNoisyTime[x_db][x_dcm][x_feb]->SetMarkerColor(632);
768  FEBNoisyTime[x_db][x_dcm][x_feb]->Draw("same, P");
769  FEBNoisyTime[x_db][x_dcm][x_feb]->GetYaxis()->SetTitleOffset(0.75);
770  FEBNoisyTime[x_db][x_dcm][x_feb]->SetStats(0);
771 
772  FEBQuietTime[x_db][x_dcm][x_feb]->SetMarkerStyle(20);
773  FEBQuietTime[x_db][x_dcm][x_feb]->SetAxisRange(rateloy,ratehiy,"Y");
774  FEBQuietTime[x_db][x_dcm][x_feb]->SetNdivisions(-7,"X");
775  FEBQuietTime[x_db][x_dcm][x_feb]->GetXaxis()->SetNdivisions(-7);
776  FEBQuietTime[x_db][x_dcm][x_feb]->GetXaxis()->SetTimeDisplay(1);
777  FEBQuietTime[x_db][x_dcm][x_feb]->GetXaxis()->SetTimeFormat("%m/%d");
778  FEBQuietTime[x_db][x_dcm][x_feb]->SetNdivisions(-7,"X");
779  FEBQuietTime[x_db][x_dcm][x_feb]->GetXaxis()->SetNdivisions(-7);
780  FEBQuietTime[x_db][x_dcm][x_feb]->SetMarkerSize(.5);
781  FEBQuietTime[x_db][x_dcm][x_feb]->SetLineColor(600); // blue
782  FEBQuietTime[x_db][x_dcm][x_feb]->SetMarkerColor(600);
783  FEBQuietTime[x_db][x_dcm][x_feb]->Draw("same, P");
784  FEBQuietTime[x_db][x_dcm][x_feb]->GetYaxis()->SetTitleOffset(0.75);
785  FEBQuietTime[x_db][x_dcm][x_feb]->SetStats(0);
786 
787  FEBNoneTime[x_db][x_dcm][x_feb]->SetMarkerStyle(22);
788  FEBNoneTime[x_db][x_dcm][x_feb]->SetAxisRange(rateloy,ratehiy,"Y");
789  FEBNoneTime[x_db][x_dcm][x_feb]->SetNdivisions(-7,"X");
790  FEBNoneTime[x_db][x_dcm][x_feb]->GetXaxis()->SetNdivisions(-7);
791  FEBNoneTime[x_db][x_dcm][x_feb]->GetXaxis()->SetTimeDisplay(1);
792  FEBNoneTime[x_db][x_dcm][x_feb]->GetXaxis()->SetTimeFormat("%m/%d");
793  FEBNoneTime[x_db][x_dcm][x_feb]->SetNdivisions(-7,"X");
794  FEBNoneTime[x_db][x_dcm][x_feb]->GetXaxis()->SetNdivisions(-7);
795  FEBNoneTime[x_db][x_dcm][x_feb]->SetMarkerSize(.5);
796  FEBNoneTime[x_db][x_dcm][x_feb]->SetLineColor(920); // gray
797  FEBNoneTime[x_db][x_dcm][x_feb]->SetMarkerColor(920);
798  FEBNoneTime[x_db][x_dcm][x_feb]->Draw("same, P");
799  FEBNoneTime[x_db][x_dcm][x_feb]->GetYaxis()->SetTitleOffset(0.75);
800  FEBNoneTime[x_db][x_dcm][x_feb]->SetStats(0);
801 
802  FEBLoADCTime[x_db][x_dcm][x_feb]->SetMarkerStyle(23);
803  FEBLoADCTime[x_db][x_dcm][x_feb]->SetAxisRange(rateloy,ratehiy,"Y");
804  FEBLoADCTime[x_db][x_dcm][x_feb]->SetNdivisions(-7,"X");
805  FEBLoADCTime[x_db][x_dcm][x_feb]->GetXaxis()->SetNdivisions(-7);
806  FEBLoADCTime[x_db][x_dcm][x_feb]->GetXaxis()->SetTimeDisplay(1);
807  FEBLoADCTime[x_db][x_dcm][x_feb]->GetXaxis()->SetTimeFormat("%m/%d");
808  FEBLoADCTime[x_db][x_dcm][x_feb]->SetNdivisions(-7,"X");
809  FEBLoADCTime[x_db][x_dcm][x_feb]->GetXaxis()->SetNdivisions(-7);
810  FEBLoADCTime[x_db][x_dcm][x_feb]->SetMarkerSize(.5);
811  FEBLoADCTime[x_db][x_dcm][x_feb]->SetLineColor(880-5); // violet
812  FEBLoADCTime[x_db][x_dcm][x_feb]->SetMarkerColor(880-5);
813  FEBLoADCTime[x_db][x_dcm][x_feb]->Draw("same, P");
814  FEBLoADCTime[x_db][x_dcm][x_feb]->GetYaxis()->SetTitleOffset(0.75);
815  FEBLoADCTime[x_db][x_dcm][x_feb]->SetStats(0);
816 
817  FEBHiADCTime[x_db][x_dcm][x_feb]->SetMarkerStyle(29);
818  FEBHiADCTime[x_db][x_dcm][x_feb]->SetAxisRange(rateloy,ratehiy,"Y");
819  FEBHiADCTime[x_db][x_dcm][x_feb]->SetNdivisions(-7,"X");
820  FEBHiADCTime[x_db][x_dcm][x_feb]->GetXaxis()->SetNdivisions(-7);
821  FEBHiADCTime[x_db][x_dcm][x_feb]->GetXaxis()->SetTimeDisplay(1);
822  FEBHiADCTime[x_db][x_dcm][x_feb]->GetXaxis()->SetTimeFormat("%m/%d");
823  FEBHiADCTime[x_db][x_dcm][x_feb]->SetNdivisions(-7,"X");
824  FEBHiADCTime[x_db][x_dcm][x_feb]->GetXaxis()->SetNdivisions(-7);
825  FEBHiADCTime[x_db][x_dcm][x_feb]->SetMarkerSize(.5);
826  FEBHiADCTime[x_db][x_dcm][x_feb]->SetLineColor(800+7); // orange
827  FEBHiADCTime[x_db][x_dcm][x_feb]->SetMarkerColor(800+7);
828  FEBHiADCTime[x_db][x_dcm][x_feb]->Draw("same, P");
829  FEBHiADCTime[x_db][x_dcm][x_feb]->GetYaxis()->SetTitleOffset(0.75);
830  FEBHiADCTime[x_db][x_dcm][x_feb]->SetStats(0);
831 
832  FEBDropTime[x_db][x_dcm][x_feb]->SetMarkerStyle(34);
833  FEBDropTime[x_db][x_dcm][x_feb]->SetAxisRange(rateloy,ratehiy,"Y");
834  FEBDropTime[x_db][x_dcm][x_feb]->SetNdivisions(-7,"X");
835  FEBDropTime[x_db][x_dcm][x_feb]->GetXaxis()->SetNdivisions(-7);
836  FEBDropTime[x_db][x_dcm][x_feb]->GetXaxis()->SetTimeDisplay(1);
837  FEBDropTime[x_db][x_dcm][x_feb]->GetXaxis()->SetTimeFormat("%m/%d");
838  FEBDropTime[x_db][x_dcm][x_feb]->SetNdivisions(-7,"X");
839  FEBDropTime[x_db][x_dcm][x_feb]->GetXaxis()->SetNdivisions(-7);
840  FEBDropTime[x_db][x_dcm][x_feb]->SetMarkerSize(.5);
841  FEBDropTime[x_db][x_dcm][x_feb]->SetLineColor(632+2); // red-brown
842  FEBDropTime[x_db][x_dcm][x_feb]->SetMarkerColor(632+2);
843  FEBDropTime[x_db][x_dcm][x_feb]->Draw("same, P");
844  FEBDropTime[x_db][x_dcm][x_feb]->GetYaxis()->SetTitleOffset(0.75);
845  FEBDropTime[x_db][x_dcm][x_feb]->SetStats(0);
846 
847  TLegend *l5 = new TLegend(0.79,0.45, 0.89, 0.65);
848  l5->AddEntry(FEBNoisyTime[x_db][x_dcm][x_feb], "noisy", "p");
849  l5->AddEntry(FEBQuietTime[x_db][x_dcm][x_feb], "quiet", "p");
850  l5->AddEntry(FEBNoneTime[x_db][x_dcm][x_feb], "none-rep", "p");
851  l5->AddEntry(FEBLoADCTime[x_db][x_dcm][x_feb], "lowADC", "p");
852  l5->AddEntry(FEBHiADCTime[x_db][x_dcm][x_feb], "highADC", "p");
853  l5->AddEntry(FEBDropTime[x_db][x_dcm][x_feb], "dropout", "p");
854  l5->SetTextSize(0.05);
855  l5->SetTextFont(42);
856  l5->SetBorderSize(0);
857  l5->SetFillColor(0);
858  l5->Draw();
859 
860  TPaveText *pt5 = new TPaveText(0.12, 0.78, 0.25, 0.89, "NDC");
861  pt5->AddText("Issue Scores");
862  char address2[30];
863  sprintf(address2, "DB%.2u DCM%.2u FEB%.2u", x_db, x_dcm, x_feb);
864  pt5->AddText(address2);
865  pt5->SetLineColor(kWhite);
866  pt5->SetShadowColor(kWhite);
867  pt5->SetFillColor(kWhite);
868  pt5->Draw();
869  pt5->SetTextFont(42);
870  char pngFile5[128];
871  if(archiveMode){
872  sprintf(pngFile5, "%s/feballscoresdatefeb-%s_%.2u_%.2u_%.2u.png", plotDir.c_str(), datelo.c_str(), x_db, x_dcm, x_feb);
873  }
874  else {
875  sprintf(pngFile5, "%s/feballscoresdatefeb-%.2u_%.2u_%.2u.png", plotDir.c_str(), x_db, x_dcm, x_feb);
876  }
877  CanvasP5->Print(pngFile5);
878 
879 
880 
881  std::cout << "Canvas6 FEBallscoresRunFEB" << std::endl;
882  std::cout << " " << std::endl;
883 
884  char name6[30];
885  sprintf(name6, "FEBallscoresRunFEB_%.2u", HWmapIDs[x]);
886  TCanvas* CanvasP6 = new TCanvas(name6,name6,1167,335);
887  FEBNoisySR[x_db][x_dcm][x_feb]->SetTitle("Issue Rates");
888  FEBNoisySR[x_db][x_dcm][x_feb]->SetMarkerStyle(20);
889  FEBNoisySR[x_db][x_dcm][x_feb]->SetAxisRange(rateloy,ratehiy,"Y");
890  FEBNoisySR[x_db][x_dcm][x_feb]->SetMarkerSize(.5);
891  FEBNoisySR[x_db][x_dcm][x_feb]->SetLineColor(632);
892  FEBNoisySR[x_db][x_dcm][x_feb]->SetMarkerColor(632);
893  FEBNoisySR[x_db][x_dcm][x_feb]->Draw("same, P");
894  FEBNoisySR[x_db][x_dcm][x_feb]->GetYaxis()->SetTitleOffset(0.75);
895  FEBNoisySR[x_db][x_dcm][x_feb]->SetStats(0);
896 
897  FEBQuietSR[x_db][x_dcm][x_feb]->SetMarkerStyle(21);
898  FEBQuietSR[x_db][x_dcm][x_feb]->SetAxisRange(rateloy,ratehiy,"Y");
899  FEBQuietSR[x_db][x_dcm][x_feb]->SetMarkerSize(.5);
900  FEBQuietSR[x_db][x_dcm][x_feb]->SetLineColor(600);
901  FEBQuietSR[x_db][x_dcm][x_feb]->SetMarkerColor(600);
902  FEBQuietSR[x_db][x_dcm][x_feb]->Draw("same, P");
903  FEBQuietSR[x_db][x_dcm][x_feb]->GetYaxis()->SetTitleOffset(0.75);
904  FEBQuietSR[x_db][x_dcm][x_feb]->SetStats(0);
905 
906  FEBNoneSR[x_db][x_dcm][x_feb]->SetMarkerStyle(22);
907  FEBNoneSR[x_db][x_dcm][x_feb]->SetAxisRange(rateloy,ratehiy,"Y");
908  FEBNoneSR[x_db][x_dcm][x_feb]->SetMarkerSize(.5);
909  FEBNoneSR[x_db][x_dcm][x_feb]->SetLineColor(kGray);
910  FEBNoneSR[x_db][x_dcm][x_feb]->SetMarkerColor(kGray);
911  FEBNoneSR[x_db][x_dcm][x_feb]->Draw("same, P");
912  FEBNoneSR[x_db][x_dcm][x_feb]->GetYaxis()->SetTitleOffset(0.75);
913  FEBNoneSR[x_db][x_dcm][x_feb]->SetStats(0);
914 
915  FEBLoADCSR[x_db][x_dcm][x_feb]->SetMarkerStyle(23);
916  FEBLoADCSR[x_db][x_dcm][x_feb]->SetAxisRange(rateloy,ratehiy,"Y");
917  FEBLoADCSR[x_db][x_dcm][x_feb]->SetMarkerSize(.5);
918  FEBLoADCSR[x_db][x_dcm][x_feb]->SetLineColor(880-5);
919  FEBLoADCSR[x_db][x_dcm][x_feb]->SetMarkerColor(880-5);
920  FEBLoADCSR[x_db][x_dcm][x_feb]->Draw("same, P");
921  FEBLoADCSR[x_db][x_dcm][x_feb]->GetYaxis()->SetTitleOffset(0.75);
922  FEBLoADCSR[x_db][x_dcm][x_feb]->SetStats(0);
923 
924  FEBHiADCSR[x_db][x_dcm][x_feb]->SetMarkerStyle(29);
925  FEBHiADCSR[x_db][x_dcm][x_feb]->SetAxisRange(rateloy,ratehiy,"Y");
926  FEBHiADCSR[x_db][x_dcm][x_feb]->SetMarkerSize(.5);
927  FEBHiADCSR[x_db][x_dcm][x_feb]->SetLineColor(800+7);
928  FEBHiADCSR[x_db][x_dcm][x_feb]->SetMarkerColor(800+7);
929  FEBHiADCSR[x_db][x_dcm][x_feb]->Draw("same, P");
930  FEBHiADCSR[x_db][x_dcm][x_feb]->GetYaxis()->SetTitleOffset(0.75);
931  FEBHiADCSR[x_db][x_dcm][x_feb]->SetStats(0);
932 
933  FEBDropSR[x_db][x_dcm][x_feb]->SetMarkerStyle(34);
934  FEBDropSR[x_db][x_dcm][x_feb]->SetAxisRange(rateloy,ratehiy,"Y");
935  FEBDropSR[x_db][x_dcm][x_feb]->SetMarkerSize(.5);
936  FEBDropSR[x_db][x_dcm][x_feb]->SetLineColor(632+2);
937  FEBDropSR[x_db][x_dcm][x_feb]->SetMarkerColor(632+2);
938  FEBDropSR[x_db][x_dcm][x_feb]->Draw("same, P");
939  FEBDropSR[x_db][x_dcm][x_feb]->GetYaxis()->SetTitleOffset(0.75);
940  FEBDropSR[x_db][x_dcm][x_feb]->SetStats(0);
941 
942  TLegend *l6 = new TLegend(0.79,0.45, 0.89, 0.65);
943  l6->AddEntry(FEBNoisyTime[x_db][x_dcm][x_feb], "noisy", "p");
944  l6->AddEntry(FEBQuietTime[x_db][x_dcm][x_feb], "quiet", "p");
945  l6->AddEntry(FEBNoneTime[x_db][x_dcm][x_feb], "none-rep", "p");
946  l6->AddEntry(FEBLoADCTime[x_db][x_dcm][x_feb], "lowADC", "p");
947  l6->AddEntry(FEBHiADCTime[x_db][x_dcm][x_feb], "highADC", "p");
948  l6->AddEntry(FEBDropTime[x_db][x_dcm][x_feb], "dropout", "p");
949  l6->SetTextSize(0.05);
950  l6->SetTextFont(42);
951  l6->SetBorderSize(0);
952  l6->SetFillColor(0);
953  l6->Draw();
954 
955  TPaveText *pt6 = new TPaveText(0.12, 0.78, 0.25, 0.89, "NDC");
956  pt6->AddText("Issue Scores");
957  sprintf(address2, "DB%.2u DCM%.2u FEB%.2u", x_db, x_dcm, x_feb);
958  pt6->AddText(address2);
959  pt6->SetLineColor(kWhite);
960  pt6->SetShadowColor(kWhite);
961  pt6->SetFillColor(kWhite);
962  pt6->Draw();
963  pt6->SetTextFont(42);
964  char pngFile6[128];
965  if(archiveMode){
966  sprintf(pngFile6, "%s/feballscoresrunfeb-%s_%.2u_%.2u_%.2u.png", plotDir.c_str(), datelo.c_str(), x_db, x_dcm, x_feb);
967  }
968  else {
969  sprintf(pngFile6, "%s/feballscoresrunfeb-%.2u_%.2u_%.2u.png", plotDir.c_str(), x_db, x_dcm, x_feb);
970  }
971  CanvasP6->Print(pngFile6);
972 
973 
974 
975  }
976  // for each map entry
977 
978 }//OnMonAnaHistosPix
const XML_Char * name
Definition: expat.h:151
string filename
Definition: shutoffs.py:106
fvar< T > trunc(const fvar< T > &x)
Definition: trunc.hpp:19
void DiblockXY(unsigned int db, unsigned int *ix, unsigned int *iy)
string outfilename
knobs that need extra care
out_file
Append EOF lines.
Definition: modifyFHiCL.py:113
Far Detector at Ash River, MN.
int colors[6]
Definition: tools.h:1
void OnMonAnaHistosFEB_IssueRates(int idet, int runlo, int runhi, const std::string &OnMonFileList, const std::string &APDList, const std::string datehi, const std::string datelo, const std::string plotDir, bool archiveMode)
Near Detector in the NuMI cavern.
const double j
Definition: BetheBloch.cxx:29
OStream cout
Definition: OStream.cxx:6
void FEBXY(unsigned int feb, unsigned int *ix, unsigned int *iy)
ifstream in
Definition: comparison.C:7
void DCMXY(unsigned int dcm, unsigned int *ix, unsigned int *iy)
void PixXY(unsigned int pix, unsigned int *ix, unsigned int *iy)
enum BeamMode string