#include <AEMPlots.h>
Public Member Functions | |
| AEMPlots () | |
| ~AEMPlots () | |
| void | FillWeek (long fEpochStart, DBRunEntries &fRuns) |
| void | FillTotal (long fEpochStart, DBRunEntries &fRuns) |
Private Attributes | |
| TH1D * | fAEMWeekSpills |
| TH1D * | fAEMWeekSpillTime |
| TH1D * | fAEMWeekEvents |
| TH1D * | fAEMWeekRate |
| TH1D * | fAEMTotalSpills |
| TH1D * | fAEMTotalSpillTime |
| TH1D * | fAEMTotalEvents |
| TH1D * | fAEMTotalRate |
| TH2D * | fAEMWeekData |
| TH2D * | fAEMTotalData |
| TH1D * | fAEMRateDist |
Class which defines histograms with MIPP statistics
Definition at line 20 of file AEMPlots.h.
| AEMPlots::AEMPlots | ( | ) |
Definition at line 16 of file AEMPlots.cxx.
References fAEMRateDist, fAEMTotalData, fAEMTotalEvents, fAEMTotalRate, fAEMTotalSpills, fAEMTotalSpillTime, fAEMWeekData, fAEMWeekEvents, fAEMWeekRate, fAEMWeekSpills, fAEMWeekSpillTime, and fNbins.
00017 { 00018 double fNbinsd = static_cast<double>(fNbins); 00019 fAEMWeekSpills = new TH1D("fAEMWeekSpills", 00020 "Spills per hour for the week", 00021 168, 0., 168.); 00022 fAEMWeekSpillTime = new TH1D("fAEMWeekSpillTime", 00023 "Spill-seconds per hour for the week", 00024 168, 0., 168.); 00025 fAEMWeekEvents = new TH1D("fAEMWeekEvents", 00026 "Events per hour for the week", 00027 168, 0., 168.); 00028 fAEMWeekRate = new TH1D("fAEMWeekRate", 00029 "Event rate for the week", 00030 168, 0., 168.); 00031 fAEMTotalSpills = new TH1D("fAEMTotalSpills", 00032 "Spills per hour for the run", 00033 fNbins, 0., fNbinsd); 00034 fAEMTotalSpillTime = new TH1D("fAEMTotalSpillTime", 00035 "Spill-seconds per hour for the run", 00036 fNbins, 0., fNbinsd); 00037 fAEMTotalEvents = new TH1D("fAEMTotalEvents", 00038 "Events per hour for the run", 00039 fNbins, 0., fNbinsd); 00040 fAEMTotalRate = new TH1D("fAEMTotalRate", 00041 "Event rate for the run", 00042 fNbins, 0., fNbinsd); 00043 fAEMWeekData = new TH2D("fAEMWeekData", 00044 "Data this week by target and momentum", 00045 2, 0., 2., 2, 0., 2.); 00046 fAEMTotalData = new TH2D("fAEMTotalData", 00047 "Integrated data by target and momentum", 00048 2, 0., 2., 2, 0., 2.); 00049 fAEMRateDist = new TH1D("fAEMRateDist", 00050 "DAQ event rate for runs this week", 00051 100, 0., 99.); 00052 00053 }
| AEMPlots::~AEMPlots | ( | ) |
Definition at line 57 of file AEMPlots.cxx.
References fAEMRateDist, fAEMTotalData, fAEMTotalEvents, fAEMTotalRate, fAEMTotalSpills, fAEMTotalSpillTime, fAEMWeekData, fAEMWeekEvents, fAEMWeekRate, fAEMWeekSpills, and fAEMWeekSpillTime.
00058 { 00059 delete fAEMWeekSpills; 00060 delete fAEMWeekSpillTime; 00061 delete fAEMWeekEvents; 00062 delete fAEMWeekRate; 00063 delete fAEMTotalSpills; 00064 delete fAEMTotalSpillTime; 00065 delete fAEMTotalEvents; 00066 delete fAEMTotalRate; 00067 delete fAEMWeekData; 00068 delete fAEMTotalData; 00069 delete fAEMRateDist; 00070 00071 }
| void AEMPlots::FillTotal | ( | long | fEpochStart, | |
| DBRunEntries & | fRuns | |||
| ) |
Definition at line 180 of file AEMPlots.cxx.
References fAEMRateDist, fAEMTotalEvents, fAEMTotalRate, fAEMTotalSpills, fAEMTotalSpillTime, and fNbins.
00181 { 00182 double fHourlySpills[fNbins]; 00183 double fHourlySpillTime[fNbins]; 00184 double fHourlyEvents[fNbins]; 00185 double fHourlyRate[fNbins]; 00186 00187 for (int i=0; i!=fNbins; ++i) { 00188 fHourlySpills[i] = 0.; 00189 fHourlySpillTime[i] = 0.; 00190 fHourlyEvents[i] = 0.; 00191 fHourlyRate[i] = 0.; 00192 } 00193 00194 for (std::vector<DBRunEntry>::iterator it=fRuns.begin(); it !=fRuns.end(); ++it) { 00195 if (it->goodrun == 1) { 00196 int fRunStart = it->epochstart - fEpochStart; // seconds into the week 00197 int fRunEnd = it->epochend - fEpochStart; 00198 double fRunLength = fRunEnd-fRunStart; 00199 if (fRunLength < 3600.) fRunLength = 3600.; 00200 00201 int fFirstHour; 00202 fFirstHour = (fRunStart<0 ? 0 : fRunStart/3600); 00203 for (int fHour=fFirstHour; (fHour!=(fRunEnd/3600)+1) && (fHour!=fNbins); ++fHour) { 00204 double fRunSecThisHour, fHourStart, fHourEnd; 00205 fHourStart = fHour*3600.; 00206 fHourEnd = (fHour+1.)*3600. -1.; 00207 00208 fRunSecThisHour = 3600.; 00209 if (fRunStart>fHourStart) fRunSecThisHour -= (fRunStart-fHourStart); 00210 if (fRunEnd<fHourEnd) fRunSecThisHour -= (fHourEnd-fRunEnd); 00211 00212 fHourlyRate[fHour] += it->DAQRate() * fRunSecThisHour/3600.; 00213 fHourlySpillTime[fHour] += it->SpillTime() *fRunSecThisHour/fRunLength; 00214 fHourlySpills[fHour] += it->Spills() * fRunSecThisHour/fRunLength; 00215 fHourlyEvents[fHour] += it->SpillEvents() * fRunSecThisHour/fRunLength; 00216 } // loop over hours of the week 00217 00218 fAEMRateDist->Fill(it->DAQRate()); 00219 } 00220 } // loop over runs 00221 00222 double fTotalSpills, fTotalSpillTime, fTotalEvents; 00223 fTotalSpills = 0.; 00224 fTotalSpillTime = 0.; 00225 fTotalEvents = 0.; 00226 00227 for (int i=0; i!=fNbins; ++i) { 00228 fAEMTotalSpills->Fill(i,fHourlySpills[i]); 00229 fAEMTotalSpillTime->Fill(i,fHourlySpillTime[i]); 00230 fAEMTotalEvents->Fill(i,fHourlyEvents[i]); 00231 fAEMTotalRate->Fill(i,fHourlyRate[i]); 00232 fTotalSpills += fHourlySpills[i]; 00233 fTotalSpillTime += fHourlySpillTime[i]; 00234 fTotalEvents += fHourlyEvents[i]; 00235 } 00236 00237 std::string fTitle("Total Run"); 00238 00239 fAEMTotalSpills->SetTitle(fTitle.c_str()); 00240 fAEMTotalSpillTime->SetTitle(fTitle.c_str()); 00241 fAEMTotalEvents->SetTitle(fTitle.c_str()); 00242 fAEMTotalRate->SetTitle(fTitle.c_str()); 00243 00244 fAEMTotalSpills->SetFillColor(38); 00245 fAEMTotalSpillTime->SetFillColor(38); 00246 fAEMTotalEvents->SetFillColor(38); 00247 fAEMTotalRate->SetFillColor(30); 00248 00249 fAEMTotalSpills->SetXTitle("Hour"); 00250 fAEMTotalSpills->SetYTitle("Spills per hour"); 00251 fAEMTotalSpillTime->SetXTitle("Hour"); 00252 fAEMTotalSpillTime->SetYTitle("Spill-seconds per hour"); 00253 fAEMTotalEvents->SetXTitle("Hour"); 00254 fAEMTotalEvents->SetYTitle("Events per hour"); 00255 fAEMTotalRate->SetXTitle("Hour"); 00256 fAEMTotalRate->SetYTitle("DAQ Rate"); 00257 00258 fAEMTotalSpills->SetMinimum(0.); 00259 fAEMTotalSpillTime->SetMinimum(0.); 00260 fAEMTotalEvents->SetMinimum(0.); 00261 fAEMTotalRate->SetMinimum(0.); 00262 00263 fAEMTotalSpillTime->SetMaximum(360.); 00264 fAEMTotalRate->SetMaximum(60.); 00265 00266 std::cout << "Total: \n" << fTotalEvents << " events in " 00267 << fTotalSpills << " spills with beam" << std::endl; 00268 00269 return; 00270 }
| void AEMPlots::FillWeek | ( | long | fEpochStart, | |
| DBRunEntries & | fRuns | |||
| ) |
Definition at line 75 of file AEMPlots.cxx.
References fAEMRateDist, fAEMWeekEvents, fAEMWeekRate, fAEMWeekSpills, and fAEMWeekSpillTime.
Referenced by main().
00076 { 00077 double fHourlySpills[168]; 00078 double fHourlySpillTime[168]; 00079 double fHourlyEvents[168]; 00080 double fHourlyRate[168]; 00081 00082 for (int i=0; i!=168; ++i) { 00083 fHourlySpills[i] = 0.; 00084 fHourlySpillTime[i] = 0.; 00085 fHourlyEvents[i] = 0.; 00086 fHourlyRate[i] = 0.; 00087 } 00088 00089 for (std::vector<DBRunEntry>::iterator it=fRuns.begin(); it !=fRuns.end(); ++it) { 00090 if (it->goodrun == 1) { 00091 int fRunStart = it->epochstart - fEpochStart; // seconds into the week 00092 int fRunEnd = it->epochend - fEpochStart; 00093 double fRunLength = fRunEnd-fRunStart; 00094 if (fRunLength < 3600.) fRunLength = 3600.; 00095 00096 int fFirstHour; 00097 fFirstHour = (fRunStart<0 ? 0 : fRunStart/3600); 00098 for (int fHour=fFirstHour; (fHour!=(fRunEnd/3600)+1) && (fHour!=168); ++fHour) { 00099 double fRunSecThisHour, fHourStart, fHourEnd; 00100 fHourStart = fHour*3600.; 00101 fHourEnd = (fHour+1.)*3600. -1.; 00102 00103 fRunSecThisHour = 3600.; 00104 if (fRunStart>fHourStart) fRunSecThisHour -= (fRunStart-fHourStart); 00105 if (fRunEnd<fHourEnd) fRunSecThisHour -= (fHourEnd-fRunEnd); 00106 00107 fHourlyRate[fHour] += it->DAQRate() * fRunSecThisHour/3600.; 00108 fHourlySpillTime[fHour] += it->SpillTime() *fRunSecThisHour/fRunLength; 00109 fHourlySpills[fHour] += it->Spills() * fRunSecThisHour/fRunLength; 00110 fHourlyEvents[fHour] += it->SpillEvents() * fRunSecThisHour/fRunLength; 00111 } // loop over hours of the week 00112 00113 fAEMRateDist->Fill(it->DAQRate()); 00114 } 00115 } // loop over runs 00116 00117 double fWeekSpills, fWeekSpillTime, fWeekEvents; 00118 fWeekSpills = 0.; 00119 fWeekSpillTime = 0.; 00120 fWeekEvents = 0.; 00121 00122 for (int i=0; i!=168; ++i) { 00123 fAEMWeekSpills->Fill(i,fHourlySpills[i]); 00124 fAEMWeekSpillTime->Fill(i,fHourlySpillTime[i]); 00125 fAEMWeekEvents->Fill(i,fHourlyEvents[i]); 00126 fAEMWeekRate->Fill(i,fHourlyRate[i]); 00127 fWeekSpills += fHourlySpills[i]; 00128 fWeekSpillTime += fHourlySpillTime[i]; 00129 fWeekEvents += fHourlyEvents[i]; 00130 } 00131 00132 std::vector<DBRunEntry>::iterator w=fRuns.begin(); 00133 if ( w!=fRuns.end() && (w->epochstart - fEpochStart) < 0) ++w; 00134 std::string fTitle((w==fRuns.end()?"quiet week":w->datestart),0,10); 00135 00136 fAEMRateDist->SetTitle(fTitle.c_str()); 00137 fAEMWeekSpills->SetTitle(fTitle.c_str()); 00138 fAEMWeekSpillTime->SetTitle(fTitle.c_str()); 00139 fAEMWeekEvents->SetTitle(fTitle.c_str()); 00140 fAEMWeekRate->SetTitle(fTitle.c_str()); 00141 00142 fAEMRateDist->SetFillColor(30); 00143 fAEMWeekSpills->SetFillColor(38); 00144 fAEMWeekSpillTime->SetFillColor(38); 00145 fAEMWeekEvents->SetFillColor(38); 00146 fAEMWeekRate->SetFillColor(30); 00147 00148 fAEMRateDist->SetXTitle("DAQ Rate"); 00149 fAEMRateDist->SetYTitle("Entries"); 00150 fAEMWeekSpills->SetXTitle("Hour"); 00151 fAEMWeekSpills->SetYTitle("Spills per hour"); 00152 fAEMWeekSpillTime->SetXTitle("Hour"); 00153 fAEMWeekSpillTime->SetYTitle("Spill-seconds per hour"); 00154 fAEMWeekEvents->SetXTitle("Hour"); 00155 fAEMWeekEvents->SetYTitle("Events per hour"); 00156 fAEMWeekRate->SetXTitle("Hour"); 00157 fAEMWeekRate->SetYTitle("DAQ Rate"); 00158 00159 fAEMWeekSpills->SetMinimum(0.); 00160 fAEMWeekSpillTime->SetMinimum(0.); 00161 fAEMWeekEvents->SetMinimum(0.); 00162 fAEMWeekRate->SetMinimum(0.); 00163 00164 fAEMWeekSpills->GetXaxis()->SetNdivisions(28,kFALSE); //mark every 6 hours 00165 fAEMWeekSpillTime->GetXaxis()->SetNdivisions(28,kFALSE); 00166 fAEMWeekEvents->GetXaxis()->SetNdivisions(28,kFALSE); 00167 fAEMWeekRate->GetXaxis()->SetNdivisions(28,kFALSE); 00168 00169 fAEMWeekSpillTime->SetMaximum(360.); 00170 fAEMWeekRate->SetMaximum(60.); 00171 00172 std::cout << "Last week: \n" << fWeekEvents << " events in " 00173 << fWeekSpills << " spills with beam" << std::endl; 00174 00175 return; 00176 }
TH1D* AEMPlots::fAEMRateDist [private] |
Definition at line 39 of file AEMPlots.h.
Referenced by AEMPlots(), FillTotal(), FillWeek(), and ~AEMPlots().
TH2D* AEMPlots::fAEMTotalData [private] |
TH1D* AEMPlots::fAEMTotalEvents [private] |
TH1D* AEMPlots::fAEMTotalRate [private] |
TH1D* AEMPlots::fAEMTotalSpills [private] |
TH1D* AEMPlots::fAEMTotalSpillTime [private] |
TH2D* AEMPlots::fAEMWeekData [private] |
TH1D* AEMPlots::fAEMWeekEvents [private] |
TH1D* AEMPlots::fAEMWeekRate [private] |
TH1D* AEMPlots::fAEMWeekSpills [private] |
TH1D* AEMPlots::fAEMWeekSpillTime [private] |
1.4.7