TV1190Histogram.cxx

Go to the documentation of this file.
00001 #include "TV1190Histogram.h"
00002 
00003 #include "TV1190Data.hxx"
00004 #include "TDirectory.h"
00005 
00006 const int Nchannels = 64;
00007 
00008 /// Reset the histograms for this canvas
00009 TV1190Histograms::TV1190Histograms(){  
00010   
00011   CreateHistograms();
00012 }
00013 
00014 
00015 void TV1190Histograms::CreateHistograms(){
00016   
00017 
00018   // Otherwise make histograms
00019   clear();
00020   
00021   std::cout << "Create Histos" << std::endl;
00022   for(int i = 0; i < Nchannels; i++){ // loop over channels    
00023 
00024     char name[100];
00025     char title[100];
00026     sprintf(name,"V1190_%i_%i",0,i);
00027 
00028     // Delete old histograms, if we already have them
00029     TH1D *old = (TH1D*)gDirectory->Get(name);
00030     if (old){
00031       delete old;
00032     }
00033 
00034 
00035     // Create new histograms
00036     
00037     sprintf(title,"V1190 histogram for channel=%i",i);  
00038     
00039     TH1D *tmp = new TH1D(name,title,5000,0,500000);
00040     tmp->SetXTitle("TDC value");
00041     tmp->SetYTitle("Number of Entries");
00042     push_back(tmp);
00043   }
00044 
00045 }
00046 
00047 
00048 
00049   
00050 /// Update the histograms for this canvas.
00051 void TV1190Histograms::UpdateHistograms(TDataContainer& dataContainer){
00052 
00053 
00054   TV1190Data *data = dataContainer.GetEventData<TV1190Data>("TDC0");
00055   if(!data) return;
00056 
00057   /// Get the Vector of ADC Measurements.
00058   std::vector<TDCMeasurement> measurements = data->GetMeasurements();
00059   for(unsigned int i = 0; i < measurements.size(); i++){ // loop over measurements
00060         
00061     int chan = measurements[i].GetChannel();
00062     GetHistogram(chan)->Fill(measurements[i].GetMeasurement());
00063   }
00064 
00065 }
00066 
00067 
00068 
00069 /// Take actions at begin run
00070 void TV1190Histograms::BeginRun(int transition,int run,int time){
00071 
00072   CreateHistograms();
00073 
00074 }
00075 
00076 /// Take actions at end run  
00077 void TV1190Histograms::EndRun(int transition,int run,int time){
00078 
00079 }

Generated on 12 Feb 2016 for ROOT Analyzer by  doxygen 1.6.1