Ejemplo n.º 1
0
void GenerateMergeConfigs(){
        //
        // Generate configurations for merging 
        // (MergeViaJDL and Terminate)
        //

        // Write config for MergeViaJDL
        std::ofstream outMerge("configMerge.txt");
        outMerge << "aliroot " << g_aliroot_version.Data() << std::endl;
        outMerge << "root " << g_root_version.Data() << std::endl;
        outMerge << "sample " << g_sample.Data() << std::endl;
        outMerge << "mode MergeViaJDL\n";
        outMerge << "traindir " << g_train_dir.Data() << std::endl; 
        outMerge << "runlist ";
        for(int irun = 0; irun < g_runlist.GetSize()-1; irun++) outMerge << g_runlist[irun] << ",";
        outMerge << g_runlist[g_runlist.GetSize()-1] << std::endl;
        outMerge.close();
        // Write config for Terminate
        std::ofstream outTerminate("configTerminate.txt");
        outTerminate << "aliroot " << g_aliroot_version.Data() << std::endl;
        outTerminate << "root " << g_root_version.Data() << std::endl;
        outTerminate << "sample " << g_sample.Data() << std::endl;
        outTerminate << "mode Terminate\n";
        outTerminate << "traindir " << g_train_dir.Data() << std::endl; 
        outTerminate << "runlist ";
        for(int irun = 0; irun < g_runlist.GetSize()-1; irun++) outTerminate << g_runlist[irun] << ",";
        outTerminate << g_runlist[g_runlist.GetSize()-1] << std::endl;
        outTerminate.close();

        printf("Configurations for MergeViaJDL and terminate generated\n");
}
Ejemplo n.º 2
0
bool testReading(TArrayI &arr, TString &json) 
{
   TArrayI *arr2 = nullptr;

   TBufferJSON::FromJSON(arr2, json);
   if (!arr2) { 
      cout << "Fail to read array from JSON" << endl; 
      return false; 
   }
   if (arr2->GetSize() != arr.GetSize()) {
      cout << "Array sizes mismatch " << arr.GetSize() << " != " << arr2->GetSize() << endl;
      delete arr2;
      return false;
   }

   for (int n=0;n<arr.GetSize();++n) 
     if (arr.At(n) != arr2->At(n)) {
      cout << "Array content mismatch indx=" << n << "  " <<  arr.At(n) << " != " << arr2->At(n) << endl;
      delete arr2;
      return false;
   }

   delete arr2;
   return true;
}
Ejemplo n.º 3
0
void GetFinalDecayProducts(Int_t ind, IlcStack & stack , TArrayI & ar){

  // Recursive algorithm to get the final decay products of a particle
  //
  // ind is the index of the particle in the IlcStack
  // stack is the particle stack from the generator
  // ar contains the indexes of the final decay products
  // ar[0] is the number of final decay products

  if (ind<0 || ind>stack.GetNtrack()) {
    cerr << "Invalid index of the particle " << ind << endl;
    return;
  } 
  if (ar.GetSize()==0) {
    ar.Set(10);
    ar[0] = 0;
  }

  TParticle * part = stack.Particle(ind);

  Int_t iFirstDaughter = part->GetFirstDaughter();
  if( iFirstDaughter<0) {
    // This particle is a final decay product, add its index to the array
    ar[0]++;
    if (ar.GetSize() <= ar[0]) ar.Set(ar.GetSize()+10); // resize if needed
    ar[ar[0]] = ind;
    return;
  } 

  Int_t iLastDaughter = part->GetLastDaughter();

  for (Int_t id=iFirstDaughter; id<=iLastDaughter;id++) {
    // Now search for final decay products of the daughters
    GetFinalDecayProducts(id,stack,ar);
  }
}
Ejemplo n.º 4
0
//___________________________________________________________
void DecodeDataString(const TString &datastring, TString &sample, TArrayI &listofruns){
  TObjArray *toks = datastring.Tokenize(":");
  sample = (dynamic_cast<TObjString *>(toks->At(0)))->String();
  TString &listrunstring = (dynamic_cast<TObjString *>(toks->At(1)))->String();
  TObjArray *runstrings = listrunstring.Tokenize(",");
  TIter runiter(runstrings);
  listofruns.Set(runstrings->GetEntriesFast());
  TObjString *myrunstring = NULL;
  Int_t counter = 0;
  while((myrunstring = dynamic_cast<TObjString *>(runiter()))) listofruns[counter++] = myrunstring->String().Atoi();  
  // Print summary:
  printf("Selected sample: %s\n", sample.Data());
  printf("========================================\n");
  for(Int_t irun = 0; irun < listofruns.GetSize(); irun++){
    printf("\trun %d\n", listofruns[irun]);
  }
  printf("\n");
  delete toks; delete runstrings;
}
Ejemplo n.º 5
0
//___________________________________________________________
void AddInput(AliAnalysisAlien *alienhandler, TString sample, TArrayI &listofruns, Bool_t MC){
  Int_t year = GetYear(sample);
  TString specialpattern, datapattern;
  if(!MC){
    // handle Data
    datapattern = "ESDs/pass2/*ESDs.root";
    specialpattern = Form("data/%d", year);
    //alienhandler->SetRunPrefix("%09d");
  } else {
    // handle MC
    datapattern = "*ESDs.root";
    specialpattern = "sim";
  }
  alienhandler->SetGridDataDir(Form("/alice/%s/%s", specialpattern.Data(), sample.Data()));
  alienhandler->SetDataPattern(datapattern.Data());
  for(Int_t ien = 0; ien < listofruns.GetSize(); ien++){
    if(!MC) alienhandler->AddRunNumber(Form("%09d", listofruns[ien]));
    else alienhandler->AddRunNumber(listofruns[ien]);
  }
  alienhandler->SetGridOutputDir(sample.Data());
  alienhandler->SetOutputToRunNo();
}
Ejemplo n.º 6
0
bool MakeSample(AliAnalysisAlien *plugin, TMap &lookup){
        //
        // Fill Sample information (Data dir, pattern, run list) to the Alien plugin
        //
        TObjArray infos;
        bool found = FindDataSample(lookup, infos);
        if(!found){
                printf("sample %s not found\n", g_sample.Data());
                return false;
        }
        TString datadir, pattern, type;
        GetData(infos, datadir, 0);
        GetData(infos, pattern, 1);
        GetData(infos, type, 2);
        plugin->SetGridDataDir(datadir.Data());
        plugin->SetDataPattern(pattern.Data());
        if(!IsMC(type)) plugin->SetRunPrefix("000");
        // Add runs to the sample
        for(int irun = 0; irun < g_runlist.GetSize(); irun++){
                plugin->AddRunNumber(g_runlist[irun]);
        }
        return true;
}