TAgilentHistogram.cxx

Go to the documentation of this file.
00001 #include "TAgilentHistogram.h"
00002 
00003 #include "TDirectory.h"
00004 
00005 const int Nchannels = 5;
00006 
00007 /// Reset the histograms for this canvas
00008 TAgilentHistograms::TAgilentHistograms(){  
00009   
00010   CreateHistograms();
00011 }
00012 
00013 /// Create Histograms and Fill
00014 void TAgilentHistograms::CreateHistograms(){
00015   
00016   // Otherwise make histograms
00017   clear();
00018 
00019   std::cout << "Create Agilent Histos" << std::endl;
00020   for(int i = 0; i < Nchannels; i++){ // loop over channels    
00021 
00022     char name[100];
00023     char title[100];
00024     sprintf(name,"Agilent_%i_%i",0,i);
00025 
00026     // Delete old histograms, if we already have them
00027     TH1D *old = (TH1D*)gDirectory->Get(name);
00028     if (old){
00029       delete old;
00030     }
00031 
00032     // Create new histograms
00033     sprintf(title,"Agilent histogram for channel=%i",i);
00034     
00035     TH1D *tmp = new TH1D(name,title,10000,0,10);
00036     tmp->SetXTitle("Current (uA)");
00037     push_back(tmp);
00038    }
00039 
00040 }
00041 
00042 
00043  #include <sys/time.h>
00044 
00045   
00046 /// Update the histograms for this canvas.
00047 void TAgilentHistograms::UpdateHistograms(TDataContainer& dataContainer){
00048 
00049 
00050 
00051     TGenericData *bert = dataContainer.GetEventData<TGenericData>("BERT");
00052     if(bert ){ 
00053       for(int i = 0; i < Nchannels; i++){
00054         GetHistogram(i)->Fill(100*((double*)bert->GetData64())[i]);
00055 
00056       }
00057     }
00058 }
00059 
00060 
00061 
00062 /// Take actions at begin run
00063 void TAgilentHistograms::BeginRun(int transition,int run,int time){
00064 
00065   CreateHistograms();
00066 }
00067 
00068 /// Take actions at end run  
00069 void TAgilentHistograms::EndRun(int transition,int run,int time){
00070   printf("in end run for TAgilent\n");
00071 }

Generated on 12 Feb 2016 for ROOT Analyzer by  doxygen 1.6.1