rate_plot.cc File Reference

#include <iostream>
#include <fstream>
#include <iosfwd>
#include <unistd.h>
#include <vector>
#include "TCanvas.h"
#include "TChain.h"
#include "TGaxis.h"
#include "TCut.h"
#include "TError.h"
#include "TFile.h"
#include "TH2.h"
#include "THStack.h"
#include "TObject.h"
#include "TLegend.h"
#include "TPaveText.h"
#include "TProfile.h"
#include "TROOT.h"
#include "TString.h"
#include "TStyle.h"
#include "TTimeStamp.h"
#include "TTree.h"
#include "TMath.h"
#include "TClonesArray.h"
#include "RSM.h"
#include "UtilRSM.h"
#include "TPSinglesEvent.h"
#include "DaqSnarlEvent.h"
#include "MessageService/MsgService.h"
#include "Util/UtilString.h"

Go to the source code of this file.

Functions

 CVSID ("$Id: rate_plot.cc,v 1.37 2010/07/26 18:15:48 rhatcher Exp $")
TCanvas * crate4_disp (const char *ptitle)
TCanvas * crate2_disp (const char *ptitle)
TCanvas * single_disp (const char *ptitle)
void tp_plot (TTree *tprates)
void tp_crate_plot (TTree *tprates, const int Crate)
void tp_vmm_plot (TTree *tprates, const int Crate, const int Varc, const int Vmm)
void ds_plot (TTree *dsrates)
void ds_crate_plot (TTree *dsrates, const int Crate)
void ds_vmm_plot (TTree *dsrates, const int Crate, const int Varc, const int Vmm)
void time_range (TTree *rates)
Double_t run_time (TH1 *rthisto, Double_t OptSignal, bool Quell=false, TH1 *fillhisto=0, double *rtsigma=0)
void set_style ()
void usage ()
int main (int argc, char **argv)

Variables

int loud = 0
bool DryRun = false
Bool_t root_files = true
Double_t time_mult = 3600.
string time_str = "hours"
Int_t ZoneDiff = 0
string ZoneStr = " (UTC)"
bool ZoneUTC = true
Int_t LocalOffset = 0
string LocalOffsetStr = ""
Double_t MinX
Double_t MaxX
Double_t FirstFrame
Double_t MinTime
Double_t MaxTime
TTimeStamp * ZeroTime
TTimeStamp * BegTime
TTimeStamp * EndTime
string ZeroStr
string BegStr
string EndStr
Int_t bin_con = 0
Int_t WeeklyZeroDate = 1
Double_t bin_mult = 3600.
string bin_str = "hour"
Int_t bin_width = 1
Int_t NBins = 0
vector< int > fRunNum
Int_t fSignalADC = 2000
Int_t fSMPlaneLimit = 16
Int_t fBlPlaneLimit = 16
Int_t fPlaneLimit = 16
Double_t fOptSMSignal = 0.18
Double_t fOptBlSignal = 0.31
Double_t fOptSignal = 0.68
string chain_title = ""
string NameBase = "rates"
bool AllowPulsed = false
bool AllowShield = true

Function Documentation

TCanvas * crate2_disp ( const char *  ptitle  ) 

Definition at line 1960 of file rate_plot.cc.

References loud.

Referenced by ds_vmm_plot(), and tp_vmm_plot().

01961 {
01962   if(loud>=2) cout << "Making crate2 Canvas\n";
01963 
01964   TCanvas *canv = new TCanvas(ptitle,ptitle,930,750);
01965   canv->Range(0.0,0.0,1.0,1.0);
01966   canv->SetGridx(0);
01967   canv->SetGridy(0);
01968   canv->SetFrameFillColor(0);
01969 
01970   TPad *drawpad;
01971   if(!(drawpad=(TPad*)gROOT->Get("drawpad")))
01972     drawpad = new TPad("drawpad","Drawing Pad",0,0,1,0.9);
01973   drawpad->SetGridx(0);
01974   drawpad->SetGridy(0);
01975   drawpad->SetFrameFillColor(0);
01976   drawpad->Divide(1,2, 0.001, 0.001);
01977   drawpad->Draw();
01978 
01979   return canv;
01980 }

TCanvas * crate4_disp ( const char *  ptitle  ) 

Definition at line 1938 of file rate_plot.cc.

References loud.

Referenced by tp_plot().

01939 {
01940   if(loud>=2) cout << "Making crate4 Canvas\n";
01941 
01942   TCanvas *canv = new TCanvas(ptitle,ptitle,930,750);
01943   canv->Range(0.0,0.0,1.0,1.0);
01944   canv->SetGridx(0);
01945   canv->SetGridy(0);
01946   canv->SetFrameFillColor(0);
01947 
01948   TPad *drawpad;
01949   if(!(drawpad=(TPad*)gROOT->Get("drawpad")))
01950     drawpad = new TPad("drawpad","Drawing Pad",0,0,1,0.9);
01951   drawpad->SetGridx(0);
01952   drawpad->SetGridy(0);
01953   drawpad->SetFrameFillColor(0);
01954   drawpad->Divide(2,2, 0.001, 0.001);
01955   drawpad->Draw();
01956 
01957   return canv;
01958 }

CVSID ( "$Id: rate_plot.  cc,
v 1.37 2010/07/26 18:15:48 rhatcher Exp $"   
)
void ds_crate_plot ( TTree *  dsrates,
const int  Crate 
)

Definition at line 1434 of file rate_plot.cc.

References loud, and time_range().

Referenced by main().

01435 {
01436   if(loud>=1) cout << "ds_crate_plot for Crate" << Crate << endl;
01437 
01438   time_range((TTree*)dsrates);
01439   /*
01440   TPad *drawpad = 0;
01441   TCanvas *rcan = 0;
01442   TPaveText *pl = 0;
01443   TProfile *rate_proj[2][3];
01444   string dsrates_base="DSVMM";
01445   dsrates_base += UtilString::ToString<int>(Crate);
01446   dsrates_base += "-";
01447   dsrates_base += UtilString::ToString<int>(Varc);
01448   dsrates_base += "-";
01449   dsrates_base += UtilString::ToString<int>(Vmm);
01450   dsrates_base += NameBase;
01451 
01452   //Open a file if requested
01453   TFile *tf = 0;
01454   if (root_files) {
01455     tf = new TFile((dsrates_base+".root").c_str(),"RECREATE");
01456     tf->cd();
01457   }
01458 
01459   rcan = crate2_disp("Init");
01460   rcan->Print((dsrates_base+".ps[").c_str());
01461   rcan->Close();
01462 
01463   if(loud >= 1) cout << "Top Title for dsrates plot: " << chain_title << endl;
01464 
01465   char names_list[2][16];
01466 
01467   time_range((TTree*)dsrates);
01468 
01469   Double_t MinRate, MaxRate;
01470   char hname[20];
01471   char htitle[30];
01472   for(int i=0;i<2;i++) for (int j=0;j<3;j++) {
01473     sprintf(hname,"rproj%d_%d",i,j);
01474     sprintf(htitle,"ADC %d Chip %d Rate",i,j);
01475     rate_proj[i][j] = new TProfile(hname,htitle,NBins,MinX,MaxX);
01476   }
01477 
01478   DaqSnarlEvent *revt = 0;
01479   //dsrates->SetBranchStatus("*",0);
01480   //dsrates->SetBranchStatus("Time*",1);
01481   //dsrates->SetBranchStatus("ChipEvents",1);
01482   dsrates->SetBranchAddress("dsevt",&revt);
01483 
01484   Int_t ientry = 0;
01485   while (dsrates->GetEntry(ientry++)) {
01486 
01487     TClonesArray* chips = revt->ChipEvents;
01488     Double_t time_val = (revt->Time-ZeroTime->GetSec())/time_mult;
01489     for (int i=0;i<chips->GetLast();i++) {
01490       DSChipEvent *chip = dynamic_cast<DSChipEvent*>(chips->At(i));
01491       if(chip->IsLoc(Crate,Varc,Vmm) && chip->ADC != 0) {
01492         rate_proj[chip->GetVadc()][chip->GetVachip()]->Fill(time_val,chip->ADC);
01493       }
01494     }
01495   }
01496 
01497   sprintf(names_list[0],"Vadc 0");
01498   sprintf(names_list[1],"Vadc 1");
01499 
01500   TLegend *leg = 0;
01501   rcan = crate2_disp("Vmm");
01502   pl = new TPaveText(0,0.9,1,1);
01503   if(chain_title.size() != 0) pl->AddText(chain_title.c_str());
01504   else pl->AddText("RawDigit ADC");
01505   pl->AddText(Form("Vmm Profiles %d-%d-%d %s",Crate,Varc,Vmm,bin_str.c_str()));
01506   rcan->cd(0);
01507   pl->SetBorderSize(1);
01508   pl->Draw();
01509   char stats[40];
01510 
01511   drawpad = dynamic_cast<TPad*>(rcan->FindObject("drawpad"));
01512   TH2D *prof_base[2];
01513   for (int i=0;i<2;i++) {
01514     MaxRate = -10;
01515     MinRate = 10000000;
01516     Double_t BinRate,BinErr;
01517     for (int j=0;j<3;j++) {
01518       for (int k=0;k<rate_proj[i][j]->GetNbinsX();k++) {
01519         BinRate = rate_proj[i][j]->GetBinContent(k);
01520         BinErr = rate_proj[i][j]->GetBinError(k);
01521         if(BinRate==0 && BinErr==0)
01522           continue;
01523         if(BinRate+BinErr > MaxRate)
01524           MaxRate = BinRate+BinErr;
01525         if(BinRate-BinErr < MinRate)
01526           MinRate = BinRate-BinErr;
01527       }
01528     }
01529     if(loud>=2) printf("MinRate=%-.6f MaxRate=%.6f\n",MinRate,MaxRate);
01530     if (MaxRate-MinRate <= 0.002) {
01531       if(loud>=2) cout << "Adjusting Min and Max Rate for small range\n";
01532       MinRate = MinRate - 1.0;
01533       MaxRate = MaxRate + 1.0;
01534     }
01535     if(loud>=2) printf("MinRate=%-.6f MaxRate=%.6f\n",MinRate,MaxRate);
01536     drawpad->cd(i+1);
01537     prof_base[i] = new TH2D(names_list[i],names_list[i],
01538                             NBins,MinX,MaxX,50,MinRate,MaxRate);
01539     if(loud>=2) printf("Base Name = %s\n",names_list[i]);
01540     if(loud>=2) printf("BinsX=%d MinX=%f MaxX=%f\n",NBins,MinX,MaxX);
01541     if(loud>=2) printf("BinsY=%d MinY=%f MaxY=%f\n",50,MinRate,MaxRate);
01542 
01543     string x_title;
01544     x_title = time_str + " since " + ZeroStr;
01545     prof_base[i]->GetXaxis()->SetTitle(x_title.c_str());
01546     prof_base[i]->GetXaxis()->CenterTitle();
01547     prof_base[i]->GetYaxis()->SetTitle("DaqSnarl ADC");
01548     prof_base[i]->GetYaxis()->CenterTitle();
01549     prof_base[i]->Draw();
01550     leg = new TLegend(0.55,0.875,1.0,1.0);
01551     leg->SetBorderSize(1);
01552     for (int j=0;j<3;j++) {
01553       rate_proj[i][j]->Draw("SAME");
01554       rate_proj[i][j]->SetLineColor(j+2);
01555       sprintf(stats,"Vachip %d Mean=%-6.2f RMS=%-4.4f",j,
01556               rate_proj[i][j]->GetMean(2),rate_proj[i][j]->GetRMS(2));
01557       leg->AddEntry(rate_proj[i][j],stats,"l");
01558       if(root_files) rate_proj[i][j]->Write();
01559     }
01560     leg->Draw();
01561 
01562     if(root_files) prof_base[i]->Write();
01563   }
01564 
01565   if(loud>=3) cout << "Printing Canvas\n";
01566   rcan->Print((dsrates_base+".ps").c_str());
01567 
01568   if (root_files) {
01569     if(loud>=2) cout << "Writing THistos, TCanvases, and TChains\n";
01570     rcan->Write();
01571     dsrates->Write();
01572   }
01573   rcan->Close();
01574 
01575   if(loud>=3) cout << "Printing Closing Canvas\n";
01576   rcan = crate2_disp("Fini");
01577   rcan->Print((dsrates_base+".ps]").c_str());
01578   rcan->Close();
01579 
01580   if(loud>=3) cout << "Deleting histograms\n";
01581   for(int i=0;i<2;i++) for(int j=0;j<3;j++) rate_proj[i][j]->Delete();
01582   for(int i=0;i<2;i++)  prof_base[i]->Delete();
01583 
01584   if (root_files) {
01585     tf->Write();
01586     tf->Close();
01587   }
01588   */
01589 }

void ds_plot ( TTree *  dsrates  ) 

Definition at line 464 of file rate_plot.cc.

References BegStr, bin_con, bin_str, chain_title, EndStr, fBlPlaneLimit, FirstFrame, fOptBlSignal, fOptSignal, fOptSMSignal, Form(), fSignalADC, fSMPlaneLimit, LocalOffset, LocalOffsetStr, loud, MaxTime, MaxX, MinTime, MinX, NameBase, NBins, root_files, run_time(), single_disp(), time_mult, time_range(), time_str, ZeroStr, ZeroTime, ZoneDiff, and ZoneUTC.

