GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CorrSpaceRead.C
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998, Agata Experiment, All rights reserved. *
3  * *
4  * Author: The Agata Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 
17 //
18 //
19 #if !defined(__CINT__) || defined(__MAKECINT__)
20 
21 #include <Riostream.h>
22 #include "TFile.h"
23 #include "TROOT.h"
24 #include "TCanvas.h"
25 #include "TFolder.h"
26 #include "TTree.h"
27 #include "TString.h"
28 #include "TH1D.h"
29 #include "TStopwatch.h"
30 #include "CorrelatedSpaceTree2I.h"
31 #include "CorrelatedSpaceTH2.h"
32 #include "CubicFilter.h"
33 
34 #endif
35 
36 void CorrSpaceTreeRead(Int_t gateInf = 2815, Int_t gateSup = 2824, TString fileName = "test1.root")
37 {
38 
39 
40  TStopwatch watch;
41  Option_t* axis = "x";
42 
43  TFile* fileIn = new TFile(fileName.Data(), "READ");
44 
45  watch.Start();
46 
47  Gw::CorrelatedSpaceTree2I* coor = (Gw::CorrelatedSpaceTree2I*)fileIn->Get("Correlated_Space");
48  Gw::CubicFilter* filter = new Gw::CubicFilter();
49  filter->SetName("Gate0");
50 
51  TFolder *folder = gROOT->GetRootFolder()->AddFolder("Filter","Folder");
52  folder->Add(filter);
53 
54  filter->AddGate(gateInf, gateSup);
55  //filter->AddGate(gateInf+5, gateSup+5);
56  //filter->ImportGates("gate.dat");
57 
58  coor->Project(axis);
59 
60  watch.Stop();
61 
62  TH1D* h = coor->GetHisto(axis);
63  h->Draw();
64  printf("Real time %6.3f\n", watch.RealTime());
65 }
66 
67 void CorrSpaceH2Read(Int_t gateInf = 2715, Int_t gateSup = 2824, TString fileName = "test3.root")
68 {
69 
70 
71  TStopwatch watch;
72  Option_t* axis = "x";
73 
74  TFile* fileIn = new TFile(fileName.Data(), "READ");
75 
76  watch.Start();
77 
78  Gw::CorrelatedSpaceTH2* coor = (Gw::CorrelatedSpaceTH2*)fileIn->Get("Correlated_Space");
79  Gw::CubicFilter* filter = new Gw::CubicFilter();
80  filter->SetName("Gate0");
81 
82  TFolder *folder = gROOT->GetRootFolder()->AddFolder(Gw::CSFilter::GetFolderName(),"Folder");
83  folder->Add(filter);
84 
85 
86  filter->AddGate(gateInf, gateSup);
87  //filter->AddGate(gateInf+200, gateSup+200);
88  //filter->ImportGates("gate.dat");
89 
90  coor->Project(axis);
91 
92  watch.Stop();
93 
94  TH1D* h = coor->GetHisto(axis);
95  h->Draw();
96  printf("Real time %6.3f\n", watch.RealTime());
97 }
98 
printf("******************************************************************** \n")
CorrelatedSpaceTH2 class that manages a 2D symmetrical correlated space stored in a TH2...
header file for all type of CorrelatedSpaceTree2I
header file for all type of CorrelatedSpaceTH2
CubicFilter class for cubic gates.
Definition: CubicFilter.h:22
static const Char_t * GetFolderName()
Get Folder name.
Definition: CSFilter.h:80
void CorrSpaceTreeRead(Int_t gateInf=2815, Int_t gateSup=2824, TString fileName="test1.root")
Definition: CorrSpaceRead.C:36
void AddGate(Double_t gateInf, Double_t gateSup, Int_t axis=0, Option_t *opt="update")
Add gate.
CorrelatedSpaceTree2I class that manages a 2D symmetrical correlated space of integers store in a tre...
void CorrSpaceH2Read(Int_t gateInf=2715, Int_t gateSup=2824, TString fileName="test3.root")
Definition: CorrSpaceRead.C:67
void Project(CSFilter *filter, Option_t *axis="X")
Project.
void Project(CSFilter *filter, Option_t *axis="X")
Project.
virtual TH1D * GetHisto(Option_t *axis="x")
Get histo.