Fermilab


Go to Notes and Further References, Exercises, top,

Notes and Further References

You can get a VldContext from any RecMinos If you look at RecMinos.h you will see the method:-
  virtual const VldContext*   GetVldContext() const;
Now in the ROOT macro look_at_data_header.C, which can be run e.g.:-
  loon -q look_at_data_header.C $ROOT_DATA/fardet_data/2002_06/F00005963_0000.mdaq.root
we can loop over RawRecords and, as you might suspect, RawRecords inherits from RecMinos (which you can confirm by looking at RawRecord.h ) so you can get its context:-
  const VldContext* vc = raw->GetVldContext();  
Now VldContext know how to print themselves:-
  cout << *vc << endl;       
which produces output similar to:-
  {CalDet|  Data|2001-08-19 16:37:39.993847010Z}  
As an aside, see how C++ allows you to treat objects just like built-in types when it comes to I/O. In the end its all down to writing another function to do the work. In this case its a global function defined in VldContext.h:-
  std::ostream& operator<<(std::ostream& os, const VldContext& vldc);
rather than a member function (because in that case it would have to be a member of ostream and we are not allowed to touch that!).

Exercises

Modify
look_at_data_header.C to print the VldContext of each RawRecord it reads.

Contact: Nick West <n.west1@physics.ox.ac.uk>
Fermilab
Security, Privacy, Legal Fermi National Accelerator Laboratory