Referenced by main().

00465 {
00466   if(loud>=1) cout << "Entering routine ds_plot" << endl;
00467   TPad *drawpad = 0;
00468   char leg_label[80];
00469   string dsrates_base="DS"+NameBase;
00470 
00471   TCut BaseCut = "dsevt.Time>1";
00472   TCut ADCCut = Form("dsevt.PostTrigADC>=%d",fSignalADC);
00473 
00474   //Open a file if requested
00475   TFile *tf = 0;
00476   ofstream tf_txt;
00477   if (root_files) {
00478     tf = new TFile((dsrates_base+".root").c_str(),"RECREATE");
00479     tf->cd();
00480   }
00481 
00482   //Open postscript file
00483   TCanvas *rcan = single_disp("Init");
00484   rcan->Print((dsrates_base+".ps[").c_str());
00485   rcan->Close();
00486 
00487   if(loud >= 1) cout << "Top Title for dsrates plot: " << chain_title << endl;
00488 
00489   rcan = single_disp("evrate");
00490   rcan->cd();
00491 
00492   TPaveText *pl = new TPaveText(0,0.9,1,1);
00493   if(chain_title.size() != 0) pl->AddText(chain_title.c_str());
00494   else pl->AddText("Far Detector");
00495   pl->AddText(("DaqSnarl Rates "+bin_str).c_str());
00496   rcan->cd(0);
00497   pl->SetBorderSize(1);
00498   pl->Draw();
00499 
00500   drawpad = dynamic_cast<TPad*>(rcan->FindObject("drawpad"));
00501   drawpad->cd();
00502   drawpad->SetTicky(0);
00503   drawpad->SetRightMargin(0.01);
00504   drawpad->SetTopMargin(0.2);
00505 
00506   time_range((TTree*)dsrates);
00507 
00508   char varexp[50];
00509   if(dsrates->GetLeaf("Time"))
00510     sprintf(varexp,"(Time-%li)/%.1f",ZeroTime->GetSec(),time_mult);
00511   if(dsrates->GetLeaf("fTime"))
00512     sprintf(varexp,"(fTime-%li)/%.1f",ZeroTime->GetSec(),time_mult);
00513 
00514   TH1F *base_hist = new TH1F("base_hist","",NBins,MinX,MaxX);
00515   dsrates->Project("base_hist",varexp,BaseCut);
00516 
00517   TH1F *sm1phit = new TH1F("sm1phit","",NBins,MinX,MaxX);
00518   TH1F *sm2phit = new TH1F("sm2phit","",NBins,MinX,MaxX);
00519   TH1F *smhblk = new TH1F("smhblk","",NBins,MinX,MaxX);
00520   TH1F *ltime = new TH1F("ltime","",NBins,MinX,MaxX);
00521 
00522   dsrates->Project("sm1phit",varexp,BaseCut&&ADCCut&&
00523                    Form("SMPlanesHit[0] > %d",fSMPlaneLimit));
00524   dsrates->Project("sm2phit",varexp,BaseCut&&ADCCut&&
00525                    Form("SMPlanesHit[1] > %d",fSMPlaneLimit));
00526   dsrates->Project("smhblk",varexp,BaseCut&&ADCCut&&
00527                    Form("SMHitBlock > %d",fBlPlaneLimit));
00528 
00529   //Calculate RunTime and Flag hyperactive detector
00530   Bool_t DetNeedsRitalin = false;//Say for 4*fOptSignal is crazy
00531   Double_t BinWidth = base_hist->GetBinWidth(-1);
00532 
00533   int i=(int)((MinTime-MinX-FirstFrame)/BinWidth);
00534   Double_t BinSignal = base_hist->GetBinContent(i+1)/BinWidth;
00535   BinSignal = BinSignal/time_mult;
00536   BinSignal = BinSignal * BinWidth / (MinX+BinWidth*(i+1)-MinTime+FirstFrame);
00537   if (BinSignal > 4*fOptSignal) {
00538     DetNeedsRitalin=true;
00539     base_hist->SetBinContent(i+1,BinWidth*4*fOptSignal*time_mult);
00540     BinSignal = 4*fOptSignal;
00541     if(sm1phit->GetBinContent(i+1)/(time_mult*(MinX+BinWidth*(i+1)-MinTime+FirstFrame)) > 4*fOptSignal) sm1phit->SetBinContent(i+1,BinWidth*4*fOptSignal*time_mult);
00542     if(sm2phit->GetBinContent(i+1)/(time_mult*(MinX+BinWidth*(i+1)-MinTime+FirstFrame)) > 4*fOptSignal) sm2phit->SetBinContent(i+1,BinWidth*4*fOptSignal*time_mult);
00543     if(smhblk->GetBinContent(i+1)/(time_mult*(MinX+BinWidth*(i+1)-MinTime+FirstFrame)) > 4*fOptSignal) smhblk->SetBinContent(i+1,BinWidth*4*fOptSignal*time_mult);
00544   }
00545 
00546   for (i++; i<(int)((MaxTime-FirstFrame-MinX)/BinWidth); i++) {
00547     BinSignal = base_hist->GetBinContent(i+1)/BinWidth;
00548     BinSignal = BinSignal/time_mult;
00549     if (BinSignal > 4*fOptSignal) {
00550       DetNeedsRitalin=true;
00551       base_hist->SetBinContent(i+1,BinWidth*4*fOptSignal*time_mult);
00552       BinSignal = 4*fOptSignal;
00553       if(sm1phit->GetBinContent(i+1)/(time_mult*BinWidth) > 4*fOptSignal) sm1phit->SetBinContent(i+1,BinWidth*4*fOptSignal*time_mult);
00554       if(sm2phit->GetBinContent(i+1)/(time_mult*BinWidth) > 4*fOptSignal) sm2phit->SetBinContent(i+1,BinWidth*4*fOptSignal*time_mult);
00555       if(smhblk->GetBinContent(i+1)/(time_mult*BinWidth) > 4*fOptSignal) smhblk->SetBinContent(i+1,BinWidth*4*fOptSignal*time_mult);
00556     }
00557   }
00558 
00559   BinSignal = base_hist->GetBinContent(i+1)/BinWidth;
00560   BinSignal = BinSignal/time_mult;
00561   BinSignal = BinSignal * BinWidth / (MaxTime-FirstFrame-MinX-BinWidth*i);
00562   if (BinSignal > 4*fOptSignal) {
00563     DetNeedsRitalin=true;
00564     base_hist->SetBinContent(i+1,BinWidth*4*fOptSignal*time_mult);
00565     BinSignal = 4*fOptSignal;
00566     if(sm1phit->GetBinContent(i+1)/(time_mult*(MinX+BinWidth*(i+1)-MinTime+FirstFrame)) > 4*fOptSignal) sm1phit->SetBinContent(i+1,BinWidth*4*fOptSignal*time_mult);
00567     if(sm2phit->GetBinContent(i+1)/(time_mult*(MinX+BinWidth*(i+1)-MinTime+FirstFrame)) > 4*fOptSignal) sm2phit->SetBinContent(i+1,BinWidth*4*fOptSignal*time_mult);
00568     if(smhblk->GetBinContent(i+1)/(time_mult*(MinX+BinWidth*(i+1)-MinTime+FirstFrame)) > 4*fOptSignal) smhblk->SetBinContent(i+1,BinWidth*4*fOptSignal*time_mult);
00569   }
00570 
00571   //Double_t RunTime = run_time(base_hist,fOptSignal);
00572   double BlRTSigma, SM1RTSigma, SM2RTSigma;
00573   Double_t BlRunTime = run_time(smhblk,fOptBlSignal,false,ltime,&BlRTSigma);
00574   Double_t SM1RunTime = run_time(sm1phit,fOptSMSignal,false,0,&SM1RTSigma);
00575   Double_t SM2RunTime = run_time(sm2phit,fOptSMSignal,false,0,&SM2RTSigma);
00576   if (loud>=0) {
00577     cout << "BlRunTime = " << Form("%0.1f%%", BlRunTime*100) << endl;
00578     cout << "SM1RunTime = " << Form("%0.1f%%", SM1RunTime*100) << endl;
00579     cout << "SM2RunTime = " << Form("%0.1f%%", SM2RunTime*100) << endl;
00580   }
00581 
00582   string x_title;
00583   x_title = time_str + " since " + ZeroStr;
00584   /*
00585   base_hist->GetXaxis()->SetTitle(x_title.c_str());
00586   base_hist->GetXaxis()->CenterTitle();
00587   base_hist->GetYaxis()->SetLabelColor(0);
00588   base_hist->GetYaxis()->SetTickLength(0);
00589   base_hist->SetMinimum(0);
00590   base_hist->Draw();
00591   */
00592 
00593   smhblk->GetXaxis()->SetTitle(x_title.c_str());
00594   smhblk->GetXaxis()->CenterTitle();
00595   smhblk->GetYaxis()->SetLabelColor(0);
00596   smhblk->GetYaxis()->SetTickLength(0);
00597   smhblk->SetMinimum(0);
00598   smhblk->SetLineColor(1);
00599   smhblk->Draw();
00600 
00601   sm1phit->SetLineColor(4);
00602   sm1phit->Draw("SAME");
00603   sm2phit->SetLineColor(2);
00604   sm2phit->Draw("SAME");
00605 
00606   //Find appropriate frequency for the line
00607   char line_name[20];
00608   Double_t line_val, line_err;
00609   TLine *line = new TLine(); line->SetLineWidth(1);
00610   TText *text = new TText(); text->SetTextSize(0.05); text->SetTextAlign(32);
00611   //Detector optimal Signal line
00612   /*
00613   sprintf(line_name,"%1.2f Hz",fOptSignal);
00614   line_val = base_hist->GetBinWidth(-1)*time_mult*fOptSignal;
00615   line_err = TMath::Sqrt(line_val);
00616   line->SetLineStyle(1);
00617   line->DrawLine(MinX,line_val,MaxX,line_val);
00618   line->SetLineStyle(2);
00619   line->DrawLine(MinX,line_val+line_err,MaxX,line_val+line_err);
00620   line->DrawLine(MinX,line_val-line_err,MaxX,line_val-line_err);
00621   text->DrawText((MinX-0.03*(MaxX-MinX)),line_val,line_name);
00622   */
00623   //Hit Block Optimal Signal line
00624   sprintf(line_name,"%1.2f Hz",fOptBlSignal);
00625   line_val = BinWidth*time_mult*fOptBlSignal;
00626   line_err = TMath::Sqrt(line_val);
00627   line->SetLineColor(kBlack);
00628   line->SetLineStyle(1);
00629   line->DrawLine(MinX,line_val,MaxX,line_val);
00630   line->SetLineStyle(2);
00631   line->DrawLine(MinX,line_val+line_err,MaxX,line_val+line_err);
00632   line->DrawLine(MinX,line_val-line_err,MaxX,line_val-line_err);
00633   text->SetTextColor(kBlack);
00634   text->DrawText((MinX-0.03*(MaxX-MinX)),line_val,line_name);
00635   //SM Optimal Signal line
00636   sprintf(line_name,"%1.2f Hz",fOptSMSignal);
00637   line_val = BinWidth*time_mult*fOptSMSignal;
00638   line_err = TMath::Sqrt(line_val);
00639   line->SetLineColor(kBlue);
00640   line->SetLineStyle(1);
00641   line->DrawLine(MinX,line_val,MaxX,line_val);
00642   line->SetLineStyle(2);
00643   line->DrawLine(MinX,line_val+line_err,MaxX,line_val+line_err);
00644   line->DrawLine(MinX,line_val-line_err,MaxX,line_val-line_err);
00645   text->SetTextColor(kBlue);
00646   text->DrawText((MinX-0.03*(MaxX-MinX)),line_val,line_name);
00647 
00648   if (line_val>base_hist->GetMaximum()) {
00649     line_val = base_hist->GetMaximum();
00650     if(loud>=1) cout << "Failed: New Line Value " << line_val << endl;
00651     Double_t line_freq;
00652     line_freq = line_val/(BinWidth*time_mult);
00653     sprintf(line_name,"%1.2f Hz",line_freq);
00654     if(loud>=1) cout << "Line Frequency " << line_freq << endl;
00655     //Draw a opt signal line, or what the max frequency denotes
00656     line->SetLineWidth(1);
00657     line->DrawLine(MinX,line_val,MaxX,line_val);
00658     //Mark the frequency of line
00659     text->SetTextSize(0.05);
00660     text->SetTextAlign(32);
00661     text->DrawText((MinX-0.03*(MaxX-MinX)),line_val,line_name);
00662   }
00663 
00664   if (DetNeedsRitalin && false) {
00665     line_val = BinWidth*time_mult*4*fOptSignal;
00666     line->SetLineColor(kRed);
00667     line->DrawLine(MinX,line_val,MaxX,line_val);
00668     sprintf(line_name,">%1.2f Hz",4*fOptSignal);
00669     text->SetTextSize(0.05);
00670     text->SetTextAlign(12);
00671     text->SetTextColor(kRed);
00672     text->DrawText((MaxX+0.03*(MaxX-MinX)),line_val,line_name);
00673   }
00674 
00675   if (bin_con!=1) {
00676     //Time Lines
00677     line->SetLineStyle(2);
00678     line->SetLineWidth(1);
00679 
00680     //MinTime line
00681     Double_t XLoc = MinX + MinTime + ZoneDiff;
00682     XLoc = XLoc - ZeroTime->GetSec()/time_mult;
00683     line->DrawLine(XLoc,0,XLoc,line_val);
00684 
00685     //MaxTime line
00686     XLoc = MinX + MaxTime + ZoneDiff;
00687     XLoc = XLoc - ZeroTime->GetSec()/time_mult;
00688     line->DrawLine(XLoc,0,XLoc,line_val);
00689   }
00690 
00691   drawpad->cd(0);
00692   TLegend *leg = new TLegend(0.60,0.89,1.0,0.99);
00693 
00694   /*
00695   sprintf(leg_label,"Signal Snarls (%d->%2.1f%%) ",
00696           (Int_t)base_hist->GetEntries(),RunTime*100);
00697   leg->AddEntry(base_hist,leg_label,"l");
00698   */
00699 
00700   leg->AddEntry(sm1phit, Form("SM1 Planes Hit > %d (%2.1f #pm %.1f %%)",
00701     fSMPlaneLimit,SM1RunTime*100,SM1RTSigma*100), "l");
00702   leg->AddEntry(sm2phit, Form("SM2 Planes Hit > %d (%2.1f #pm %.1f %%)",
00703     fSMPlaneLimit,SM2RunTime*100,SM2RTSigma*100), "l");
00704   leg->AddEntry(smhblk, Form("Hit Block > %d (%2.1f #pm %.1f %%)",
00705     fBlPlaneLimit,BlRunTime*100,BlRTSigma*100), "l");
00706 
00707   leg->SetBorderSize(1);
00708   leg->Draw();
00709 
00710   drawpad->Modified();
00711   drawpad->Update();
00712 
00713   //Add an axis atop the plot with
00714   if (ZoneUTC) {
00715     drawpad->SetTopMargin(0.2);
00716     drawpad->SetTickx(0);
00717     TGaxis *LocalTimeAxis = new TGaxis(MinX, drawpad->GetUymax(),
00718       MaxX, drawpad->GetUymax(), MinX-(LocalOffset/time_mult),
00719       MaxX-(LocalOffset/time_mult), 510, "-");
00720     LocalTimeAxis->SetTitle(Form("%s since %s (%s)", time_str.c_str(),
00721       ZeroTime->AsString("s"), LocalOffsetStr.c_str()));
00722     LocalTimeAxis->CenterTitle();
00723 
00724     LocalTimeAxis->Draw();
00725   }
00726 
00727   drawpad->Modified();
00728   drawpad->Update();
00729 
00730   TPaveText *time_text = new TPaveText(0.0,0.89,0.32,0.99,"brNDC");
00731   sprintf(leg_label,"Zero: %s",ZeroStr.c_str());
00732   TText *tt = time_text->AddText(leg_label);
00733   //tt->SetTextSize(leg->GetTextSize());
00734   tt->SetTextFont(leg->GetTextFont());
00735   sprintf(leg_label,"Beg: %s",BegStr.c_str());
00736   tt = time_text->AddText(leg_label);
00737   //tt->SetTextSize(leg->GetTextSize());
00738   tt->SetTextFont(leg->GetTextFont());
00739   sprintf(leg_label,"End: %s",EndStr.c_str());
00740   tt = time_text->AddText(leg_label);
00741   //tt->SetTextSize(leg->GetTextSize());
00742   tt->SetTextFont(leg->GetTextFont());
00743   time_text->SetBorderSize(1);
00744   time_text->Draw();
00745 
00746   TCanvas *lcan = single_disp("livetime");
00747   lcan->cd();
00748   /*
00749 
00750   pl->Clear();
00751   if(chain_title.size() != 0) pl->AddText(chain_title.c_str());
00752   else pl->AddText("Far Detector");
00753   pl->AddText(("Livetime Development "+bin_str).c_str());
00754   lcan->cd(0);
00755   pl->SetBorderSize(1);
00756   pl->Draw();
00757 
00758   drawpad = dynamic_cast<TPad*>(lcan->FindObject("drawpad"));
00759   drawpad->cd();
00760   drawpad->SetTicky(0);
00761 
00762   ltime->GetXaxis()->SetTitle(x_title.c_str());
00763   ltime->GetXaxis()->CenterTitle();
00764   ltime->GetYaxis()->SetLabelColor(0);
00765   ltime->GetYaxis()->SetTickLength(0);
00766   ltime->SetMinimum(0);
00767   ltime->Draw();
00768 
00769   //MaxOntime line
00770   Double_t X1 = MinX + MinTime + ZoneDiff - ZeroTime->GetSec()/time_mult;
00771   Double_t X2 = MinX + MaxTime + ZoneDiff - ZeroTime->GetSec()/time_mult;
00772   line->SetLineStyle(1);
00773   line->SetLineWidth(1);
00774   line->SetLineColor(3);
00775   line->DrawLine(X1,0,X2,99.5*(MaxTime-MinTime)/BinWidth);
00776   */
00777 
00778   if (root_files) {
00779     if(loud>=2) cout << "Writing THistos, TCanvases, and TChains" << endl;
00780 
00781     //Write the histograms
00782     base_hist->Write();
00783     sm1phit->Write();
00784     sm2phit->Write();
00785     smhblk->Write();
00786     ltime->Write();
00787 
00788     //Write the canvases
00789     rcan->Write();
00790     lcan->Write();
00791 
00792     //Write the tree
00793     dsrates->Write();
00794 
00795   }
00796 
00797   if(loud>=3) cout << "Printing Canvas\n";
00798   rcan->Print((dsrates_base+".ps").c_str());
00799   rcan->Close();
00800   //lcan->Print((dsrates_base+".ps").c_str());
00801   lcan->Close();
00802 
00803   if(loud>=3) cout << "Printing Closing Canvas\n";
00804   rcan = single_disp("Fini");
00805   rcan->Print((dsrates_base+".ps]").c_str());
00806   rcan->Close();
00807 
00808   if(loud>=3) cout << "Deleting histograms\n";
00809   base_hist->Delete();
00810 
00811   sm1phit->Delete();
00812   sm2phit->Delete();
00813   smhblk->Delete();
00814   ltime->Delete();
00815 
00816   if (root_files) {
00817     tf->Write();
00818     tf->Close();
00819   }
00820 }

