# Analysis using the Event Tag System

### Analysis using the Event Tag System

The Event Tag System is a system designed to reduce the overall analysis time by allowing the user to filter his/her initial data sample by imposing some selections criteria and thus read and analyze only the events that fulfill them. In this page we will review the way to use the existing Event Tag System to perform data analysis either in an interactive or in a batch mode. By taking a look at the following examples, as far as the interactive session is concerned, you will see that the user needs to call the same lines of code regardless where the AliESDs.root files are stored.

There are two main classes that deal with the analysis using the event tag system:

• Tag Cuts Classes: Allow the user to impose selection criteria over all the tag fields.
• AliTagAnalysis: The main class that interacts with the Event Tag System and by taking into account the previously imposed selection criteria returns a chain of files along with the associated list of events that fulfill them.
• AliXMLColection: The main class that allows us to create xml collections with the files and the events we want to analyze.

All these classes can be found under the STEER and ANALYSIS modules of $ALICE_ROOT . In the following paragraphs we describe some practical analysis examples using the new Analysis Framework. ### Interactive analysis with locally stored ESDs We assume that a user has stored locally a few ESDs and that the first step, regarding the creation of the tag files for the locally stored ESDs has been finished. The created tag files are stored locally under$HOME/PDC06/Tags. Then we proceed as follows:

• Create an AliRunTagCuts and an AliEventTagCuts Object and impose some selection criteria
AliRunTagCuts *runCuts = new AliRunTagCuts();
AliEventTagCuts *eventCuts = new AliEventTagCuts();
eventCuts->SetMultiplicityRange(10,15);
• Create an AliTagAnalysis Object
AliTagAnalysis *tagAna = new AliTagAnalysis();
• Chain the tag files that are stored locally
tagAna->ChainLocalTags("\$HOME/PDC06/Tags");
• Create a new esd chain and assign the chain that is returned by querying the tags
TChain* chain = 0x0;
chain = tagAna->QueryTags(runCuts,eventCuts);
• Create a manager and a task
AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain1",TChain::Class(),
AliAnalysisManager::kInputContainer);

AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist1", TH1::Class(),
AliAnalysisManager::kOutputContainer, "Pt.ESD.root");

cinput1->SetData(chain);

• Analyze the chain with the manager
mgr->StartAnalysis("local",chain);

A complete example of this analysis case can be found in Local ESD Analysis.
The corresponding example for accessing the "MC truth" can be found in Local MC Analysis.

### Interactive analysis with grid stored ESDs

In the case where we want to analyze ESDs that are stored in the file catalog then the first step is to have a collection of official tag files. Then connect to the GRID using the API:

TGrid::Connect("alien://");
• Create an AliRunTagCuts and an AliEventTagCuts Object and impose some selection criteria
AliRunTagCuts *runCuts = new AliRunTagCuts();
AliEventTagCuts *eventCuts = new AliEventTagCuts();
eventCuts->SetMultiplicityRange(10,15);
• Create an AliTagAnalysis Object
AliTagAnalysis *tagAna = new AliTagAnalysis();
• Chain the tag files that are stored in alien - we assume that the collection of tag files is called tag.xml
TAlienCollection* coll = TAlienCollection::Open("tag.xml");
TGridResult* TagResult = coll->GetGridResult("",0,0);
TagAna->ChainGridTags(TagResult);
• Create a new esd chain and assign the chain that is returned by querying the tags
TChain* chain = 0x0;
chain = tagAna->QueryTags(runCuts,eventCuts);
• The rest of the lines are identical as in case 1 - Analyze the chain with the manager
mgr->StartAnalysis("local",chain);

A complete example of this analysis case can be found in Interactive ESD Analysis.
The corresponding example for accessing the "MC truth" can be found in Interactive MC Analysis.

### Interactive analysis with ESDs stored on the CAF

At the moment this is the only case where the tags are not used - This section will son be updated.

In the case where we want to analyze ESDs that are stored on the CAF then the first step is to create the tag files for these files. Once this step is completed and the created tag files are stored locally, we proceed by following the steps listed in the first case. Once this is done and we have created the chain along with the associated event list the we proceed as follows:

• Connect to the PROOF Cluster
gROOT->Proof("proof://@lxb6046.cern.ch");
• Upload and enable the par file
gProof->EnablePackage("ESD");
• Analyze the chain with a selector
analysischain->SetProof();
analysischain->Process(selectorfile);

The macro DemoTagsCAF.C, is a simple example that demonstrates all the previous steps.

At the moment there is a problem when using the tag system with the CAF which doesn't allow the iteration over the TEventList entries. The bug has been reported and we expect to be resolved soon.

### Batch analysis with grid stored ESDs

For a first idea on how we've implemented this case, check the following link: Integration of the event tags in batch analysis - Offline meeting (02/11/06).

A complete example of this analysis case can be found in Batch ESD Analysis.

The corresponding example for accessing the "MC truth" can be found in Batch MC Analysis.