ROOT logo
// $Id: $
/*
 * Example macro to run TPC calibration interface embedded into AliRoot reconstruction. 
 * The input used is unpacked from the HLTOUT of recorded data, in which the merged
 * tracks, the ESD and the TPC clusters have been added. The seed maker and the calibration 
 * components follow.
 *
 * Usage:
 * <pre>
 *   aliroot -b -q calib-from-hltout.C'("raw.root","task"     )'     | tee calib-from-hltout.log
 *   aliroot -b -q calib-from-hltout.C'("raw.root","calibtime")'     | tee calib-from-hltout.log
 *   aliroot -b -q calib-from-hltout.C'("raw.root","calibtimegain")' | tee calib-from-hltout.log
 * </pre>
 *
 *
 * The reconstruction is steered by the AliReconstruction object in the
 * usual way. Keep in mind that you should use the proper default and
 * specific storage otherwise the reconstruction will break.
 *
 * @ingroup alihlt_tpc
 * @author Kalliopi.Kanaki@ift.uib.no
 */

void calib_from_hltout(const char* input="./", const char* option="task"){

  gSystem->Load("libANALYSIS");
  gSystem->Load("libTPCcalib");  
  
  if(!gSystem->AccessPathName("galice.root")){
    cerr << "Please delete file galice.root or run at a different place." << endl;
    return;
  }

  if (!input) {
    cerr << "Please specify input or run without arguments." << endl;
    return;
  }

  /////////////////////////////////////////////////////////////////////////
  //
  // init the HLT system in order to define the analysis chain below
  //
 
  AliHLTSystem *gHLT = AliHLTPluginBase::GetInstance();
  if(!gHLT){
    cerr << "fatal error: cannot get HLT instance" << endl;
  }

  AliHLTConfiguration publisher("hltout", "AliHLTOUTPublisher", NULL, "");
  
  AliHLTConfiguration seedconf("seeds", "TPCCalibSeedMaker", "hltout","");
  
  TString calibOption = option;
  if     (calibOption.CompareTo("task")==0)          AliHLTConfiguration calibtimeconf("TPCcalib",      "TPCCalibration",  "hltout seeds" ,"");
  else if(calibOption.CompareTo("calibtime")==0)     AliHLTConfiguration calibtimeconf("calibTime",     "TPCCalibTime",    "hltout seeds", "");
  else if(calibOption.CompareTo("calibtimegain")==0) AliHLTConfiguration calibtimeconf("calibTimeGain", "TPCCalibTimeGain","hltout seeds", "");
  else 
    {
      cerr << "\nPlease specify an option for the calibration component you want to run." << endl;
      return;
    }


  /////////////////////////////////////////////////////////////////////////
  //
  // Init and run the reconstruction
  // All but HLT reconstruction is switched off
  //
  AliReconstruction rec;
  rec.SetInput(input);
  rec.SetRunVertexFinder(kFALSE);
  rec.SetRunLocalReconstruction("HLT");
  rec.SetRunTracking("");
  rec.SetLoadAlignFromCDB(0);
  rec.SetRunQA(":");
  rec.SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  rec.SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd()));
  //rec.SetDefaultStorage("local:///home/kanaki/calibComp/libraryTest/OCDB/");
  //rec.SetSpecificStorage("GRP/GRP/Data", "local:///home/kanaki/calibComp/libraryTest/OCDB/");


  // NOTE: FillESD is a step in the AliReconstruction sequence and has
  // nothing to do with the fact that this macro writes ESD output
  // HLT processes the HLTOUT during FillESD and extracts data which
  // has already been prepared. This step is currently not necessary for
  // this macro
  rec.SetFillESD("");
  
  if     (calibOption.CompareTo("task")==0)          rec.SetOption("HLT", "libAliHLTUtil.so libAliHLTGlobal.so libAliHLTTPC.so libAliHLTTPCCalibration.so loglevel=0x7c chains=TPCcalib"); 
  if     (calibOption.CompareTo("calibtime")==0)     rec.SetOption("HLT", "libAliHLTUtil.so libAliHLTGlobal.so libAliHLTTPC.so libAliHLTTPCCalibration.so loglevel=0x7c chains=calibTime"); 
  else if(calibOption.CompareTo("calibtimegain")==0) rec.SetOption("HLT", "libAliHLTUtil.so libAliHLTGlobal.so libAliHLTTPC.so libAliHLTTPCCalibration.so loglevel=0x7c chains=calibTimeGain");
  
  //rec.SetEventRange(0,20);
  rec.Run();
}
 calib-from-hltout.C:1
 calib-from-hltout.C:2
 calib-from-hltout.C:3
 calib-from-hltout.C:4
 calib-from-hltout.C:5
 calib-from-hltout.C:6
 calib-from-hltout.C:7
 calib-from-hltout.C:8
 calib-from-hltout.C:9
 calib-from-hltout.C:10
 calib-from-hltout.C:11
 calib-from-hltout.C:12
 calib-from-hltout.C:13
 calib-from-hltout.C:14
 calib-from-hltout.C:15
 calib-from-hltout.C:16
 calib-from-hltout.C:17
 calib-from-hltout.C:18
 calib-from-hltout.C:19
 calib-from-hltout.C:20
 calib-from-hltout.C:21
 calib-from-hltout.C:22
 calib-from-hltout.C:23
 calib-from-hltout.C:24
 calib-from-hltout.C:25
 calib-from-hltout.C:26
 calib-from-hltout.C:27
 calib-from-hltout.C:28
 calib-from-hltout.C:29
 calib-from-hltout.C:30
 calib-from-hltout.C:31
 calib-from-hltout.C:32
 calib-from-hltout.C:33
 calib-from-hltout.C:34
 calib-from-hltout.C:35
 calib-from-hltout.C:36
 calib-from-hltout.C:37
 calib-from-hltout.C:38
 calib-from-hltout.C:39
 calib-from-hltout.C:40
 calib-from-hltout.C:41
 calib-from-hltout.C:42
 calib-from-hltout.C:43
 calib-from-hltout.C:44
 calib-from-hltout.C:45
 calib-from-hltout.C:46
 calib-from-hltout.C:47
 calib-from-hltout.C:48
 calib-from-hltout.C:49
 calib-from-hltout.C:50
 calib-from-hltout.C:51
 calib-from-hltout.C:52
 calib-from-hltout.C:53
 calib-from-hltout.C:54
 calib-from-hltout.C:55
 calib-from-hltout.C:56
 calib-from-hltout.C:57
 calib-from-hltout.C:58
 calib-from-hltout.C:59
 calib-from-hltout.C:60
 calib-from-hltout.C:61
 calib-from-hltout.C:62
 calib-from-hltout.C:63
 calib-from-hltout.C:64
 calib-from-hltout.C:65
 calib-from-hltout.C:66
 calib-from-hltout.C:67
 calib-from-hltout.C:68
 calib-from-hltout.C:69
 calib-from-hltout.C:70
 calib-from-hltout.C:71
 calib-from-hltout.C:72
 calib-from-hltout.C:73
 calib-from-hltout.C:74
 calib-from-hltout.C:75
 calib-from-hltout.C:76
 calib-from-hltout.C:77
 calib-from-hltout.C:78
 calib-from-hltout.C:79
 calib-from-hltout.C:80
 calib-from-hltout.C:81
 calib-from-hltout.C:82
 calib-from-hltout.C:83
 calib-from-hltout.C:84
 calib-from-hltout.C:85
 calib-from-hltout.C:86
 calib-from-hltout.C:87
 calib-from-hltout.C:88
 calib-from-hltout.C:89
 calib-from-hltout.C:90
 calib-from-hltout.C:91
 calib-from-hltout.C:92
 calib-from-hltout.C:93
 calib-from-hltout.C:94
 calib-from-hltout.C:95
 calib-from-hltout.C:96