TComplicatedExampleCanvas Class Reference

A complicated canvas example, using the values from V792 module. More...

#include <TComplicatedExampleCanvas.hxx>

Inheritance diagram for TComplicatedExampleCanvas:
Inheritance graph
[legend]
Collaboration diagram for TComplicatedExampleCanvas:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TComplicatedExampleCanvas ()
void ResetCanvasHistograms ()
 Reset the histograms for this canvas.
void UpdateCanvasHistograms (TDataContainer &dataContainer)
 Update the histograms for this canvas.
void PlotCanvas (TDataContainer &dataContainer, TRootEmbeddedCanvas *embedCanvas)
 Plot the histograms for this canvas.
void SetUpCompositeFrame (TGCompositeFrame *compFrame, TRootanaDisplay *display)
void BeginRun (int transition, int run, int time)
 Take actions at begin run.
virtual void EndRun (int transition, int run, int time)
 Take actions at end run.
std::string GetTabName ()
TRootEmbeddedCanvas * GetEmbeddedCanvas ()
 This method is only.

Private Attributes

TH1F * adcValue [32]
TGNumberEntry * fBankCounterButton

Detailed Description

A complicated canvas example, using the values from V792 module.

Definition at line 13 of file TComplicatedExampleCanvas.hxx.


Constructor & Destructor Documentation

TComplicatedExampleCanvas::TComplicatedExampleCanvas (  ) 

Definition at line 9 of file TComplicatedExampleCanvas.cxx.

References adcValue.

00009                                                     : TCanvasHandleBase("V792 ADC Values"){
00010 
00011   for(int i = 0; i < 32; i++){
00012     char name[100];
00013     char title[100];
00014     sprintf(name,"adcValue%i",i+10);
00015     sprintf(title,"ADC values for channel %i",i);
00016     adcValue[i] = new TH1F(name,title,2000,0,4000);
00017   }
00018 }


Member Function Documentation

void TComplicatedExampleCanvas::BeginRun ( int  transition,
int  run,
int  time 
) [inline, virtual]

Take actions at begin run.

Reimplemented from TCanvasHandleBase.

Definition at line 29 of file TComplicatedExampleCanvas.hxx.

00029                                                 {
00030     std::cout << "BOR: User can do something here... " << std::endl;
00031   }

virtual void TCanvasHandleBase::EndRun ( int  transition,
int  run,
int  time 
) [inline, virtual, inherited]

Take actions at end run.

Reimplemented in TFancyHistogramCanvas.

Definition at line 36 of file TCanvasHandleBase.hxx.

00036 {};

TRootEmbeddedCanvas* TCanvasHandleBase::GetEmbeddedCanvas (  )  [inline, inherited]

This method is only.

Definition at line 41 of file TCanvasHandleBase.hxx.

00041                                           {
00042     std::cerr<< "Not implemented for base class; exiting." << std::endl;
00043     exit(0);
00044     return 0;
00045   }

std::string TCanvasHandleBase::GetTabName (  )  [inline, inherited]

Definition at line 38 of file TCanvasHandleBase.hxx.

References TCanvasHandleBase::fTabName.

Referenced by TRootanaDisplay::AddSingleCanvas().

00038 {return fTabName;}

Here is the caller graph for this function:

void TComplicatedExampleCanvas::PlotCanvas ( TDataContainer dataContainer,
TRootEmbeddedCanvas *  embedCanvas 
) [virtual]

Plot the histograms for this canvas.

Implements TCanvasHandleBase.

Definition at line 74 of file TComplicatedExampleCanvas.cxx.

References adcValue, and fBankCounterButton.

00074                                                                                                          {
00075 
00076   TCanvas* c1 = embedCanvas->GetCanvas();
00077   c1->Clear();
00078   int whichbank = fBankCounterButton->GetNumberEntry()->GetIntNumber();
00079   if(whichbank >=0 && whichbank <32)
00080     adcValue[whichbank]->Draw();
00081   c1->Modified();
00082   c1->Update();
00083 
00084 }

void TComplicatedExampleCanvas::ResetCanvasHistograms (  )  [virtual]

Reset the histograms for this canvas.

Implements TCanvasHandleBase.

Definition at line 46 of file TComplicatedExampleCanvas.cxx.

References adcValue.

00046                                                      {
00047 
00048   for(int i = 0; i < 32; i++)
00049     adcValue[i]->Reset();
00050 }

void TComplicatedExampleCanvas::SetUpCompositeFrame ( TGCompositeFrame *  compFrame,
TRootanaDisplay display 
) [virtual]

Reimplemented from TCanvasHandleBase.

Definition at line 20 of file TComplicatedExampleCanvas.cxx.

References fBankCounterButton.

00020                                                                                                         {
00021 
00022 
00023   // Now create my embedded canvas, along with the various buttons for this canvas.
00024   
00025   TGHorizontalFrame *labelframe = new TGHorizontalFrame(compFrame,200,40);
00026   
00027   fBankCounterButton = new TGNumberEntry(labelframe, 0, 9,999, TGNumberFormat::kNESInteger,
00028                                               TGNumberFormat::kNEANonNegative, 
00029                                               TGNumberFormat::kNELLimitMinMax,
00030                                               0, 31);
00031 
00032   fBankCounterButton->Connect("ValueSet(Long_t)", "TRootanaDisplay", display, "UpdatePlotsAction()");
00033   fBankCounterButton->GetNumberEntry()->Connect("ReturnPressed()", "TRootanaDisplay", display, "UpdatePlotsAction()");
00034   labelframe->AddFrame(fBankCounterButton, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
00035   TGLabel *labelMinicrate = new TGLabel(labelframe, "ADC Channel (0-31)");
00036   labelframe->AddFrame(labelMinicrate, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
00037 
00038   compFrame->AddFrame(labelframe, new TGLayoutHints(kLHintsCenterX,2,2,2,2));
00039 
00040 
00041 }

void TComplicatedExampleCanvas::UpdateCanvasHistograms ( TDataContainer dataContainer  )  [virtual]

Update the histograms for this canvas.

Implements TCanvasHandleBase.

Definition at line 53 of file TComplicatedExampleCanvas.cxx.

References adcValue, VADCMeasurement::GetChannel(), TDataContainer::GetEventData(), VADCMeasurement::GetMeasurement(), and TV792Data::GetMeasurements().

00053                                                                                    {
00054 
00055   // Get the V792 data
00056   TV792Data *v792 = dataContainer.GetEventData<TV792Data>("ADC0");
00057   if(v792 ){ 
00058 
00059     // Loop over ADC measurements
00060     std::vector<VADCMeasurement>& measurements = v792->GetMeasurements();
00061     for(unsigned int i = 0; i < measurements.size(); i++){
00062       VADCMeasurement adcmeas = measurements[i];
00063         
00064       // For each measurement, update histogram
00065       int chan = adcmeas.GetChannel();
00066       if(chan >= 0 && chan < 32){
00067         adcValue[chan]->Fill(adcmeas.GetMeasurement());
00068       }
00069     }      
00070   }
00071 }

Here is the call graph for this function:


Member Data Documentation

Definition at line 35 of file TComplicatedExampleCanvas.hxx.

Referenced by PlotCanvas(), and SetUpCompositeFrame().


The documentation for this class was generated from the following files:

Generated on 12 Feb 2016 for ROOT Analyzer by  doxygen 1.6.1