GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DanteWatchers.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2010 by Olivier Stezowski *
3  * stezow(AT)ipnl.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
21 #ifndef _DanteWatchers
22 #define _DanteWatchers
23 
24 // root includes
25 #include "TRotation.h"
26 #include "TH3.h"
27 #include "TString.h"
28 
29 // Gw and Watcher definition
30 #include "TTreeWatchers.h"
31 #include "MetaWatchers.h"
32 #include "RancLegnaroWatchers.h"
33 
34 // a simple structure that kept all the information for one Dante module
35 struct MyDante {
36 
37  // position in dante reference system (provided by dante)
38  Double_t X;
39  Double_t Y;
40  Double_t Z;
41  // position in beam reference system (calculated in this watcher)
42  Double_t Xr;
43  Double_t Yr;
44  Double_t Zr;
45 
46  // time and amplitude
47  Double_t T;
48  Double_t A;
49 
50  // status flag to know if the detector has fired
51  Bool_t has_fired;
52 
53  // used for calibration
54  Double_t threshold_adc;
55 
56  Double_t threshold_x_left;
58  Double_t threshold_y_down;
59  Double_t threshold_y_up;
60 
61  // used for calibration
62  Double_t AX, BX, CX;
63  Double_t AY, BY, CY;
64 
65  MyDante() :
66  X(0.0),
67  Y(0.0),
68  Z(0.0),
69  Xr(0.0),
70  Yr(0.0),
71  Zr(0.0),
72  T(0.0),
73  A(0.0),
74  has_fired(false),
75  threshold_adc(200.0),
76  threshold_x_left(-100.0),
77  threshold_x_right(100.0),
78  threshold_y_down(-100.0),
79  threshold_y_up(100.0),
80  AX(0.0), BX(1.0), CX(0.0),
81  AY(0.0), BY(1.0), CY(0.0) {;}
82 
83  // apply calibration, set is_fired to false if not a good event (i.e in threshold)
84  void Calibrate () ;
85 };
86 
88 
91 {
92 public:
93  // number of modules compositing DANTE
94  static const Short_t gMaxNumberOfModules = 5;
95  // number of items per module (X,Y,T,A)
96  static const Short_t gNumberOfItems = 4;
97  // table to get for each items the position in the rawBuf vector
99  // init table to default
100  static void InitLUT();
101 
102  // Rotations
103  // 0 is Z, 1 is Y, 2 is Z and 4 is X
104  TRotation fRotation_tmp[4][gMaxNumberOfModules]; // tmp waiting for a single matrix to be tested
106 
107 protected:
108  // number of module for the current setting
110  // one structure per module
112 protected:
113  // Compute true postion of the recoil in beam reference system
114  void ComputeRealPosition(Short_t);
115 
116 public:
117  BaseDanteWatcher(const char *, const char *, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
118  virtual ~BaseDanteWatcher();
119 
120  // (re)load the current configuration
121  Bool_t LoadCalibration(const char *calib_file = "Dante.conf"); //*MENU*
122 
124  virtual void Exec(Option_t *option="");
125 
126  ClassDef(BaseDanteWatcher,0) // Base class to get Dante Data
127 };
128 
129 //class Gw::AgataEventDisplay;
130 
132 
135 {
136 protected:
137 
138  // histograms to check if everything is all right
139  // how many channels fired
140  TH1F *fCounts;
141  // positions in 2D for each module
142  TObjArray *fPositions;
143  TObjArray *fPositionsC;
144  // positions in 3D space (beam reference)
145  TH3F *fPos3D;
146 
147  TH1F *fR;
148  TH1F *fTheta;
149  TH1F *fPhi;
150  TH2F *fThetaxPhi;
151 
152  TString fTypeName;
153  Int_t fMaxCycle;
154  const Char_t* fConfFileName;
155  const Char_t* fPathFile;
156 
157 private:
158  static Float_t fgMetric;
159 
160 protected:
162  virtual void DoCanvas(TCanvas *c, Option_t *o);
163 
164 public:
165  DisplayDante(const char *, const char *, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
166  virtual ~DisplayDante();
167 
169  virtual void Exec(Option_t *option="");
170 
172  virtual void ShowEve(const Char_t* danteConfFile, const Char_t* agataPathFile); //*MENU* *GETTER=GetConfFileName,GetPathFile* *ARGS={danteConfFile=>fConfFileName,agataPathFile=>fPathFile}*
173 
175  void SetActive(Bool_t active = true); //*TOGGLE*
176 
178  virtual void SetMaxCycle(Int_t cycle) { fMaxCycle = cycle; } //*MENU*
179 
181  virtual Int_t GetMaxCycle() { return fMaxCycle; }
182 
184  virtual const Char_t* GetConfFileName() const { return fConfFileName; }
185 
187  virtual const Char_t* GetPathFile() const { return fPathFile; }
188 
189  ClassDef(DisplayDante,0) // Display some spectra specific to DANTE
190 };
191 
193 {
194 private:
195  Int_t fNbDante;
196 
197  UShort_t *fWhichDante; //[10]
198  // hit in the dante module in global reference system
199  Float_t *fDanteXr; //[10]
200  Float_t *fDanteYr; //[10]
201  Float_t *fDanteZr; //[10]
202  // amplitude of the signal
203  Float_t *fDanteA; //[10]
204  // calibrated poistion in the module reference system
205  Float_t *fDanteXc; //[10]
206  Float_t *fDanteYc; //[10]
207 
208  Float_t fDanteBeta; //
209 
210 protected:
211  virtual void SetBranches();
212 
213 public:
214  MyDanteTree(const char *name, const char *title, TTree *tree = 0x0);
215  ~MyDanteTree();
216 
218 
219  virtual void Exec(Option_t *option="");
220 
221  ClassDef(MyDanteTree,0) // Built the Dante Branch
222 };
223 
225 
228 {
229 protected:
230  Double_t fMeanBeta;
231 
232 public:
233  DoDanteDoppler(const char *, const char *, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
234  virtual ~DoDanteDoppler()
235  {;}
236 
237  Double_t GetMeanBeta() const
238  { return fMeanBeta; }
239  void SetMeanBeta(Double_t mean)
240  { fMeanBeta = mean; }
241 
242  void ChangeMeanBeta(Double_t b); //*MENU* *ARGS={b=>fMeanBeta}
243 
245  virtual void Exec(Option_t *option="");
246 
247  ClassDef(DoDanteDoppler,0) //
248 };
249 
250 
251 
252 
253 #endif
254 
Double_t threshold_y_up
Definition: DanteWatchers.h:59
TRotation fRotation_tmp[4][gMaxNumberOfModules]
TBrowser * b
Double_t BY
Definition: DanteWatchers.h:63
Bool_t has_fired
Definition: DanteWatchers.h:51
Double_t T
Definition: DanteWatchers.h:47
Double_t AX
Definition: DanteWatchers.h:62
virtual void ShowEve(const Char_t *danteConfFile, const Char_t *agataPathFile)
show eve event display
Interface for any watcher that is a VertexBuilder.
virtual void SetBranches()
const Char_t * fConfFileName
Double_t AY
Definition: DanteWatchers.h:63
virtual ~DoDanteDoppler()
Double_t CX
Definition: DanteWatchers.h:62
TObjArray * fPositions
Double_t Y
Definition: DanteWatchers.h:39
Double_t fMeanBeta
virtual void DoCanvas(TCanvas *c, Option_t *o)
To be overwritten by real implementation if a canvas is produced.
Double_t Zr
Definition: DanteWatchers.h:44
Double_t GetMeanBeta() const
Double_t BX
Definition: DanteWatchers.h:62
Base for a watcher on an ancillary (raw) frame.
Double_t X
Definition: DanteWatchers.h:38
Apply the doppler correction.
static Short_t gLUT[gNumberOfItems][gMaxNumberOfModules]
Definition: DanteWatchers.h:98
virtual ~DisplayDante()
static void InitLUT()
TH2F * fThetaxPhi
Double_t Yr
Definition: DanteWatchers.h:43
BaseDanteWatcher(const char *, const char *, TDirectory *sp_dir=0x0, TDirectory *tag_dir=0x0)
Definition: DanteWatchers.C:46
Base class for a Watcher that fill a TTree or some branches of a TTree.
Definition: TTreeWatchers.h:51
virtual void Exec(Option_t *option="")
watch the current frame
virtual void Exec(Option_t *option="")
watch the current frame
Base class for Dante Watcher.
Definition: DanteWatchers.h:90
To display the basic spectra for Dante.
virtual void Exec(Option_t *option="")
watch the current frame
virtual ~BaseDanteWatcher()
Definition: DanteWatchers.C:57
virtual Int_t GetMaxCycle()
Get max cycle.
MyDante fDante[gMaxNumberOfModules]
Double_t Z
Definition: DanteWatchers.h:40
TObjArray * fPositionsC
Double_t threshold_y_down
Definition: DanteWatchers.h:58
DisplayDante(const char *, const char *, TDirectory *sp_dir=0x0, TDirectory *tag_dir=0x0)
virtual void Exec(Option_t *option="")
watch the current frame
TRotation fRotation[gMaxNumberOfModules]
void SetActive(Bool_t active=true)
Toggle active task.
static const Short_t gMaxNumberOfModules
Definition: DanteWatchers.h:94
virtual void SetMaxCycle(Int_t cycle)
Set max cycle, before resetting buffer.
Double_t threshold_x_right
Definition: DanteWatchers.h:57
Double_t Xr
Definition: DanteWatchers.h:42
TString fTypeName
const Char_t * fPathFile
Double_t threshold_x_left
Definition: DanteWatchers.h:56
MyDanteTree(const char *name, const char *title, TTree *tree=0x0)
void SetMeanBeta(Double_t mean)
virtual const Char_t * GetConfFileName() const
Get Dante conf file.
DoDanteDoppler(const char *, const char *, TDirectory *sp_dir=0x0, TDirectory *tag_dir=0x0)
Bool_t LoadCalibration(const char *calib_file="Dante.conf")
Definition: DanteWatchers.C:62
Double_t A
Definition: DanteWatchers.h:48
void ChangeMeanBeta(Double_t b)
void Calibrate()
Definition: DanteWatchers.C:31
Double_t threshold_adc
Definition: DanteWatchers.h:54
static const Short_t gNumberOfItems
Definition: DanteWatchers.h:96
Short_t fNumberOfModules
virtual const Char_t * GetPathFile() const
Get agata path file.
void ComputeRealPosition(Short_t)
Double_t CY
Definition: DanteWatchers.h:63