ROOT logo
// $Id: HLTVZEROTest.C 43204 2010-08-30 07:47:06Z richterm $
void HLTVZEROTest();
/**
 * @file HLTVZEROTest.C
 * @brief Example macro to run the AliHLTSampleRawAnalysisComponent in
 * AliReconstruction.
 *
 * The component subscribes to DDL raw data published by the
 * AliHLTRawReaderPublisherComponent. The macros requires a raw data file
 * and a corresponding GRP entry.
 *
 * <pre>
 * Usage: aliroot -b -q -l \
 *     HLTVZEROTest.C'("rawfile", "cdb", minEvent, maxEvent)'
 *
 * Examples:
 *     HLTVZEROTest.C'("raw.root", minEvent, MaxEvent)'
 *     HLTVZEROTest.C'("./", minEvent, MaxEvent)'
 *     HLTVZEROTest.C'("alien:///alice/data/2010/.../raw/....root")' 
 *
 * Defaults
 *     cdb="local://$ALICE_ROOT/OCDB" -> take local OCDB from distribution
 *     minEvent=-1   -> no lower event selection
 *     maxEvent=-1   -> no upper event selection
 *
 * </pre>
 *
 * The input file can be a local raw.root file but also a file from the
 * GRID. The separate DDL files generated in simulation can be accessed
 * using AliRawReaderFile by speficying "directory/".
 *
 * Since the macro runs AliReconstruction the OCDB needs to be set up, in
 * particular the GRP entry. If testing with a local OCDB you have to
 * simulate some events and run the macro in the folder of the simulation.
 * Also HLT components configure from objects in the OCDB.
 *
 * Note: You need a valid GRID token, if you want to access files directly
 * from the Grid, use 'alien-token-init' of your alien installation.
 *
 * @author Matthias.Richter@ift.uib.no
 * @ingroup alihlt_tutorial
 */


// ---------------------------------------------------------------------------- 
void HLTVZEROTest(const Char_t *filename, const Char_t *cdbURI,
		  Int_t minEvent=-1, Int_t maxEvent=-1) {
  
  printf (" ============================================= \n\n");
  printf ("        TEST VZERO RECONSTRUCTION              \n\n");
  printf (" ============================================= \n");

  if(!gSystem->AccessPathName("galice.root")){
    cerr << "AliReconstruction on raw data requires to delete galice.root, ";
    cerr << "or run at different place." << endl;
    cerr << "!!! DO NOT DELETE the galice.root of your simulation, ";
    cerr << "but create a subfolder !!!!" << endl;
    return;
  }

  if (gSystem->AccessPathName(filename)) {
    cerr << "can not find file " << filename << endl;
    return;
  }

  // -- connect to the GRID if we use a file or OCDB from the GRID
  TString struri=cdbURI;
  TString strfile=filename;
  if (struri.BeginsWith("raw://") ||
      strfile.Contains("://") && !strfile.Contains("local://")) {
    TGrid::Connect("alien");
  }

  // -- Set the CDB storage location
  AliCDBManager * man = AliCDBManager::Instance();
  man->SetDefaultStorage(cdbURI);
  if (struri.BeginsWith("local://")) {
    // set specific storage for GRP entry
    // search in the working directory and one level above, the latter
    // follows the standard simulation setup like e.g. in test/ppbench
    if (!gSystem->AccessPathName("GRP/GRP/Data")) {
      man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD");
    } else if (!gSystem->AccessPathName("../GRP/GRP/Data")) {
      man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD/..");      
    } else {
      cerr << "can not find a GRP entry, please run the macro in the folder" << endl;
      cerr << "of a simulated data sample, or specify a GRID OCDB" << endl;
      HLTVZEROTest();      
      return;
    }
  }

  //////////////////////////////////////////////////////////////////////////////////////
  //
  // Reconstruction settings
  AliReconstruction rec;

  if (minEvent>=0 || maxEvent>minEvent) {
    if (minEvent<0) minEvent=0;
    if (maxEvent<minEvent) maxEvent=minEvent;
    rec.SetEventRange(minEvent,maxEvent);
  }

  rec.SetRunReconstruction("HLT");
  rec.SetLoadAlignFromCDB(kFALSE);
  rec.SetWriteESDfriend(kFALSE);

  // due to bug ...
  // StopOnError needs to be disabled
  rec.SetStopOnError(kFALSE);
  rec.SetRunVertexFinder(kFALSE);
  rec.SetInput(filename);

  // QA options
  rec.SetRunQA(":") ;
  //rec.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;

  //////////////////////////////////////////////////////////////////////////////////////
  //
  // setup the HLT system
  AliHLTSystem* pHLT=AliHLTPluginBase::GetInstance();

  // define a data publisher configuration for VZERO raw data
  AliHLTConfiguration publisher("RAW-Publisher", 
				"AliRawReaderPublisher", 
				"", 
				"-equipmentid 3584 "
				"-datatype 'DDL_RAW ' 'VZRO' "
				"-dataspec 0x01"
				);

  // define configuration of the VZEROReconstruction component
  AliHLTConfiguration vzeroReco("VZERO-Reconstruction", 
				"VZEROReconstruction", 
				"RAW-Publisher",
				""
				);

  // define configuration of the GlobalEsdConverter component
  AliHLTConfiguration esdConverter("GLOBAL-ESD-Converter",
				   "GlobalEsdConverter", 
				   "VZERO-Reconstruction",
				   ""
				   );

  // define configuration for Root file writer of VZERO output
  AliHLTConfiguration rootWriter("RootWriter", 
				 "ROOTFileWriter",
				 "VZERO-Reconstruction GLOBAL-ESD-Converter",
				 "-directory analysis -datafile vzeroRec"
				 );



  // set option for the HLT module in AliReconstruction
  // arguments
  //  - ignore-hltout : ignore the HLTOUT payload from the HLT DDLs
  //  - libraries to be used as plugins
  //  - loglevel=0x7c : Important, Info, Warning, Error, Fatal
  rec.SetOption("HLT",
		"ignore-hltout " 
		"libAliHLTUtil.so libAliHLTGlobal.so libAliHLTVZERO.so "
		"loglevel=0x7c "
		"chains=GLOBAL-ESD-Converter,RootWriter"
		);

  rec.SetRunPlaneEff(kFALSE);

  // switch off cleanESD
  rec.SetCleanESD(kFALSE);

  AliLog::Flush();
  rec.Run();
}

