<commit_before>#include <THnSparse.h>
#include <TTreeStream.h>
#include <AliLog.h>

#include <AliESDEvent.h>
#include <AliESDtrack.h>

#include "AliESDUtils.h"

#include "AliMESpidTask.h"
#include "AliMESeventInfo.h"
#include "AliMEStrackInfo.h"

ClassImp(AliMESpidTask)

//________________________________________________________________________
AliMESpidTask::AliMESpidTask()
  : AliMESbaseTask()
{
  //
  // Constructor
  //
}

//________________________________________________________________________
AliMESpidTask::AliMESpidTask(const char *name)
  : AliMESbaseTask(name)
{
  //
  // Constructor
  //
}


//________________________________________________________________________
AliMESpidTask::~AliMESpidTask()
{
  //
  // Destructor
  //
}

//________________________________________________________________________
void AliMESpidTask::UserCreateOutputObjects()
{
  //define user data containers
  AliMESbaseTask::UserCreateOutputObjects();

  //define extra user containers
}

//________________________________________________________________________
void AliMESpidTask::UserExec(Option_t *opt)
{
  // Run user analysis. The following objects are allocated after calling AliMESbaseTask::UserExec(opt)
  // fEvInfo  -  reconstructed event information (class AliMESeventInfo)
  // fTracks  -  reconstructed array of tracks (class TObjArray of AliMEStrackInfo)
  // fMCevInfo-  MC event information (class AliMESeventInfo)
  // fMCtracks-  MC array of tracks (class TObjArray of AliMEStrackInfo)

  AliMESbaseTask::UserExec(opt);


  Double_t mult_comb08 = fEvInfo->GetMultiplicity(AliMESeventInfo::kComb);  	// combined multiplicity with |eta| < 0.8
  Double_t mult_V0M = fEvInfo->GetMultiplicity(AliMESeventInfo::kV0M);   			// V0M percentile
  /*
  if(ESDmult > 0.){
	  if(ESDmult < 0.01) ESDmult = 1;
	  else if(ESDmult < 0.1) ESDmult = 2;
	  else if(ESDmult < 1.) ESDmult = 3;
	  else if(ESDmult < 5.) ESDmult = 4;   // 1-5 bin
	  else if(ESDmult < 10.) ESDmult = 8;   // 5-10 bin
	  else if(ESDmult < 15.) ESDmult = 12;   // 10-15 bin
	  else if(ESDmult < 20.) ESDmult = 18;   // 15-20 bin
	  else if(ESDmult < 30.) ESDmult = 25;   // 20-30 bin
	  else if(ESDmult < 40.) ESDmult = 35;   // 30-40 bin
	  else if(ESDmult < 50.) ESDmult = 45;   // 40-50 bin
	  else if(ESDmult < 70.) ESDmult = 60;   // 50-70 bin
	  else ESDmult = 90;   // 70-100 bin
  }
*/
  Double_t mult_comb0408 = fEvInfo->GetMultiplicity(AliMESeventInfo::kComb0408);		// combined multiplicity with 0.4 < |eta| < 0.8

  // event shape for data (from ESD)
  Double_t directivity_plus = fEvInfo->GetEventShape()->GetDirectivity(1);
  Double_t directivity_minus = fEvInfo->GetEventShape()->GetDirectivity(0);
  Double_t directivity =  (directivity_plus + directivity_minus) / 2.0;
  // if( mult_comb08 == 1 && directivity > 0.0001 ){
  //     printf("dir plus = %f\t dir minus = %f \t dir = %f\n\n", directivity_plus, directivity_minus, directivity);
  //     exit(1);
  // }
  // event shape for MC (from MC event)
  Double_t MC_directivity_plus = 0;
  Double_t MC_directivity_minus = 0;
  Double_t MC_directivity = 0;
  if( HasMCdata() ){ // run only on MC
      MC_directivity_plus = fMCevInfo->GetEventShape()->GetDirectivity(1);
      MC_directivity_minus = fMCevInfo->GetEventShape()->GetDirectivity(0);
      MC_directivity =  (MC_directivity_plus + MC_directivity_minus) / 2.0;
  }

/*
//   ((TH2*)fHistosQA->At(3))->Fill(0., ev_mult);
  // ESD event level cuts
//   AliInfo(Form("\n\n\nHas trigger MB: %d",fEvInfo->HasTriggerMB()));
//   AliInfo(Form("Has trigger HM: %d",fEvInfo->HasTriggerHM()));
  if( !fEvInfo->HasTriggerMB() ) return;
//   ((TH2*)fHistosQA->At(3))->Fill(1, ev_mult);
 //   AliInfo(Form("Has vertex: %d",fEvInfo->HasVertex()));
//   AliInfo (Form("vertex Z = %g",fEvInfo->GetVertexZ()));
  if( !fEvInfo->HasVertex() ) return;
  ((TH2*)fHistosQA->At(3))->Fill(0., ESDmult);
  //   AliInfo(Form("IsPileUp: %d",fEvInfo->IsPileUp()));
  if( fEvInfo->IsPileUp() ) return;
  ((TH2*)fHistosQA->At(3))->Fill(1, ESDmult);
  if (TMath::Abs(fEvInfo->GetVertexZ()) > 10.) return;
  ((TH2*)fHistosQA->At(3))->Fill(2, ESDmult);
  //   if(fEvInfo->GetMultiplicity(AliMESeventInfo::kComb) < 0.) return;
  if(ESDmult < 0.) return;
  ((TH2*)fHistosQA->At(3))->Fill(3, ESDmult);
*/
  Double_t vec_hNoEvts[4];   // vector used to fill hNoEvts
  THnSparseD *hNoEvts = (THnSparseD*)fHistosQA->At(3);
//   vec_hNoEvts[1] = fEvInfo->GetMultiplicity(AliMESeventInfo::kComb);				// combined multiplicity with |eta| < 0.8
  vec_hNoEvts[1] = mult_comb08;				// combined multiplicity with |eta| < 0.8
//   vec_hNoEvts[2] = fEvInfo->GetMultiplicity(AliMESeventInfo::kV0M);				// V0M percentile
  vec_hNoEvts[2] = mult_V0M;				// V0M percentile
//   vec_hNoEvts[3] = fEvInfo->GetMultiplicity(AliMESeventInfo::kComb0408);		// combined multiplicity with 0.4 < |eta| < 0.8
// vec_hNoEvts[3] = mult_comb0408;		// combined multiplicity with 0.4 < |eta| < 0.8
  vec_hNoEvts[3] = directivity;		// combined multiplicity with 0.4 < |eta| < 0.8

/*
 // !!!!!!!!!!
 // These are meaningless as long as AliPPVsMultUtils:IsSelected() is used in AliMEStender
 // !!!!!!!!!!

  if( !fEvInfo->HasTriggerMB() ) return;

  if( !fEvInfo->HasVertex() ) return;
  vec_hNoEvts[0] = 0.;
  hNoEvts->Fill(vec_hNoEvts);

  if( fEvInfo->IsPileUp() ) return;
  vec_hNoEvts[0] = 1.;
  hNoEvts->Fill(vec_hNoEvts);

  if (TMath::Abs(fEvInfo->GetVertexZ()) > 10.) return;
  vec_hNoEvts[0] = 2.;
  hNoEvts->Fill(vec_hNoEvts);

  if(mult_comb08 < 0. || mult_V0M < 0.) return;<commit_msg>Included MC dimensions for the number of events<commit_after>#include <THnSparse.h>
#include <TTreeStream.h>
#include <AliLog.h>

#include <AliESDEvent.h>
#include <AliESDtrack.h>

#include "AliESDUtils.h"

#include "AliMESpidTask.h"
#include "AliMESeventInfo.h"
#include "AliMEStrackInfo.h"

ClassImp(AliMESpidTask)

//________________________________________________________________________
AliMESpidTask::AliMESpidTask()
  : AliMESbaseTask()
{
  //
  // Constructor
  //
}

//________________________________________________________________________
AliMESpidTask::AliMESpidTask(const char *name)
  : AliMESbaseTask(name)
{
  //
  // Constructor
  //
}


//________________________________________________________________________
AliMESpidTask::~AliMESpidTask()
{
  //
  // Destructor
  //
}

//________________________________________________________________________
void AliMESpidTask::UserCreateOutputObjects()
{
  //define user data containers
  AliMESbaseTask::UserCreateOutputObjects();

  //define extra user containers
}

//________________________________________________________________________
void AliMESpidTask::UserExec(Option_t *opt)
{
  // Run user analysis. The following objects are allocated after calling AliMESbaseTask::UserExec(opt)
  // fEvInfo  -  reconstructed event information (class AliMESeventInfo)
  // fTracks  -  reconstructed array of tracks (class TObjArray of AliMEStrackInfo)
  // fMCevInfo-  MC event information (class AliMESeventInfo)
  // fMCtracks-  MC array of tracks (class TObjArray of AliMEStrackInfo)

  AliMESbaseTask::UserExec(opt);


  Double_t mult_comb08 = fEvInfo->GetMultiplicity(AliMESeventInfo::kComb);  	// combined multiplicity with |eta| < 0.8
  Double_t mult_V0M = fEvInfo->GetMultiplicity(AliMESeventInfo::kV0M);   			// V0M percentile
  /*
  if(ESDmult > 0.){
	  if(ESDmult < 0.01) ESDmult = 1;
	  else if(ESDmult < 0.1) ESDmult = 2;
	  else if(ESDmult < 1.) ESDmult = 3;
	  else if(ESDmult < 5.) ESDmult = 4;   // 1-5 bin
	  else if(ESDmult < 10.) ESDmult = 8;   // 5-10 bin
	  else if(ESDmult < 15.) ESDmult = 12;   // 10-15 bin
	  else if(ESDmult < 20.) ESDmult = 18;   // 15-20 bin
	  else if(ESDmult < 30.) ESDmult = 25;   // 20-30 bin
	  else if(ESDmult < 40.) ESDmult = 35;   // 30-40 bin
	  else if(ESDmult < 50.) ESDmult = 45;   // 40-50 bin
	  else if(ESDmult < 70.) ESDmult = 60;   // 50-70 bin
	  else ESDmult = 90;   // 70-100 bin
  }
*/
  Double_t mult_comb0408 = fEvInfo->GetMultiplicity(AliMESeventInfo::kComb0408);		// combined multiplicity with 0.4 < |eta| < 0.8

  // event shape for data (from ESD)
  Double_t directivity_plus = fEvInfo->GetEventShape()->GetDirectivity(1);
  Double_t directivity_minus = fEvInfo->GetEventShape()->GetDirectivity(0);
  Double_t directivity =  (directivity_plus + directivity_minus) / 2.0;
  // if( mult_comb08 == 1 && directivity > 0.0001 ){
  //     printf("dir plus = %f\t dir minus = %f \t dir = %f\n\n", directivity_plus, directivity_minus, directivity);
  //     exit(1);
  // }
  // event shape for MC (from MC event)
  Double_t MC_directivity_plus = 0;
  Double_t MC_directivity_minus = 0;
  Double_t MC_directivity = 0;
  if( HasMCdata() ){ // run only on MC
      MC_directivity_plus = fMCevInfo->GetEventShape()->GetDirectivity(1);
      MC_directivity_minus = fMCevInfo->GetEventShape()->GetDirectivity(0);
      MC_directivity =  (MC_directivity_plus + MC_directivity_minus) / 2.0;
  }

/*
//   ((TH2*)fHistosQA->At(3))->Fill(0., ev_mult);
  // ESD event level cuts
//   AliInfo(Form("\n\n\nHas trigger MB: %d",fEvInfo->HasTriggerMB()));
//   AliInfo(Form("Has trigger HM: %d",fEvInfo->HasTriggerHM()));
  if( !fEvInfo->HasTriggerMB() ) return;
//   ((TH2*)fHistosQA->At(3))->Fill(1, ev_mult);
 //   AliInfo(Form("Has vertex: %d",fEvInfo->HasVertex()));
//   AliInfo (Form("vertex Z = %g",fEvInfo->GetVertexZ()));
  if( !fEvInfo->HasVertex() ) return;
  ((TH2*)fHistosQA->At(3))->Fill(0., ESDmult);
  //   AliInfo(Form("IsPileUp: %d",fEvInfo->IsPileUp()));
  if( fEvInfo->IsPileUp() ) return;
  ((TH2*)fHistosQA->At(3))->Fill(1, ESDmult);
  if (TMath::Abs(fEvInfo->GetVertexZ()) > 10.) return;
  ((TH2*)fHistosQA->At(3))->Fill(2, ESDmult);
  //   if(fEvInfo->GetMultiplicity(AliMESeventInfo::kComb) < 0.) return;
  if(ESDmult < 0.) return;
  ((TH2*)fHistosQA->At(3))->Fill(3, ESDmult);
*/
  Double_t vec_hNoEvts[7];   // vector used to fill hNoEvts
  THnSparseD *hNoEvts = (THnSparseD*)fHistosQA->At(3);
//   vec_hNoEvts[1] = fEvInfo->GetMultiplicity(AliMESeventInfo::kComb);				// combined multiplicity with |eta| < 0.8
  vec_hNoEvts[1] = mult_comb08;				// combined multiplicity with |eta| < 0.8
//   vec_hNoEvts[2] = fEvInfo->GetMultiplicity(AliMESeventInfo::kV0M);				// V0M percentile
  vec_hNoEvts[2] = mult_V0M;				// V0M percentile
//   vec_hNoEvts[3] = fEvInfo->GetMultiplicity(AliMESeventInfo::kComb0408);		// combined multiplicity with 0.4 < |eta| < 0.8
// vec_hNoEvts[3] = mult_comb0408;		// combined multiplicity with 0.4 < |eta| < 0.8
  vec_hNoEvts[3] = directivity;		// combined multiplicity with 0.4 < |eta| < 0.8
  if( HasMCdata() ){
    vec_hNoEvts[4] = fMCevInfo->GetMultiplicity(AliMESeventInfo::kGlob08);
	vec_hNoEvts[5] = fMCevInfo->GetMultiplicity(AliMESeventInfo::kV0M);
    vec_hNoEvts[6] = MC_directivity;
  }

/*
 // !!!!!!!!!!
 // These are meaningless as long as AliPPVsMultUtils:IsSelected() is used in AliMEStender
 // !!!!!!!!!!

  if( !fEvInfo->HasTriggerMB() ) return;

  if( !fEvInfo->HasVertex() ) return;
  vec_hNoEvts[0] = 0.;
  hNoEvts->Fill(vec_hNoEvts);

  if( fEvInfo->IsPileUp() ) return;
  vec_hNoEvts[0] = 1.;
  hNoEvts->Fill(vec_hNoEvts);

  if (TMath::Abs(fEvInfo->GetVertexZ()) > 10.) return;
  vec_hNoEvts[0] = 2.;
  hNoEvts->Fill(vec_hNoEvts);

  if(mult_comb08 < 0. || mult_V0M < 0.) return;
{'fraction_non_alphanumeric': 0.1552212389380531, 'fraction_numerical': 0.033805309734513275, 'mean_word_length': 4.027135231316726, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 111, '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': '2390585', 'n_tokens_mistral': 4545, 'n_tokens_neox': 4218, 'n_words': 804}