Difference between revisions of "ROOT 4 DataMonitoring"
Jump to navigation
Jump to search
(4 intermediate revisions by the same user not shown) | |||
Line 51: | Line 51: | ||
### | ### | ||
# | # | ||
− | |||
− | |||
− | |||
− | |||
# | # | ||
# | # | ||
Line 61: | Line 57: | ||
# | # | ||
− | == | + | ==hsimple.cxx== |
float GetData(); | float GetData(); | ||
Line 80: | Line 76: | ||
int i; | int i; | ||
TApplication theApp("App", &argc, argv); | TApplication theApp("App", &argc, argv); | ||
− | |||
− | |||
TCanvas *c = new TCanvas("c", "The Hello Canvas", 400, 400); | TCanvas *c = new TCanvas("c", "The Hello Canvas", 400, 400); | ||
c->Connect("Closed()", "TApplication", &theApp, "Terminate()"); | c->Connect("Closed()", "TApplication", &theApp, "Terminate()"); | ||
TH1F *Hist1= new TH1F("Hist1","Hist1",100,0,10); | TH1F *Hist1= new TH1F("Hist1","Hist1",100,0,10); | ||
− | |||
− | |||
TCanvas *c = new TCanvas("c", "The Hello Canvas", 400, 400); | TCanvas *c = new TCanvas("c", "The Hello Canvas", 400, 400); | ||
c->Connect("Closed()", "TApplication", &theApp, "Terminate()"); | c->Connect("Closed()", "TApplication", &theApp, "Terminate()"); | ||
Line 103: | Line 95: | ||
{ | { | ||
Float_t random = gRandom->Rndm(1); | Float_t random = gRandom->Rndm(1); | ||
− | |||
return (2.5+random*5.0); | return (2.5+random*5.0); | ||
} | } | ||
=add EVIO= | =add EVIO= |
Latest revision as of 00:23, 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) # ### # # # .$(SrcSuf).$(ObjSuf): $(CXX) $(CXXFLAGS) -c $< #
hsimple.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); }