improved GenEventHeader() method in case of AOD
[u/mrichter/AliRoot.git] / STEER / CreateXML.C
CommitLineData
f8587b1c 1//_________________________________________________________________________
2// Macro that creates esd xml collections by querying the tags.
3// It addresses the following use cases:
4// o) The tag files are stored locally.
5// - One queries the tags by using simple string statements.
6// - One queries the tags by using the corresponding aliroot classes.
7// o) The tag files are stored in the file catalog.
8// In this case the first thing we do is to query the f.c.
9// and extract a collection (xml) of tag files.
10// - One queries the tags by using simple string statements.
11// - One queries the tags by using the corresponding aliroot classes.
12//
13// In all cases you create the xml file by using the CreateXMLCollection
14// of the AliTagAnalysisClass. The first argument of this method is the
15// name of the output xml collection which is stored locally.
d33b8eee 16//
17// coll_in: xml collection of tag files
18// or path to the tag files
19//
20// coll_out: name of the output xml collection
f8587b1c 21//_________________________________________________________________________
d33b8eee 22Bool_t CreateXML(char * coll_in="pp.xml", char * coll_out="global2")
23{
f8587b1c 24 TStopwatch timer;
25 timer.Start();
26
d33b8eee 27
28 gSystem->Load("libTreePlayer"); //needed in the case of the string statements
29 gSystem->Load("libANALYSIS"); //needed by libANALYSISalice
30 gSystem->Load("libANALYSISalice"); //needed AliTagAnalysis
f8587b1c 31
32 // Create A tag analysis object and impose some selection criteria
33 AliTagAnalysis *TagAna = new AliTagAnalysis();
34
35 //Case where the tag files are stored locally
d33b8eee 36 //TagAna->ChainLocalTags(coll_in);
f8587b1c 37
38 //Case where the tag files are stored in the file catalog
d33b8eee 39 //coll_in (pp.xml) is the xml collection of tag files that was produced
40 //by querying the file catalog:
41 // find -x pp /alice/sim/PDC_08/LHC08r/270001/* *tag.root > pp.xml
42
43 TGrid::Connect("alien://pcapiserv01.cern.ch:10000","elopez");
f8587b1c 44 //TGrid::Connect("alien://");
d33b8eee 45 TAlienCollection* coll = TAlienCollection::Open(coll_in);
46 TGridResult* TagResult = coll->GetGridResult("",0,0);
47 cout << endl << "Chain Grid Tags..." << endl;
f8587b1c 48 TagAna->ChainGridTags(TagResult);
49
50 //__________________________//
51 //Usage of string statements//
52 //__________________________//
d33b8eee 53/*
54 const char* runTagCuts = "fAliceRunId==270001";
55 const char* lhcTagCuts = "fLHCTag.fLHCState==LHC08r";
56 const char* detTagCuts = "fDetectorTag.fTPC==1";
57 const char* evTagCuts = "(fEventTag.fTopPtMin >= 1.0)&&(fEventTag.fNumberOfTracks >= 11)&&(fEventTag.fNumberOfTracks <= 12)";
58*/
f8587b1c 59
60 //________________________________________________//
61 //Usage of AliRunTagCuts & AliEventTagCuts classes//
62 //________________________________________________//
63 // create a RunTagCut object
d33b8eee 64 AliRunTagCuts *runTagCuts = new AliRunTagCuts();
65 // runTagCuts->SetRunId(270001);
66
67 // create an LHCTagCuts object
68 AliLHCTagCuts *lhcTagCuts = new AliLHCTagCuts();
69
70 // create an DetectorTagCuts object
71 AliDetectorTagCuts *detTagCuts = new AliDetectorTagCuts();
72
f8587b1c 73 // create an EventTagCut object
d33b8eee 74 AliEventTagCuts *evTagCuts = new AliEventTagCuts();
75 //evTagCuts->SetMultiplicityRange(11,12);
76 //evTagCuts->SetTopPtMin(1.0);
77
78 // Query the Tags and create the xml collection
79 cout << endl << "Create XML Collection..." << endl;
80 TagAna->CreateXMLCollection(coll_out, runTagCuts, lhcTagCuts, detTagCuts, evTagCuts);
f8587b1c 81
82 timer.Stop();
83 timer.Print();
84
85 return kTRUE;
86}