void ds_vmm_plot ( TTree *  dsrates,
const int  Crate,
const int  Varc,
const int  Vmm 
)

Definition at line 1591 of file rate_plot.cc.

References DSChipEvent::ADC, bin_str, chain_title, BlockEvent::ChipEvents, crate2_disp(), Form(), ChipEvent::GetVachip(), ChipEvent::GetVadc(), ChipEvent::IsLoc(), loud, MaxX, MinX, NameBase, NBins, root_files, BlockEvent::Time, time_mult, time_range(), time_str, ZeroStr, and ZeroTime.

Referenced by main().

01592 {
01593   if(loud>=1) cout << "Entering routine ds_vmm_plot" << endl;
01594   TPad *drawpad = 0;
01595   TCanvas *rcan = 0;
01596   TPaveText *pl = 0;
01597   TProfile *rate_proj[2][3];
01598   string dsrates_base="DSVMM";
01599   dsrates_base += UtilString::ToString<int>(Crate);
01600   dsrates_base += "-";
01601   dsrates_base += UtilString::ToString<int>(Varc);
01602   dsrates_base += "-";
01603   dsrates_base += UtilString::ToString<int>(Vmm);
01604   dsrates_base += NameBase;
01605 
01606   //Open a file if requested
01607   TFile *tf = 0;
01608   if (root_files) {
01609     tf = new TFile((dsrates_base+".root").c_str(),"RECREATE");
01610     tf->cd();
01611   }
01612 
01613   rcan = crate2_disp("Init");
01614   rcan->Print((dsrates_base+".ps[").c_str());
01615   rcan->Close();
01616 
01617   if(loud >= 1) cout << "Top Title for dsrates plot: " << chain_title << endl;
01618 
01619   char names_list[2][16];
01620 
01621   time_range((TTree*)dsrates);
01622 
01623   char hname[20];
01624   char htitle[30];
01625   for(int i=0;i<2;i++) for (int j=0;j<3;j++) {
01626     sprintf(hname,"rproj%d_%d",i,j);
01627     sprintf(htitle,"ADC %d Chip %d Rate",i,j);
01628     rate_proj[i][j] = new TProfile(hname,htitle,NBins,MinX,MaxX);
01629   }
01630 
01631   DaqSnarlEvent *revt = 0;
01632   dsrates->SetBranchAddress("dsevt",&revt);
01633 
01634   Int_t ientry = 0;
01635   while (dsrates->GetEntry(ientry++)) {
01636 
01637     TClonesArray* chips = revt->ChipEvents;
01638     Double_t time_val = (revt->Time-ZeroTime->GetSec())/time_mult;
01639     for (int i=0;i<chips->GetLast();i++) {
01640       DSChipEvent *chip = dynamic_cast<DSChipEvent*>(chips->At(i));
01641       if (chip->IsLoc(Crate,Varc,Vmm) && chip->ADC > 0) {
01642         rate_proj[chip->GetVadc()][chip->GetVachip()]->Fill(time_val,chip->ADC);
01643       }
01644     }
01645   }
01646 
01647   sprintf(names_list[0],"Vadc 0");
01648   sprintf(names_list[1],"Vadc 1");
01649 
01650   TLegend *leg = 0;
01651   rcan = crate2_disp("Vmm");
01652   pl = new TPaveText(0,0.9,1,1);
01653   if(chain_title.size() != 0) pl->AddText(chain_title.c_str());
01654   else pl->AddText("RawDigit ADC");
01655   pl->AddText(Form("Vmm Profiles %d-%d-%d %s",Crate,Varc,Vmm,bin_str.c_str()));
01656 
01657   rcan->cd(0);
01658   pl->SetBorderSize(1);
01659   pl->Draw();
01660   char stats[40];
01661 
01662   drawpad = dynamic_cast<TPad*>(rcan->FindObject("drawpad"));
01663   TH2D *prof_base[2];
01664   double MinRate, MaxRate;
01665   for (int i=0;i<2;i++) {
01666     MaxRate = -10;
01667     MinRate = 10000000;
01668     Double_t BinRate,BinErr;
01669     for (int j=0;j<3;j++) {
01670       for (int k=0;k<rate_proj[i][j]->GetNbinsX();k++) {
01671         BinRate = rate_proj[i][j]->GetBinContent(k);
01672         BinErr = rate_proj[i][j]->GetBinError(k);
01673         if(BinRate==0 && BinErr==0) continue;
01674         if(BinRate+BinErr > MaxRate) MaxRate = BinRate+BinErr;
01675         if(BinRate-BinErr < MinRate) MinRate = BinRate-BinErr;
01676       }
01677     }
01678     if(loud>=2) printf("MinRate=%-.6f MaxRate=%.6f\n",MinRate,MaxRate);
01679     if (MaxRate-MinRate <= 0.002) {
01680       if(loud>=2) cout << "Adjusting Min and Max Rate for small range\n";
01681       MinRate = MinRate - 1.0;
01682       MaxRate = MaxRate + 1.0;
01683     }
01684     if(MinRate < 1.0) MinRate = 1.0;
01685     //Up the Min and Max Rate for LogY
01686     bool DoLogY = true;
01687     double MinY, MaxY;
01688 
01689     if (DoLogY) {
01690       MinY = MinRate - 0.1*(TMath::Log10(MaxRate/MinRate));
01691       if(MinY < 1.0) MinY = 1.0;
01692       MaxY = MaxRate + 0.1*(MaxRate-MinRate);
01693     }
01694     else {
01695       MinY = MinRate - 0.1*(MaxRate-MinRate);
01696       if(MinY < 0.0) MinY = 0.0;
01697       MaxY = MaxRate + 0.1*(MaxRate-MinRate);
01698     }
01699 
01700     if(loud>=2) printf("MinRate=%-.6f MaxRate=%.6f\n",MinRate,MaxRate);
01701     drawpad->cd(i+1);
01702     if(DoLogY) gPad->SetLogy();
01703     prof_base[i] = new TH2D(names_list[i],names_list[i],
01704                             NBins,MinX,MaxX,1,MinY,MaxY);
01705     if(loud>=2) printf("Base Name = %s\n",names_list[i]);
01706     if(loud>=2) printf("BinsX=%d MinX=%f MaxX=%f\n",NBins,MinX,MaxX);
01707     if(loud>=2) printf("BinsY=%d MinY=%f MaxY=%f\n",50,MinRate,MaxRate);
01708 
01709     string x_title;
01710     x_title = time_str + " since " + ZeroStr;
01711     prof_base[i]->GetXaxis()->SetTitle(x_title.c_str());
01712     prof_base[i]->GetXaxis()->CenterTitle();
01713     prof_base[i]->GetYaxis()->SetTitle("DaqSnarl ADC");
01714     prof_base[i]->GetYaxis()->CenterTitle();
01715     prof_base[i]->Draw();
01716     leg = new TLegend(0.55,0.875,1.0,1.0);
01717     leg->SetBorderSize(1);
01718     for (int j=0; j<3; j++) {
01719       rate_proj[i][j]->Draw("SAME");
01720       rate_proj[i][j]->SetLineColor(j+2);
01721       sprintf(stats,"Vachip %d Mean=%-6.2f RMS=%-4.4f",j,
01722               rate_proj[i][j]->GetMean(2),rate_proj[i][j]->GetRMS(2));
01723       leg->AddEntry(rate_proj[i][j],stats,"l");
01724       if(root_files) rate_proj[i][j]->Write();
01725     }
01726     leg->Draw();
01727 
01728     if(root_files) prof_base[i]->Write();
01729   }
01730 
01731   if(loud>=3) cout << "Printing Canvas\n";
01732   rcan->Print((dsrates_base+".ps").c_str());
01733 
01734   if (root_files) {
01735     if(loud>=2) cout << "Writing THistos, TCanvases, and TChains\n";
01736     rcan->Write();
01737     dsrates->Write();
01738   }
01739   rcan->Close();
01740 
01741   if(loud>=3) cout << "Printing Closing Canvas\n";
01742   rcan = crate2_disp("Fini");
01743   rcan->Print((dsrates_base+".ps]").c_str());
01744   rcan->Close();
01745 
01746   if(loud>=3) cout << "Deleting histograms\n";
01747   for(int i=0;i<2;i++) for(int j=0;j<3;j++) rate_proj[i][j]->Delete();
01748   for(int i=0;i<2;i++) prof_base[i]->Delete();
01749 
01750   if (root_files && tf!=0) {
01751     tf->Write();
01752     tf->Close();
01753   }
01754 }

