GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GSIOnlySetup.C
Go to the documentation of this file.
1 
2 #if !defined(__CINT__)
3 
4 #include "FrameDispatcher.h"
5 
6 // Watchers
7 
8 #include "WatcherClient.h"
9 #include "ADFWatchers.h"
10 #include "CrystalWatchers.h"
11 #include "PSAWatchers.h"
12 #include "TrackedWatchers.h"
13 #include "EventPSAWatchers.h"
14 #include "EventWatchers.h"
15 #include "MetaWatchers.h"
16 #include "RancLegnaroWatchers.h"
17 #include "DanteWatchers.h"
18 //#include "MyTree.h"
19 //#include "PrismaWatchers.h"
20 
21 #include "WatchersConfig.h"
22 
23 #include "ADFWatchers.h"
24 
25 #ifdef HAS_PRESPEC
26 #include "GSIWatchers.h"
27 #include "GSIPrespecWatchers.h"
28 #endif
29 
30 #include "MyTree.h"
31 
32 
33 using namespace Gw;
34 using namespace ADF;
35 
37 const char *GetWN(const char *name, const char *ext)
38 {
39  return Form("%s%s",name,ext);
40 }
41 
43 void DoTSRateCollector(TTask *top_task, TSRateCollector *collector)
44 {
45  TTask *task; FrameDispatcher *fd; TSRate *ts_rate;
46 
47  // loop on task to get FrameDispatchers
48  TIter next(top_task->GetListOfTasks());
49  while ( (task = (TTask *)next()) ) {
50  if ( task == collector )
51  continue;
52  fd = dynamic_cast<FrameDispatcher *> (task);
53  if ( fd ) {
54  TIter next_w(fd->GetListOfTasks());
55  while ( (task = (TTask *)next_w()) ) {
56  ts_rate = dynamic_cast<TSRate *> (task);
57  if ( ts_rate ) {
58  collector->AddHook(ts_rate,fd->GetName());
59  }
60  }
61  }
62  }
63 }
64 
66 /*
67  i
68 */
69 Bool_t SetupWatchers(const char *df_type, FrameDispatcher *fd, const char *ext = "")
70 {
71  Bool_t ok = false; TString DFtype = df_type;
72 
73 // ANY KIND OF DATA FLOW
74  // ADF ----------------------------------------------------------------
75  // General to any kind of data flow, based on the key part of the frame
76  if ( DFtype.Contains("ADF") ) {
77  // Watchers on any kind of Agata Frame ... the trigger should not be changed (lowest agatakey version) !
78  AgataFrameTrigger *trig =
79  new AgataFrameTrigger("ADF");
80  trig->Add(FactoryItem("Agata","agata",Version(1,0)),
81  FactoryItem("Agata","agata",Version(0,0)));
82  trig->Universal(true);
83  fd->SetTrigger(trig);
84 
85  // Just dump the frames in a file for decoding
86  Watcher *dumper = new Dumper();
87  dumper->SetActive(false);
88  fd->Add(dumper);
89 
90  // frame length, message type, event number of time stamp
91  fd->Add<AgataKeyWatcher>(GetWN("AgataKey",ext),"To check the keys on the Data Flow");
92  fd->Add<TSRate>(GetWN("TSRate",ext),"To get rate form consecutive TS value");
93 
94  ok = true;
95  }
96  // ADF -----------------------------------------------------------------
97 
98 
99  // RANC0 -----------------------------------------------------------------
100  // output of the ancillary producer or Filter
101  if ( DFtype.Contains("RANC0") ) {
102 
103  // define WatcherClient for a specific trigger
104  // it defines a trigger on an ancilary frame
105  AgataFrameTrigger *trig =
106  AgataFrameTrigger::Build("RANC0", "data:ranc0");
107  fd->SetTrigger(trig);
108 
109  // to get all the raw spectra for ancillaries
110  fd->Add<TSRate>(GetWN("TSRate",ext),"To get rate form consecutive TS value");
111 
112 #ifdef HAS_PRESPEC
113  fd->Add<MBSWatcher>(GetWN("MBSWatcher",ext),"To get the content of MBS Frame ");
114 // fd->Add<LightLYCCAVertexBuilder>(GetWN("LightLYCCAVertexBuilder",ext),"To get the vertex from LYCCA ");
115 // fd->Add<GlobalDC>(GetWN("LyccaVertex",ext),"To get the vertex given LYCCA ");
116 
117 // TTreeMaster *rootmaster = fd->Add<TTreeMaster>(GetWN("TreeMaster",ext),"Own the tree");
118 // rootmaster->Add<Unpack>("Unpack","Branch on Unpack Data");
119 #endif
120  ok = true;
121  }
122  // RANC0 -----------------------------------------------------------------
123 
124  if ( DFtype.Contains("MERGER") ) {
125 
126  AgataFrameTrigger *trig =
127  AgataFrameTrigger::Build("Event", "event:data event:data:psa data:ranc0");
128 
129  // set the main trigger to coincidences between ancillary et gammas
130  fd->SetTrigger(trig);
131 
132  fd->Add<TSCoinc>(GetWN("TSCoinc",ext),"TS distribution in events");
133  fd->Add<MBSWatcher>(GetWN("MBSWatcher",ext),"RawData as produced by the MBS2ADF");
134 
135 // Any kind of Watcher on event:data:psa, data:ranc1 or
136 // fd->Add<DisplayRancLegnaro>(GetWN("DisplayRanc",ext),"RawData as produced by the Ancillary Filter");
137 // fd->Add<DisplayDante>(GetWN("DisplayDante",ext),"Display Raw and Calibrated Data for Dante");
138  // watcher to keep rates
139  fd->Add<TSRate>(GetWN("TSRate",ext),"To get rate form consecutive TS value");
140 
141 // Build and Fill TTrees
142  // create a TreeMaster which takes care of the TTree part
143  // It opens a root file (TreeMaster.root), build a tree and call Fill in the Exec method
144 
145  TTreeMaster *rootmaster = fd->Add<TTreeMaster>(GetWN("TreeMaster",ext),"Own the tree");
146  // Using this option, if one watcher does not pass the condition, the spectra of the following are not filled
147  rootmaster->SetDoSpectra(1);
148  // to this tree, add a watcher which adds branches and takes cares to fill them
149  rootmaster->Add<Unpack>(GetWN("Unpack",ext),"To Produce Tree with Unpack Data");
150  rootmaster->Add<Sort>(GetWN("Sort",ext),"To Produce Tree with Unpack Data");
151  rootmaster->Add<Calibr>(GetWN("Calibr",ext),"To Produce Tree with Unpack Data");
152  rootmaster->Add<Anl>(GetWN("Anl",ext),"To Produce Tree with Unpack Data");
153  rootmaster->AddWatcher<LightLYCCAVertexBuilder_1>(GetWN("VertexBuilder",ext),"To Compute a vertex from Anl");
154  rootmaster->Add<DoMyHitTree>("HitTree","Branch on hits");
155 
156  fd->Add<GlobalDC>(GetWN("CheckDoppler",ext),"Check Doppler as computed by Anl");
157  fd->Add<HitsSpectra>(GetWN("HitsSpectra",ext),"Gamma-ray spectra from Hits");
158 
159 //DoMyCoincTree
160  ok = true;
161  }
162  // TRACKING Level //
163  if ( DFtype.Contains("TRACKING") ) {
164 
165  // a trigger on event with hits, tracked gammas and ancillary
166  AgataFrameTrigger *trig =
167  AgataFrameTrigger::Build("TRACKING", "event:data event:data:psa data:tracked");
168 
169  // set the main trigger to coincidences between ancillary et gammas
170  fd->SetTrigger(trig);
171 
172  // specific to tracked frame
173  // gamma-gamma matrix
174  fd->Add<Coinc2D>(GetWN("GxG",ext),"Gamma Gamma coincidence");
175 
176 // Build and Fill TTrees : add branches related to the tracking
177  // create a TreeMaster which takes care of the TTree part
178  // It opens a root file (TreeMaster.root), build a tree and call Fill in the Exec method
179  // TTreeMaster *rootmaster = fd->Add<TTreeMaster>(GetWN("TreeMaster",ext),"Own the tree");
180  // to this tree, add a watcher which adds branches and takes cares to fill them
181  // rootmaster->Add<DoMyRawAncillaryTree>("RawAncTree","Branch on ancillary");
182  // rootmaster->Add<DoMyHitTree>("HitTree","Branch on hits");
183  // rootmaster->Add<DoMyTrackTree>("TrackTree","Branch on track");
184 
185 
186  ok = true;
187  }
188 
189 
190  return ok;
191 }
192 
193 #endif
194 
195 
196 
197 
198 
virtual void Add(TTask *)
add only Watchers to the list of tasks to avoid problems.
Definition: Watchers.cpp:244
void DoTSRateCollector(TTask *top_task, TSRateCollector *collector)
browse all dispatchers to look for TSRate Watcher
Definition: GSIOnlySetup.C:43
Watcher that built the spectra expected for a Vertex.
Just dump the frame in a file.
void AddHook(Watcher *, const char *)
Add a timestamp rate.
built a root tree for the tracked part
Definition: MyTree.h:162
virtual SharedFP * Add(const FactoryItem &key_item, const FactoryItem &frame_item, bool iscons=true, const Char_t *option="")
Add a frame to the list of required frames.
Definition: Trigger.h:492
Watcher to keep last TS values.
Process a buffer, trigg and dispachs the work to sub-watchers.
virtual Bool_t SetTrigger(ADF::DFTrigger *)
This is the default trigger for any added watcher.
const char * GetWN(const char *name, const char *ext)
Build the Watcher name adding an extension.
Definition: GSIOnlySetup.C:37
Base class for a Watcher.
Definition: Watchers.h:60
Watcher_T * Add(const Char_t *name, const Char_t *title, ADF::DFTrigger *t=0x0)
allocate a new watcher so that it creates corectly its directory under the dispatcher directory ...
To check and display the Data Flow structure by the key content of the frame.
Base class for version numbers.
Definition: Version.h:38
To be used for Agata Data Flow.
Definition: Trigger.h:462
Sort data from unpackdata watchers.
*********************************** HitsSpectra Class **************************************/// ...
Gives the distribution of the different timstamps in a composite frame.
Unpack data from mbs encapsulated in ADF frame.
Watcher to build a tree with branches processed in several watchers.
Bool_t SetupWatchers(const char *df_type, FrameDispatcher *fd, const char *ext="")
It shows how to set up the watchers for different kind of data flow.
Definition: GSIOnlySetup.C:69
void SetDoSpectra(Short_t do_spectra)
to know spectra mode for this watcher
Definition: TTreeWatchers.h:96
void Universal(Bool_t b=true)
Set this trigger as universal or not.
Definition: Trigger.h:130
MBSWatcher, to check the structure of the MBS Frame.
Definition: GSIWatchers.h:112
Base class that described an item in a Factory.
Definition: FactoryItem.h:52
compute histograms for several TSRate