Public Member Functions | |
| BDTDPlotter () | |
| void | fill (BDTestData &d) |
| void | write (const char *name) |
Private Attributes | |
| TGraph | inst_all |
| TGraph | inst_le |
| TGraph | inst_pme |
| TGraph | inst_phe |
| TGraph | accu_all |
| TGraph | accu_le |
| TGraph | accu_pme |
| TGraph | accu_phe |
| double | count_all |
| double | count_le |
| double | count_pme |
| double | count_phe |
|
|
Definition at line 175 of file BDTestData.cxx. References count_all, count_le, count_phe, and count_pme.
|
|
|
Definition at line 180 of file BDTestData.cxx. References accu_all, accu_le, accu_phe, accu_pme, count_all, count_le, count_phe, count_pme, BDTestData::earliest, Form(), inst_all, inst_le, inst_phe, inst_pme, BDTestData::tgtdist, BDTestData::tor101, BDTestData::tortgt, BDTestData::tr101d, and BDTestData::trtgtd. Referenced by generate_bdtd_plots(). 00181 {
00182 double pot = 0.0;
00183 if (pot <= 0.0) pot = bdtd.trtgtd;
00184 if (pot <= 0.0) pot = bdtd.tortgt;
00185 if (pot <= 0.0) pot = bdtd.tr101d;
00186 if (pot <= 0.0) pot = bdtd.tor101;
00187
00188 double ts = bdtd.earliest;
00189
00190 if (ts == 0.0) {
00191 cerr << "Skipping zero timestamp - pot=" << pot << endl;
00192 return;
00193 }
00194 if (pot < 0.0) {
00195 if (pot > -0.1) return;
00196 TDatime dt((time_t)ts);
00197 cerr << "Skipping negative PoT = " << pot
00198 << " at " << Form("%.6f",ts)
00199 << " " << dt.AsSQLString()
00200 << endl;
00201 return;
00202 }
00203
00204 inst_all.SetPoint(inst_all.GetN(),ts,pot);
00205
00206 double accum_pot=0;
00207 if (!accu_all.GetN()) {
00208 accu_all.SetPoint(0,ts,pot);
00209 accum_pot=pot;
00210 }
00211 else {
00212 double accum_ts=0;
00213 accu_all.GetPoint(accu_all.GetN()-1,accum_ts,accum_pot);
00214 accum_pot += pot;
00215 accu_all.SetPoint(accu_all.GetN(),ts,accum_pot);
00216 }
00217 count_all += pot;
00218
00219 double tgtdist = bdtd.tgtdist;
00220
00221 // Ripped from BDTarget::TargetIn
00222
00223 const float dist_cut = 0.2*Munits::meter;
00224 const float le_pos = 0.0*Munits::meter;
00225 const float pme_pos = 1.0*Munits::meter;
00226 const float phe_pos = 2.5*Munits::meter;
00227 if (fabs(tgtdist-le_pos) < dist_cut) { // kLE;
00228 inst_le.SetPoint(inst_le.GetN(),ts,pot);
00229 accu_le.SetPoint(accu_le.GetN(),ts,accum_pot);
00230 count_le += pot;
00231 }
00232 else if (fabs(tgtdist-pme_pos) < dist_cut) { // kPsME;
00233 inst_pme.SetPoint(inst_pme.GetN(),ts,pot);
00234 accu_pme.SetPoint(accu_pme.GetN(),ts,accum_pot);
00235 count_pme += pot;
00236 }
00237 else if (fabs(tgtdist-phe_pos) < dist_cut) { // kPsHE;
00238 inst_phe.SetPoint(inst_phe.GetN(),ts,pot);
00239 accu_phe.SetPoint(accu_phe.GetN(),ts,accum_pot);
00240 count_phe += pot;
00241 }
00242
00243 if (pot > 50)
00244 cerr << accu_all.GetN()
00245 << ": pot=" << pot << " accum_pot=" << accum_pot
00246 << " @ " << Form("%.6f",ts)
00247 << endl;
00248 }
|
|
|
Definition at line 331 of file BDTestData.cxx. References accu_all, accu_le, accu_phe, accu_pme, count_all, count_le, count_phe, count_pme, footer(), Form(), inst_le, inst_phe, inst_pme, legend(), max, min, and RawDataBlock::Print(). Referenced by generate_bdtd_plots(). 00332 {
00333 // mostly ripped from BeamData/ana/npot.C
00334
00335 const float min = 0.0; // *scale for instantaneous
00336 const float max = 40.0;
00337 TCanvas* c1 = new TCanvas("c1","npot",640,480);
00338
00339 TPad* pad = new TPad("pad","",0,0,1,1);
00340 //pad->SetFillColor(42);
00341 pad->SetGrid();
00342 pad->Draw();
00343 pad->cd();
00344
00345 TGraph* inst = &inst_all;
00346 TH1F* hinst = inst->GetHistogram();
00347 TAxis *ainst = hinst->GetXaxis();
00348
00349 TH1F* hfinst = c1->DrawFrame(ainst->GetXmin(), min, ainst->GetXmax(), max);
00350 TAxis* fainst = hfinst->GetXaxis();
00351 fainst->SetTimeDisplay(1);
00352 fainst->SetTimeFormat("%m/%d");
00353 fainst->SetTitle("Date (2005)");
00354 hfinst->GetYaxis()->SetTitle("Protons per Spill (1E12)");
00355 int ndiv = hfinst->GetNdivisions("Y");
00356 hfinst->SetTitle("NuMI Protons");
00357
00358 inst->Draw("B");
00359 c1->cd();
00360 TPad* overlay = new TPad("overlay","",0,0,1,1);
00361 overlay->SetFillStyle(4000);
00362 overlay->SetFillColor(0);
00363 overlay->SetFrameFillStyle(4000);
00364 overlay->Draw();
00365 overlay->cd();
00366
00367 const float large_marker_size = 1;
00368 const float small_marker_size = 0.8;
00369 const int small_line_size = 3;
00370 const char* drawopt = "P";
00371
00372
00373 accu_all.SetLineColor(0);
00374 accu_all.SetLineWidth(5);
00375 accu_all.SetMarkerSize(large_marker_size);
00376 accu_all.SetMarkerStyle(20);
00377
00378 int n_accumulated = accu_all.GetN();
00379 double maxaccum = accu_all.GetY()[n_accumulated-1];
00380 cerr << "Max = " << maxaccum << endl;
00381 double maxscale=1.60; // highest value for accum
00382 int expo=20; // accum exponent
00383 double max_pad_scale = maxscale*1e8;
00384
00385 cerr << "using maxscale = " << maxscale << ", expo = "
00386 << expo << " max_pad_scale = " << max_pad_scale << endl;
00387
00388 TH1F* hfaccum = overlay->DrawFrame(fainst->GetXmin(),0,
00389 fainst->GetXmax(),max_pad_scale);
00390 hfaccum->SetNdivisions(0,"X");
00391 hfaccum->SetNdivisions(0,"Y");
00392 TAxis* oainst = hfaccum->GetXaxis();
00393 oainst->SetTimeDisplay(1);
00394 oainst->SetTimeFormat("%m/%d");
00395 oainst->SetLabelOffset(99);
00396
00397 hfaccum->GetYaxis()->SetLabelOffset(99);
00398
00399 accu_all.Draw(drawopt);
00400
00401 TGaxis* axis = new TGaxis(oainst->GetXmax(), 0,
00402 oainst->GetXmax(), max_pad_scale,
00403 0,maxscale, ndiv,"+L");
00404
00405 axis->SetTitle(Form("Total Delivered Protons (1E%d)",expo));
00406 axis->SetTextColor(2);
00407 axis->SetLineColor(2);
00408 axis->SetLabelColor(2);
00409 axis->Draw();
00410
00411 inst_le.SetMarkerColor(2);
00412 inst_le.SetLineWidth(1);
00413 accu_le.SetMarkerColor(2);
00414 accu_le.SetLineColor(2);
00415 accu_le.SetLineWidth(small_line_size);
00416 accu_le.SetMarkerSize(small_marker_size);
00417 accu_le.SetMarkerStyle(20);
00418
00419 inst_pme.SetMarkerColor(4);
00420 inst_pme.SetLineWidth(1);
00421 accu_pme.SetMarkerColor(4);
00422 accu_pme.SetLineColor(4);
00423 accu_pme.SetLineWidth(small_line_size);
00424 accu_pme.SetMarkerSize(small_marker_size);
00425 accu_pme.SetMarkerStyle(20);
00426
00427 inst_phe.SetMarkerColor(6);
00428 inst_phe.SetLineWidth(1);
00429 accu_phe.SetMarkerColor(6);
00430 accu_phe.SetLineColor(6);
00431 accu_phe.SetLineWidth(small_line_size);
00432 accu_phe.SetMarkerSize(small_marker_size);
00433 accu_phe.SetMarkerStyle(20);
00434
00435 if (inst_le.GetN()) {
00436 //inst_le.Draw("B");
00437 accu_le.Draw(drawopt);
00438 }
00439
00440 if (inst_pme.GetN()) {
00441 //inst_pme.Draw("B");
00442 accu_pme.Draw(drawopt);
00443 }
00444
00445 if (inst_phe.GetN()) {
00446 //inst_phe.Draw("B");
00447 accu_phe.Draw(drawopt);
00448 }
00449
00450 footer();
00451
00452 int colors[] = { 1,2,4,6 };
00453 string keys[] = {
00454 Form("All (%5.2E PoT)",count_all*1e12),
00455 Form("LE (%5.2E PoT)",count_le*1e12),
00456 Form("pME (%5.2E PoT)",count_pme*1e12),
00457 Form("pHE (%5.2E PoT)",count_phe*1e12)
00458 };
00459 legend(.2,.8,.5,.6,4,colors,keys);
00460
00461 c1->Modified();
00462 c1->Update();
00463
00464
00465 #if 0
00466 cerr << "Printing eps\n";
00467 c1->Print("npot.eps");
00468 cerr << "Printing pdf\n";
00469 c1->Print("npot.pdf");
00470 #endif
00471
00472 #if 0
00473 cerr << "Dumping npot.png" << endl;
00474 TImageDump* di = new TImageDump("npot.png");
00475 c1->Paint();
00476 di->Close();
00477 //delete di;
00478 #else
00479 cerr << "Printing npot.png" << endl;
00480 c1->Print("npot.png");
00481 #endif
00482 #if 0
00483 cerr << "Dumping npot.gif" << endl;
00484 di = new TImageDump("npot.gif");
00485 c1->Paint();
00486 di->Close();
00487 //delete di;
00488 #else
00489 cerr << "Printing npot.gif" << endl;
00490 c1->Print("npot.gif");
00491 #endif
00492
00493
00494 cerr << "Writing root file\n";
00495 TFile file("npot.root","RECREATE");
00496 file.cd();
00497 inst->SetName("pot");
00498 inst->Write();
00499 file.Close();
00500
00501 }
|
|
|
Definition at line 165 of file BDTestData.cxx. |
|
|
Definition at line 165 of file BDTestData.cxx. |
|
|
Definition at line 165 of file BDTestData.cxx. |
|
|
Definition at line 165 of file BDTestData.cxx. |
|
|
Definition at line 166 of file BDTestData.cxx. Referenced by BDTDPlotter(), fill(), and write(). |
|
|
Definition at line 166 of file BDTestData.cxx. Referenced by BDTDPlotter(), fill(), and write(). |
|
|
Definition at line 166 of file BDTestData.cxx. Referenced by BDTDPlotter(), fill(), and write(). |
|
|
Definition at line 166 of file BDTestData.cxx. Referenced by BDTDPlotter(), fill(), and write(). |
|
|
Definition at line 164 of file BDTestData.cxx. Referenced by fill(). |
|
|
Definition at line 164 of file BDTestData.cxx. |
|
|
Definition at line 164 of file BDTestData.cxx. |
|
|
Definition at line 164 of file BDTestData.cxx. |
1.3.9.1