<commit_before>// $Id$
/**
 * @file extract-ESD.C
 * @brief Tool to extract the HLT ESD from the raw data.
 *
 * Usage:
 * <pre>
 *   aliroot -b -q 'extract-ESD.C("raw.root", cdb, nOfEvents)' | tee extract-ESD.log
 *   aliroot -b -q 'extract-ESD.C("alien:///alice/data/2010/.../.root", "raw://", nOfEvents)' | tee extract-ESD.log
 * </pre>
 *
 * @author <EMAIL>
 * @ingroup alihlt_tutorial
 */
void extract_ESD(const char* input, const char *cdbURI, int nofEvents=-1){

  // setup of the RawReader
  if(!input){
    cerr << "invalid path" << endl;
    cerr << "usage: aliroot -b -q extract-ESD.C'(\"raw.root\", \"cdb\", nOfEvents)'" << endl;
    return;
  }

  TString strfile = input;
  TString struri  = cdbURI;
  
  if(strfile.Contains("://") && !strfile.Contains("local://")) TGrid::Connect("alien");
  
  // Set the CDB storage location
  AliCDBManager *man = AliCDBManager::Instance();
  man->SetDefaultStorage(cdbURI);
  man->SetRun(0);
  if (struri.BeginsWith("local://")) man->SetSpecificStorage("HLT/Calib/StreamerInfo", "local://$ALICE_ROOT/OCDB");
 
  AliRawReader* pRawReader=AliRawReader::Create(input);
  if (!pRawReader){
    cout << "cannot open RawReader for file " << input << endl;
    return;
  }

  if (!pRawReader->NextEvent()){
    cerr << "no events available" << endl;
    return;
  }

  // setup of the HLT system
  AliHLTSystem *pHLT = AliHLTPluginBase::GetInstance();
  if(!pHLT) cerr << "fatal error: can not get HLT instance" << endl;

  TString arg;
  arg.Form("-typeid ALIESDV0");
  AliHLTConfiguration publisher("hltout-publisher", "AliHLTOUTPublisher" , NULL, arg.Data());

  arg.Form("-treename HLTesdTree");
  AliHLTConfiguration collector("sink1","EsdCollector","hltout-publisher", arg.Data());<commit_msg>- corrected the CDB manager initialization depending on the source of the CDB URI - removed the specific storage setting, the default storage takes care of what's necessary for the data unpacking<commit_after>// $Id$
/**
 * @file extract-ESD.C
 * @brief Tool to extract the HLT ESD from the raw data.
 *
 * Usage:
 * <pre>
 *   aliroot -b -q 'extract-ESD.C("raw.root", cdb, nOfEvents)' | tee extract-ESD.log
 *   aliroot -b -q 'extract-ESD.C("alien:///alice/data/2010/.../.root", "raw://", nOfEvents)' | tee extract-ESD.log
 * </pre>
 *
 * @author <EMAIL>
 * @ingroup alihlt_tutorial
 */
void extract_ESD(const char* input, const char *cdbURI, int nofEvents=-1){

  // setup of the RawReader
  if(!input){
    cerr << "invalid path" << endl;
    cerr << "usage: aliroot -b -q extract-ESD.C'(\"raw.root\", \"cdb\", nOfEvents)'" << endl;
    return;
  }

  TString strfile = input;
  TString struri  = cdbURI;
  
  if(strfile.Contains("://") && !strfile.Contains("local://")) TGrid::Connect("alien");
  
  // Set the CDB storage location
  AliCDBManager *man = AliCDBManager::Instance();
  man->SetDefaultStorage(cdbURI);
  //man->SetRun(146018);

  AliRawReader* pRawReader=AliRawReader::Create(input);
  if (!pRawReader){
    cout << "cannot open RawReader for file " << input << endl;
    return;
  }
  
  if (!pRawReader->NextEvent()){
    cerr << "no events available" << endl;
    return;
  }
  
  if(struri.Contains("local") || strfile.Contains("alien")) man->SetRun(pRawReader->GetRunNumber());

  // setup of the HLT system
  AliHLTSystem *pHLT = AliHLTPluginBase::GetInstance();
  if(!pHLT) cerr << "fatal error: cannot get HLT instance" << endl;

  TString arg;
  arg.Form("-typeid ALIESDV0");
  AliHLTConfiguration publisher("hltout-publisher", "AliHLTOUTPublisher" , NULL, arg.Data());

  arg.Form("-treename HLTesdTree");
  AliHLTConfiguration collector("sink1","EsdCollector","hltout-publisher", arg.Data());
{'fraction_non_alphanumeric': 0.17462482946793997, 'fraction_numerical': 0.00572987721691678, 'mean_word_length': 3.8236842105263156, 'pattern_counts': {'":': 2, '<': 53, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5484438', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1298, 'n_words': 314}