# Reconstruction of Raw Data

The class AliReconstruction manages the reconstruction starting from raw data input. It creates a raw reader for the given raw data input format and calls the Reconstruct method of the  AliReconstructor objects of the selected detectors with the raw reader as argument. In the Reconstruct method the detector specific local reconstruction is performed for all events. For the determination of the primary vertex and the tracking the same methods are used as for Monte Carlo data. For raw data input the FillESD method of the reconstructors is called for each event with the raw reader as additional argument.

For the time being the galice.root file and the run loader as they were created by the simulation are used for the reconstruction of raw data as well. In the future the galice.root file will probably be created by the AliReconstruction class taking the information from a run database.

The local reconstruction of raw data has to be implemented in a method of the reconstructor of the corresponding detector with the following signature:

void Reconstruct(AliRunLoader* runLoader, AliRawReader* rawReader) const;

The signature differs from the one for the local reconstruction of Monte Carlo data by the additional argument for the raw reader. The loop over the events is done inside the method and can be implemented in the following way:

Int_t iEvent = 0;
while (rawReader->NextEvent()) {
runLoader->GetEvent(iEvent++);
...
}

The implementation of the reconstruction algorithm depends on the detector. Usually the corresponding raw stream class is used here to access the digits in the raw data.

There are in principle two different ways of creating reconstructed objects from raw data as illustrated in the figure below. The first possibility is to create a file with digits in the format as it is used for Monte Carlo data. The advantage of this approach is that the same reconstruction code can be used for Monte Carlo and raw data. The second possibility is to interface the reconstruction algorithms directly to the raw data. This avoids conflicts between simulated digits files and digits files created from raw data and it saves the code for the conversion. On the other hand additional code is needed to interface the reconstruction code to raw data. Therefore the second option is more attractive when the data input part and the algorithmic part of the reconstruction code are well separated.

Currently there is a default implementation of the Reconstruct method for raw data provided in the base class AliReconstructor, but this method will be made pure virtual soon to enforce the implementation of this method in all derived reconstructors.

The default implementation of the FillESD method for raw data in AliReconstructor calls the FillESD method for Monte Carlo data. Therefore it has to be implemented in the derived reconstructors only when raw data digits are needed to fill the ESD for the corresponding detector. The signature of the FillESD method for raw data has an additional argument for the raw reader compared to the FillESD method for Monte Carlo data:


void FillESD(AliRunLoader* runLoader, AliRawReader* rawReader; AliESD* esd) const;