ROOT logo
//_________________________________________________________________________
// Macro that creates esd xml collections by querying the tags.
// It addresses the following use cases:
// o) The tag files are stored locally.
//   - One queries the tags by using simple string statements.
//   - One queries the tags by using the corresponding aliroot classes.
// o) The tag files are stored in the file catalog. 
//    In this case the first thing we do is to query the f.c.
//    and extract a collection (xml) of tag files. 
//   - One queries the tags by using simple string statements.
//   - One queries the tags by using the corresponding aliroot classes.
//                                             
// In all cases you create the xml file by using the CreateXMLCollection
// of the AliTagAnalysisClass. The first argument of this method is the
// name of the output xml collection which is stored locally.
//
//  coll_in:    xml collection of tag files 
//           or path to the tag files
//
//  coll_out:   name of the output xml collection
//_________________________________________________________________________
Bool_t CreateXML(char * coll_in="pp.xml", char * coll_out="global2")
{
  TStopwatch timer;
  timer.Start();
  
  
  gSystem->Load("libTreePlayer");    //needed in the case of the string statements
  gSystem->Load("libANALYSIS");      //needed by libANALYSISalice
  gSystem->Load("libANALYSISalice"); //needed AliTagAnalysis

  // Create A tag analysis object and impose some selection criteria
  AliTagAnalysis *TagAna = new AliTagAnalysis(); 

  //Case where the tag files are stored locally
  //TagAna->ChainLocalTags(coll_in);

  //Case where the tag files are stored in the file catalog
  //coll_in (pp.xml) is the xml collection of tag files that was produced 
  //by querying the file catalog:
  // find -x pp /alice/sim/PDC_08/LHC08r/270001/* *tag.root > pp.xml

  TGrid::Connect("alien://pcapiserv01.cern.ch:10000","elopez");
  //TGrid::Connect("alien://"); 
  TAlienCollection* coll = TAlienCollection::Open(coll_in);
  TGridResult* TagResult = coll->GetGridResult("",0,0);
  cout << endl << "Chain Grid Tags..."  << endl;
  TagAna->ChainGridTags(TagResult);

  //__________________________//
  //Usage of string statements//
  //__________________________//
/*
  const char* runTagCuts = "fAliceRunId==270001";
  const char* lhcTagCuts = "fLHCTag.fLHCState==LHC08r";
  const char* detTagCuts = "fDetectorTag.fTPC==1";
  const char* evTagCuts  = "(fEventTag.fTopPtMin >= 1.0)&&(fEventTag.fNumberOfTracks >= 11)&&(fEventTag.fNumberOfTracks <= 12)";
*/

  //________________________________________________//
  //Usage of AliRunTagCuts & AliEventTagCuts classes//
  //________________________________________________//
  // create a RunTagCut object
  AliRunTagCuts *runTagCuts = new AliRunTagCuts();
  // runTagCuts->SetRunId(270001);

  // create an LHCTagCuts object
  AliLHCTagCuts *lhcTagCuts = new AliLHCTagCuts();

  // create an DetectorTagCuts object
  AliDetectorTagCuts *detTagCuts  = new AliDetectorTagCuts();

  // create an EventTagCut object
  AliEventTagCuts *evTagCuts = new AliEventTagCuts();
  //evTagCuts->SetMultiplicityRange(11,12);
  //evTagCuts->SetTopPtMin(1.0);

  // Query the Tags and create the xml collection 
  cout << endl << "Create XML Collection..."  << endl;
  TagAna->CreateXMLCollection(coll_out, runTagCuts, lhcTagCuts, detTagCuts, evTagCuts);

  timer.Stop();
  timer.Print();

  return kTRUE;
}
 CreateXML.C:1
 CreateXML.C:2
 CreateXML.C:3
 CreateXML.C:4
 CreateXML.C:5
 CreateXML.C:6
 CreateXML.C:7
 CreateXML.C:8
 CreateXML.C:9
 CreateXML.C:10
 CreateXML.C:11
 CreateXML.C:12
 CreateXML.C:13
 CreateXML.C:14
 CreateXML.C:15
 CreateXML.C:16
 CreateXML.C:17
 CreateXML.C:18
 CreateXML.C:19
 CreateXML.C:20
 CreateXML.C:21
 CreateXML.C:22
 CreateXML.C:23
 CreateXML.C:24
 CreateXML.C:25
 CreateXML.C:26
 CreateXML.C:27
 CreateXML.C:28
 CreateXML.C:29
 CreateXML.C:30
 CreateXML.C:31
 CreateXML.C:32
 CreateXML.C:33
 CreateXML.C:34
 CreateXML.C:35
 CreateXML.C:36
 CreateXML.C:37
 CreateXML.C:38
 CreateXML.C:39
 CreateXML.C:40
 CreateXML.C:41
 CreateXML.C:42
 CreateXML.C:43
 CreateXML.C:44
 CreateXML.C:45
 CreateXML.C:46
 CreateXML.C:47
 CreateXML.C:48
 CreateXML.C:49
 CreateXML.C:50
 CreateXML.C:51
 CreateXML.C:52
 CreateXML.C:53
 CreateXML.C:54
 CreateXML.C:55
 CreateXML.C:56
 CreateXML.C:57
 CreateXML.C:58
 CreateXML.C:59
 CreateXML.C:60
 CreateXML.C:61
 CreateXML.C:62
 CreateXML.C:63
 CreateXML.C:64
 CreateXML.C:65
 CreateXML.C:66
 CreateXML.C:67
 CreateXML.C:68
 CreateXML.C:69
 CreateXML.C:70
 CreateXML.C:71
 CreateXML.C:72
 CreateXML.C:73
 CreateXML.C:74
 CreateXML.C:75
 CreateXML.C:76
 CreateXML.C:77
 CreateXML.C:78
 CreateXML.C:79
 CreateXML.C:80
 CreateXML.C:81
 CreateXML.C:82
 CreateXML.C:83
 CreateXML.C:84
 CreateXML.C:85
 CreateXML.C:86
 CreateXML.C:87