<commit_before>void InitHistograms(AliDielectron *die, Int_t cutDefinition);
void InitCF(AliDielectron* die, Int_t cutDefinition);

void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition);
void SetupPairCuts(AliDielectron *die, Int_t cutDefinition);

void AddMCSignals(AliDielectron *die);
void SetEtaCorrection();
TVectorD *GetRunNumbers();

TString names=("TPC;TOF;TRD;rec;TOFTRD;TOFTRD2;ITScls;ITSamy;dca;chi2;Gam0;Gam01;Gam05;Gam10;Gam15;Gam20;EtaGap01;EtaGap02;EtaGap03;EtaGap04;EtaGap05;SubLS;SubRndm");
enum { kTPC=0, kTOF, kTRD, krec, kTOFTRD, kTOFTRD2, kITScls, kITSamy, kDCA, kChi, kGam0, kGam01, kGam05, kGam10, kGam15, kGam20, kEtaGap01, kEtaGap02, kEtaGap03, kEtaGap04, kEtaGap05, kSubLS, kSubRndm };

TObjArray *arrNames=names.Tokenize(";");
const Int_t nDie=arrNames->GetEntries();

Bool_t  hasMC = kFALSE;
TString list  = gSystem->Getenv("LIST");

AliDielectron* ConfigJpsi_jb_PbPb(Int_t cutDefinition, TString prod="")
{
  //
  // Setup the instance of AliDielectron
  //
  
  // find mc or not?
  if( list.IsNull()) list=prod;
  if( list.Contains("LHC10h")   || list.Contains("LHC11h")   ) hasMC=kFALSE;
  if( list.Contains("LHC11a10") || list.Contains("LHC12a17") ) hasMC=kTRUE;
  

  // MC event handler?
  //  hasMC=isMC;
  //(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);    

  //ESD handler?
  Bool_t isESD=(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->IsA()==AliESDInputHandler::Class());
  
  // switch off some configurations
  switch(cutDefinition) {
    case kTPC:   
    case kTOF:   
    case kTRD:
      return 0x0;
      break;
      //case kTOFTRD:   
    case krec:   
      if(!hasMC) return 0x0;
      break;
      //case kTOFTRD2:   
    case kITScls:
    case kITSamy:
    case kDCA:
    case kChi:      
      return 0x0;
      break;
      //    case kGam0:   
      //    case kGam01:   
      //    case kGam05:   
      //    case kGam10:   
      //    case kGam15:   
      //    case kGam20:
    case kEtaGap01:   
    case kEtaGap02:   
    case kEtaGap03:   
    case kEtaGap04:   
    case kEtaGap05:   
    case kSubLS:
    case kSubRndm:
      if( hasMC) return 0x0;
      break;
  }
  
  // create the actual framework object
  TString name=Form("%02d",cutDefinition);
  if (cutDefinition<arrNames->GetEntriesFast()){
    name=arrNames->At(cutDefinition)->GetName();
  }
  AliDielectron *die = new AliDielectron(Form("%s",name.Data()),
                                         Form("Track cuts: %s",name.Data()));
  
  // Monte Carlo Signals and TRD efficiency tables
  if(hasMC) {
    AddMCSignals(die);
    
    // trd tables
    TString pidTab="$TRAIN_ROOT/util/dielectron/dielectron/TRDpidEff_eleProb07_TRDntr4_6.root";
    TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
    if (trainRoot.IsNull()) pidTab="$ALICE_ROOT/PWGDQ/dielectron/files/TRDpidEff_eleProb07_TRDntr4_6.root";

    if (gSystem->AccessPathName(gSystem->ExpandPathName(pidTab.Data())))
      Error("ConfigPbPb","PID table not found: %s",pidTab.Data());
    else 
      die->SetTRDcorrectionFilename(pidTab.Data());
  }
  
  // cut setup
  SetupTrackCuts(die,cutDefinition);
  SetupPairCuts(die,cutDefinition);
  
  // histogram setup
  if(cutDefinition == kTOFTRD  || 
     cutDefinition == kGam0    || 
     cutDefinition == kTOFTRD2 || 
     cutDefinition >= kEtaGap01 ) 
    InitHistograms(die,cutDefinition);
  
  // CF container setup
  if(cutDefinition <  kEtaGap01 || 
     cutDefinition == kSubRndm  )
    InitCF(die,cutDefinition);
  
  // bgrd estimators
  if(!hasMC) {
    
    if(cutDefinition == kTOFTRD) {  
      // rotations
      AliDielectronTrackRotator *rot=new AliDielectronTrackRotator;
      rot->SetIterations(10);
      rot->SetConeAnglePhi(TMath::Pi());
      rot->SetStartAnglePhi(TMath::Pi());
      die->SetTrackRotator(rot);
      // mixing
      AliDielectronMixingHandler *mix=new AliDielectronMixingHandler;
      mix->AddVariable(AliDielectronVarManager::kZvPrim,20,-10.,10.);
      mix->AddVariable(AliDielectronVarManager::kCentrality,"0,5,10,20,50,80");
      mix->SetMixType(AliDielectronMixingHandler::kAll);
      mix->SetDepth(50);
      die->SetMixingHandler(mix);
    }
    
    
    // TPC event plane configurations
    Double_t gGap;
    switch(cutDefinition) {
      case kEtaGap01:   gGap=0.1;   break;
      case kEtaGap02:   gGap=0.2;   break;
      case kEtaGap03:   gGap=0.3;   break;
      case kEtaGap04:   gGap=0.4;   break;
      case kEtaGap05:   gGap=0.5;   break;
      default: gGap=0.0;
    }
    
    AliDielectronVarCuts *poi = new AliDielectronVarCuts("PoI","PoI");
    poi->AddCut(AliDielectronVarManager::kM,2.92,3.20);     // particles of interest, jpsi mass window
    die->GetEventPlanePOIPreFilter().AddCuts(poi); 
    
    if(cutDefinition >= kEtaGap01 && 
       cutDefinition <  kSubLS     ) {
      AliDielectronVarCuts *etaGap = new AliDielectronVarCuts(AliDielectronVarManager::GetValueName(AliDielectronVarManager::kEta),"etaGap");
      etaGap->AddCut(AliDielectronVarManager::kEta,-1*gGap,gGap,kTRUE);
      die->GetEventPlanePreFilter().AddCuts(etaGap);
    }<commit_msg>-binning ME<commit_after>void InitHistograms(AliDielectron *die, Int_t cutDefinition);
void InitCF(AliDielectron* die, Int_t cutDefinition);

void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition);
void SetupPairCuts(AliDielectron *die, Int_t cutDefinition);

void AddMCSignals(AliDielectron *die);
void SetEtaCorrection();
TVectorD *GetRunNumbers();

TString names=("TPC;TOF;TRD;rec;TOFTRD;TOFTRD2;ITScls;ITSamy;dca;chi2;Gam0;Gam01;Gam05;Gam10;Gam15;Gam20;EtaGap01;EtaGap02;EtaGap03;EtaGap04;EtaGap05;SubLS;SubRndm");
enum { kTPC=0, kTOF, kTRD, krec, kTOFTRD, kTOFTRD2, kITScls, kITSamy, kDCA, kChi, kGam0, kGam01, kGam05, kGam10, kGam15, kGam20, kEtaGap01, kEtaGap02, kEtaGap03, kEtaGap04, kEtaGap05, kSubLS, kSubRndm };

TObjArray *arrNames=names.Tokenize(";");
const Int_t nDie=arrNames->GetEntries();

Bool_t  hasMC = kFALSE;
TString list  = gSystem->Getenv("LIST");

AliDielectron* ConfigJpsi_jb_PbPb(Int_t cutDefinition, TString prod="")
{
  //
  // Setup the instance of AliDielectron
  //
  
  // find mc or not?
  if( list.IsNull()) list=prod;
  if( list.Contains("LHC10h")   || list.Contains("LHC11h")   ) hasMC=kFALSE;
  if( list.Contains("LHC11a10") || list.Contains("LHC12a17") ) hasMC=kTRUE;
  

  // MC event handler?
  //  hasMC=isMC;
  //(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);    

  //ESD handler?
  Bool_t isESD=(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->IsA()==AliESDInputHandler::Class());
  
  // switch off some configurations
  switch(cutDefinition) {
    case kTPC:   
    case kTOF:   
    case kTRD:
      return 0x0;
      break;
      //case kTOFTRD:   
    case krec:   
      if(!hasMC) return 0x0;
      break;
      //case kTOFTRD2:   
    case kITScls:
    case kITSamy:
    case kDCA:
    case kChi:      
      return 0x0;
      break;
      //    case kGam0:   
      //    case kGam01:   
      //    case kGam05:   
      //    case kGam10:   
      //    case kGam15:   
      //    case kGam20:
    case kEtaGap01:   
    case kEtaGap02:   
    case kEtaGap03:   
    case kEtaGap04:   
    case kEtaGap05:   
    case kSubLS:
    case kSubRndm:
      if( hasMC) return 0x0;
      break;
  }
  
  // create the actual framework object
  TString name=Form("%02d",cutDefinition);
  if (cutDefinition<arrNames->GetEntriesFast()){
    name=arrNames->At(cutDefinition)->GetName();
  }
  AliDielectron *die = new AliDielectron(Form("%s",name.Data()),
                                         Form("Track cuts: %s",name.Data()));
  
  // Monte Carlo Signals and TRD efficiency tables
  if(hasMC) {
    AddMCSignals(die);
    
    // trd tables
    TString pidTab="$TRAIN_ROOT/util/dielectron/dielectron/TRDpidEff_eleProb07_TRDntr4_6.root";
    TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
    if (trainRoot.IsNull()) pidTab="$ALICE_ROOT/PWGDQ/dielectron/files/TRDpidEff_eleProb07_TRDntr4_6.root";

    if (gSystem->AccessPathName(gSystem->ExpandPathName(pidTab.Data())))
      Error("ConfigPbPb","PID table not found: %s",pidTab.Data());
    else 
      die->SetTRDcorrectionFilename(pidTab.Data());
  }
  
  // cut setup
  SetupTrackCuts(die,cutDefinition);
  SetupPairCuts(die,cutDefinition);
  
  // histogram setup
  if(cutDefinition == kTOFTRD  || 
     cutDefinition == kGam0    || 
     cutDefinition == kTOFTRD2 || 
     cutDefinition >= kEtaGap01 ) 
    InitHistograms(die,cutDefinition);
  
  // CF container setup
  if(cutDefinition <  kEtaGap01 || 
     cutDefinition == kSubRndm  )
    InitCF(die,cutDefinition);
  
  // bgrd estimators
  if(!hasMC) {
    
    if(cutDefinition == kTOFTRD) {  
      // rotations
      AliDielectronTrackRotator *rot=new AliDielectronTrackRotator;
      rot->SetIterations(10);
      rot->SetConeAnglePhi(TMath::Pi());
      rot->SetStartAnglePhi(TMath::Pi());
      die->SetTrackRotator(rot);
      // mixing
      AliDielectronMixingHandler *mix=new AliDielectronMixingHandler;
      mix->AddVariable(AliDielectronVarManager::kZvPrim,10,-10.,10.);
      mix->AddVariable(AliDielectronVarManager::kCentrality,16,0.,80.);
      mix->SetMixType(AliDielectronMixingHandler::kAll);
      mix->SetDepth(100);
      die->SetMixingHandler(mix);
    }
    
    
    // TPC event plane configurations
    Double_t gGap;
    switch(cutDefinition) {
      case kEtaGap01:   gGap=0.1;   break;
      case kEtaGap02:   gGap=0.2;   break;
      case kEtaGap03:   gGap=0.3;   break;
      case kEtaGap04:   gGap=0.4;   break;
      case kEtaGap05:   gGap=0.5;   break;
      default: gGap=0.0;
    }
    
    AliDielectronVarCuts *poi = new AliDielectronVarCuts("PoI","PoI");
    poi->AddCut(AliDielectronVarManager::kM,2.92,3.20);     // particles of interest, jpsi mass window
    die->GetEventPlanePOIPreFilter().AddCuts(poi); 
    
    if(cutDefinition >= kEtaGap01 && 
       cutDefinition <  kSubLS     ) {
      AliDielectronVarCuts *etaGap = new AliDielectronVarCuts(AliDielectronVarManager::GetValueName(AliDielectronVarManager::kEta),"etaGap");
      etaGap->AddCut(AliDielectronVarManager::kEta,-1*gGap,gGap,kTRUE);
      die->GetEventPlanePreFilter().AddCuts(etaGap);
    }
{'fraction_non_alphanumeric': 0.12815761240612503, 'fraction_numerical': 0.030235053155174097, 'mean_word_length': 3.292172457095019, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2883115', 'n_tokens_mistral': 4042, 'n_tokens_neox': 3901, 'n_words': 609}