int main ( int  argc,
char **  argv 
)

Definition at line 151 of file rate_plot.cc.

References AllowPulsed, AllowShield, bin_con, bin_mult, bin_str, bin_width, chain_title, DryRun, ds_crate_plot(), ds_plot(), ds_vmm_plot(), exit(), fBlPlaneLimit, UtilRSM::FileFileList(), fname, fOptBlSignal, fOptSignal, fOptSMSignal, Form(), fPlaneLimit, fSignalADC, fSMPlaneLimit, Nav::kWarning, loud, NameBase, set_style(), time_mult, time_str, tp_crate_plot(), tp_plot(), tp_vmm_plot(), usage(), WeeklyZeroDate, ZoneDiff, ZoneStr, and ZoneUTC.

00152 {
00153   int c; int B=0; char W=0;
00154   int crate; int varc; int vmm;
00155   Double_t tdoub=0;
00156   Int_t tint=0;
00157   char tnm[40];
00158 
00159   Bool_t DoTP=true;
00160   Bool_t DoDS=true;
00161   Bool_t DoVMM=false;
00162   Bool_t DoCrate=false;
00163 
00164   string ListFile="";
00165 
00166   while ((c = getopt(argc,argv,"vqnhR:L:N:x:X:b:B:Ww:Mm:T:s:P:V:C:A:")) != -1)
00167     switch (c) {
00168     case 'v':
00169       loud++;
00170       break;
00171     case 'q':
00172       loud--;
00173       break;
00174     case 'n':
00175       DryRun = true;
00176       break;
00177     case 'h':
00178       usage(); exit(0);
00179       break;
00180     case 'R':
00181       tint=0;
00182       while(optarg[tint]) {
00183         switch(optarg[tint]) {
00184           case 'd':
00185             DoDS=false;
00186             break;
00187           case 'D':
00188             DoDS=true;
00189             break;
00190           case 't':
00191             DoTP=false;
00192             break;
00193           case 'T':
00194             DoTP=true;
00195             break;
00196           default:
00197             break;
00198         }
00199         tint++;
00200       }
00201       break;
00202     case 'L':
00203       ListFile=optarg;
00204       break;
00205     case 'N':
00206       NameBase=optarg;
00207       break;
00208     case 'x':
00209     case 'X':
00210       B=0;
00211       while((W=toupper(optarg[B]))) {
00212       switch ((int)W) {
00213       case 'S':
00214         time_mult = 1.; time_str = "seconds";
00215         break;
00216       case 'M':
00217         time_mult = 60.; time_str = "minutes";
00218         break;
00219       case 'H':
00220         time_mult = 3600.; time_str = "hours";
00221         break;
00222       case 'D':
00223         time_mult = 86400.; time_str = "days";
00224         break;
00225       case 'U':
00226         ZoneDiff=0; ZoneStr=" (UTC)"; ZoneUTC=true;
00227         break;
00228       case 'L':
00229         ZoneDiff=6*3600; ZoneStr=" (CST)"; ZoneUTC=false;
00230         break;
00231       default:
00232         if(loud>=0) cout << "Unspecified X-Axis: " << optarg << endl;
00233         if(loud>=0) cout << "Use S(Sec), M(Min), H(Hours), D(Days),";
00234         if(loud>=0) cout << "U(UTC), or L(CST)" << endl;
00235         exit(1);
00236         break;
00237       }B++;}
00238       if(loud>=0) cout << time_str << ZoneStr << " on X-Axis\n";
00239       break;
00240     case 'b':
00241     case 'B':
00242       B=0;W=0;
00243       sscanf(optarg,"%d%c",&B,&W);
00244       if(B!=0) bin_width=B;
00245       else {
00246         cout << "Bad argument to -b option: " << optarg << endl;
00247         usage(); exit(1);
00248       }
00249       if(W!=0) switch ((int)toupper(W)) {
00250       case 'S':
00251         bin_mult = 1; bin_str = Form("second");
00252         break;
00253       case 'M':
00254         bin_mult = 60; bin_str = Form("minute");
00255         break;
00256       case 'H':
00257         bin_mult = 3600; bin_str = Form("hour");
00258         break;
00259       case 'D':
00260         bin_mult = 86400; bin_str = Form("day");
00261         break;
00262       default:
00263         if(loud>=0) cout << "Unspecified binning: " << optarg << endl;
00264         if(loud>=0) cout << "Use S(Sec), M(Min), H(Hours), or D(Days)\n";
00265         exit(1);
00266         break;
00267       }
00268       else {
00269         cout << "Bad argument to -b option: " << optarg << endl;
00270         usage(); exit(1);
00271       }
00272       if(loud>=0) cout << bin_width << " " << bin_str << " time bins\n";
00273       break;
00274     case 'W':
00275       bin_con = 1; bin_width = 1; bin_mult = 3600; bin_str = Form("Hour");
00276       time_mult = 86400.; time_str = "Days";
00277       if(loud>=0) cout << "Weekly binning convention, zero on Sunday\n";
00278       if(loud>=0) cout << time_str << " on X-Axis\n";
00279       if(loud>=0) cout << bin_width << " " << bin_str << " time bins\n";
00280       break;
00281     case 'w':
00282       WeeklyZeroDate = atoi(optarg);
00283       break;
00284     case 'M':
00285       bin_con = 2; bin_width = 4; bin_mult = 3600; bin_str = Form("Hour");
00286       time_mult = 86400.; time_str = "Days";
00287       if(loud>=0) cout << "Monthly binning, zero on end of month\n";
00288       if(loud>=0) cout << time_str << " on X-Axis\n";
00289       if(loud>=0) cout << bin_width << " " << bin_str << " time bins\n";
00290       break;
00291     case 'T':
00292       chain_title = optarg;
00293       if(loud>=0) cout << "Top of TCanvas title=" << optarg << endl;
00294       break;
00295     case 's':
00296       sscanf(optarg,"%lf%s",&tdoub,tnm);
00297       if (strncasecmp(tnm,"adc",3) == 0) {
00298         fSignalADC=TMath::Nint(tdoub);
00299         if(loud>=0) cout << "Min PostTrig ADC Signal: " << fSignalADC << endl;
00300       }
00301       else if (strncasecmp(tnm,"sm",2) == 0) {
00302         fOptSMSignal=(TMath::Nint(100*tdoub))/100.0;
00303         if(loud>=0) cout << "Optimal SM Signal: " << fOptSMSignal << endl;
00304       }
00305       else if (strncasecmp(tnm,"bl",2) == 0) {
00306         fOptBlSignal=(TMath::Nint(100*tdoub))/100.0;
00307         if(loud>=0) cout << "Optimal Block Signal: " << fOptBlSignal << endl;
00308       }
00309       else {
00310         fOptSignal=(TMath::Nint(100*tdoub))/100.0;
00311         if(loud>=0) cout << "Optimal Signal: " << fOptSignal << endl;
00312       }
00313       break;
00314     case 'P':
00315       sscanf(optarg,"%d%s",&tint,tnm);
00316       if (strncasecmp(tnm,"sm",2) == 0) {
00317         fSMPlaneLimit=tint;
00318         if(loud>=0) cout << "SM Plane Limit set to: " << fSMPlaneLimit << endl;
00319       }
00320       else if (strncasecmp(tnm,"bl",2) == 0) {
00321         fBlPlaneLimit=tint;
00322         if(loud>=0) cout << "Block Plane Limit set to: " << fBlPlaneLimit << endl;
00323       }
00324       else {
00325         fPlaneLimit=tint;
00326         if(loud>=0) cout << "Plane Limit set to: " << fPlaneLimit << endl;
00327       }
00328       break;
00329     case 'A':
00330       tint=0;
00331       while(optarg[tint]) {
00332         switch(optarg[tint]) {
00333           case 'p':
00334             AllowPulsed = false;
00335             break;
00336           case 'P':
00337             AllowPulsed = true;
00338             break;
00339           case 's':
00340             AllowShield = false;
00341             break;
00342           case 'S':
00343             AllowShield = true;
00344             break;
00345           default:
00346             break;
00347         }
00348         tint++;
00349         if(loud>=0) cout << "AllowShield=" << AllowShield << " AllowPulsed=" << AllowPulsed <<endl;
00350       }
00351       break;
00352     case 'V':
00353       sscanf(optarg,"%d-%d-%d",&crate,&varc,&vmm);
00354       DoVMM = true;
00355       break;
00356     case 'C':
00357       sscanf(optarg,"%d",&crate);
00358       DoCrate = true;
00359       break;
00360     default:
00361       cerr << "unknown command line option:" << optopt << endl;
00362       usage();
00363       exit(1);
00364       break;
00365     }
00366   if(loud>=1) cout << "Verbose output level " << loud << endl;
00367   if(loud>=1) cout << time_str << " on X-Axis\n";
00368   if(loud>=1) cout << bin_width << " " << bin_str << " time bins\n";
00369 
00370   bin_str = Form(" (%d %s bins)",bin_width,bin_str.c_str());
00371 
00372   set_style();
00373 
00374   if(loud<=0) gErrorIgnoreLevel = kWarning;
00375   char fname[200];
00376 
00377   vector<string> RateFiles;
00378   if (ListFile.size() > 0) {
00379     RateFiles = UtilRSM::FileFileList(ListFile,".rate.root");
00380   }
00381   for (int i=optind; i<argc; i++) {
00382     RateFiles.push_back(argv[i]);
00383   }
00384 
00385   TChain *tpchain = new TChain("tprates");
00386   TChain *dschain = new TChain("dsrates");
00387 
00388   for (unsigned int i=0; i<RateFiles.size(); i++) {
00389     sprintf(fname,"%s",RateFiles[i].c_str());
00390     TFile *tf = new TFile(fname);
00391     if (!tf) {
00392       printf("Failed to open %s\n",fname);
00393       continue;
00394     }
00395     if (tf->IsZombie()) {
00396       printf("Zombie file %s\n",fname);
00397       continue;
00398     }
00399     if (DoTP) {
00400       TObject *tobj = tf->Get("tprates");
00401       if(!tobj)
00402         printf("No tprates in %s\n",fname);
00403       else {
00404         if(tobj->InheritsFrom("TChain"))
00405           tpchain->Add((TChain *)tobj);
00406         else if(tobj->InheritsFrom("TTree"))
00407           tpchain->Add(fname);
00408       }
00409       if(loud>=2)
00410         printf("TPChain now has %lld entries\n",
00411                (long long int)tpchain->GetEntries());
00412     }
00413     if (DoDS) {
00414       TObject *tobj = tf->Get("dsrates");
00415       if(!tobj)
00416         printf("No dsrates in %s\n",fname);
00417       else {
00418         if(tobj->InheritsFrom("TChain")) dschain->Add((TChain *)tobj);
00419         else if(tobj->InheritsFrom("TTree")) dschain->Add(fname);
00420       }
00421       if (loud>=2) {
00422         printf("DSChain now has %lld entries\n",
00423                (long long int)dschain->GetEntries());
00424       }
00425     }
00426     tf->Close();
00427   }
00428 
00429   if (DoTP) {
00430     if (loud>=1) {
00431       printf("Final tpchain has %lld entries in %d trees\n",
00432              (long long int)tpchain->GetEntries(),tpchain->GetNtrees());
00433     }
00434     if (tpchain->GetEntries()==0) {
00435       printf("Final tpchain has 0 entries(unusable)\n");
00436     }
00437     else {
00438       if(!DryRun) {
00439         if(DoCrate) tp_crate_plot((TTree*)tpchain,crate);
00440         else if(DoVMM) tp_vmm_plot((TTree*)tpchain,crate,varc,vmm);
00441         else tp_plot((TTree*)tpchain);
00442       }
00443     }
00444   }
00445 
00446   if (DoDS) {
00447     if (loud>=1) {
00448       printf("Final dschain has %lld entries in %d trees\n",
00449              (long long int)dschain->GetEntries(),dschain->GetNtrees());
00450     }
00451     if (dschain->GetEntries() == 0) {
00452       printf("Final dschain has 0 entries(unusable)\n");
00453     }
00454     else {
00455       if (!DryRun) {
00456         if(DoCrate) ds_crate_plot((TTree*)dschain,crate);
00457         else if(DoVMM) ds_vmm_plot((TTree*)dschain,crate,varc,vmm);
00458         else ds_plot((TTree*)dschain);
00459       }
00460     }
00461   }
00462 }

