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