Difference between revisions of "ROOT 4 DataMonitoring"

From New IAC Wiki
Jump to navigation Jump to search
Line 29: Line 29:
 
  #  
 
  #  
 
  #
 
  #
$ (HSIMPLE):    $(HSIMPLEO)
+
  $(HSIMPLE):    $(HSIMPLEO)
 
                 $(LD) $(LDFLAGS) $^  $(ROOTLIBS) $(EVIOLIBS) $(OutPutOpt)$@
 
                 $(LD) $(LDFLAGS) $^  $(ROOTLIBS) $(EVIOLIBS) $(OutPutOpt)$@
 
                 $(MT_EXE)
 
                 $(MT_EXE)

Revision as of 00:15, 2 December 2007

Simple histogram filler

Makefile

# Makefile for the ROOT test programs.
#
include Makefile.arch
#
#------------------------------------------------------------------------------
#
#
HSIMPLEO      = hsimple.$(ObjSuf)
HSIMPLES      = hsimple.$(SrcSuf)
HSIMPLE       = hsimple$(ExeSuf)
#
#
OBJS          = $(HWORLDO) $(HSIMPLEO)
#
PROGRAMS      = $(HWORLD) $(HSIMPLE)
#
ROOTLIBS      = -L$(ROOTSYS)/lib -lCore -lCint -lRIO -lHist -lGraf -lGraf3d -lGpad -lNet -lTree -lRint -lPostscript -lMatrix -lPhysics
#
EVIOLIBS      =-L/home/daq/CODA/2.5/Linux/lib -lcoda -lpthread -lm -ldl -rdynamic
#
#------------------------------------------------------------------------------
#
.SUFFIXES: .$(SrcSuf) .$(ObjSuf) .$(DllSuf)
#
all:            $(PROGRAMS) 
# 
#
 $(HSIMPLE):     $(HSIMPLEO)
               $(LD) $(LDFLAGS) $^  $(ROOTLIBS) $(EVIOLIBS) $(OutPutOpt)$@
               $(MT_EXE)
               @echo "$@ done"
#
clean:
               @rm -f $(OBJS) core
#
distclean:      clean
               -@mv -f linearIO.root linearIO.roott
               @rm -f $(PROGRAMS) $(EVENTSO) $(EVENTLIB) *Dict.* *.def *.exp \
                  *.root *.ps *.so *.lib *.dll *.d *.log .def so_locations
               @rm -rf cxx_repository
               -@mv -f linearIO.roott linearIO.root
               -@cd RootShower && $(MAKE) distclean
               -@cd rhtml && $(MAKE) distclean
               -@cd RootIDE && $(MAKE) distclean
#
.SUFFIXES: .$(SrcSuf)
#
###
#
Hello.$(ObjSuf): Hello.h
HelloDict.$(SrcSuf): Hello.h
       @echo "Generating dictionary $@..."
       @rootcint -f $@ -c $^
#
#
.$(SrcSuf).$(ObjSuf):
       $(CXX) $(CXXFLAGS) -c $<
#

test.cxx

float GetData();

  1. ifndef __CINT__
  2. include "TFile.h"
  3. include "TH1.h"
  4. include "TH2.h"
  5. include "TProfile.h"
  6. include "TNtuple.h"
  7. include "TRandom.h"
  1. include "TApplication.h"
  2. include "TCanvas.h"
  3. include "TLine.h"
  4. include "TPaveLabel.h"

//______________________________________________________________________________ int main(int argc, char **argv) {

 int i;
 TApplication theApp("App", &argc, argv);


 TCanvas *c = new TCanvas("c", "The Hello Canvas", 400, 400);
 c->Connect("Closed()", "TApplication", &theApp, "Terminate()");
 TH1F *Hist1= new TH1F("Hist1","Hist1",100,0,10);


 TCanvas *c = new TCanvas("c", "The Hello Canvas", 400, 400);
 c->Connect("Closed()", "TApplication", &theApp, "Terminate()");
 TH1F *Hist1= new TH1F("Hist1","Hist1",100,0,10);


 for(i=0; i<30; i++)
   {
     Hist1->Fill(GetData());
     Hist1->Draw();
     c->Update();
   }
 theApp.Run();

}

  1. endif

float GetData() {

 Float_t random = gRandom->Rndm(1);
 return (2.5+random*5.0);

} (


add EVIO