<commit_before>// Names should contain a comma seperated list of cut settings
// Current options: all, electrons, kCutSet1, TTreeCuts, V0_TPCcorr, V0_ITScorr
AliAnalysisTaskElectronEfficiencyV2* AddTask_acapon_Efficiency(TString names                = "kCutSet1",
                                                               Int_t whichGen               = 0, // 0=all sources, 1=Jpsi, 2=HS
                                                               Int_t wagonnr                = 0,
                                                               TString centrality           = "0;100;V0A", // min;max;estimator
                                                               Bool_t SDDstatus             = kTRUE,
                                                               Bool_t applyPIDcorr          = kTRUE,
                                                               std::string resoFilename     = "", // Leave blank to not use resolution files
                                                               Bool_t DoPairing             = kTRUE,
                                                               Bool_t DoULSLS               = kTRUE,
                                                               Bool_t DeactivateLS          = kTRUE,
                                                               Bool_t DoCocktailWeighting   = kFALSE,
                                                               Bool_t GetCocktailFromAlien  = kFALSE,
                                                               std::string CocktailFilename = "",
                                                               Bool_t cutlibPreloaded       = kFALSE,
                                                               Bool_t getFromAlien          = kFALSE)
{

  std::cout << "########################################\nADDTASK of ANALYSIS started\n########################################" << std::endl;

  TObjArray* arrNames = names.Tokenize(";");
  Int_t nDie          = arrNames->GetEntries();
  Printf("Number of implemented cuts: %i", nDie);

  std::string resoFilenameFromAlien = "/alice/cern.ch/user/a/acapon/ResolutionFiles/";
  resoFilenameFromAlien.append(resoFilename);

  std::string CocktailFilenameFromAlien = "/alice/cern.ch/user/a/acapon/Cocktails/";
  CocktailFilenameFromAlien.append(CocktailFilename);

  // #########################################################
  // Configuring Analysis Manager
  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
  TString fileName        = AliAnalysisManager::GetCommonFileName();
  fileName = "AnalysisResults.root"; // create a subfolder in the file

  // #########################################################
  // Loading individual config file either local or from Alien
  TString configBasePath("$ALICE_PHYSICS/PWGDQ/dielectron/macrosLMEE/");
  TString configFile("Config_acapon_Efficiency.C");
  TString configLMEECutLib("LMEECutLib_acapon.C");
  // Load updated macros from private ALIEN path
  if(getFromAlien //&&
      && (!gSystem->Exec(Form("alien_cp alien:///alice/cern.ch/user/a/acapon/PWGDQ/dielectron/macrosLMEE/%s .",configFile.Data())))
      && (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/a/acapon/PWGDQ/dielectron/macrosLMEE/LMEECutLib_acapon.C ."))
      ){
    configBasePath=Form("%s/",gSystem->pwd());
  }
  TString configFilePath(configBasePath+configFile);
  TString configLMEECutLibPath(configBasePath+configLMEECutLib);

  // Load dielectron configuration files
  if(!gROOT->GetListOfGlobalFunctions()->FindObject(configLMEECutLib.Data())){
    gROOT->LoadMacro(configLMEECutLibPath.Data());
  }
  if(!gROOT->GetListOfGlobalFunctions()->FindObject(configFile.Data())){
    gROOT->LoadMacro(configFilePath.Data());
  }

  // #########################################################
  // Creating an instance of the task
  AliAnalysisTaskElectronEfficiencyV2* task = new AliAnalysisTaskElectronEfficiencyV2(Form("%s%d",names.Data(), wagonnr));

  // #########################################################
  // Possibility to set generator. If nothing set all generators are taken into account
  if(whichGen == 0){
    std::cout << "No generator specified. Looking at all sources" << std::endl;
    task->SetGeneratorMCSignalName("");
    task->SetGeneratorULSSignalName("");
  }
  else if(whichGen == 1){
    std::cout << "Generator names specified -> Jpsi2ee_1 and B2Jpsi2ee_1" << std::endl;
    task->SetGeneratorMCSignalName("Jpsi2ee_1;B2Jpsi2ee_1");
    task->SetGeneratorULSSignalName("Jpsi2ee_1;B2Jpsi2ee_1");
  }
  else if(whichGen == 2){
    std::cout << "Generator names specified -> Pythia CC_1, Pythia BB_1 and Pythia B_1" << std::endl;
    task->SetGeneratorMCSignalName("Pythia CC_1;Pythia BB_1;Pythia B_1");
    task->SetGeneratorULSSignalName("Pythia CC_1;Pythia BB_1;Pythia B_1");
  }

  // #########################################################
  // Cut lib
  LMEECutLib* cutlib = new LMEECutLib(SDDstatus);
  // Event selection is the same for all cut settings
  task->SetEnablePhysicsSelection(kTRUE);
  task->SetTriggerMask(triggerNames);
  task->SetEventFilter(cutlib->GetEventCuts(kFALSE, kFALSE));

  // Set centrality requirements
  // There is certainly a better way to do this next section....
  TObjArray* centDetails = centrality.Tokenize(";");
  TString tempMinFloat = TString(centDetails->At(0)->GetName());
  TString tempMaxFloat = TString(centDetails->At(1)->GetName());
  Float_t minCent = tempMinFloat.Atoi();
  Float_t maxCent = tempMaxFloat.Atoi();
  std::cout << "CentMin = " <<  minCent << "  CentMax = " <<  maxCent << std::endl;
  task->SetCentrality(minCent, maxCent);
  TString whichCentEst = TString(centDetails->At(2)->GetName());
  task->SetCentralityEstimator(whichCentEst);

  // #########################################################
  // Set minimum and maximum values of generated tracks. Only used to save computing power.
  // Do not set here your analysis pt-cuts
  task->SetMinPtGen(minGenPt);
  task->SetMaxPtGen(maxGenPt);
  task->SetMinEtaGen(minGenEta);
  task->SetMaxEtaGen(maxGenEta);


  // #########################################################
  // Set kinematic cuts for pairing
  task->SetKinematicCuts(minPtCut, maxPtCut, minEtaCut, maxEtaCut);<commit_msg>Update AddTask_acapon_Efficiency.C<commit_after>// Names should contain a comma seperated list of cut settings
// Current options: all, electrons, kCutSet1, TTreeCuts, V0_TPCcorr, V0_ITScorr
AliAnalysisTaskElectronEfficiencyV2* AddTask_acapon_Efficiency(TString names                = "kCutSet1",
                                                               Int_t whichGen               = 0, // 0=all sources, 1=Jpsi, 2=HS
                                                               Int_t wagonnr                = 0,
                                                               TString centrality           = "0;100;V0A", // min;max;estimator
                                                               Bool_t SDDstatus             = kTRUE,
                                                               Bool_t applyPIDcorr          = kTRUE,
                                                               std::string resoFilename     = "", // Leave blank to not use resolution files
                                                               Bool_t DoPairing             = kTRUE,
                                                               Bool_t DoULSLS               = kTRUE,
                                                               Bool_t DeactivateLS          = kTRUE,
                                                               Bool_t DoCocktailWeighting   = kFALSE,
                                                               Bool_t GetCocktailFromAlien  = kFALSE,
                                                               std::string CocktailFilename = "",
                                                               Bool_t cutlibPreloaded       = kFALSE,
                                                               Bool_t getFromAlien          = kFALSE)
{

  std::cout << "########################################\nADDTASK of ANALYSIS started\n########################################" << std::endl;

  TObjArray* arrNames = names.Tokenize(";");
  Int_t nDie          = arrNames->GetEntries();
  Printf("Number of implemented cuts: %i", nDie);

  std::string resoFilenameFromAlien = "/alice/cern.ch/user/a/acapon/ResolutionFiles/";
  resoFilenameFromAlien.append(resoFilename);

  std::string CocktailFilenameFromAlien = "/alice/cern.ch/user/a/acapon/Cocktails/";
  CocktailFilenameFromAlien.append(CocktailFilename);

  // #########################################################
  // Configuring Analysis Manager
  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
  TString fileName        = AliAnalysisManager::GetCommonFileName();
  fileName = "AnalysisResults.root"; // create a subfolder in the file

  // #########################################################
  // Loading individual config file either local or from Alien
  TString configBasePath("$ALICE_PHYSICS/PWGDQ/dielectron/macrosLMEE/");
  TString configFile("Config_acapon_Efficiency.C");
  TString configLMEECutLib("LMEECutLib_acapon.C");
  // Load updated macros from private ALIEN path
  if(getFromAlien //&&
      && (!gSystem->Exec(Form("alien_cp alien:///alice/cern.ch/user/a/acapon/PWGDQ/dielectron/macrosLMEE/%s .",configFile.Data())))
      && (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/a/acapon/PWGDQ/dielectron/macrosLMEE/LMEECutLib_acapon.C ."))
      ){
    configBasePath=Form("%s/",gSystem->pwd());
  }
  TString configFilePath(configBasePath+configFile);
  TString configLMEECutLibPath(configBasePath+configLMEECutLib);

  // Load dielectron configuration files
  if(!gROOT->GetListOfGlobalFunctions()->FindObject(configLMEECutLib.Data())){
    gROOT->LoadMacro(configLMEECutLibPath.Data());
  }
  if(!gROOT->GetListOfGlobalFunctions()->FindObject(configFile.Data())){
    gROOT->LoadMacro(configFilePath.Data());
  }

  // #########################################################
  // Creating an instance of the task
  AliAnalysisTaskElectronEfficiencyV2* task = new AliAnalysisTaskElectronEfficiencyV2(Form("%s%d",names.Data(), wagonnr));

  // #########################################################
  // Possibility to set generator. If nothing set all generators are taken into account
  if(whichGen == 0){
    std::cout << "No generator specified. Looking at all sources" << std::endl;
    task->SetGeneratorMCSignalName("");
    task->SetGeneratorULSSignalName("");
  }
  else if(whichGen == 1){
    std::cout << "Generator names specified -> Jpsi2ee_1 and B2Jpsi2ee_1" << std::endl;
    task->SetGeneratorMCSignalName("Jpsi2ee_1;B2Jpsi2ee_1");
    task->SetGeneratorULSSignalName("Jpsi2ee_1;B2Jpsi2ee_1");
  }
  else if(whichGen == 2){
    std::cout << "Generator names specified -> Pythia CC_1, Pythia BB_1 and Pythia B_1" << std::endl;
    task->SetGeneratorMCSignalName("Pythia CC_1;Pythia BB_1;Pythia B_1");
    task->SetGeneratorULSSignalName("Pythia CC_1;Pythia BB_1;Pythia B_1");
  }

  // #########################################################
  // Cut lib
  LMEECutLib* cutlib = new LMEECutLib(SDDstatus);
  // Event selection is the same for all cut settings
  task->SetEnablePhysicsSelection(kTRUE);
  task->SetTriggerMask(triggerNames);
  task->SetEventFilter(cutlib->GetEventCuts(kFALSE, kFALSE));
  task->SetRejectParticleFromOOB(kTRUE);

  // Set centrality requirements
  // There is certainly a better way to do this next section....
  TObjArray* centDetails = centrality.Tokenize(";");
  TString tempMinFloat = TString(centDetails->At(0)->GetName());
  TString tempMaxFloat = TString(centDetails->At(1)->GetName());
  Float_t minCent = tempMinFloat.Atoi();
  Float_t maxCent = tempMaxFloat.Atoi();
  std::cout << "CentMin = " <<  minCent << "  CentMax = " <<  maxCent << std::endl;
  task->SetCentrality(minCent, maxCent);
  TString whichCentEst = TString(centDetails->At(2)->GetName());
  task->SetCentralityEstimator(whichCentEst);

  // #########################################################
  // Set minimum and maximum values of generated tracks. Only used to save computing power.
  // Do not set here your analysis pt-cuts
  task->SetMinPtGen(minGenPt);
  task->SetMaxPtGen(maxGenPt);
  task->SetMinEtaGen(minGenEta);
  task->SetMaxEtaGen(maxGenEta);


  // #########################################################
  // Set kinematic cuts for pairing
  task->SetKinematicCuts(minPtCut, maxPtCut, minEtaCut, maxEtaCut);
{'fraction_non_alphanumeric': 0.17680698967434472, 'fraction_numerical': 0.007466243050039714, 'mean_word_length': 2.4261224489795916, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 74, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 56, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5896834', 'n_tokens_mistral': 3564, 'n_tokens_neox': 3394, 'n_words': 653}