ROOT logo
/*
 * Example macro to run the HLT vertexer embedded
 * into AliRoot reconstruction. The reconstruction is done from the raw data.
 *
 * Usage:
 * <pre>
 *   aliroot -b -q rec-vertexer.C | tee rec-vertexer.log
 * </pre>
 *
 * The chain to be run is defined by the macro given to the parameter
 * 'config='
 *
 * The macro asumes raw data to be available in the rawx folders, either
 * simulated or real data. A different input can be specified as parameter
 * <pre>
 *   aliroot -b -q rec-vertexer.C'("input.root")'
 * </pre>
 *
 * AliHLTTPCDigitReader32Bit is used to read the data
 *
 * In the first section, an analysis chain is defined. The scale of the
 * chain can be defined by choosing the range of sectors and partitions.
 *
 * The reconstruction is steered by the AliReconstruction object in the
 * usual way.
 *
 * @ingroup alihlt_global
 * @author 
 */
void rec_vertexer(const char* input="./")
{
  
  if(!gSystem->AccessPathName("galice.root")){
    cerr << "please delete the galice.root or run at 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();
 
  TString option="libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so libAliHLTGlobal.so loglevel=0x7c chains=";
  ///////////////////////////////////////////////////////////////////////////////////////////////////
  //
  // define the analysis chain to be run
  //
  int iMinSlice=0;
  int iMaxSlice=35;
  int iMinPart=0;
  int iMaxPart=5;
  TString writerInput;
  TString mergerInput;
  TString histoInput;
  TString histogramHandlerInputClusterFinder;
  TString cdumpInput;
  for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
    TString trackerInput;
    for (int part=iMinPart; part<=iMaxPart; part++) {
      TString arg, publisher, cf;
      TString clusterHistoOutput;
      // raw data publisher components
      int ddlno=768;
      if (part>1) ddlno+=72+4*slice+(part-2);
      else ddlno+=2*slice+part;
      arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC '  -dataspec 0x%02x%02x%02x%02x -verbose", ddlno, slice, slice, part, part);
      publisher.Form("DP_%02d_%d", slice, part);
      new AliHLTConfiguration(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());

      // cluster finder components
      cf.Form("CF_%02d_%d", slice, part);
      new AliHLTConfiguration(cf.Data(), "TPCClusterFinder32Bit", publisher.Data(), "-solenoidBz -5");

      if (trackerInput.Length()>0) trackerInput+=" ";
      trackerInput+=cf;
      if (writerInput.Length()>0) writerInput+=" ";
      writerInput+=cf;
      if (histoInput.Length()>0) histoInput+=" ";
      histoInput+=cf;
      if (cdumpInput.Length()>0) cdumpInput+=" ";
      cdumpInput+=cf;
    }
    TString tracker;
    // tracker components
    tracker.Form("TR_%02d", slice);
    new AliHLTConfiguration(tracker.Data(), "TPCCATracker", trackerInput.Data(), "");

    if (writerInput.Length()>0) writerInput+=" ";
    writerInput+=tracker;
    if (mergerInput.Length()>0) mergerInput+=" ";
    mergerInput+=tracker;
    //add all slice tracks to histo input
    //if (histoInput.Length()>0) histoInput+=" ";
    //histoInput+=tracker;
  }

  // GlobalMerger component
    new AliHLTConfiguration("globalmerger","TPCCAGlobalMerger",mergerInput.Data(),"");
  
    //add all global tracks to histo input
  if (histoInput.Length()>0) histoInput+=" ";
  histoInput+="globalmerger";
  
  // specify whether to write all blocks separately or merge the tracks
  // and convert to ESD
  bool writeBlocks=false;

  // the esd converter configuration
  new AliHLTConfiguration("esd-converter", "GlobalEsdConverter"   , "globalmerger", "-fitTracksToVertex 1");
  
  new AliHLTConfiguration("global-vertexer", "GlobalVertexer"   , "esd-converter", "");
  
  new AliHLTConfiguration("v0HistoOut", "V0Histo"   , "global-vertexer", "");

  new AliHLTConfiguration("GVhistorootfile", "ROOTFileWriter", "global-vertexer" , "-datafile primaryVertexHistograms -concatenate-events -overwrite");
  
  new AliHLTConfiguration("v0historootfile", "ROOTFileWriter", "v0HistoOut" , "-datafile secondaryVertexHistograms -concatenate-events -overwrite");

  option+="v0historootfile";

  option+=",GVhistorootfile";

  ///////////////////////////////////////////////////////////////////////////////////////////////////
  //
  // Init and run the reconstruction
  // All but HLT reconstructio is switched off
  //
  AliReconstruction rec;


  rec.SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  // rec.SetDefaultStorage("local://$HOME/HCDB"); 
  //rec.SetSpecificStorage("GRP/GRP/Data",
  //			 Form("local://%s",gSystem->pwd()));

  //  rec.SetSpecificStorage("GRP/GRP/Data","local:///opt/HLT-public/OCDB/LHC09c");
  //  rec.SetSpecificStorage("GRP/CTP/Config","local:///opt/HLT-public/OCDB/LHC09c");
  //  rec.SetSpecificStorage("GRP/CTP/Config", "local:///opt/HLT-public/rec/LHC09c/");

  rec.SetInput(input);
  rec.SetRunVertexFinder(kFALSE);
  rec.SetRunReconstruction("HLT");  //add TPC for comparison
  rec.SetLoadAlignFromCDB(0);
  rec.SetRunQA(":");
  rec.SetOption("HLT",option);
  // switch off cleanESD
  rec.SetCleanESD(kFALSE);
  //  rec.SetEventRange(0, 100);
  rec.Run();
}
 rec-vertexer.C:1
 rec-vertexer.C:2
 rec-vertexer.C:3
 rec-vertexer.C:4
 rec-vertexer.C:5
 rec-vertexer.C:6
 rec-vertexer.C:7
 rec-vertexer.C:8
 rec-vertexer.C:9
 rec-vertexer.C:10
 rec-vertexer.C:11
 rec-vertexer.C:12
 rec-vertexer.C:13
 rec-vertexer.C:14
 rec-vertexer.C:15
 rec-vertexer.C:16
 rec-vertexer.C:17
 rec-vertexer.C:18
 rec-vertexer.C:19
 rec-vertexer.C:20
 rec-vertexer.C:21
 rec-vertexer.C:22
 rec-vertexer.C:23
 rec-vertexer.C:24
 rec-vertexer.C:25
 rec-vertexer.C:26
 rec-vertexer.C:27
 rec-vertexer.C:28
 rec-vertexer.C:29
 rec-vertexer.C:30
 rec-vertexer.C:31
 rec-vertexer.C:32
 rec-vertexer.C:33
 rec-vertexer.C:34
 rec-vertexer.C:35
 rec-vertexer.C:36
 rec-vertexer.C:37
 rec-vertexer.C:38
 rec-vertexer.C:39
 rec-vertexer.C:40
 rec-vertexer.C:41
 rec-vertexer.C:42
 rec-vertexer.C:43
 rec-vertexer.C:44
 rec-vertexer.C:45
 rec-vertexer.C:46
 rec-vertexer.C:47
 rec-vertexer.C:48
 rec-vertexer.C:49
 rec-vertexer.C:50
 rec-vertexer.C:51
 rec-vertexer.C:52
 rec-vertexer.C:53
 rec-vertexer.C:54
 rec-vertexer.C:55
 rec-vertexer.C:56
 rec-vertexer.C:57
 rec-vertexer.C:58
 rec-vertexer.C:59
 rec-vertexer.C:60
 rec-vertexer.C:61
 rec-vertexer.C:62
 rec-vertexer.C:63
 rec-vertexer.C:64
 rec-vertexer.C:65
 rec-vertexer.C:66
 rec-vertexer.C:67
 rec-vertexer.C:68
 rec-vertexer.C:69
 rec-vertexer.C:70
 rec-vertexer.C:71
 rec-vertexer.C:72
 rec-vertexer.C:73
 rec-vertexer.C:74
 rec-vertexer.C:75
 rec-vertexer.C:76
 rec-vertexer.C:77
 rec-vertexer.C:78
 rec-vertexer.C:79
 rec-vertexer.C:80
 rec-vertexer.C:81
 rec-vertexer.C:82
 rec-vertexer.C:83
 rec-vertexer.C:84
 rec-vertexer.C:85
 rec-vertexer.C:86
 rec-vertexer.C:87
 rec-vertexer.C:88
 rec-vertexer.C:89
 rec-vertexer.C:90
 rec-vertexer.C:91
 rec-vertexer.C:92
 rec-vertexer.C:93
 rec-vertexer.C:94
 rec-vertexer.C:95
 rec-vertexer.C:96
 rec-vertexer.C:97
 rec-vertexer.C:98
 rec-vertexer.C:99
 rec-vertexer.C:100
 rec-vertexer.C:101
 rec-vertexer.C:102
 rec-vertexer.C:103
 rec-vertexer.C:104
 rec-vertexer.C:105
 rec-vertexer.C:106
 rec-vertexer.C:107
 rec-vertexer.C:108
 rec-vertexer.C:109
 rec-vertexer.C:110
 rec-vertexer.C:111
 rec-vertexer.C:112
 rec-vertexer.C:113
 rec-vertexer.C:114
 rec-vertexer.C:115
 rec-vertexer.C:116
 rec-vertexer.C:117
 rec-vertexer.C:118
 rec-vertexer.C:119
 rec-vertexer.C:120
 rec-vertexer.C:121
 rec-vertexer.C:122
 rec-vertexer.C:123
 rec-vertexer.C:124
 rec-vertexer.C:125
 rec-vertexer.C:126
 rec-vertexer.C:127
 rec-vertexer.C:128
 rec-vertexer.C:129
 rec-vertexer.C:130
 rec-vertexer.C:131
 rec-vertexer.C:132
 rec-vertexer.C:133
 rec-vertexer.C:134
 rec-vertexer.C:135
 rec-vertexer.C:136
 rec-vertexer.C:137
 rec-vertexer.C:138
 rec-vertexer.C:139
 rec-vertexer.C:140
 rec-vertexer.C:141
 rec-vertexer.C:142
 rec-vertexer.C:143
 rec-vertexer.C:144
 rec-vertexer.C:145
 rec-vertexer.C:146
 rec-vertexer.C:147
 rec-vertexer.C:148
 rec-vertexer.C:149
 rec-vertexer.C:150
 rec-vertexer.C:151
 rec-vertexer.C:152
 rec-vertexer.C:153
 rec-vertexer.C:154
 rec-vertexer.C:155
 rec-vertexer.C:156
 rec-vertexer.C:157