// ---------------------------------------------------------------------------- 
void HLTVZEROTest(const Char_t *filename, Int_t minEvent=-1, Int_t maxEvent=-1){
  HLTVZEROTest(filename, "local://$ALICE_ROOT/OCDB", minEvent, maxEvent);
}

// ---------------------------------------------------------------------------- 
void HLTVZEROTest() {
  cout << "HLTVZEROTest: Run HLT component 'VZEROReconstruction' in AliReconstruction" << endl;
  cout << " Usage: aliroot -b -q -l \\" << endl;
  cout << "     HLTVZEROTest.C'(\"file\", \"cdb\", minEvent, maxEvent)'" << endl;
  cout << "" << endl;
  cout << " Examples:" << endl;
  cout << "     HLTVZEROTest.C'(\"raw.root\", minEvent, MaxEvent)'" << endl;
  cout << "     HLTVZEROTest.C'(\"./\", minEvent, MaxEvent)'" << endl;
  cout << "     HLTVZEROTest.C'(\"alien:///alice/data/2010/.../raw/....root\")' " << endl;
  cout << "" << endl;
  cout << " Defaults" << endl;
  cout << "     cdb=\"local://$ALICE_ROOT/OCDB\"  -> take local OCDB" << endl;
  cout << "     minEvent=-1   -> no lower event selection" << endl;
  cout << "     maxEvent=-1   -> no upper event selection" << endl;
}
 HLTVZEROTest.C:1
 HLTVZEROTest.C:2
 HLTVZEROTest.C:3
 HLTVZEROTest.C:4
 HLTVZEROTest.C:5
 HLTVZEROTest.C:6
 HLTVZEROTest.C:7
 HLTVZEROTest.C:8
 HLTVZEROTest.C:9
 HLTVZEROTest.C:10
 HLTVZEROTest.C:11
 HLTVZEROTest.C:12
 HLTVZEROTest.C:13
 HLTVZEROTest.C:14
 HLTVZEROTest.C:15
 HLTVZEROTest.C:16
 HLTVZEROTest.C:17
 HLTVZEROTest.C:18
 HLTVZEROTest.C:19
 HLTVZEROTest.C:20
 HLTVZEROTest.C:21
 HLTVZEROTest.C:22
 HLTVZEROTest.C:23
 HLTVZEROTest.C:24
 HLTVZEROTest.C:25
 HLTVZEROTest.C:26
 HLTVZEROTest.C:27
 HLTVZEROTest.C:28
 HLTVZEROTest.C:29
 HLTVZEROTest.C:30
 HLTVZEROTest.C:31
 HLTVZEROTest.C:32
 HLTVZEROTest.C:33
 HLTVZEROTest.C:34
 HLTVZEROTest.C:35
 HLTVZEROTest.C:36
 HLTVZEROTest.C:37
 HLTVZEROTest.C:38
 HLTVZEROTest.C:39
 HLTVZEROTest.C:40
 HLTVZEROTest.C:41
 HLTVZEROTest.C:42
 HLTVZEROTest.C:43
 HLTVZEROTest.C:44
 HLTVZEROTest.C:45
 HLTVZEROTest.C:46
 HLTVZEROTest.C:47
 HLTVZEROTest.C:48
 HLTVZEROTest.C:49
 HLTVZEROTest.C:50
 HLTVZEROTest.C:51
 HLTVZEROTest.C:52
 HLTVZEROTest.C:53
 HLTVZEROTest.C:54
 HLTVZEROTest.C:55
 HLTVZEROTest.C:56
 HLTVZEROTest.C:57
 HLTVZEROTest.C:58
 HLTVZEROTest.C:59
 HLTVZEROTest.C:60
 HLTVZEROTest.C:61
 HLTVZEROTest.C:62
 HLTVZEROTest.C:63
 HLTVZEROTest.C:64
 HLTVZEROTest.C:65
 HLTVZEROTest.C:66
 HLTVZEROTest.C:67
 HLTVZEROTest.C:68
 HLTVZEROTest.C:69
 HLTVZEROTest.C:70
 HLTVZEROTest.C:71
 HLTVZEROTest.C:72
 HLTVZEROTest.C:73
 HLTVZEROTest.C:74
 HLTVZEROTest.C:75
 HLTVZEROTest.C:76
 HLTVZEROTest.C:77
 HLTVZEROTest.C:78
 HLTVZEROTest.C:79
 HLTVZEROTest.C:80
 HLTVZEROTest.C:81
 HLTVZEROTest.C:82
 HLTVZEROTest.C:83
 HLTVZEROTest.C:84
 HLTVZEROTest.C:85
 HLTVZEROTest.C:86
 HLTVZEROTest.C:87
 HLTVZEROTest.C:88
 HLTVZEROTest.C:89
 HLTVZEROTest.C:90
 HLTVZEROTest.C:91
 HLTVZEROTest.C:92
 HLTVZEROTest.C:93
 HLTVZEROTest.C:94
 HLTVZEROTest.C:95
 HLTVZEROTest.C:96
 HLTVZEROTest.C:97
 HLTVZEROTest.C:98
 HLTVZEROTest.C:99
 HLTVZEROTest.C:100
 HLTVZEROTest.C:101
 HLTVZEROTest.C:102
 HLTVZEROTest.C:103
 HLTVZEROTest.C:104
 HLTVZEROTest.C:105
 HLTVZEROTest.C:106
 HLTVZEROTest.C:107
 HLTVZEROTest.C:108
 HLTVZEROTest.C:109
 HLTVZEROTest.C:110
 HLTVZEROTest.C:111
 HLTVZEROTest.C:112
 HLTVZEROTest.C:113
 HLTVZEROTest.C:114
 HLTVZEROTest.C:115
 HLTVZEROTest.C:116
 HLTVZEROTest.C:117
 HLTVZEROTest.C:118
 HLTVZEROTest.C:119
 HLTVZEROTest.C:120
 HLTVZEROTest.C:121
 HLTVZEROTest.C:122
 HLTVZEROTest.C:123
 HLTVZEROTest.C:124
 HLTVZEROTest.C:125
 HLTVZEROTest.C:126
 HLTVZEROTest.C:127
 HLTVZEROTest.C:128
 HLTVZEROTest.C:129
 HLTVZEROTest.C:130
 HLTVZEROTest.C:131
 HLTVZEROTest.C:132
 HLTVZEROTest.C:133
 HLTVZEROTest.C:134
 HLTVZEROTest.C:135
 HLTVZEROTest.C:136
 HLTVZEROTest.C:137
 HLTVZEROTest.C:138
 HLTVZEROTest.C:139
 HLTVZEROTest.C:140
 HLTVZEROTest.C:141
 HLTVZEROTest.C:142
 HLTVZEROTest.C:143
 HLTVZEROTest.C:144
 HLTVZEROTest.C:145
 HLTVZEROTest.C:146
 HLTVZEROTest.C:147
 HLTVZEROTest.C:148
 HLTVZEROTest.C:149
 HLTVZEROTest.C:150
 HLTVZEROTest.C:151
 HLTVZEROTest.C:152
 HLTVZEROTest.C:153
 HLTVZEROTest.C:154
 HLTVZEROTest.C:155
 HLTVZEROTest.C:156
 HLTVZEROTest.C:157
 HLTVZEROTest.C:158
 HLTVZEROTest.C:159
 HLTVZEROTest.C:160
 HLTVZEROTest.C:161
 HLTVZEROTest.C:162
 HLTVZEROTest.C:163
 HLTVZEROTest.C:164
 HLTVZEROTest.C:165
 HLTVZEROTest.C:166
 HLTVZEROTest.C:167
 HLTVZEROTest.C:168
 HLTVZEROTest.C:169
 HLTVZEROTest.C:170
 HLTVZEROTest.C:171
 HLTVZEROTest.C:172
 HLTVZEROTest.C:173
 HLTVZEROTest.C:174
 HLTVZEROTest.C:175
 HLTVZEROTest.C:176
 HLTVZEROTest.C:177
 HLTVZEROTest.C:178
 HLTVZEROTest.C:179
 HLTVZEROTest.C:180
 HLTVZEROTest.C:181
 HLTVZEROTest.C:182
 HLTVZEROTest.C:183
 HLTVZEROTest.C:184
 HLTVZEROTest.C:185
 HLTVZEROTest.C:186
 HLTVZEROTest.C:187
 HLTVZEROTest.C:188
 HLTVZEROTest.C:189
 HLTVZEROTest.C:190
 HLTVZEROTest.C:191
 HLTVZEROTest.C:192
 HLTVZEROTest.C:193
 HLTVZEROTest.C:194
 HLTVZEROTest.C:195
 HLTVZEROTest.C:196
 HLTVZEROTest.C:197