GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GANIL/EventPSAWatchers.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 _EventPSAWatchers
22 #define _EventPSAWatchers
23 
24 #include "Watchers.h"
25 #include "CompositeFrame.h"
26 #include "PSAFrame.h"
27 #include "CanvasVisu.h"
28 #include "TF1.h"
29 
31 
32 
33 class TObjArray;
34 class TPaveText;
35 class TLatex;
36 class VertexBuilder;
37 
38 using namespace ADF;
39 class TTimer;
40 
41 
43 
45 
49 {
50 protected:
51  static Float_t fgMetric;
52 
53 protected:
56 
57 protected:
60 
61 protected:
63  UInt_t GetNbFramePSA();
64 
66  PSAInterface *GetDataPSA(UInt_t which);
67 
68 public:
69  EventPSAWatcher(const char *name, const char *title, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0) :
70  WatcherWithTag(name,title,sp_dir,tag_dir),
71  fPSAFrame(0x0),
72  fFrame(0x0)
73  {;}
74  virtual ~EventPSAWatcher()
75  {
76  if (fPSAFrame)
77  delete fPSAFrame;
78  fPSAFrame = 0x0;
79  }
80 
82 
85  virtual Bool_t SetTrigger( ADF::DFTrigger */*trigger*/ = 0x0 );
86 
87  ClassDef(EventPSAWatcher,0) // Trigger on tracked Frame
88 };
89 
90 
92 
94 
104 {
105  static const UShort_t gNbCrys = 180u;
106 
107 private:
108  VertexBuilder *fVertexBuilder;
109 
110 protected:
111  AgataGeometryTransformer *fTrans;
112 
113 protected:
115  TObjArray fSpectra;
116  TObjArray fSpectraDoppler;
117 
121 
122  TH2 *fGxG;
123  TH2 *fGxT;
127 
128  TH1 *fFold;
129 
131  TH1F *fDistri;
132  TH3F *fPosXYZ;
133  TH3F *fPosXYZ_Ta;
134 
135 protected:
137  virtual void DoCanvas(TCanvas *c, Option_t *);
138 
139 protected:
141  virtual Double_t DoDopplerCorrection(const TrackedHit *hit, VertexInterface *vertex);
142 
143 public:
144  HitsSpectra(const char *name, const char *title, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
145  virtual ~HitsSpectra();
146 
148  virtual void Exec(Option_t *option="");
149 
150  ClassDef(HitsSpectra,0) // Gamma-rays spectra using hits
151 };
152 
153 
155 
156 //class HitDisplay3D : public EventPSAWatcher
157 //{
158 
159 //private:
160 // AgataGeometryTransformer* fTrans;
161 
162 // Int_t fMaxCycle;
163 
164 // const Char_t* fPathFile;
165 
166 //protected:
167 // //! To be overwritten by real implementation if a canvas is produced.
168 // virtual void DoCanvas(TCanvas *c, Option_t *);
169 
170 //public:
171 // HitDisplay3D(const char *name, const char *type, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
172 // virtual ~HitDisplay3D();
173 
174 // //! watch the current frame
175 // virtual void Exec(Option_t *option="");
176 
177 // //! show eve event display
178 // virtual void ShowEve(const Char_t* agataPathFile); //*MENU* *GETTER=GetPathFile* *ARGS={agataPathFile=>fPathFile}*
179 
180 // //! Toggle active task
181 // void SetActive(Bool_t active = true); //*TOGGLE*
182 
183 // //! Set max cycle, before resetting buffer
184 // virtual void SetMaxCycle(Int_t cycle) { fMaxCycle = cycle; } //*MENU*
185 
186 // //! Get max cycle
187 // virtual Int_t GetMaxCycle() { return fMaxCycle; }
188 
189 // //! Get Prima conf file
190 // virtual const Char_t* GetPathFile() const { return fPathFile; }
191 
192 // ClassDef(HitDisplay3D,0) // psa display
193 //};
194 
195 
197 
198 //class TGToolTip;
199 //class TBox;
200 //class TObject;
203 // A schematic view of a triple cluster is drawn (a hexagon per crystal) the size of the triangle inside each sector
204 // is proportional to the counts inside this sector for a given depth. This latter could be set via the menu.
205 // Default wise the depth change for a given range of time in seconds (SetRefresh in Menu). To watch a single depth
206 // use SetDepth method, it stops the automatic refresh. To launch again this refresh use SetRefresh method.
207 // There are two ways of normalization. Default wise the rates in each sector is normalized onto the maximum counts
208 // found in all crystals. By setting in Menu via the method SetNormalization, the rates are normalized onto the maximum
209 // of counts for each individual crystal.
210 // Depth equal to zero correspond to the rate in core.
211 
212 //*/
213 //class RateDisplay : public EventPSAWatcher
214 //{
215 //private:
216 
217 // TObjArray* fSectorList; // container of detector sector Polyline
218 
219 // TObjArray* fLabelList; // container of label crystal PaveText
220 
221 // TObjArray* fRateList; // container of rate sector Polyline
222 
223 // AgataGeometryTransformer* fTransf; // geometry transformer
224 
225 // TArrayI* fCountArray[7]; // count array for each sector for a given depth
226 
227 // TArrayI* fCountMax; // max count per crystal
228 
229 // Int_t fCountCoreMax; // max count for core
230 
231 // Int_t fCountMaxAll; // max count in all cristals
232 
233 // Int_t fCurrentCycle; // current number of cycles
234 
235 // Int_t fMaxCycle; // maximum number of cycles before resetting histo
236 
237 // Int_t fDepth; // depth number of the crystal
238 
239 // Bool_t fNormByAll; // fNorm: true, count normalized by the maximum of all cristals; false, normalized per cristal
240 
241 // TTimer* fTimer; // timer
242 
243 // Long_t fRefresh; // time lapse between two depth refreshes in seconds
244 
245 // TLatex* fDepthText; // text for depth
246 
247 // Int_t fLastX; // last position of mouse in X
248 
249 // Int_t fLastY; // last position of mouse in Y
250 
251 // TBox* fBox; // just a box for tool tip
252 
253 // TGToolTip* fInfoTip; // info tool tip
254 
255 
256 // TH1I* fHistoCntCrystal; // number of counts per crystal
257 
258 // TH1I* fHistoCntSlice[180*6*6]; // number of counts in each detector per depth and per sector
259 
260 //private:
261 // const ADF::NamedItem<UShort_t>* fCrysID; //!
262 // const ADF::NamedItem<Float_t>* fCoreE1; //!
263 
264 //private:
265 // static const Double_t fgkDRho; // distance between two crystal
266 // static const Double_t fgkRho1; // inner radius of the sector
267 // static const Double_t fgkRho2; // outer radius of the sector
268 // static const Double_t fgkDRange; // range of the pad
269 // static const Int_t fgkNofPoints; // number of points of the polyline for a sector
270 // static const Int_t fgkNofSectors; // total number of sectors
271 // static const Int_t fgkNofCrystals;// total number of crystals
272 // static const Int_t fgkNofSlices; // total number of slices (= number of depths-1, depth = 0 for core)
273 // static const Int_t fgkNDivX; // number of clusters displayed in X
274 // static const Int_t fgkNDivY; // number of clusters displayed in Y
275 
276 //protected:
277 // //! To be overwritten by real implementation if a canvas is produced.
278 // virtual void DoCanvas(TCanvas* canvas, Option_t* option);
279 
280 // //! Add sectors for a cluster to list
281 // void AddCluster(Double_t xOffset = 0, Double_t yOffset = 0);
282 
283 // //! Add cluster at a given position to list
284 // void AddCristals(Double_t xPos = 0, Double_t yPos = 0);
285 
286 // //! Add polyline rate object list
287 // void AddRates();
288 
289 //public:
290 // RateDisplay(const Char_t *name, const Char_t *title, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
291 // virtual ~RateDisplay();
292 
293 // //! watch the current frame
294 // virtual void Exec(Option_t *option="");
295 
296 // //! Set depth
297 // virtual void SetDepth(Int_t depth = 1, Bool_t stop = true); //*MENU*
298 
299 // //! Get depth
300 // virtual Int_t GetDepth() { return fDepth; }
301 
302 // //! Set normalization of counts per all crystals (true) or per each crystal (false)
303 // virtual void SetNormalization(Bool_t norm) {fNormByAll = norm;} //*TOGGLE* *ARGS={norm=>fNormByAll} *GETTER=IsNormByAll
304 
305 // //! return normalization
306 // virtual Bool_t IsNormByAll() {return fNormByAll;}
307 
308 // //! Set max cycle
309 // virtual void SetMaxCycle(Int_t cycle) { fMaxCycle = cycle; } //*MENU*
310 
311 // //! Get max cycle
312 // virtual Int_t GetMaxCycle() { return fMaxCycle; }
313 
314 // //! Set Refresh
315 // void SetRefresh(Long_t r); //*MENU*
316 
317 // //!Get Refresh
318 // virtual Long_t GetRefresh() { return fRefresh; }
319 
320 // //! Update rates
321 // void UpdateRates();
322 
323 // //! Update canvas
324 // void UpdateCanvas();
325 
326 // //! reset
327 // void Reset();
328 
329 // //! Zero
330 // virtual void Zero(Option_t *hname="pool", Option_t *binning=""); //*MENU*
331 
332 // //! Set the trigger attached to this watcher
333 // virtual Bool_t SetTrigger( ADF::DFTrigger */*trigger*/ = 0x0 );
334 
335 // //! Handle Movement
336 // void HandleMovement(Int_t eventType, Int_t eventX, Int_t eventY, TObject* select);
337 
338 // ClassDef(RateDisplay,0) // rate display
339 //};
340 
342 
343 class EBWatcher : public EventPSAWatcher, public CanvasVisu
344 {
345  static const UShort_t gNbCrys = 180u;
346 
347 private:
348  VertexBuilder *fVertexBuilder;
349 
350 protected:
351  AgataGeometryTransformer *fTrans;
352 
353 protected:
355  TObjArray fSpectra;
356 
360 
361  TH2 *fGxG;
362  TH2 *fGxT;
363 
364  TH1 *fFold;
365 
367  TH1F *fDistri;
368  TH3F *fPosXYZ_Ta;
369 
370 public:
371  EBWatcher(const char *name, const char *title, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
372  virtual ~EBWatcher();
373 
375  virtual void Exec(Option_t *option="");
376 
377  void ShowCrystalSpectra(); //*MENU*
378  virtual void SetLoupe(bool loupeon = true){CanvasVisu::SetLoupe(loupeon);} //*MENU*
379 
380  void ShowSuperimposedCores(); //*MENU*
381 
382  void ShowCoreVsSumSpectra(bool OnSamePad = false); //*MENU*
383 
384  void ShowGammaGamma(); //*MENU*
385 
386  void ShowGammaTime(); //*MENU*
387 
388  void Show3DHits(); //*MENU*
389 
390 
391 
392 
393  ClassDef(EBWatcher,0) // Gamma-rays spectra using hits
394 };
395 
396 
397 
398 #include "TLine.h"
399 
401 {
402  static const UShort_t gNbCrystTot = 180u;
403  static const UShort_t gNbSeg = 36u;
404 
405 private:
406  UShort_t gNbCrys;
407  TString CrystalNames[gNbCrystTot];
408 
409  ULong64_t fFirstTS[gNbCrystTot];
410  ULong64_t fLastTS[gNbCrystTot];
411  ULong64_t fTS;
412 
413  Double_t fTSMax[gNbCrystTot];
414 
415  TString fCrystalList;
416  TString fCrystalListForSegments;
417 
418  Int_t fTSWindow;
419  Int_t fDeltaTS;
420 
421  Int_t fTotalHistPos;
422  Int_t fGraphPos;
423  Int_t fNToFill;
424 
425  Bool_t fGoodInit;
426 
427  TList *fListOfHists;
428 
429  TObjArray *f_TS_Dist[gNbCrystTot];
430  TObjArray *f_CoreCheck[gNbCrystTot];
431  TObjArray *f_SegCheck[gNbCrystTot][gNbSeg];
432  TH1F *fSpectra[gNbCrystTot];
433  TLine *fCoreLines[gNbCrystTot];
434  TH1F *fLastFittedHist[gNbCrystTot];
435  TF1 *fLastFitFunction[gNbCrystTot];
436 
437  Float_t fERef;
438  Float_t fLastFitResultCore[gNbCrystTot][4];
439  Float_t fLastFitResultSeg[gNbCrystTot][gNbSeg][4];
440 
441  TF1 *fGausFuncCry[gNbCrystTot];
442  TF1 *fGausFuncSeg[gNbCrystTot][gNbSeg];
443 
444 public:
445  TimeCheckBuilder(const char *name, const char *title, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
446  virtual ~TimeCheckBuilder(){;}
447 
449  virtual void Exec(Option_t *option="");
450 
451  void ShowCrystalSpectra(); //*MENU*
452  void ShowCrystalLastFits(); //*MENU*
453  void ShowSegments(const char *CrystalName); //*MENU*
454  virtual void SetLoupe(bool loupeon = true){CanvasVisu::SetLoupe(loupeon);} //*MENU*
455 
456 
457 private:
458  void ReadConfFile();
459  TObjArray *BuildArray(const char * BaseName,Int_t NBins, Double_t Min, Double_t Max, Bool_t MakeGraph);
460  void ReProcessHists(Int_t cry);
461  Int_t GetNFill(Int_t cry);
462  void AnalyseGraphs(Int_t cry);
463 
464  TString GetCrystalName(Int_t cry);
465  Int_t GetCrystalId(TString Name);
466 
467 
468 
469  ClassDef(TimeCheckBuilder,0) // Gamma-rays spectra using hits
470 };
471 
472 #endif
473 
virtual void SetLoupe(bool loupeon=true)
Interface for any watcher that is a VertexBuilder.
Base class for a Frame.
Definition: Frame.h:73
TH1 * fCoreCommon
Sum of all core spectra (without Doppler correction)
TH1F * fDistri
Crystal fold.
static Float_t fgMetric
AgataGeometryTransformer * fTrans
TObjArray fSpectra
Core energy for any crystal.
AgataGeometryTransformer * fTrans
Frame * fPSAFrame
current PSA frame to help decoding one by one
TH1F * fDistri
Crystal fold.
EventPSAWatcher(const char *name, const char *title, TDirectory *sp_dir=0x0, TDirectory *tag_dir=0x0)
TObjArray fSpectra
Core energy for any crystal.
header file for PSAFrame.cpp
TH1 * fCoreCommon
Sum of all core spectra (without Doppler correction)
It is a hit associated to a list of Hits.
Definition: Hits.h:256
WatcherWithTag()
list of tagged histograms
Definition: Watchers.cpp:1123
! Show rates (counts) per Crystal *!
A Shared Frame Pointer.
Definition: Frame.h:597
*********************************** HitsSpectra Class **************************************/// ...
Base class for a trigger on a data flow.
Definition: Trigger.h:155
TH1 * fCoreCommonDoppler
Sum of all core spectra (with Doppler correction)
SharedFP * fFrame
main frame i.e. event:data:psa
*********************************** EventPSAWatcher Class **************************************/// ...
virtual void SetLoupe(bool loupeon=true)
virtual void SetLoupe(bool loupeon=true)
Definition: CanvasVisu.C:646