GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LNL/ADFWatchers.C
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 // Watcher definition
22 #ifndef _ADFWatchers
23 #include "ADFWatchers.h"
24 #endif
25 
26 #include "TSystem.h"
27 #include <stdexcept>
28 
29 using namespace ADF;
30 
32 
33 Bool_t ADFWatcher::SetTrigger( ADF::DFTrigger *trigger )
34 {
35  if ( ! Watcher::SetTrigger(trigger) ){
36  fFrame = 0x0;
37  return false;
38  }
39 
40  // set the unique frame to be watched
41  fFrame = GetTrigger()->GetInputSharedFP();
42 
43  return true;
44 }
45 
47 void Dumper::Exec(Option_t */*option*/)
48 {
49 // Frame by Frame action
50  // be sure the key (the frame) has been set properly
51  if ( fFrame == 0x0 )
52  return;
53 
54  // if new file is asked, next open erase the file
55  if ( fIsNew )
56  { fFrame->GetFrame()->Dump(fFilename.Data(), fIsNew); fIsNew = false; }
57  else
58  { fFrame->GetFrame()->Dump(fFilename.Data(), fIsNew); }
59 }
60 void Dumper::SetOutputFile(const Char_t *filename)
61 {
62  fFilename = filename; fIsNew = true;
63 }
64 
66  AgataKeyWatcher::AgataKeyWatcher(const Char_t *name, const Char_t *title, TDirectory *sp_dir, TDirectory *tag_dir):
67  ADFWatcher(name,title,sp_dir,tag_dir),
68  fKey(0x0),
69  fWhichBin(-1),
70  fKeyFilter("*",true),
71  fSubKeyFilter("*",true),
72  fLastEventNumber(0u),
73  flastTimestamp(0UL),
74  fShowGlobalConf(false),
75  fLengthFrame(0x0),
76  fKeyMessage(0x0),
77  fEventNumber(0x0),
78  fTimeStamp(0x0),
79  fCEventNumber(0x0),
80  fCTimeStamp(0x0),
81  fCoincTimeStamp(0x0),
82  fLengthSubFrame(0x0),
83  fKeyMessageSubFrame(0x0)
84 {
85 // allocation of the histograms you would like to fill
86  fLengthFrame = MakeTH1<TH1F>("LengthFrame","Length of the Frames (bytes)", aKByte,0,20*aKByte);
87  fKeyMessage = MakeTH1<TH1F>("KeyMessage","Message type", 3,0,3) ;
88  fKeyMessage->SetBit(TH1::kCanRebin);
89  fEventNumber = MakeTH1<TH1D>("EventNumber","Last event numbers", kMaxCycle,0.,kMaxCycle) ;
90  fTimeStamp = MakeTH1<TH1D>("TimeStamp","Last time stamps", kMaxCycle,0.,kMaxCycle) ;
91  fCEventNumber = MakeTH1<TH1F>("CEventNumber","Consecutive event numbers", 1000,0, 10000) ;
92  fCTimeStamp = MakeTH1<TH1F>("CTimeStamp","Consecutive time stamps", 1000,0, 10000000) ;
93  fCoincTimeStamp = MakeTH1<TH1F>("CoincTimeStamp","Time stamp distribution in composite frames", 500,0,1000 ) ;
94  fLengthSubFrame = MakeTH1<TH1F>("LengthSubFrame","Length of the SubFrames (bytes)", aKByte,0,20*aKByte);
95  fKeyMessageSubFrame = MakeTH1<TH1F>("KeyMessageSubFrame","Message type for SubFrames in Composite Frame", 1,0,1);
96  fKeyMessageSubFrame->SetBit(TH1::kCanRebin);
97 }
98 
100 {
101 // destruction of the histograms done because they have been added to the pool
102 }
103 
104 void AgataKeyWatcher::SetKeyFilter(const Char_t *keypattern, const Char_t *subkeypattern)
105 {
106  TString stmp1(keypattern), stmp2(subkeypattern);
107 
108  Bool_t wildcard1 = false, wildcard2 = false;
109  if ( stmp1.Contains("*") )
110  wildcard1 = true;
111  if ( stmp2.Contains("*") )
112  wildcard2 = true;
113 
114  TRegexp tmp1(keypattern,wildcard1), tmp2(subkeypattern,wildcard2);
115 
116  // change the filters only if it is a valid expression
117  if ( tmp1.Status() == TRegexp::kOK ) {
118  fKeyFilter = tmp1;
119  }
120  if ( tmp2.Status() == TRegexp::kOK ) {
121  fSubKeyFilter = tmp2;
122  }
123 }
124 
125 void AgataKeyWatcher::DoCanvas(TCanvas *c, Option_t *o)
126 {
127  TString option = o;
128  if ( option == "" ) {
129  c->Divide(3,2,0.001,0.001);
130  c->cd(1);
131  fLengthFrame->Draw();
132  c->cd(2);
133  fLengthSubFrame->Draw();
134  c->cd(3);
135  fEventNumber->Draw();
136  c->cd(4);
137  fKeyMessage->Draw();
138  c->cd(5);
139  fKeyMessageSubFrame->Draw();
140  c->cd(6);
141  fTimeStamp->Draw();
142  }
143  if ( option == "q" ) {
144  c->Divide(1,3,0.001,0.001);
145  c->cd(1);
146  fCEventNumber->Draw();
147  c->cd(2);
148  fCTimeStamp->Draw();
149  c->cd(3);
150  fCoincTimeStamp->Draw();
151  }
152 }
153 
154 void AgataKeyWatcher::Exec(Option_t */*option*/)
155 {
156  if ( gDebug > 2 )
157  printf("AgataKeyWatcher::Exec is called \n");
158 
159  UInt_t length, current, eventnumber, message; ULong64_t timestamp; TString mess, mess_sec, mess_tmp;
160 
161  if ( fFrame != 0x0 ) {
162  if ( fFrame->IsValid() )
163  fKey = dynamic_cast<const AgataKey *>(fFrame->GetFrame()->GetKey());
164  else
165  fKey = 0x0;
166  }
167  else
168  fKey = 0x0;
169 
170  // be sure the key (the frame) has been set properly
171  if ( fKey == 0x0 )
172  return;
173 
174  // first test if a filter is applied
175  mess = AgataKeyFactory::theFactory()->GetMessage(fKey->GetMessage());
176  if ( ! mess.Contains(fKeyFilter) )
177  return;
178 
179  // now fill histograms
180  fLengthFrame->Fill(fKey->GetFrameLength()); fKeyMessage->Fill(mess.Data(),1);
181  if ( mess.Contains("UnknownKey") ) { // an unknown key
182  std::cout << " WARNING, unknown key " << std::endl;
183  fKey->Print();
184  }
185  // try and read the possible event# and timestamp (may not exists in case of low version number of agata key
186  const BufferIO *buf = fFrame->GetFrame()->GetRealBuffer();
187  buf->SetOffset();
188  if ( fKey->GetFrameLength() < 12u ) {
189  eventnumber = 0u;
190  timestamp = 0UL;
191  }
192  else {
193  (*buf) >> eventnumber;
194  if ( fKey->GetFrameLength() < 20u )
195  timestamp = 0UL;
196  else (*buf) >> timestamp;
197  }
198 
199  // which is negative if this method has never been called
200  if ( fWhichBin == -1 ) {
201  fLastEventNumber = eventnumber;
202  flastTimestamp = timestamp;
203  fWhichBin = 0;
204  }
205 
206  // fill timestamp and event number related
207  fEventNumber->Fill(fWhichBin,eventnumber);
208  fTimeStamp->Fill(fWhichBin,timestamp);
209 
210  fCEventNumber->Fill(eventnumber-fLastEventNumber);
211  fCTimeStamp->Fill(timestamp-flastTimestamp);
212 
213  /*
214  if ( eventnumber < fLastEventNumber ) {
215  fEventNumberQuality->Fill(-1);
216  // cout << " Current event # " << eventnumber << " Previous event # " << fLastEventNumber << endl;
217  }
218  else
219  eventnumber == fLastEventNumber ? fEventNumberQuality->Fill(0) : fEventNumberQuality->Fill(1);
220 
221  if ( timestamp < flastTimestamp ) {
222  fTimeStampQuality->Fill(-1);
223  // cout << " Current timestamp # " << timestamp << " Previous timestamp # " << flastTimestamp << endl;
224  }
225  else
226  timestamp == flastTimestamp ? fTimeStampQuality->Fill(0) : fTimeStampQuality->Fill(1); */
227 
228  fLastEventNumber = eventnumber;
229  flastTimestamp = timestamp;
230 
231  // check if message contains conf. if yes dump the content in a file
232  if ( mess.Contains("conf") && fShowGlobalConf ) {
233  FILE *fp; Short_t which = 0;
234  while ( which < 20 ) {
235  if ( gSystem->AccessPathName(Form("./%s%d.conf",mess.Data(),which)) )
236  break;
237  which++;
238  }
239  fp = ::fopen(Form("./%s%d.conf",mess.Data(),which),"w"); fFrame->GetFrame()->Dump(fp); ::fclose(fp);
240  }
241  if ( mess.Contains("event") ) {
242 
243  fKeyMessageSubFrame->Fill(mess.Data(),1);
244 
245  // try to look for a true message type at the beginning of the buffer
246  Bool_t is_a_start = false; Short_t max_loop = 0u;
247  buf->SetOffset();
248  while ( buf->FreeSize() > 20u ) {
249 
250  // up to ten embedded frames in one frame
251  if ( max_loop++ == 10u )
252  { fLog << " Max has been reached in scan of composite frame " << nline; break; }
253 
254  current = buf->Offset();
255 
256  (*buf) >> length >> message >> eventnumber >> timestamp ;
257 
258  mess_tmp = AgataKeyFactory::theFactory()->GetMessage(message);
259 
260 // cout << "[" << mess_tmp.Data() << "]" << endl;
261  if ( mess_tmp.Contains("UnknownKey") ) { // an unknown key
262  is_a_start = false;
263  }
264  else is_a_start = true;
265 
266  if ( is_a_start ) { // a known key has been found
267 
268  buf->SetOffset( current + length );
269 
270  mess_sec = "|";
271  mess_sec += mess_tmp;
272  mess_sec += "|";
273 
274  mess_sec = Form("|%s|",mess_tmp.Data());
275 
276  if ( mess_tmp.Contains(fSubKeyFilter ) ) {
277 
278  fLengthSubFrame->Fill(length);
279  fKeyMessageSubFrame->Fill(mess_sec.Data(),1);
280 
281  fCoincTimeStamp->Fill(timestamp-flastTimestamp);
282  }
283  }
284  else buf->SetOffset( current + 4u );
285  }
286  }
287 
288  if ( fWhichBin == kMaxCycle ) {
289  fWhichBin = 0u;
290  fEventNumber->Reset("ICE"); fTimeStamp->Reset("ICE");
291  }
292  else fWhichBin++;
293 }
294 
296 
297 TSRate::TSRate(const Char_t *name, const Char_t *title, TDirectory *sp_dir, TDirectory *tag_dir) :
298  ADFWatcher(name,title,sp_dir,tag_dir),
299  fTSRates(0)
300 {
301 }
302 
303 void TSRate::Exec(Option_t * /*option*/)
304 {
305  // fLog << debug << " In TSRate::Exec() " << nline;
306 
307  if ( fFrame && fFrame->IsValid() ) {
308  AgataKey *key = dynamic_cast<AgataKey *>(fFrame->GetFrame()->GetKey());
309  if ( key ) {
310  ULong64_t ts = key->GetTimeStamp() ;
311  if ( fTSRates.size() > 0 ) {
312  if ( fTSRates.back() < ts )
313  fTSRates.push_back( ts ) ;
314  // else
315  // std::cout << " Two consecutive TS in a bunch inversed !" << std::endl;
316  }
317  else fTSRates.push_back( ts ) ;
318  }
319  }
320 
321  // fLog << debug << " Out TSRate::Exec() " << dolog;
322 
323 }
324 
326 
327 TSRateCollector::TSRateCollector(const Char_t *name, const Char_t *title, TDirectory *sp_dir, TDirectory *tag_dir) :
328  Watcher(name,title,sp_dir,tag_dir),
329  fDefinitionRate(),
330  fCurrentRate(),
331  fTSRates(),
332  fRates(),
333  fPacketWidth(),
334  fDeadTime(),
335  fT0(kMaxULong64)
336 {
337  fTSRates.SetOwner(false); fPacketWidth.SetOwner(false); fDeadTime.SetOwner(false);
338 
339  // rate every 30 second for one hour
340  fDefinitionRate.Add(30*fgkOneSecond,120);
341  // rate every 10 minutes for 12 hour
342  fDefinitionRate.Add(600*fgkOneSecond,72);
343  // rate every hour for 48 hours
344  fDefinitionRate.Add(3600*fgkOneSecond,48);
345 }
346 
347 Bool_t TSRateCollector::SetT0()
348 {
349  ULong64_t val, min = kMaxULong64;
350 
351  // try and see if first time it is called or if timestamp has been reset
352  TIter next(&fTSRates);
353  TSRate *ts_rate;
354  while ( (ts_rate = (TSRate *)next()) ) {
355  if ( ts_rate->LastValues().size() ) {
356  val = ts_rate->LastValues().at(0);
357  if ( val < min )
358  min = val;
359  }
360  }
361  if ( min < fT0 ) {
362  // change histograms title to include starting time
363  TDatime dt;
364  for (Int_t i = 0; i < fRates.GetHists()->GetSize(); i++) {
365 
366  // reset stat
367  fCurrentRate[i].Reset(fDefinitionRate.fNbScales);
368 
369  if ( fRates.GetHists()->At(i) == 0x0 )
370  continue;
371  TString tmp = fRates.GetHists()->At(i)->GetName();
372  tmp += " since ";
373  tmp += dt.AsString();
374 
375  ((TH1 *)fRates.GetHists()->At(i))->Reset();
376  ((TH1 *)fRates.GetHists()->At(i))->SetTitle(tmp.Data());
377 
378  }
379  fT0 = min;
380  std::cout << " New TIMESTAMP in TSRateCollector" << fT0 << std::endl;
381  }
382 
383  return (fT0 != kMaxULong64);
384 }
385 
386 void TSRateCollector::AddHook(Watcher *ts_rate, const char *fd_name)
387 {
388  const Short_t wheel_size = 5;
389  Color_t color_wheel[wheel_size] = { kBlue, kGreen+2, kOrange, kRed, kViolet };
390  Style_t style_wheel[wheel_size] = { 3001, 3002, 3003, 3004, 3005 };
391 
392  if ( !ts_rate->InheritsFrom("TSRate") )
393  return;
394 
395  if ( ts_rate ) {
396  // keep an hook on it and creates the associated struct to compute stats
397  fTSRates.Add ( ts_rate );
398  C_Rate c_rate(fDefinitionRate.fNbScales); fCurrentRate.push_back( c_rate );
399 
400  // now add histograms
401  TString hname = fd_name;
402  hname += "_Rate";
403 
404  Int_t hsize = 0;
405  for (Int_t i = 0; i < fDefinitionRate.fNbScales; i++)
406  hsize += fDefinitionRate.fNbSamples[i] + gEmptyBins;
407 
408  hsize += 10;
409  TH1F *h = MakeTH1<TH1F>(hname.Data(),"Rate",hsize,0,hsize);
410  fRates.Add(h);
411  h->SetFillColor(color_wheel[(fRates.GetHists()->GetSize()-1)%wheel_size]);
412  h->SetFillStyle(style_wheel[(fRates.GetHists()->GetSize()-1)%wheel_size]);
413  h->SetXTitle("[0][30s/bin = 1hour] -- [170][10m/bin = 12hours] -- [292][1h/bin = 2days]");
414  h->SetYTitle("k/s");
415 
416  hname = fd_name; hname += "_Width";
417  h = MakeTH1<TH1F>(hname.Data(),"Width distribution of packets (s)",200,0,20);
418  fPacketWidth.Add(h);
419  h->SetFillColor(color_wheel[(fRates.GetHists()->GetSize()-1)%wheel_size]);
420  h->SetFillStyle(style_wheel[(fRates.GetHists()->GetSize()-1)%wheel_size]);
421 
422  hname = fd_name; hname += "_Deadtime";
423  h = MakeTH1<TH1F>(hname.Data(),"Dead time distribution between consecutive packets (s)",100,0,100);
424  fDeadTime.Add(h);
425  h->SetFillColor(color_wheel[(fRates.GetHists()->GetSize()-1)%wheel_size]);
426  h->SetFillStyle(style_wheel[(fRates.GetHists()->GetSize()-1)%wheel_size]);
427  }
428 }
429 
430 void TSRateCollector::DoCanvas(TCanvas *c, Option_t * /*o*/)
431 {
432  Int_t nbcolumn = 3; c->Divide(nbcolumn,fRates.GetHists()->GetSize()/nbcolumn,0.001,0.001);
433 
434  for (Int_t i = 0; i < fRates.GetHists()->GetSize(); i++) {
435  c->cd(i+1);
436  TH1 *h = (TH1F *)fRates.GetHists()->At(i);
437  if ( h )
438  h->Draw();
439  }
441  TString cmd = Form("RunLoupeOnPad( (TCanvas *)gROOT->GetListOfCanvases()->FindObject(\"%s\") )", c->GetName());
442  gROOT->ProcessLine(cmd.Data());
443 }
444 
445 #include "TMath.h"
446 
447 void TSRateCollector::Exec(Option_t * /*option*/)
448 {
449  const static Double_t to_rate = fgkOneSecond/(1000.);
450 
451  TSRate *ts_rate; TH1 *h; ULong64_t dt0, dt, slot, cycle;
452 
453  if ( gDebug > 0 )
454  printf("TSRateCollector::Exec is called \n");
455 
456  if ( fTSRates.GetSize() == 0 )
457  return; // to avoid doing things in case there are no input
458 
459  // first time this is called, computes T0
460  if ( ! SetT0() ) {
461  printf(" WARNING in TSRateCollector::Exec Cannot get First timestamp \n");
462  return;
463  }
464 
465  // loop on all registered TSRate
466 
467  for (Int_t i = 0; i < fTSRates.GetSize(); i++) {
468 
469  // get TSRate
470  ts_rate = (TSRate *)fTSRates.At(i);
471 
472 // std::cout << " TSRate name : " << ts_rate->GetName()
473 // << " , registered @ position " << i << " , has view # TS : " << ts_rate->LastValues().size() << std::endl;
474 
475  // nothing to do
476  if ( ts_rate->LastValues().size() < 2 )
477  continue;
478 
479  // compute some value to have an idea of the TS structure
480  h = (TH1F *)fPacketWidth.At(i);
481  Double_t width = ts_rate->LastValues().at(ts_rate->LastValues().size()-1) - ts_rate->LastValues().at(0);
482  width /= fgkOneSecond;
483  h->Fill(width);
484 
485  h = (TH1F *)fDeadTime.At(i);
486  if ( ts_rate->LastValues().at(0) > fCurrentRate[i].fLastTS ) {
487  h->Fill((ts_rate->LastValues().at(0)-fCurrentRate[i].fLastTS)/fgkOneSecond);
488  }
489  else { // ste underflow
490  h->Fill(-(fCurrentRate[i].fLastTS-ts_rate->LastValues().at(0))/fgkOneSecond);
491  // continue;
492  }
493  // h->Fill(ts_rate->LastValues().size());
494 
495 // std::cout << " WIDTH " << width << std::endl;
496 
497  // keep last TS of the packet for next packet
498  fCurrentRate[i].fLastTS = ts_rate->LastValues().at(ts_rate->LastValues().size()-1);
499 
500 /* // only one frame ... very low counting rate ...
501  if ( ts_rate->LastValues().size() < 2 ) {
502 // ts_rate->LastValues().resize(0);
503  // do not resize so that the value is kept in the TSRate and a new one is going to be added
504  // not really a good way to proceed but should give a quite good idea in case of very low counting rates
505  continue;
506  } */
507 
508  // statistics
509  h = (TH1F *)fRates.GetHists()->At(i);
510 
511  for (size_t j = 1; j < ts_rate->LastValues().size(); j++) {
512 
513  if ( ts_rate->LastValues().at(j) < fT0 ) {
514  std::cout << " ERROR Timestamp in array smaller that T0 " << std::endl;
515  continue;
516  }
517 
518  // compute time since T0 and since first timestamp
519  dt0 = ts_rate->LastValues().at(j) - fT0;
520  // compute time between two consecutive TS and the associated rate
521  dt = ts_rate->LastValues().at(j) - ts_rate->LastValues().at(j-1);
522 
523  // loop on the different scales to compute statistics
524  Int_t h0 = 0;
525  for (Int_t k = 0; k < fDefinitionRate.fNbScales; k++) {
526  // cycle since T0
527  cycle = dt0 / fDefinitionRate.fPrecision[k];
528  //
529  if ( cycle == fCurrentRate[i].fCycle[k] ) { // add to current for integration
530  fCurrentRate[i].fSum[k] += dt;
531  fCurrentRate[i].fNbCounts[k]++;
532  }
533  else { // a new input in the histogram
534 
535  // bin number to be changed
536  slot = fCurrentRate[i].fCycle[k] % fDefinitionRate.fNbSamples[k];
537 
538  // fill h
539  // it has to be with Sum to take into account the real time counting time and remove empty cycle
540 /* if ( slot == 0 ) {
541  for (Int_t bin = h0; bin < h0+fDefinitionRate.fNbSamples[k]; bin++) {
542  h->SetBinContent(bin+1,0);
543  }
544  } */
545  if ( fCurrentRate[i].fSum[k] > 0
546  && ((slot+h0+1) < UInt_t(h->GetNbinsX()))
547  && ((slot+h0+1) > 0) ) {
548  h->SetBinContent(slot+h0+1,fCurrentRate[i].fNbCounts[k]*to_rate/fCurrentRate[i].fSum[k]);
549  }
550  else {
551  std::cout << " SUM is O !! "
552  << fCurrentRate[i].fSum[k] << " j " << j << " " << ts_rate->LastValues().size()
553  << " " << fCurrentRate[i].fNbCounts[k] << " " << dt << std::endl;
554  }
555 
556 /* else
557  std::cout << slot+h0+1 << std::endl;
558  std::cout << fCurrentRate[i].fNbCounts[k]*to_rate/fCurrentRate[i].fSum[k] << std::endl; */
559 
560  // keep the current situation
561  fCurrentRate[i].fSum[k] = dt;
562  fCurrentRate[i].fNbCounts[k] = 1;
563 
564  fCurrentRate[i].fCycle[k] = cycle;
565  }
566  h0 += (fDefinitionRate.fNbSamples[k] + gEmptyBins);
567  }
568  }
569 
570  ts_rate->LastValues().resize(0);
571  } // i
572 
573  if ( 0 )
574  printf("TSRateCollector::Exec is done \n");
575 }
576 
577 
579 
580 TimeStampWatcher::TimeStampWatcher( const char * name, const char * title, TDirectory *sp_dir, TDirectory *tag_dir):
581  ADFWatcher(name,title,sp_dir,tag_dir)
582 {
583  int TMax = 3600;
584  TimeStampHist = MakeTH1<TH1F>("TimeStampHist", "Time stamp distribution",TMax*10., 0, TMax);
585  FirstTimeStamp = 0;
586 }
587 
589 {
590 }
591 
592 
593 void TimeStampWatcher::DoCanvas(TCanvas * /*c*/, Option_t *o)
594 {
595  TimeStampHist->Draw(o);
596 }
597 
598 void TimeStampWatcher::Exec(Option_t * /*option*/)
599 {
600 
601  ULong64_t fTimestamp = ((AgataKey *)fFrame->GetFrame()->GetKey())->GetTimeStamp();
602 
603  if(fTimestamp != 0 && FirstTimeStamp==0) FirstTimeStamp = fTimestamp;
604 
605  double TSinSec = (fTimestamp-FirstTimeStamp)*10*1e-9;
606 
607  TimeStampHist->Fill(TSinSec);
608  LastTimeStamp = fTimestamp;
609 
610 }
611 
612 void TimeStampWatcher::Zero(Option_t * /*opt1*/, Option_t * /*opt2*/)
613 {
614  TimeStampHist->Reset();
616 }
std::vector< Int_t > fNbSamples
virtual Bool_t IsValid() const
true if it is a valid pointer
Definition: Frame.h:616
void SetOutputFile(const Char_t *filename)
******************************************************************************************/// ...
virtual void Exec(Option_t *option="")
watch the current frame
virtual Key * GetKey()=0
To get the Key associated to this frame.
SharedFP * fFrame
the frame to be watched
printf("******************************************************************** \n")
virtual void Add(TTask *)
add only Watchers to the list of tasks to avoid problems.
Definition: Watchers.cpp:244
virtual Frame * GetFrame() const
Definition: Frame.h:625
virtual void Exec(Option_t *option="")
watch the current frame
virtual void DoCanvas(TCanvas *c, Option_t *)
To be overwritten by real implementation if a canvas is produced.
Bool_t SetT0()
******************************************************************************************/// ...
Just dump the frame in a file.
void AddHook(Watcher *, const char *)
Add a timestamp rate.
Watcher to keep last TS values.
AgataKeyWatcher(const Char_t *name, const Char_t *title, TDirectory *sp_dir=0x0, TDirectory *tag_dir=0x0)
*/
Interface to AgataKey.
virtual const BufferIO * GetRealBuffer() const =0
give access to the underlying buffer of the data part
static const ULong64_t fgkOneSecond
virtual Bool_t SetTrigger(ADF::DFTrigger *=0x0)
Set the Frame to be watched.
LogMessage & nline(LogMessage &)
virtual void Print(std::ostream &out=std::cout) const
Print the content of the key.
virtual ULong64_t GetTimeStamp() const =0
To set the timestamp.
Base class for a Watcher.
Definition: Watchers.h:60
UInt_t Offset() const
it returns the current position in the buffer
Definition: BufferIO.h:240
const UInt_t aKByte
Definition: BaseBuffer.h:35
virtual void Exec(Option_t *option="")
watch the current frame
TSRateCollector(const Char_t *name, const Char_t *title, TDirectory *sp_dir=0x0, TDirectory *tag_dir=0x0)
*/
To check and display the Data Flow structure by the key content of the frame.
virtual void DoCanvas(TCanvas *c, Option_t *)
To be overwritten by real implementation if a canvas is produced.
virtual void Zero(Option_t *opt1, Option_t *opt2)
******************************************************************************************/// ...
LogMessage fLog
Definition: Watchers.h:86
virtual ~TimeStampWatcher()
******************************************************************************************/// ...
virtual void DoCanvas(TCanvas *c, Option_t *)
To be overwritten by real implementation if a canvas is produced.
UInt_t FreeSize() const
it returns the number of free bytes to the end
Definition: BufferIO.h:236
std::vector< ULong64_t > fPrecision
TimeStampWatcher(const char *name, const char *title, TDirectory *sp_dir=0x0, TDirectory *tag_dir=0x0)
*/
virtual void Exec(Option_t *option="")
******************************************************************************************/// ...
TSRate(const Char_t *name, const Char_t *title, TDirectory *sp_dir=0x0, TDirectory *tag_dir=0x0)
*/
Base class for a trigger on a data flow.
Definition: Trigger.h:155
ADF::LogMessage & endl(ADF::LogMessage &log)
void SetKeyFilter(const Char_t *keypattern="*", const Char_t *subkeypattern="*")
change the filters applied on the main key and on subkeys
virtual void Exec(Option_t *option="")
watch the current frame
virtual UInt_t GetFrameLength() const
Base Watcher working for any kind of Frame (Frame interface)
virtual void Dump(const Char_t *filename, Bool_t anew=false) const =0
Dump the content of the frame in a file (for debugging)
std::vector< ULong64_t > & LastValues()
virtual ~AgataKeyWatcher()
******************************************************************************************/// ...
ClassImp(ADFWatcher)
virtual UInt_t GetMessage() const =0
To get the message type encoded.
compute histograms for several TSRate
UInt_t SetOffset(UInt_t off=0u) const
change the current position.
Definition: BufferIO.cpp:122