Difference between revisions of "ROOT 4 DataMonitoring"
Jump to navigation
Jump to search
Line 2: | Line 2: | ||
==Makefile== | ==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== | ==test.cxx== | ||
+ | |||
+ | float GetData(); | ||
+ | |||
+ | #ifndef __CINT__ | ||
+ | #include "TFile.h" | ||
+ | #include "TH1.h" | ||
+ | #include "TH2.h" | ||
+ | #include "TProfile.h" | ||
+ | #include "TNtuple.h" | ||
+ | #include "TRandom.h" | ||
+ | |||
+ | #include "TApplication.h" | ||
+ | #include "TCanvas.h" | ||
+ | #include "TLine.h" | ||
+ | #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(); | ||
+ | } | ||
+ | #endif | ||
+ | |||
+ | float GetData() | ||
+ | { | ||
+ | Float_t random = gRandom->Rndm(1); | ||
+ | |||
+ | return (2.5+random*5.0); | ||
+ | } | ||
+ | ( | ||
+ | |||
=add EVIO= | =add EVIO= |
Revision as of 00:14, 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();
- ifndef __CINT__
- include "TFile.h"
- include "TH1.h"
- include "TH2.h"
- include "TProfile.h"
- include "TNtuple.h"
- include "TRandom.h"
- include "TApplication.h"
- include "TCanvas.h"
- include "TLine.h"
- 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();
}
- endif
float GetData() {
Float_t random = gRandom->Rndm(1);
return (2.5+random*5.0);
} (