#include <TDragonRun.h>
Collaboration diagram for TDragonRun:
This class is used as a driver to create ROOT trees and as the interface to the DragonRoot code online. It does all the hard work unpacking the data, sorting into subevents and writing out ROOT trees containing TDragonEvents, TScalerEvents and TEpicsEvents if desired. This type of tree may be more useful than a tree produced by the DAQ which contains raw unpacked data.
Definition at line 28 of file TDragonRun.h.
Public Types | |
enum | EEventId { kEV_BOR = 0x8000, kEV_EOR = 0x8001, kEV_DRAGON_G = 0x0001, kEV_DRAGON_H = 0x0004, kEV_EPICS = 0x0014, kEV_SCALER = 0x0002 } |
enum | ETrigMask { kTRIG_DRAGON_HMEM = 0x0002, kTRIG_DRAGON_GMEM = 0x0008, kTRIG_DRAGON_CHME = 0x0001, kTRIG_DRAGON_CGME = 0x0004, kTRIG_SCALER = 0x0000, kTRIG_EPICS = 0x0064 } |
Public Member Functions | |
TDragonRun () | |
~TDragonRun () | |
void | SetHiModules (const UShort_t *, const UInt_t &, const UShort_t *, const UInt_t &) |
void | SetGrModules (const UShort_t *, const UInt_t &, const UShort_t *, const UInt_t &) |
void | SetDebug (Bool_t) |
void | SetDatabase (const Char_t *) |
Bool_t | HasDetector (const Char_t *) const |
void | AddDetector (THiDetector *) |
void | AddDetector (TGrDetector *) |
void | OpenRootFile (const Char_t *) |
void | OpenMidasFile (const Char_t *) |
Bool_t | ReadMidasEvent () |
Bool_t | UnpackDragonEvent () |
Bool_t | UnpackScalerEvent () |
Bool_t | UnpackEpicsEvent () |
void | WriteTree () const |
void | CloseRootFile () const |
void | CloseMidasFile () const |
void | GetModules (vector< UShort_t > *, const Char_t *, const Char_t *) |
vector< THiDetector * > & | GetHiDetectors () |
vector< TGrDetector * > & | GetGrDetectors () |
TMidasEvent * | GetMidasEvent () const |
TDragonEvent * | GetDragonEvent () const |
TScalerEvent * | GetScalerEvent () const |
TEpicsEvent * | GetEpicsEvent () const |
TTree * | ReadDragonTree (const Char_t *) const |
void | TestDragonTree (const Char_t *=0) const |
Private Member Functions | |
TDragonRun (const TDragonRun &) | |
TDragonRun & | operator= (const TDragonRun &) |
void | SetTree () |
Int_t | DumpSubEventH (Int_t, const UShort_t *, Int_t) const |
Int_t | DumpSubEventG (Int_t, const UShort_t *, Int_t) const |
Int_t | UnpackSubEventH (Int_t, const UShort_t *, Int_t, TSubEvent &) const |
Int_t | UnpackSubEventG (Int_t, const UShort_t *, Int_t, TSubEvent &) const |
Int_t | DumpScaler (const UInt_t *, Int_t) const |
Int_t | UnpackScaler (const UInt_t *, Int_t, vector< TDataItem< UInt_t > > &) const |
Int_t | DumpEpics (const Float_t *, Int_t) const |
Int_t | UnpackEpics (const Float_t *, Int_t, vector< TDataItem< Float_t > > &) const |
UInt_t * | SetModules (const UShort_t *, UInt_t, UInt_t &) |
Private Attributes | |
string | fDatabase |
TFile * | fRootFile |
TMidasFile * | fMidasFile |
TTree * | fDragonTree |
TMidasEvent * | fMidasEvent |
TDragonEvent * | fDragonEvent |
TScalerEvent * | fScalerEvent |
TEpicsEvent * | fEpicsEvent |
vector< THiDetector * > | fDetectorsH |
vector< TGrDetector * > | fDetectorsG |
UInt_t | fAdcSlotsH |
UInt_t | fTdcSlotsH |
UInt_t * | fAdcSlotH |
UInt_t * | fTdcSlotH |
UInt_t | fAdcSlotsG |
UInt_t | fTdcSlotsG |
UInt_t * | fAdcSlotG |
UInt_t * | fTdcSlotG |
const UShort_t | fFeraHeaderBit |
UShort_t | fHeaderWordG |
UShort_t | fHeaderWordH |
Bool_t | fDebug |
|
Enumeration of the types of events we expect to see in the data. If new ones are added they should be included here. Definition at line 63 of file TDragonRun.h. |
|
Enumeration of the types of triggers we expect to see in the data. If new ones are added they should be included here.
Definition at line 69 of file TDragonRun.h. |
|
Default constructor. Initializes the gamma-ray and heavy-ion ADC and TDC slots, and initializes a TDragonEvent which is used for writing out the events to a ROOT tree. Definition at line 44 of file TDragonRun.cxx. References fAdcSlotG, fAdcSlotH, fAdcSlotsG, fAdcSlotsH, fDatabase, fDebug, fDragonEvent, fDragonTree, fEpicsEvent, fHeaderWordG, fHeaderWordH, fMidasEvent, fMidasFile, fRootFile, fScalerEvent, fTdcSlotG, fTdcSlotH, fTdcSlotsG, and fTdcSlotsH. |
|
Default destructor. Definition at line 77 of file TDragonRun.cxx. References fDetectorsG, and fDetectorsH. |
|
Private copy constructor. Stops copying. Definition at line 71 of file TDragonRun.cxx. |
|
Sets the module slots that are to be expected in the methods called by UnpackDragonEvent() for the gamma-ray events. Make sure that these are correct, otherwise you will find that the data does not get unpacked. Heavy-ion FERA module layout:
Definition at line 108 of file TDragonRun.cxx. References fAdcSlotH, fAdcSlotsH, fFeraHeaderBit, fHeaderWordH, fTdcSlotH, fTdcSlotsH, and SetModules(). |
Here is the call graph for this function:
|
Sets the module slots that are to be expected in the methods called by UnpackDragonEvent() for the gamma-ray events. Make sure that these are correct, otherwise you will find that the data does not get unpacked. Gamma-ray FERA module layout:
Definition at line 133 of file TDragonRun.cxx. References fAdcSlotG, fAdcSlotsG, fFeraHeaderBit, fHeaderWordG, fTdcSlotG, fTdcSlotsG, and SetModules(). |
Here is the call graph for this function:
|
Sets the event debug flag. If this is true then decoded events will be printed to cout and cerr, while it is being decoded. The methods are identical to those used for unpacking proper, so are invaluable for debugging because they can be used to cross-reference against the raw data to see if the unpack methods are working correctly.
Definition at line 179 of file TDragonRun.h. References fDebug. |
|
Sets the database from which to retrieve the modules.
Definition at line 192 of file TDragonRun.h. References fDatabase. |
|
Checks to see if there is a detector named name added to the run. This is used to make sure that detectors do not get added more than once (they still can be if AddDetector is called without checking here first).
Definition at line 187 of file TDragonRun.cxx. References fDetectorsG, and fDetectorsH. |
|
Adds a detector to a run. Each detector added is stored in a vector of detectors. For each detector added, it is important that the name is correctly set. This name should also match the name of a calibration table in the SQL database.
Definition at line 212 of file TDragonRun.cxx. References fDetectorsH, and TDetector::GetName(). |
Here is the call graph for this function:
|
Adds a gamma-ray detector to a run. Each detector added is stored in a vector of detectors. For each detector added, it is important that the name is correctly set. This name should also match the name of a calibration table in the SQL database.
Definition at line 226 of file TDragonRun.cxx. References fDetectorsG, and TDetector::GetName(). |
Here is the call graph for this function:
|
This opens the output ROOT file. This is not related to the ROOT file produced by the frontend, as this code outputs a ROOT file that is more useful i.e. instead of being filled with packed data, it is filled with TDragonEvents.
Definition at line 240 of file TDragonRun.cxx. |
Here is the call graph for this function:
|
This opens the relevant MIDAS .mid file for reading.
Definition at line 255 of file TDragonRun.cxx. References fMidasFile, and TMidasFile::Open(). |
Here is the call graph for this function:
|
Reads a TMidasEvent from file, and sets the data into fMidasEvent.
Definition at line 201 of file TDragonRun.h. References fMidasEvent, fMidasFile, and TMidasFile::Read(). |
Here is the call graph for this function:
|
This unpacks each event into fDragonEvent.
Definition at line 397 of file TDragonRun.cxx. References TDragonEvent::AddCgmeSubEvent(), TDragonEvent::AddChmeSubEvent(), TDragonEvent::AddGmemSubEvent(), TDragonEvent::AddHmemSubEvent(), DumpSubEventG(), DumpSubEventH(), fDragonEvent, fMidasEvent, TMidasEvent::GetDataSize(), TMidasEvent::GetTriggerMask(), TMidasEvent::LocateBank(), TMidasEvent::SwapBytes(), UnpackSubEventG(), and UnpackSubEventH(). |
Here is the call graph for this function:
|
This unpacks each event into fScalerEvent.
Definition at line 997 of file TDragonRun.cxx. References TScalerEvent::AddScalers(), DumpScaler(), fMidasEvent, fScalerEvent, TMidasEvent::GetDataSize(), TMidasEvent::GetTriggerMask(), TMidasEvent::LocateBank(), TMidasEvent::SwapBytes(), and UnpackScaler(). |
Here is the call graph for this function:
|
This unpacks each event into fEpicsEvent.
Definition at line 1081 of file TDragonRun.cxx. References TEpicsEvent::AddEpics(), DumpEpics(), fEpicsEvent, fMidasEvent, TMidasEvent::GetDataSize(), TMidasEvent::GetTriggerMask(), TMidasEvent::LocateBank(), TMidasEvent::SwapBytes(), and UnpackEpics(). |
Here is the call graph for this function:
|
Write the unpacked TDragonEvent, TScalerEvent and TEpicsEvent to the ROOT tree. This is just a wrapper for TTree::Fill(). Definition at line 210 of file TDragonRun.h. References fDragonTree. |
|
This closes the output ROOT file. Definition at line 219 of file TDragonRun.h. References TMidasFile::Close(), and fRootFile. |
Here is the call graph for this function:
|
This closes the input MIDAS file. Definition at line 227 of file TDragonRun.h. References TMidasFile::Close(), and fMidasFile. |
Here is the call graph for this function:
|
Function to retrieve modules from the MySQL database. This is rather limited as to what it can do. If more functions similar to this are needed then this one should be modified so that it is more generic.
Definition at line 283 of file TDragonRun.cxx. References fDatabase. |
|
Get the heavy-ion detectors vector.
Definition at line 308 of file TDragonRun.h. |
|
Get the gamma-ray detectors vector.
Definition at line 316 of file TDragonRun.h. |
|
Used to obtain the current TMidasEvent being processed.
Definition at line 234 of file TDragonRun.h. |
|
Used to obtain the current TDragonEvent being processed.
Definition at line 251 of file TDragonRun.h. |
|
Used to obtain the current TScalerEvent being processed.
Definition at line 270 of file TDragonRun.h. |
|
Used to obtain the current TEpicsEvent being processed.
Definition at line 289 of file TDragonRun.h. |
|
Read a tree for use with dragon data. It is up to the user to delete the pointer returned. TFile handles it if we give a file that doesn't really exist (albeit rather badly).
Definition at line 319 of file TDragonRun.cxx. |
|
Read and test the ROOT tree. This is useful to use after a tree has been created with makeDragonTree. It reads the file and makes sure the byte count is correct, so nothing fancy. Do this after a tree has been made and written to "myfile.root", for example: TDragonRun dr; dr.TestDragonTree("myfile.root");
Definition at line 346 of file TDragonRun.cxx. References fRootFile, TEpicsEvent::Print(), TScalerEvent::Print(), TDragonEvent::Print(), and ReadDragonTree(). |
Here is the call graph for this function:
|
Private assignment operator. Stops copying.
Definition at line 100 of file TDragonRun.cxx. |
|
This sets a branch address of the output ROOT tree to include the TDragonEvent, TScalerEvent and TEpicsEvent to be written to file. We use the default splitting of 99 to split the written objects into their data members. Definition at line 270 of file TDragonRun.cxx. References fDragonEvent, fDragonTree, fEpicsEvent, and fScalerEvent. |
|
This method is identical to UnpackSubEventH, but instead just prints information to cout. It's an internal function only, so can't be called directly. If there is a suspicion that there is an unpacking problem this is a good place to try and start debugging it by calling SetDebug(1).
Definition at line 755 of file TDragonRun.cxx. References fAdcSlotH, fAdcSlotsH, fFeraHeaderBit, fHeaderWordH, fTdcSlotH, and fTdcSlotsH. |
|
This method is identical to UnpackSubEventG, but instead just prints information to cout. It's an internal function only, so can't be called directly. If there is a suspicion that there is an unpacking problem this is a good place to try and start debugging it by calling SetDebug(1).
Definition at line 879 of file TDragonRun.cxx. References fAdcSlotsG, fFeraHeaderBit, fHeaderWordG, and fTdcSlotsG. |
|
This is the actual unpacking method that unpacks data from the heavy-ion memories. It's an internal function only, so can't be called directly, but if there is a suspicion that there is a problem with unpacking then call SetDebug(1) and try and diagnose the issue there (which will be much easier than trying to debug this function).
Definition at line 523 of file TDragonRun.cxx. References fAdcSlotH, fAdcSlotsH, fFeraHeaderBit, fHeaderWordH, fTdcSlotH, fTdcSlotsH, and TSubEvent::Set(). |
Here is the call graph for this function:
|
This is the actual unpacking method that unpacks data from the gamma-ray memories. It's an internal function only, so can't be called directly, but if there is a suspicion that there is a problem with the unpacking then call SetDebug(1) and try and diagnose the issue there (which will be much easier than trying to debug this function).
Definition at line 638 of file TDragonRun.cxx. References fAdcSlotG, fAdcSlotsG, fFeraHeaderBit, fHeaderWordG, fTdcSlotG, fTdcSlotsG, and TSubEvent::Set(). |
Here is the call graph for this function:
|
Dump unpacking info to screen. This is useful for debugging.
Definition at line 1054 of file TDragonRun.cxx. |
|
This is where the actual scaler unpacking takes place.
Definition at line 1039 of file TDragonRun.cxx. |
|
Dump unpacking info to screen. This is useful for debugging.
Definition at line 1140 of file TDragonRun.cxx. |
|
This is where the actual epics unpacking takes place.
Definition at line 1123 of file TDragonRun.cxx. |
|
Generic slot setter. This sets the slot bit-map used to determine whether raw data has come from a particular module. This is good only if there are less than 32 slots in a bit, otherwise it will need modification.
Definition at line 158 of file TDragonRun.cxx. |
|
The database to retreive the modules from. Definition at line 76 of file TDragonRun.h. |
|
The ROOT file created if you want to write out TDragonEvents. Definition at line 79 of file TDragonRun.h. |
|
The currently opened MIDAS .mid data file. Not used online. Definition at line 82 of file TDragonRun.h. |
|
A pointer to the ROOT tree to be filled. Definition at line 85 of file TDragonRun.h. |
|
The MIDAS event which is filled at each read of the open MIDAS file, or which is set directly when online. Definition at line 89 of file TDragonRun.h. |
|
A pointer to the TDragonEvent that is written out. This event is continually filled, written and then emptied. Definition at line 93 of file TDragonRun.h. |
|
A pointer to the TScalerEvent that is written out. This event is continually filled, written and then emptied. Definition at line 97 of file TDragonRun.h. |
|
A pointer to the TEpicsEvent that is written out. This event is continually filled, written and then emptied. Definition at line 101 of file TDragonRun.h. |
|
All the heavy-ion detectors added to a run are stored in this vector. This is looped in the main sort program to find which signals belong to it. Definition at line 106 of file TDragonRun.h. |
|
All the gamma-ray detectors added to a run are stored in this vector. This is looped in the main sort program to find which signals belong to it. Definition at line 111 of file TDragonRun.h. |
|
Heavy-ion ADC slots. Each bit represents a (un)filled slot. This should not be set directly, instead use SetModules() and make sure that sql/modules.sql contains the correct slot numbers. Definition at line 117 of file TDragonRun.h. |
|
Heavy-ion TDC slots. Each bit represents a (un)filled slot. This should not be set directly, instead use SetModules() and make sure that sql/modules.sql contains the correct slot numbers. Definition at line 123 of file TDragonRun.h. |
|
Heavy-ion ADC slots. Definition at line 126 of file TDragonRun.h. |
|
Heavy-ion TDC slots. Definition at line 129 of file TDragonRun.h. |
|
Gamma-ray ADC slots. Each bit represents a (un)filled slot. This should not be set directly, instead use SetModules() and make sure that sql/modules.sql contains the correct slot numbers. Definition at line 135 of file TDragonRun.h. |
|
Gamma-ray TDC slots. Each bit represents a (un)filled slot. This should not be set directly, instead use SetModules() and make sure that sql/modules.sql contains the correct slot numbers. Definition at line 140 of file TDragonRun.h. |
|
Gamma-ray ADC slots. Definition at line 143 of file TDragonRun.h. |
|
Gamma-ray TDC slots. Definition at line 146 of file TDragonRun.h. |
|
FERA header bit. Definition at line 149 of file TDragonRun.h. |
|
Gamma-ray header-word tag. Definition at line 152 of file TDragonRun.h. |
|
Heavy-ion header-word tag. Definition at line 155 of file TDragonRun.h. |
|
If this boolean is set true then data is dumped to cout (where it can be redirected to file) rather than be decoded into subevents. This is really only useful for debugging, and is set with SetDebug(1). Definition at line 161 of file TDragonRun.h. |