Double_t run_time ( TH1 *  rthisto,
Double_t  OptSignal,
bool  Quell = false,
TH1 *  fillhisto = 0,
double *  rtsigma = 0 
)

Definition at line 1874 of file rate_plot.cc.

References FirstFrame, loud, MaxTime, MinTime, MinX, NBins, and time_mult.

Referenced by ds_plot().

01876 {
01877   Int_t UsedBins = 2;
01878   Double_t RunTime = 0;
01879   Double_t BinWidth = rthisto->GetBinWidth(-1);
01880 
01881   Double_t BinOptContent = OptSignal * time_mult * BinWidth;
01882   Double_t BinOptErr = 2*TMath::Sqrt(BinOptContent);
01883 
01884   Int_t i=(Int_t)((MinTime-MinX-FirstFrame)/BinWidth);
01885   Double_t BinContent = rthisto->GetBinContent(i+1);
01886   BinContent = BinContent*BinWidth/(MinX+BinWidth*(i+1)-MinTime+FirstFrame);
01887   if (BinContent > BinOptContent-BinOptErr) {
01888     RunTime += 1.0;
01889     if(Quell) BinContent = BinOptContent;
01890   }
01891   else RunTime += BinContent/BinOptContent;
01892   rthisto->SetBinContent(i+1,BinContent);
01893 
01894   if (fillhisto) {
01895     fillhisto->SetBinContent(i+1,(int)(RunTime*100));
01896   }
01897 
01898   if(loud>1) cout << "bin " << i << endl;
01899   int imax = (Int_t)((MaxTime-FirstFrame-MinX)/BinWidth);
01900   if(imax >= rthisto->GetNbinsX()) imax = rthisto->GetNbinsX()-1;
01901   for (i++; i<imax; i++) {
01902     if(loud>1) cout << "bin " << i << endl;
01903     BinContent = rthisto->GetBinContent(i+1);
01904     if(BinContent > BinOptContent-BinOptErr) {
01905       RunTime += 1.0;
01906       if(Quell) rthisto->SetBinContent(i+1,BinOptContent);
01907     }
01908     else RunTime += BinContent/BinOptContent;
01909 
01910     if (fillhisto) {
01911       fillhisto->SetBinContent(i+1,(int)(RunTime*100));
01912     }
01913     UsedBins++;
01914   }
01915 
01916   BinContent = rthisto->GetBinContent(i+1);
01917   BinContent = BinContent * BinWidth / (MaxTime-FirstFrame-MinX-BinWidth*i);
01918   if(BinContent > BinOptContent-BinOptErr) {
01919     RunTime += 1.0;
01920     if(Quell) BinContent = BinOptContent;
01921   }
01922   else RunTime += BinContent/BinOptContent;
01923   rthisto->SetBinContent(i+1,BinContent);
01924 
01925   if (fillhisto) {
01926     fillhisto->SetBinContent(i+1,(int)(RunTime*100));
01927   }
01928 
01929   if(rtsigma) *rtsigma = 1.0/TMath::Sqrt(UsedBins*time_mult*BinWidth*OptSignal);
01930 
01931   if(loud>=1) cout << "Pre RunTime = " << RunTime << endl;
01932   if(loud>=1) printf("UsedBins=%d of NBins=%d\n",UsedBins,NBins);
01933   if(loud>=2) printf("BinWidth=%f\n",BinWidth);
01934   RunTime = (double)RunTime/UsedBins;
01935   return RunTime;
01936 }

void set_style (  ) 

Definition at line 2004 of file rate_plot.cc.

References loud.

Referenced by main().

02005 {
02006   TStyle* myVStyle = new  TStyle("videoStyle", "Video Style");
02007   // Colors
02008   myVStyle->SetFillColor(10);
02009   myVStyle->SetFrameFillColor(10);
02010   myVStyle->SetPalette(1,0);
02011   myVStyle->SetCanvasColor(10);
02012   myVStyle->SetPadColor(10);
02013   myVStyle->SetHistLineColor(kBlack);
02014   myVStyle->SetFuncColor(kGreen);
02015   myVStyle->SetLabelColor(kBlue,"xyz");
02016   myVStyle->SetTitleColor(kBlack);
02017   myVStyle->SetTitleFillColor(kWhite);
02018 
02019   // Sizes
02020   myVStyle->SetCanvasDefH(300);
02021   myVStyle->SetCanvasDefW(500);
02022   myVStyle->SetPadBottomMargin(0.15);
02023   myVStyle->SetPadTopMargin(0.13);
02024   myVStyle->SetPadLeftMargin(0.15);
02025   myVStyle->SetLabelSize(0.04,"xyz");
02026   myVStyle->SetLabelOffset(0.01,"xyz");
02027   myVStyle->SetTitleSize(0.06,"xyz");
02028   //myVStyle->SetTitleOffset(-0.1,"xyz");
02029   myVStyle->SetTitleBorderSize(1);
02030 
02031   // Misc
02032   myVStyle->SetHistLineWidth(2);
02033   myVStyle->SetFrameLineWidth(1);
02034   myVStyle->SetFuncWidth(2);
02035   myVStyle->SetPadGridX(1);
02036   myVStyle->SetPadGridY(1);
02037   myVStyle->SetCanvasBorderMode(0);
02038   myVStyle->SetPadTickX(1);
02039   myVStyle->SetPadTickY(1);
02040   myVStyle->SetOptStat(0);
02041   myVStyle->SetMarkerStyle(1);
02042   myVStyle->SetMarkerSize(0.85);
02043 
02044   // Fonts
02045   myVStyle->SetTitleFont(52);
02046   myVStyle->SetStatFont(52);
02047   myVStyle->SetLabelFont(52,"xyz");
02048   myVStyle->SetTextFont(52);
02049 
02050   // Paper
02051   myVStyle->SetPaperSize(20,24);
02052 
02053   //gROOT->ForceStyle();
02054   gROOT->SetStyle("videoStyle");
02055   if(loud>=2) gStyle->ls();
02056 }

TCanvas * single_disp ( const char *  ptitle  ) 

Definition at line 1982 of file rate_plot.cc.

References loud.

Referenced by ds_plot().

01983 {
01984   if(loud>=2) cout << "Making single Canvas\n";
01985 
01986   TCanvas *canv = new TCanvas(ptitle,ptitle,930,750);
01987   canv->Range(0.0,0.0,1.0,1.0);
01988   canv->SetGridx(0);
01989   canv->SetGridy(0);
01990   canv->SetFrameFillColor(0);
01991 
01992   TPad *drawpad;
01993   if(!(drawpad=(TPad*)gROOT->Get("drawpad")))
01994     drawpad = new TPad("drawpad","Drawing Pad",0,0,1,0.9);
01995   drawpad->SetGridx(0);
01996   drawpad->SetGridy(0);
01997   drawpad->Range(0.0,0.0,1.0,1.0);
01998   drawpad->SetFrameFillColor(0);
01999   drawpad->Draw();
02000 
02001   return canv;
02002 }

void time_range ( TTree *  rates  ) 

Definition at line 1756 of file rate_plot.cc.

References BegStr, BegTime, bin_con, bin_mult, bin_width, Munits::day, EndStr, EndTime, FirstFrame, LocalOffset, LocalOffsetStr, loud, MaxTime, MaxX, MinTime, MinX, NBins, time_mult, WeeklyZeroDate, ZeroStr, ZeroTime, ZoneDiff, ZoneStr, and ZoneUTC.

Referenced by GfxTrackList::Configure(), GfxStripList::Configure(), GfxShowerList::Configure(), GfxDigitList::Configure(), ds_crate_plot(), ds_plot(), ds_vmm_plot(), tp_crate_plot(), tp_plot(), and tp_vmm_plot().

01757 {
01758   if(loud>=1) cout << "Entering routine time_range" << endl;
01759   char tleaf[10];
01760   if(rates->GetLeaf("Time")) sprintf(tleaf,"Time");
01761   if(rates->GetLeaf("fTime")) sprintf(tleaf,"fTime");
01762 
01763   Int_t MinSec = (int)(rates->GetMinimum(tleaf));
01764   Int_t MaxSec = (int)(rates->GetMaximum(tleaf));
01765 
01766   ZeroTime = new TTimeStamp(MinSec,0);
01767   BegTime = new TTimeStamp(MinSec,0);
01768   EndTime = new TTimeStamp(MaxSec,0);
01769 
01770   int min_time_isdst(0);
01771   if (true) {
01772     time_t min_time = (time_t)MinSec;
01773     struct tm *lmin_time = localtime(&min_time);
01774     min_time_isdst = lmin_time->tm_isdst;
01775   }
01776 
01777   int mid_time_isdst(0);
01778   if (true) {
01779     time_t mid_time = (time_t)((MinSec/2+MaxSec/2));
01780     struct tm *lmid_time = localtime(&mid_time);
01781     mid_time_isdst = lmid_time->tm_isdst;
01782   }
01783 
01784   int max_time_isdst(0);
01785   if (true) {
01786     time_t max_time = (time_t)MaxSec;
01787     struct tm *lmax_time = localtime(&max_time);
01788     max_time_isdst = lmax_time->tm_isdst;
01789   }
01790 
01791   LocalOffset = ZeroTime->GetZoneOffset();
01792   LocalOffsetStr = "CST";
01793   if ((min_time_isdst==1 && max_time_isdst==1) || mid_time_isdst==1) {
01794     LocalOffset -= 3600;
01795     LocalOffsetStr = "CDT";
01796   }
01797 
01798   Int_t day;
01799 
01800   MinTime = (MinSec-ZoneDiff)/time_mult;
01801   FirstFrame = (Int_t)MinTime;
01802   if (bin_con==1 || bin_con==2) {
01803     FirstFrame = ((Int_t)(MinTime*time_mult/86400.))*86400/time_mult;
01804   }
01805   ZeroTime = new TTimeStamp((Int_t)(FirstFrame*time_mult)+ZoneDiff,0);
01806   day = ZeroTime->GetDate(ZoneUTC)-((ZeroTime->GetDate(ZoneUTC)/100)*100);
01807   //time_t seconds = ZeroTime->GetSec()-ZoneDiff;
01808   //wday = gmtime(&seconds)->tm_wday;
01809 
01810   //Reset ZeroTime to the nearest zero day to MinTime
01811   //Strech the endtime to ZeroTime + 7 days
01812   if (bin_con==1) {
01813     if (WeeklyZeroDate > 7) {
01814       ZeroTime->Set(WeeklyZeroDate, 0, 0, true, 0);
01815       MinTime = (int)((ZeroTime->GetSec() - ZoneDiff) / time_mult);
01816       FirstFrame = MinTime;
01817     }
01818     else {
01819       //int wday = ZeroTime->GetDayOfWeek(ZoneUTC);
01820       FirstFrame = ((FirstFrame*time_mult/86400)+1)*86400/time_mult;
01821       MinTime = FirstFrame;
01822 
01823       ZeroTime = new TTimeStamp((Int_t)(FirstFrame*time_mult)+ZoneDiff,0);
01824     }
01825 
01826     BegTime = ZeroTime;
01827     EndTime = new TTimeStamp((Int_t)((FirstFrame+7)*time_mult)+ZoneDiff,0);
01828   }
01829 
01830   //Reset ZeroTime to the day of the previous month before the data
01831   while (bin_con==2 && day<28) {
01832     FirstFrame = ((FirstFrame*time_mult/86400)-1)*86400/time_mult;
01833     MinTime = FirstFrame;
01834     ZeroTime = new TTimeStamp((Int_t)(FirstFrame*time_mult)+ZoneDiff,0);
01835     day = ZeroTime->GetDate(ZoneUTC)-((ZeroTime->GetDate(ZoneUTC)/100)*100);
01836   }
01837 
01838   //Reset ZeroTime to the BegTime
01839   if (bin_con==3) {
01840     ZeroTime = BegTime;
01841     FirstFrame = ZeroTime->GetSec()/time_mult;
01842   }
01843 
01844   ZeroStr=ZeroTime->AsString("s");
01845   BegStr=BegTime->AsString("s");
01846   EndStr=EndTime->AsString("s");
01847   if (!ZoneUTC) {
01848     ZeroStr=ZeroTime->AsString("cl"); ZeroStr=ZeroStr.substr(0,19);
01849     BegStr=BegTime->AsString("cl"); BegStr=BegStr.substr(0,19);
01850     EndStr=EndTime->AsString("cl"); EndStr=EndStr.substr(0,19);
01851   }
01852   ZeroStr += ZoneStr;
01853   BegStr += ZoneStr;
01854   EndStr += ZoneStr;
01855 
01856   MaxTime = (MaxSec-ZoneDiff)/time_mult;
01857   MinX = 0;
01858   MaxX = MaxTime-FirstFrame;
01859   NBins = ((Int_t)((time_mult/bin_mult)*(MaxX-MinX)/bin_width)) + 1;
01860   MaxX = MinX + (bin_mult*bin_width/time_mult)*NBins;
01861   if (bin_con==1) {
01862     MaxTime = FirstFrame + 7;
01863     MaxX = 7;
01864     NBins = 168;
01865   }
01866 
01867   if (loud>0) {
01868     cout << "MaxTime = " << MaxTime << endl;
01869     cout << "MaxX = " << MaxX << endl;
01870     cout << "NBins = " << NBins << endl;
01871   }
01872 }

