# Quality Assurance

Author: Yves Schutz

### Presentation

The QA framework provides the means to assess the quality of the data at various level of Monte-Carlo simulation and Monte-Carlo and real data reconstruction. The various levels include Raws, SDigits, Digits (simulation) and Raws, SimPoints and ESDs (reconstruction).   The QA is performed in two steps:

1. Creation of QA data objects: these objects obligatory derive from a ROOT TH1; The QA data objects for a given level and a given detectors are stored in a ROOT TList.
2. Checking of QA data objects: this is done  by comparing the parameters (first, second, third moment,....) of the QA data with either user defined values of with user defined reference QAdata.

Each user defined QA data object is automatically cloned for the various EventSpecies defined in AliRecoParam, i.e., presenty kLowMult, kHighMult, kCosmic et kCalib. The associated names (LowMultiplicity", "HighMultiplicity", "Cosmic", "Calibration") are added to the user defined QA data objects name and the objects are stored in directories with the same name.

The statistics of the QA data objects is user defined. The number of events to process defines a cycle. A run can include several cycle and a cycle can span over several run. Since a run can included several EventSpecies, the filling of the histograms according to the EventSpecie is controlled by the framework.

The result of the checking is represented per detector as a severity level in a bit map and stored in the QA object (AliQA)  which itself is stored in the Tags object(AliTag). It can be accessed at any stage of the data processing to verify the QA of the previous step.

The QA framework is regularely discussed during the Offine Weeks. Check the April session

### Implementation

Detectors must create 3 classes in AliDETQADataMakerSim in libDETsim and AliDETQADataMakerSim in libDETrec and AliDETQAChecker in libDETbase. The following methods must be implemented. The implementation of PHOS can be used as a template. Definitions and naming convention are implemented in AliQA

• QADataMakerSim for Hits, SDigits and Digits
• void AliDETQADataMakerSim::InitHits()                                      // creation of QA data objects for Hits
• void AliDETQADataMakerSim::InitDigits()                                   // creation of QA data objects for Digits
• void AliDETQADataMakerSim::InitSDigits()                                 // creation of QA data objects for SDigits
• void AliDETQADataMakerSim::MakeHits(TTree * hitTree)         // fill QA data objects from Hit Tree
• void AliDETQADataMakerSim::MakeDigits(TTree * digitTree)   // fill QA data objects from Digit Tree
• void AliDETQADataMakerSim::MakeSDigits(TTree * sdigitTree)// fill QA data objects from SDigit Tree
• void AliDETQADataMakerSim::StartOfDetectorCycle()                // Detector specific actions at start of cycle
• void AliDETQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list) // called at the end of the cycle; the checker can be called here.
• QADataMakerRec for Raws, RecPoints and ESDs
• void AliDETQADataMakerRec::InitRaws()                                                 // creation of QA data objects for Raws
• void AliDETQADataMakerRec::InitRecPoints()                                          // creation of QA data objects for RecPoints
• void AliDETQADataMakerRec::InitESDs()                                                 // creation of QA data objects forESDs
• void AliDETQADataMakerRec::MakeRecPoints(TTree * recpointsTree)   // fill QA data objects from RecPoints Tree
• void AliDETQADataMakerRec::MakeESDs(AliESDEvent * esd)              // fill QA data objects from ESD object
• void AliDETQADataMakerRec::StartOfDetectorCycle()                             // Detector specific actions at start of cycle
• void AliDETQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list) // called at the end of the cycle; the checker can be called here.

• Reference data

To use the default checker, which compares every QA data object with a corresponding reference data object, implemented in AliQACheckerBase::Check, reference data should be constructed wih the QADataMaker's and stored in OCDB using the AliQADataMakerSteer::Save2OCDB method. One can also create any QA data reference object and save it too OCDB without the QA framework tools. The structure of OCDB is as follows:

$ROOT_DIR/$DET/QA/$EventSpecie where •$ROOT_DIR has the structure of OCDB root directory, for example local://$ALICE_ROOT/QAref (already defined in trunk) or alien://.... (not yet defined) •$DET is the usual detectector name
• $EventSpecie is defined in AlirecoParam.h as EventSpecie_t type. Reference data can be saved to OCDB using the helper method: AliQAManager * qas = AliQAManager::QAManager("sim") ; AliQAManager::Save2OCDB(const Int_t runNumber, const char * year = "08",const Int_t cycleNumber=0, const char * detectors = "ALL"); Before you need to set the path to the QADB: qas->SetDefaultStorage("local://$ALICE_ROOT/QAref");

### Running

The QA actions can be activitated at run time during simulation and reconstruction:

• Sim.C : add the folowing lines to the simulation steering macro

void sim(Int_t nev=1) {
AliSimulation simu;
simu.SetRunQA("ALL:ALL") ;
AliQA::SetQARefStorage("local://$ALICE_ROOT/QARef") ; for (Int_t det = 0 ; det < AliQA::kNDET ; det++) { simu.SetQACycles(det, 2) ; } } • Rec.C : add the folowing lines to the reconstruction steering macro void sim(Int_t nev=1) { AliSimulation simu; simu.SetRunQA("ALL:ALL") ; AliQA::SetQARefStorage("local://$ALICE_ROOT/QARef") ;
for (Int_t det = 0 ; det < AliQA::kNDET ; det++) {
simu.SetQACycles(det, 2) ;
}
}

The QA can also be run after simulation or reconstruction. Macro exemples can be found in $ALICE_ROOT/test/QA/sim(rec)qa.C. To test all the possibilties (QA during simulation and reconstruction, after simulation and reconstruction, for Raw data alone) run the shell script$ALICE_ROOT/test/QA/simrun.sh.

Running QA will produce the following root files:

• DETQA.RunNumber.CycleNumber.root // contains all the QA data objects in a directory structure
• QA.root // contains the QA result object

These files are not saved for further use. Remembre the QA result is stored in the Tags; you have to run tag.C. The QA data files can be merged (all runs, all cycles, all detectors) in a single root file using AliQADataMakerSteer::Merge().