ATLAS Offline Software
Loading...
Searching...
No Matches
xAODForward package

Retrieving object in Root Core

Retrieving ALFADataContainer

In the xAOD file an ALFADataContainer object is stored. It has to be read first with the help of an xAOD::TEvent object. When EventLoop is used, the code will be the following

xAOD::TEvent* event = wk()->xaodEvent();
const xAOD::ALFADataContainer* alfaContainer = NULL;
if( ! event->retrieve( alfaContainer, "ALFADataContainer").isSuccess() ){
Error("execute", "Failed to retrieve ALFADataContainer. Exiting." );
return EL::StatusCode::FAILURE;
}
Tool for accessing xAOD files outside of Athena.
ALFADataContainer_v1 ALFADataContainer

In the code above it is checked if reading of the ALFADataContainer was successful. Without it RootCore will issue a warning.

Note
Objects read from xAOD::TEvent are const pointers.

The retrieved xAOD::ALFADataContainer has an interface similar to std::vector and contains two ALFAData objects. The first object is filled with the TrackingData tree and the second with the EventHeader tree. The trees are described in the twiki page https://twiki.cern.ch/twiki/bin/viewauth/Atlas/ALFAntupleAlg

Warning
Both ALFAData objects contain all the variables, but the variables that are not present in the corresponding tree contain default values.

Retrieving an ALFAData object from ALFADataContainer

ALFAData objects can be read from the ALFADataContainer similarly to std::vector. It means that e.g. the at() method can be used.

In order to read the first ALFAData object which contains TrackingData information the following code can be used:

const xAOD::ALFAData* trackingData = alfaContainer->at(0);
const T * at(size_type n) const
Access an element, as an rvalue.
ALFAData_v1 ALFAData
Definition ALFAData.h:18

In order to read the first ALFAData object which contains event data information the following code can be used:

const xAOD::ALFAData* eventData = alfaContainer->at(1);

Detailed descriptions of the functions providing access to the specific variables contain information in which tree the variable is stored.

Retrieving data in Athena

In the xAOD file an ALFADataContainer object is stored and has to be retrieved first. For example,

const xAOD::ALFADataContainer* alfaContainer = 0;
CHECK( evtStore()->retrieve( alfaContainer, "ALFADataContainer" ) );
#define CHECK(...)
Evaluate an expression and check for errors.

Retrieving ALFAData objects from the container object is common between Athena and RootCore, so please consult subsection Retrieving an ALFAData object from ALFADataContainer

Decoding vector indicies from serialised 2D arrays for tracks

All arrays stored in the xAOD are one dimensional, so 2D arrays are transformed into 1D arrays in the xAOD.

In the case of the 2D arrays storing information about tracks, the index of a 1D array is constructed in the following way:

   potIndex*maxTrackCnt() + trackIndex

where:

  • potIndex is the index of the pot ranging from 0 to 7,
  • maxTrackCnt() is the number of maximal number of tracks in one station,
  • trackIndex is the index of the track in a station.
Warning
The number of entries in the vector does not correspond to the number of tracks. To say if there is a track or not it has to be checked that the value of the variable is different from default one (usually -9999).

In order to extract pot number from the array element index the following formula can be used

int potIndex = index/maxTrackCnt();
Definition index.py:1

In order to extract the track index from the array element index, the following formula can be used

int trackIndex = index%maxTrackCnt();

Decoding vector indices from serialised 2D arrays for plates

All arrays stored in the xAOD are one dimensional, so 2D arrays are transformed into 1D arrays in the xAOD.

In the case of the 2D arrays storing information about plates, the index of a 1D array is constructed in the following way:

   potIndex*numberOfPlates + plateIndex

where:

  • potIndex is the index of the pot ranging from 0 to 7,
  • numberOfPlates is the number of plates in a detector (20 for main detector and 3 for overlap detector),
  • plateIndex is the index of considered plate

In order to extract the pot number from the array element index, the following formula can be used

int potIndex = index/numberOfPlates;

In order to extract plate index from the array element index the following formula can be used

int trackIndex = index%numberOfPlates;

Decoding vector indices with track information from serialised 3D arrays

All arrays stored in the xAOD are one dimensional, so 3D arrays are transformed into 1D arrays in the xAOD.

In the case of the 3D arrays storing information about tracks and plates, the index of a 1D array is constructed in the following way:

   potIndex*maxTrackCnt()*numberOfPlates + trackIndex*numberOfPlates + plateIndex

where:

  • potIndex is the index of the pot ranging from 0 to 7,
  • maxTrackCnt() is the number of maximal number of tracks in one station,
  • numberOfPlates is the maximal number of plates that can be used in track reconstruction - for main detector tracks it is 20, for overlap detectors it is 3,
  • trackIndex is the index of the track in a station,
  • plateIndex index of considered plate (from 0 to 19 for main detectors or from 0 to 2 for overlap detectors)\
Warning
The number of entries in the vector does not correspond to the number of tracks. To say if there is a track or not it has to be checked that the track for this pot and this index was reconstructed in one of the detectors using getDetectorPartID().

In order to extract the pot number from the array element index, the following formula can be used

int potIndex = index/(maxTrackCnt()*numberOfPlates);

In order to extract the track index from the array element index, the following formula can be used

int trackIndex = (index/numberOfPlates)%maxTrackCnt();

In order to extract the plate index from the array element index, the following formula can be used

int plateIndex = index%numberOfPlates;

Decrypting vector index with fibers information from serialised 3D array

All arrays stored in the xAOD are one dimensional, so 3D arrays are transformed into 1D arrays in the xAOD.

In the case of the 3D arrays storing information about fibers, the index of a 1D array is constructed in the following way:

   potIndex*numberOfPlates*numberOfLayers + plateIndex*numberOfLayers + layerIndex

where:

  • potIndex is the index of the pot ranging from 0 to 7,
  • numberOfPlates is the maximal number of plates that can be used in track reconstruction - for main detector tracks it is 20, for overlap detectors it is 3,
  • numberLayers is the number of fiber layers in a plate, which is equal to 64 for main detectors and 30 for overlap detectors,
  • plateIndex is the index of the considered plate of fibers (runs from 0 to 20 for main detectors and from 0 to 2 for overlap detectors)
  • layerIndex is the index of considered layer (runs from 0 to 63 for main detectors and from 0 to 29 for overlap detectors)

In order to extract the pot number from the array element index, the following formula can be used

int potIndex = index/(numberOfPlates*numberOfLayers);

In order to extract the plate index from the array element index, the following formula can be used

int plateIndex = (index/numberOfLayers)%numberOfPlates;

In order to extract the layer index from the array element index, the following formula can be used

int layerIndex = index%numberOfLayers;