void tp_crate_plot ( TTree *  tprates,
const int  Crate 
)

Definition at line 1015 of file rate_plot.cc.

References AllowPulsed, bin_str, chain_title, BlockEvent::ChipEvents, Form(), ChipEvent::GetCrate(), ChipEvent::GetVadc(), ChipEvent::GetVarc(), ChipEvent::GetVmm(), ChipEvent::IsLoc(), TPChipEvent::IsPulsed, TPChipEvent::IsShield, loud, MaxX, MinX, NameBase, NBins, TPChipEvent::Rate, root_files, tc, BlockEvent::Time, time_mult, time_range(), time_str, ZeroStr, and ZeroTime.

Referenced by main().

01016 {
01017   if(loud>=1) cout << "tp_crate_plot for Crate" << Crate << endl;
01018 
01019   time_range((TTree*)tprates);
01020 
01021   string TPBase=Form("TPCrate%d",Crate);
01022   if(Crate>15) TPBase="TPCrateAll";
01023   TPBase += NameBase;
01024 
01025   //Open a file if requested
01026   TFile *tf = 0;
01027   ofstream tf_txt;
01028   if (root_files) {
01029     tf = new TFile((TPBase+".root").c_str(),"RECREATE");
01030     tf->cd();
01031   }
01032 
01033   int FirstCrate = Crate;
01034   int LastCrate = Crate;
01035   int NCrates = 1;
01036   if (Crate>15) {
01037     FirstCrate = 0;
01038     LastCrate = 15;
01039     NCrates = 16;
01040   }
01041 
01042   TCanvas *tc = new TCanvas("Init","Init",612, 792, 612, 792);
01043   tc->Print((TPBase+".ps[").c_str());
01044   tc->Close();
01045 
01046   vector<vector<vector<TProfile*> > > CrateVarcVmmVadc0;
01047   vector<vector<vector<TProfile*> > > CrateVarcVmmVadc1;
01048   vector<vector<vector<THStack*> > > CrateVarcVmmStack;
01049 
01050   for (int i=FirstCrate; i<=LastCrate; i++) {
01051     int icrate = i - FirstCrate;
01052     vector<vector<TProfile*> > VarcVmmVadc0Temp;
01053     vector<vector<TProfile*> > VarcVmmVadc1Temp;
01054     vector<vector<THStack* > > VarcVmmStackTemp;
01055     for (int ivarc=0; ivarc<3; ivarc++) {
01056       vector<TProfile*> VmmVadc0Temp;
01057       vector<TProfile*> VmmVadc1Temp;
01058       vector<THStack* > VmmStackTemp;
01059       for (int ivmm=0; ivmm<6; ivmm++) {
01060         VmmVadc0Temp.push_back(new TProfile(
01061           Form("TPCrate%dVarc%dVmm%dVadc0",icrate,ivarc,ivmm),
01062           Form("VARC %d VMM %d VADC 0",ivarc,ivmm),
01063           NBins,MinX,MaxX));
01064         VmmVadc0Temp[ivmm]->SetLineColor(kRed);
01065         VmmVadc1Temp.push_back(new TProfile(
01066           Form("TPCrate%dVarc%dVmm%dVadc1",icrate,ivarc,ivmm),
01067           Form("VARC %d VMM %d VARC 1",ivarc,ivmm),
01068           NBins,MinX,MaxX));
01069         VmmVadc1Temp[ivmm]->SetLineColor(kBlue);
01070         VmmStackTemp.push_back(new THStack(
01071           Form("Crate%dVarc%dVmm%d",icrate,ivarc,ivmm),
01072           Form("VARC %d VMM %d",ivarc,ivmm)));
01073         VmmStackTemp[ivmm]->Add(VmmVadc0Temp[ivmm]);
01074         VmmStackTemp[ivmm]->Add(VmmVadc1Temp[ivmm]);
01075       }
01076       VarcVmmVadc0Temp.push_back(VmmVadc0Temp);
01077       VarcVmmVadc1Temp.push_back(VmmVadc1Temp);
01078       VarcVmmStackTemp.push_back(VmmStackTemp);
01079     }
01080     CrateVarcVmmVadc0.push_back(VarcVmmVadc0Temp);
01081     CrateVarcVmmVadc1.push_back(VarcVmmVadc1Temp);
01082     CrateVarcVmmStack.push_back(VarcVmmStackTemp);
01083   }
01084 
01085   TPSinglesEvent *revt = 0;
01086   tprates->SetBranchAddress("tpevt",&revt);
01087 
01088   if (Crate > 15) {
01089     int ientry = 0;
01090     while (tprates->GetEntry(ientry++)) {
01091       TClonesArray* chips = revt->ChipEvents;
01092       Double_t UTime = (revt->Time-ZeroTime->GetSec())/time_mult;
01093       int RateMap[16][3][6][2];
01094       memset(RateMap,0,16*3*6*2*sizeof(int));
01095       for (int i=0;i<chips->GetLast();i++) {
01096         TPChipEvent *chip = dynamic_cast<TPChipEvent*>(chips->At(i));
01097 
01098         //Additional shield check based on logical location
01099         bool ShieldChip = false;
01100         if((chip->GetVarc() == 0 || chip->GetVarc() == 2) && chip->GetVmm()==5)
01101           ShieldChip = true;
01102         if(chip->IsPulsed && !AllowPulsed && !(chip->IsShield || ShieldChip))
01103           continue;
01104 
01105         RateMap[chip->GetCrate()][chip->GetVarc()]
01106          [chip->GetVmm()][chip->GetVadc()] += chip->Rate;
01107       }
01108       for (int icrate=0; icrate<NCrates; icrate++) {
01109         for (int ivarc=0; ivarc<3; ivarc++) {
01110           for (int ivmm=0; ivmm<6; ivmm++) {
01111             if(RateMap[icrate][ivarc][ivmm][0] > 1)
01112               CrateVarcVmmVadc0[icrate][ivarc][ivmm]->Fill(UTime,
01113                 RateMap[icrate][ivarc][ivmm][0]);
01114             if(RateMap[icrate][ivarc][ivmm][1] > 1)
01115               CrateVarcVmmVadc1[icrate][ivarc][ivmm]->Fill(UTime,
01116                 RateMap[icrate][ivarc][ivmm][1]);
01117           }
01118         }
01119       }
01120     }
01121   }
01122   else {
01123     int ientry = 0;
01124     while (tprates->GetEntry(ientry++)) {
01125       TClonesArray* chips = revt->ChipEvents;
01126       Double_t UTime = (revt->Time-ZeroTime->GetSec())/time_mult;
01127       int RateMap[3][6][2];
01128       memset(RateMap,0,3*6*2*sizeof(int));
01129       for (int i=0;i<chips->GetLast();i++) {
01130         TPChipEvent *chip = dynamic_cast<TPChipEvent*>(chips->At(i));
01131         if(!chip->IsLoc(Crate)) continue;
01132 
01133         //Additional shield check based on logical location
01134         bool ShieldChip = false;
01135         if((chip->GetVarc() == 0 || chip->GetVarc() == 2) && chip->GetVmm()==5)
01136           ShieldChip = true;
01137         if(chip->IsPulsed && !AllowPulsed && !(chip->IsShield || ShieldChip))
01138           continue;
01139 
01140         RateMap[chip->GetVarc()][chip->GetVmm()][chip->GetVadc()] +=
01141           chip->Rate;
01142       }
01143       for (int ivarc=0; ivarc<3; ivarc++) {
01144         for (int ivmm=0; ivmm<6; ivmm++) {
01145           if(RateMap[ivarc][ivmm][0] > 0)
01146             CrateVarcVmmVadc0[0][ivarc][ivmm]->Fill(UTime,
01147               RateMap[ivarc][ivmm][0]);
01148           if(RateMap[ivarc][ivmm][1] > 0)
01149             CrateVarcVmmVadc1[0][ivarc][ivmm]->Fill(UTime,
01150               RateMap[ivarc][ivmm][1]);
01151         }
01152       }
01153     }
01154   }
01155 
01156   for(int i=FirstCrate; i<=LastCrate; i++) {
01157     int icrate = i - FirstCrate;
01158     tc = new TCanvas(Form("Crate%d",i), Form("Crate%d",i),
01159                      612, 792, 612, 792);
01160     tc->Range(0.0,0.0,1.0,1.0);
01161     tc->SetGridx(0);
01162     tc->SetGridy(0);
01163     tc->SetFrameFillColor(0);
01164 
01165     TPaveText* pl = new TPaveText(0.0,0.9,1.0,1.0);
01166     pl->SetBorderSize(1);
01167     if(chain_title.size() != 0) pl->AddText(chain_title.c_str());
01168     else pl->AddText("RawTpSinglesSummaryBlock Rates");
01169     pl->AddText(Form("Crate %d Profiles %s",i,bin_str.c_str()));
01170     pl->Draw();
01171 
01172     vector <TPad*> dpad;
01173     for (Int_t ipad=0; ipad<3; ipad++) {
01174       double x = (double)ipad;
01175       dpad.push_back(new TPad(Form("dpad%d",ipad),Form("dpad%d",ipad),
01176                      0.3*x+0.09, 0., 0.3*(x+1)+0.09, 0.85));
01177 
01178       dpad[ipad]->SetBorderSize(1);
01179       dpad[ipad]->SetGridx(0);
01180       dpad[ipad]->SetGridy(0);
01181       dpad[ipad]->SetFrameFillColor(0);
01182       dpad[ipad]->Divide(1,6, 0.001, 0.001);
01183       dpad[ipad]->Draw();
01184     }
01185 
01186     TText* text = new TText();
01187     text->SetTextSize(0.03);
01188     text->SetTextAlign(22);
01189     for (int ivarc=0; ivarc<3; ivarc++) {
01190       double y = (double)ivarc;
01191       text->DrawText(0.3*(y+0.5)+0.09,0.87,Form("VARC%d",ivarc));
01192     }
01193 
01194     text->SetTextAngle(90);
01195     for (Int_t ivmm=0; ivmm<6; ivmm++) {
01196       double y = (double)ivmm;
01197       text->DrawText(0.045,(0.85*(y+0.5)/6.0),Form("VMM%d",ivmm));
01198     }
01199 
01200     for (int ivarc=0; ivarc<3; ivarc++) {
01201       for (int ivmm=0; ivmm<6; ivmm++) {
01202         dpad[ivarc]->cd(6-ivmm);
01203         if(CrateVarcVmmVadc0[icrate][ivarc][ivmm]->GetMean(2) == 0 &&
01204            CrateVarcVmmVadc1[icrate][ivarc][ivmm]->GetMean(2) == 0) continue;
01205         CrateVarcVmmStack[icrate][ivarc][ivmm]->Draw("nostack");
01206         CrateVarcVmmStack[icrate][ivarc][ivmm]->GetXaxis()->SetTitle(
01207           (time_str + " since " + ZeroStr).c_str());
01208         CrateVarcVmmStack[icrate][ivarc][ivmm]->GetXaxis()->CenterTitle();
01209         CrateVarcVmmStack[icrate][ivarc][ivmm]->GetYaxis()->SetTitle("TP Rate (Hz)");
01210         CrateVarcVmmStack[icrate][ivarc][ivmm]->GetYaxis()->CenterTitle();
01211         TLegend *leg = new TLegend(0.5,0.875,0.99,0.99);
01212         leg->SetBorderSize(1);
01213         leg->AddEntry(CrateVarcVmmVadc0[icrate][ivarc][ivmm],
01214           Form("Vadc 0 Mean=%-6.2f RMS=%-4.4f",
01215           CrateVarcVmmVadc0[icrate][ivarc][ivmm]->GetMean(2),
01216           CrateVarcVmmVadc0[icrate][ivarc][ivmm]->GetRMS(2)),
01217           "l");
01218         leg->AddEntry(CrateVarcVmmVadc1[icrate][ivarc][ivmm],
01219           Form("Vadc 1 Mean=%-6.2f RMS=%-4.4f",
01220           CrateVarcVmmVadc1[icrate][ivarc][ivmm]->GetMean(2),
01221           CrateVarcVmmVadc1[icrate][ivarc][ivmm]->GetRMS(2)),
01222           "l");
01223         leg->Draw();
01224       }
01225     }
01226 
01227     for (int ivarc=0; ivarc<3 ; ivarc++) {
01228       for (int ivmm=0; ivmm<6; ivmm++) {
01229         double MaxRate = -10.0;
01230         double MinRate = 99e99;
01231         for (int k=0;k<NBins;k++) {
01232           double BinRate = CrateVarcVmmVadc0[icrate][ivarc][ivmm]->GetBinContent(k);
01233           double BinErr = CrateVarcVmmVadc0[icrate][ivarc][ivmm]->GetBinError(k);
01234           if (BinRate>0 && BinErr>0) {
01235             if(BinRate+BinErr > MaxRate) MaxRate = BinRate+BinErr;
01236             if(BinRate-BinErr < MinRate) MinRate = BinRate-BinErr;
01237           }
01238           BinRate = CrateVarcVmmVadc1[icrate][ivarc][ivmm]->GetBinContent(k);
01239           BinErr = CrateVarcVmmVadc1[icrate][ivarc][ivmm]->GetBinError(k);
01240           if (BinRate>0 && BinErr>0) {
01241             if(BinRate+BinErr > MaxRate) MaxRate = BinRate+BinErr;
01242             if(BinRate-BinErr < MinRate) MinRate = BinRate-BinErr;
01243           }
01244         }
01245         if (MaxRate-MinRate <= 0.002) {
01246           if(loud>=2) cout << "Adjusting Min/Max Rate for small range\n";
01247           MinRate = MinRate - 1.0;
01248           MaxRate = MaxRate + 1.0;
01249         }
01250 
01251         double MinY = MinRate - (MaxRate -MinRate)*0.1;
01252         if(MinY < 0.0) MinY = 0.0;
01253         double MaxY = MaxRate + (MaxRate -MinRate)*0.1;
01254 
01255         if(loud>=2) printf("MinRate=%-.6f MaxRate=%.6f\n",MinRate,MaxRate);
01256         CrateVarcVmmStack[icrate][ivarc][ivmm]->SetMinimum(MinY);
01257         CrateVarcVmmStack[icrate][ivarc][ivmm]->SetMaximum(MaxY);
01258       }
01259     }
01260 
01261     tc->Write();
01262     tc->Print((TPBase+".ps").c_str());
01263   }
01264 
01265   tc = new TCanvas("Init","Init",612, 792, 612, 792);
01266   tc->Print((TPBase+".ps]").c_str());
01267   tc->Close();
01268 
01269   if (root_files) {
01270     for(int icrate=0; icrate<NCrates; icrate++) {
01271       for (int ivarc=0; ivarc<3; ivarc++) {
01272         for (int ivmm=0; ivmm<6; ivmm++) {
01273           CrateVarcVmmVadc0[icrate][ivarc][ivmm]->Write();
01274           CrateVarcVmmVadc1[icrate][ivarc][ivmm]->Write();
01275           CrateVarcVmmStack[icrate][ivarc][ivmm]->Write();
01276         }
01277       }
01278     }
01279     tc->Write();
01280     tf->Write();
01281     tf->Close();
01282   }
01283 }

