ROOT logo
// $Id: HLTZDCTest.C 43204 2010-08-30 07:47:06Z richterm $
void HLTZDCTest();
/**
 * @file HLTZDCTest.C
 * @brief Example macro to run the AliHLTZDCESDRecoComponent 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 \
 *     HLTZDCTest.C'("rawfile", "cdb", minEvent, maxEvent)'
 *
 * Examples:
 *     HLTZDCTest.C'("raw.root", minEvent, MaxEvent)'
 *     HLTZDCTest.C'("./", minEvent, MaxEvent)'
 *     HLTZDCTest.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 Chiara Oppedisano <Chiara.Oppedisano@to.infn.it>
 *         Jochen Thaeder <jochen@thaeder.de>
 * @ingroup alihlt_zdc
 */

// ---------------------------------------------------------------------------- 
void HLTZDCTest(const Char_t *filename, const Char_t *cdbURI,
		  Int_t minEvent=-1, Int_t maxEvent=-1) {
  
  printf (" ============================================= \n\n");
  printf ("        TEST ZDC 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;
      HLTZDCTest();      
      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 ZDC raw data
  AliHLTConfiguration publisher("RAW-Publisher", 
				"AliRawReaderPublisher", 
				"", 
				"-equipmentid 3840 "
				"-datatype 'DDL_RAW ' 'ZDC ' "
				"-dataspec 0x01"
				);

  // define configuration of the ZDCReconstruction component
  AliHLTConfiguration vzeroReco("ZDC-Reconstruction", 
				"ZDCESDReco", 
				"RAW-Publisher",
				""
				);

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

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



  // 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 libAliHLTZDC.so "
		"loglevel=0x7c "
		"chains=GLOBAL-ESD-Converter,RootWriter"
		);

  rec.SetRunPlaneEff(kFALSE);

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

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

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

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