void tp_plot ( TTree *  tprates  ) 

Definition at line 822 of file rate_plot.cc.

References AllowPulsed, bin_str, chain_title, crate4_disp(), TPSinglesEvent::CratePulsed, TPSinglesEvent::CrateRate, Form(), LocalOffset, LocalOffsetStr, loud, MaxX, MinX, NameBase, NBins, NCRATE, root_files, BlockEvent::Time, time_mult, time_range(), time_str, ZeroStr, ZeroTime, and ZoneUTC.

Referenced by main().

00823 {
00824   if(loud>=1) cout << "Entering routine tp_plot" << endl;
00825   TPad *drawpad = 0;
00826   TCanvas *rcan = 0;
00827   TPaveText *pl = 0;
00828   TProfile *rate_proj[16];
00829   string TPBase="TP"+NameBase;
00830 
00831   //Open a file if requested
00832   TFile *tf = 0;
00833   ofstream tf_txt;
00834   if (root_files) {
00835     tf = new TFile((TPBase+".root").c_str(),"RECREATE");
00836     tf->cd();
00837   }
00838 
00839   rcan = crate4_disp("Init");
00840   rcan->Print((TPBase+".ps[").c_str());
00841   rcan->Close();
00842 
00843   if(loud >= 1) cout << "Top Title for tprates plot: " << chain_title << endl;
00844 
00845   char names_list[4][16];
00846 
00847   //tprates->SetBranchStatus("*ChipEvent*",0);
00848   time_range((TTree*)tprates);
00849 
00850   char hname[20];
00851   char htitle[30];
00852   for (int i=0;i<NCRATE;i++) {
00853     sprintf(hname,"rproj%d",i);
00854     sprintf(htitle,"Crate %d Rate",i);
00855     rate_proj[i] = new TProfile(hname,htitle,NBins,MinX,MaxX);
00856   }
00857 
00858   //tprates->SetBranchStatus("*CrateRate*",1);
00859   //tprates->SetBranchStatus("*Time*",1);
00860   if (tprates->GetBranch("tpevt")) {
00861     if (loud>=2) cout << "New Branch, read from TPSinglesEvent object" << endl;
00862     TPSinglesEvent *tpevt = 0;
00863     tprates->SetBranchAddress("tpevt",&tpevt);
00864     Int_t ientry = 0;
00865     tprates->GetEntry(0);
00866     while (tprates->GetEntry(ientry++)) {
00867       Double_t time_val = (tpevt->Time-ZeroTime->GetSec())/time_mult;
00868       for (int i=0;i<NCRATE;i++) {
00869         if(!AllowPulsed && tpevt->CratePulsed[i]) continue;
00870         (rate_proj[i])->Fill(time_val,(tpevt->CrateRate[i])/1000);
00871       }
00872     }
00873   }
00874   else {
00875     Int_t CrateRate[16];
00876     Int_t Time;
00877     if (loud>=2) cout << "Old Branch, read Time and CrateRate branches" << endl;
00878     tprates->SetBranchAddress("Time",&Time);
00879     tprates->SetBranchAddress("CrateRate",CrateRate);
00880     Int_t ientry = 0;
00881     while (tprates->GetEntry(ientry++)) {
00882       Double_t time_val = (Time-ZeroTime->GetSec())/time_mult;
00883       for(int i=0;i<NCRATE;i++)
00884         (rate_proj[i])->Fill(time_val,(CrateRate[i])/1000);
00885     }
00886   }
00887 
00888   sprintf(names_list[0],"SM1South");
00889   sprintf(names_list[1],"SM1North");
00890   sprintf(names_list[2],"SM2South");
00891   sprintf(names_list[3],"SM2North");
00892 
00893   TLegend *leg = 0;
00894   rcan = crate4_disp("Profiles");
00895   pl = new TPaveText(0,0.9,1,1);
00896   if(chain_title.size() != 0) pl->AddText(chain_title.c_str());
00897   else pl->AddText("RawTpSinglesSummaryBlock Rates");
00898   pl->AddText(("Z-Progression Profiles "+bin_str).c_str());
00899   rcan->cd(0);
00900   pl->SetBorderSize(1);
00901   pl->Draw();
00902   char stats[40];
00903 
00904   drawpad = dynamic_cast<TPad*>(rcan->FindObject("drawpad"));
00905   TH2D *prof_base[4];
00906   double MinRate, MaxRate;
00907 
00908   for (int i=0;i<4;i++) {
00909     MaxRate = -10;
00910     MinRate = 10000000;
00911     Double_t BinRate,BinErr;
00912     for (int j=0;j<4;j++) {
00913       for (int k=0;k<rate_proj[4*i+j]->GetNbinsX();k++) {
00914         BinRate = rate_proj[4*i+j]->GetBinContent(k);
00915         BinErr = rate_proj[4*i+j]->GetBinError(k);
00916         if(BinRate==0 && BinErr==0)
00917           continue;
00918         if(BinRate+BinErr > MaxRate)
00919           MaxRate = BinRate+BinErr;
00920         if(BinRate-BinErr < MinRate)
00921           MinRate = BinRate-BinErr;
00922       }
00923     }
00924     if (MaxRate-MinRate <= 0.002) {
00925       if(loud>=2) cout << "Adjusting Min and Max Rate for small range\n";
00926       MinRate = MinRate - 1.0;
00927       MaxRate = MaxRate + 1.0;
00928     }
00929     if(loud>=2) printf("MinRate=%-.6f MaxRate=%.6f\n",MinRate,MaxRate);
00930     TPad *tpad = dynamic_cast<TPad*>(drawpad->cd(i+1));
00931     tpad->SetRightMargin(0.01);
00932     prof_base[i] = new TH2D(names_list[i],names_list[i],NBins,MinX,MaxX,
00933              50,MinRate-0.1*(MaxRate-MinRate),
00934              MaxRate+0.1*(MaxRate-MinRate));
00935     if(loud>=2) printf("Base Name = %s\n",names_list[i]);
00936     if(loud>=2) printf("BinsX=%d MinX=%f MaxX=%f\n",NBins,MinX,MaxX);
00937     if(loud>=2) printf("BinsY=%d MinY=%f MaxY=%f\n",50,MinRate-0.1*(MaxRate-MinRate),MaxRate+0.1*(MaxRate-MinRate));
00938 
00939     string x_title;
00940     x_title = time_str + " since " + ZeroStr;
00941     prof_base[i]->GetXaxis()->SetTitle(x_title.c_str());
00942     prof_base[i]->GetXaxis()->CenterTitle();
00943     prof_base[i]->GetYaxis()->SetTitle("TP Rate (kHz)");
00944     prof_base[i]->GetYaxis()->CenterTitle();
00945     prof_base[i]->Draw();
00946     leg = new TLegend(0.55,0.875,1.0,1.0);
00947     leg->SetBorderSize(1);
00948     for (int j=0;j<4;j++) {
00949       rate_proj[4*i+j]->Draw("SAME");
00950       rate_proj[4*i+j]->SetLineColor(j+1);
00951       sprintf(stats,"Crate %d Mean=%-6.2f RMS=%-4.4f",(4*i+j),
00952               rate_proj[4*i+j]->GetMean(2),rate_proj[4*i+j]->GetRMS(2));
00953       leg->AddEntry(rate_proj[4*i+j],stats,"l");
00954     }
00955     leg->Draw();
00956 
00957     tpad->Modified();
00958     tpad->Update();
00959 
00960     //Add an axis atop the plot with
00961     if (ZoneUTC) {
00962       tpad->SetTopMargin(0.23);
00963       tpad->SetTickx(0);
00964       TGaxis *LocalTimeAxis = new TGaxis(MinX, tpad->GetUymax(),
00965         MaxX, tpad->GetUymax(), MinX-(LocalOffset/time_mult),
00966         MaxX-(LocalOffset/time_mult), 510, "-");
00967       LocalTimeAxis->SetTitle(Form("%s since %s (%s)", time_str.c_str(),
00968         ZeroTime->AsString("s"), LocalOffsetStr.c_str()));
00969       LocalTimeAxis->CenterTitle();
00970 
00971       LocalTimeAxis->Draw();
00972     }
00973 
00974     tpad->Modified();
00975     tpad->Update();
00976   }
00977 
00978   if(loud>=3) cout << "Printing Canvas\n";
00979   rcan->Print((TPBase+".ps").c_str());
00980 
00981   if (root_files) {
00982     if(loud>=2) cout << "Writing THistos, TCanvases, and TChains\n";
00983 
00984     //Write the histograms
00985     for (int i=0;i<4;i++) {
00986       for (int j=0;j<4;j++)
00987         rate_proj[4*i+j]->Write();
00988       prof_base[i]->Write();
00989     }
00990 
00991     //Write the canvas
00992     rcan->Write();
00993 
00994     //Write the tree
00995     tprates->Write();
00996 
00997   }
00998   rcan->Close();
00999 
01000   if(loud>=3) cout << "Printing Closing Canvas\n";
01001   rcan = crate4_disp("Fini");
01002   rcan->Print((TPBase+".ps]").c_str());
01003   rcan->Close();
01004 
01005   if(loud>=3) cout << "Deleting histograms\n";
01006   for(int i=0;i<16;i++) rate_proj[i]->Delete();
01007   for(int i=0;i<4;i++)  prof_base[i]->Delete();
01008 
01009   if (root_files) {
01010     tf->Write();
01011     tf->Close();
01012   }
01013 }

void tp_vmm_plot ( TTree *  tprates,
const int  Crate,
const int  Varc,
const int  Vmm 
)

Definition at line 1285 of file rate_plot.cc.

References AllowPulsed, bin_str, chain_title, BlockEvent::ChipEvents, crate2_disp(), Form(), ChipEvent::GetVachip(), ChipEvent::GetVadc(), ChipEvent::IsLoc(), TPChipEvent::IsPulsed, loud, MaxX, MinX, NameBase, NBins, TPChipEvent::Rate, root_files, BlockEvent::Time, time_mult, time_range(), time_str, ZeroStr, and ZeroTime.

Referenced by main().

01286 {
01287   if(loud>=1) cout << "Entering routine tp_vmm_plot" << endl;
01288   TPad *drawpad = 0;
01289   TCanvas *rcan = 0;
01290   TPaveText *pl = 0;
01291   TProfile *rate_proj[2][3];
01292   string TPBase = Form("TPVMM%d-%d-%d",Crate,Varc,Vmm);
01293   TPBase += NameBase;
01294 
01295   //Open a file if requested
01296   TFile *tf = 0;
01297   if (root_files) {
01298     tf = new TFile((TPBase+".root").c_str(),"RECREATE");
01299     tf->cd();
01300   }
01301 
01302   rcan = crate2_disp("Init");
01303   rcan->Print((TPBase+".ps[").c_str());
01304   rcan->Close();
01305 
01306   if(loud >= 1) cout << "Top Title for tprates plot: " << chain_title << endl;
01307 
01308   char names_list[2][16];
01309 
01310   time_range((TTree*)tprates);
01311 
01312   Double_t MinRate, MaxRate;
01313   char hname[20];
01314   char htitle[30];
01315   for(int i=0;i<2;i++) for (int j=0;j<3;j++) {
01316     sprintf(hname,"rproj%d_%d",i,j);
01317     sprintf(htitle,"ADC %d Chip %d Rate",i,j);
01318     rate_proj[i][j] = new TProfile(hname,htitle,NBins,MinX,MaxX);
01319   }
01320 
01321   TPSinglesEvent *revt = 0;
01322   //tprates->SetBranchStatus("*",0);
01323   //tprates->SetBranchStatus("Time*",1);
01324   //tprates->SetBranchStatus("ChipEvents",1);
01325   tprates->SetBranchAddress("tpevt",&revt);
01326 
01327   Int_t ientry = 0;
01328   while (tprates->GetEntry(ientry++)) {
01329 
01330     TClonesArray* chips = revt->ChipEvents;
01331     Double_t time_val = (revt->Time-ZeroTime->GetSec())/time_mult;
01332     for (int i=0;i<chips->GetLast();i++) {
01333       TPChipEvent *chip = dynamic_cast<TPChipEvent*>(chips->At(i));
01334       if(chip->IsLoc(Crate,Varc,Vmm)) {
01335         if(chip->IsPulsed && !AllowPulsed) continue;
01336         rate_proj[chip->GetVadc()][chip->GetVachip()]->Fill(time_val,chip->Rate);
01337       }
01338     }
01339   }
01340 
01341   sprintf(names_list[0],"Vadc 0");
01342   sprintf(names_list[1],"Vadc 1");
01343 
01344   TLegend *leg = 0;
01345   rcan = crate2_disp("Vmm");
01346   pl = new TPaveText(0,0.9,1,1);
01347   if(chain_title.size() != 0) pl->AddText(chain_title.c_str());
01348   else pl->AddText("RawTpSinglesSummaryBlock Rates");
01349   pl->AddText(Form("Vmm Profiles %d-%d-%d %s",Crate,Varc,Vmm,bin_str.c_str()));
01350   rcan->cd(0);
01351   pl->SetBorderSize(1);
01352   pl->Draw();
01353   char stats[40];
01354 
01355   drawpad = dynamic_cast<TPad*>(rcan->FindObject("drawpad"));
01356   TH2D *prof_base[2];
01357   for (int i=0;i<2;i++) {
01358     MaxRate = -10;
01359     MinRate = 10000000;
01360     Double_t BinRate,BinErr;
01361     for (int j=0;j<3;j++) {
01362       for (int k=0;k<rate_proj[i][j]->GetNbinsX();k++) {
01363         BinRate = rate_proj[i][j]->GetBinContent(k);
01364         BinErr = rate_proj[i][j]->GetBinError(k);
01365         if(BinRate==0 && BinErr==0)
01366           continue;
01367         if(BinRate+BinErr > MaxRate)
01368           MaxRate = BinRate+BinErr;
01369         if(BinRate-BinErr < MinRate)
01370           MinRate = BinRate-BinErr;
01371       }
01372     }
01373     if (MaxRate-MinRate <= 0.002) {
01374       if(loud>=2) cout << "Adjusting Min and Max Rate for small range\n";
01375       MinRate = MinRate - 1.0;
01376       MaxRate = MaxRate + 1.0;
01377     }
01378     if(loud>=2) printf("MinRate=%-.6f MaxRate=%.6f\n",MinRate,MaxRate);
01379     drawpad->cd(i+1);
01380     prof_base[i] = new TH2D(names_list[i],names_list[i],NBins,MinX,MaxX,
01381              50,MinRate-0.1*(MaxRate-MinRate),
01382              MaxRate+0.1*(MaxRate-MinRate));
01383     if(loud>=2) printf("Base Name = %s\n",names_list[i]);
01384     if(loud>=2) printf("BinsX=%d MinX=%f MaxX=%f\n",NBins,MinX,MaxX);
01385     if(loud>=2) printf("BinsY=%d MinY=%f MaxY=%f\n",50,MinRate-0.1*(MaxRate-MinRate),MaxRate+0.1*(MaxRate-MinRate));
01386 
01387     string x_title;
01388     x_title = time_str + " since " + ZeroStr;
01389     prof_base[i]->GetXaxis()->SetTitle(x_title.c_str());
01390     prof_base[i]->GetXaxis()->CenterTitle();
01391     prof_base[i]->GetYaxis()->SetTitle("TP Rate (Hz)");
01392     prof_base[i]->GetYaxis()->CenterTitle();
01393     prof_base[i]->Draw();
01394     leg = new TLegend(0.55,0.875,1.0,1.0);
01395     leg->SetBorderSize(1);
01396     for (int j=0;j<3;j++) {
01397       rate_proj[i][j]->Draw("SAME");
01398       rate_proj[i][j]->SetLineColor(j+2);
01399       sprintf(stats,"Vachip %d Mean=%-6.2f RMS=%-4.4f",j,
01400               rate_proj[i][j]->GetMean(2),rate_proj[i][j]->GetRMS(2));
01401       leg->AddEntry(rate_proj[i][j],stats,"l");
01402       if(root_files) rate_proj[i][j]->Write();
01403     }
01404     leg->Draw();
01405 
01406     if(root_files) prof_base[i]->Write();
01407   }
01408 
01409   if(loud>=3) cout << "Printing Canvas\n";
01410   rcan->Print((TPBase+".ps").c_str());
01411 
01412   if (root_files) {
01413     if(loud>=2) cout << "Writing THistos, TCanvases, and TChains\n";
01414     rcan->Write();
01415     tprates->Write();
01416   }
01417   rcan->Close();
01418 
01419   if(loud>=3) cout << "Printing Closing Canvas\n";
01420   rcan = crate2_disp("Fini");
01421   rcan->Print((TPBase+".ps]").c_str());
01422   rcan->Close();
01423 
01424   if(loud>=3) cout << "Deleting histograms\n";
01425   for(int i=0;i<2;i++) for(int j=0;j<3;j++) rate_proj[i][j]->Delete();
01426   for(int i=0;i<2;i++)  prof_base[i]->Delete();
01427 
01428   if (root_files) {
01429     tf->Write();
01430     tf->Close();
01431   }
01432 }

void usage (  ) 

Definition at line 121 of file rate_plot.cc.

References bin_str, bin_width, fOptSignal, fPlaneLimit, and time_str.

00122 {
00123   cout << "Usage: rate_plot -qvhntWMR -D,T,L [base] -C [Title] "
00124        << " -V [Crate-Varc-Vmm]"
00125        << " -x [X-Axis] -B [BinWidth]"
00126        << " -P [PlaneLimit] -s [OptRate]"
00127        << " [List of .rate.root files]" << endl;
00128   cout << " -v: Verbose output up one level\n";
00129   cout << " -q: Quiet output down one level\n";
00130   cout << " -h: Output this usage statement\n";
00131   cout << " -n: Dry Run (not for real, just for play)\n";
00132   cout << " -V [Crate-Varc-Vmm]: Make chip level plots\n";
00133   cout << " -W: Weekly binning convention, zero on Sunday, days on X-axis, 1 hour bins\n";
00134   cout << " -w [DATE]: Weekly binning convention zero day to DATE"
00135        << " (20071022 e.g.)" << endl;
00136   cout << " -M: Monthly binning convention, zero on end of month, days on X-axis, 4 hour bins\n";
00137   cout << " -m DATE: Monthly binning convention for month of DATE"
00138        << " (200710 e.g.)" << endl;
00139   cout << " -T \"title\": Title to go atop all plots\n";
00140   cout << " -X [S,M,H,D]: X-axis on seconds, minutes, hours, or days ("
00141        << time_str << ")" << endl;
00142   cout << " -B BinWidth[S,M,H,D]: Bin by BinWidth seconds, minutes, hours, or days ("
00143        << bin_width << bin_str << ")" << endl;
00144   cout << " -P PlaneLimit: Number of planes on SM activity cuts("
00145        << fPlaneLimit << ")" << endl;
00146   cout << " -s OptRate: Optimal Signal Snarl Rate ("
00147        << fOptSignal << ")" << endl;
00148   cout << " -A [P,S,p,s]: Allow (capital letter) or Disallow (small letter) pulsed (p or P) and shield (s or S)" << endl;
00149 }


Variable Documentation

bool AllowPulsed = false

Definition at line 116 of file rate_plot.cc.

Referenced by main(), tp_crate_plot(), tp_plot(), and tp_vmm_plot().

bool AllowShield = true

Definition at line 117 of file rate_plot.cc.

Referenced by main().

string BegStr

Definition at line 69 of file rate_plot.cc.

Referenced by ds_plot(), and time_range().

TTimeStamp * BegTime

Definition at line 68 of file rate_plot.cc.

Referenced by AlgFitTrackCam::NDStripBegTime(), and time_range().

Int_t bin_con = 0

Definition at line 71 of file rate_plot.cc.

Referenced by ds_plot(), main(), and time_range().

Double_t bin_mult = 3600.

Definition at line 78 of file rate_plot.cc.

Referenced by main(), and time_range().

string bin_str = "hour"

Definition at line 79 of file rate_plot.cc.

Referenced by ds_plot(), ds_vmm_plot(), main(), tp_crate_plot(), tp_plot(), tp_vmm_plot(), and usage().

Int_t bin_width = 1

Definition at line 80 of file rate_plot.cc.

Referenced by main(), time_range(), and usage().

string chain_title = ""

Definition at line 92 of file rate_plot.cc.

Referenced by ds_plot(), ds_vmm_plot(), main(), tp_crate_plot(), tp_plot(), and tp_vmm_plot().

bool DryRun = false

Definition at line 53 of file rate_plot.cc.

Referenced by isetup(), and main().

string EndStr

Definition at line 69 of file rate_plot.cc.

Referenced by ds_plot(), and time_range().

TTimeStamp * EndTime

Definition at line 68 of file rate_plot.cc.

Referenced by time_range().

Int_t fBlPlaneLimit = 16

Definition at line 86 of file rate_plot.cc.

Referenced by ds_plot(), and main().

Double_t FirstFrame

Definition at line 67 of file rate_plot.cc.

Referenced by ds_plot(), run_time(), and time_range().

Double_t fOptBlSignal = 0.31

Definition at line 89 of file rate_plot.cc.

Referenced by ds_plot(), and main().

Double_t fOptSignal = 0.68

Definition at line 90 of file rate_plot.cc.

Referenced by ds_plot(), main(), and usage().

Double_t fOptSMSignal = 0.18

Definition at line 88 of file rate_plot.cc.

Referenced by ds_plot(), and main().

Int_t fPlaneLimit = 16

Definition at line 87 of file rate_plot.cc.

Referenced by main(), and usage().

Definition at line 83 of file rate_plot.cc.

Referenced by RunFileModule::RunFileModule(), and RunSummary::RunSummary().

Int_t fSignalADC = 2000

Definition at line 84 of file rate_plot.cc.

Referenced by ds_plot(), and main().

Int_t fSMPlaneLimit = 16

Definition at line 85 of file rate_plot.cc.

Referenced by ds_plot(), and main().

Int_t LocalOffset = 0

Definition at line 61 of file rate_plot.cc.

Referenced by ds_plot(), time_range(), and tp_plot().

string LocalOffsetStr = ""

Definition at line 62 of file rate_plot.cc.

Referenced by ds_plot(), time_range(), and tp_plot().

int loud = 0
Double_t MaxTime
Double_t MaxX

Definition at line 66 of file rate_plot.cc.

Referenced by ds_plot(), ds_vmm_plot(), time_range(), tp_crate_plot(), tp_plot(), and tp_vmm_plot().

Double_t MinTime
Double_t MinX
string NameBase = "rates"

Definition at line 93 of file rate_plot.cc.

Referenced by ds_plot(), ds_vmm_plot(), main(), tp_crate_plot(), tp_plot(), and tp_vmm_plot().

Int_t NBins = 0
Bool_t root_files = true

Definition at line 54 of file rate_plot.cc.

Referenced by ds_plot(), ds_vmm_plot(), tp_crate_plot(), tp_plot(), and tp_vmm_plot().

Double_t time_mult = 3600.
string time_str = "hours"

Definition at line 57 of file rate_plot.cc.

Referenced by ds_plot(), ds_vmm_plot(), main(), tp_crate_plot(), tp_plot(), tp_vmm_plot(), and usage().

Int_t WeeklyZeroDate = 1

Definition at line 77 of file rate_plot.cc.

Referenced by main(), and time_range().

string ZeroStr

Definition at line 69 of file rate_plot.cc.

Referenced by ds_plot(), ds_vmm_plot(), time_range(), tp_crate_plot(), tp_plot(), and tp_vmm_plot().

TTimeStamp* ZeroTime

Definition at line 68 of file rate_plot.cc.

Referenced by ds_plot(), ds_vmm_plot(), time_range(), tp_crate_plot(), tp_plot(), and tp_vmm_plot().

Int_t ZoneDiff = 0

Definition at line 58 of file rate_plot.cc.

Referenced by ds_plot(), main(), and time_range().

string ZoneStr = " (UTC)"

Definition at line 59 of file rate_plot.cc.

Referenced by main(), and time_range().

bool ZoneUTC = true

Definition at line 60 of file rate_plot.cc.

Referenced by ds_plot(), main(), time_range(), and tp_plot().


Generated on 8 May 2018 for loon by  doxygen 1.6.1