<commit_before>/*************************************************************************
* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
*                                                                        *
* Author: The ALICE Off-line Project.                                    *
* Contributors are mentioned in the code where appropriate.              *
*                                                                        *
* Permission to use, copy, modify and distribute this software and its   *
* documentation strictly for non-commercial purposes is hereby granted   *
* without fee, provided that the above copyright notice appears in all   *
* copies and that both the copyright notice and this permission notice   *
* appear in the supporting documentation. The authors make no claims     *
* about the suitability of this software for any purpose. It is          *
* provided "as is" without express or implied warranty.                  * 
**************************************************************************/

#include "AliAnalysisTaskHOCFA.h"
#include "TSystem.h"
#include "Riostream.h"
#include "TClonesArray.h"
#include "TList.h"
#include "TString.h"
#include "TComplex.h"
#include "TH1I.h"
#include "TH1F.h"
#include "TH1D.h"
#include "TProfile.h"
#include "AliJBaseTrack.h"
#include "TMath.h"

#include <sstream>

using std::cout;
using std::endl;

ClassImp(AliAnalysisTaskHOCFA)

/* -------------------------------------------------------------------------- /
/ Methods inherited from AliAnalysisTaskSE.                                   /
/ -------------------------------------------------------------------------- */
AliAnalysisTaskHOCFA::AliAnalysisTaskHOCFA():
  fInputList(0),
  fDebugLevel(0),
  fMainList(0),
  fNCentralityBins(9), fCentrality(-1.), fCentralityBin(-1),
  fMultiplicity(0), fMultiplicityMin(10),
  fPtMin(0.2), fPtMax(5.),
  fUseWeightsNUE(kTRUE), fUseWeightsNUA(kFALSE),
  fGetSC3h(kTRUE),
  fGetEtaGap(kFALSE), fEtaGap(0.),
  fNCombi(6),
  fHistoConfig(0)
{
// Dummy constructor of the class.
  printf("AliAnalysisTaskHOCFA Dummy constructor\n");
  InitialiseArrayMembers();
}

// ------------------------------------------------------------------------- //
AliAnalysisTaskHOCFA::AliAnalysisTaskHOCFA(const char *name):
  fInputList(0),
  fDebugLevel(0),
  fMainList(0),
  fNCentralityBins(9), fCentrality(-1.), fCentralityBin(-1),
  fMultiplicity(0), fMultiplicityMin(10),
  fPtMin(0.2), fPtMax(5.),
  fUseWeightsNUE(kTRUE), fUseWeightsNUA(kFALSE),
  fGetSC3h(kTRUE),
  fGetEtaGap(kFALSE), fEtaGap(0.),
  fNCombi(6),
  fHistoConfig(0)
{
// Constructor of the class.
  printf("AliAnalysisTaskHOCFA Constructor\n");
  InitialiseArrayMembers();

// Define the main TList.
  fMainList = new TList();
  fMainList->SetName("analysisCFA");
  fMainList->SetOwner(kTRUE);
}

// ------------------------------------------------------------------------- //
AliAnalysisTaskHOCFA::~AliAnalysisTaskHOCFA()
{
// Destructor of the class.
  if (fMainList) {delete fMainList;}
}

// ------------------------------------------------------------------------- //
void AliAnalysisTaskHOCFA::UserCreateOutputObjects()
{
// Declare the output of the task at the beginning of the analysis.
  if (fDebugLevel > 1) {
    printf("AliAnalysisTaskHOCFA::UserCreateOutputObjects() reached.\n");
  }

  BookFinalResults();

  // Save the configuration of the analysis.
  fHistoConfig->Fill(0.5, fPtMin);
  fHistoConfig->Fill(1.5, fPtMax);
  fHistoConfig->Fill(2.5, fMultiplicityMin);
  if (fUseWeightsNUE) {fHistoConfig->Fill(3.5, 1.);}
  if (fUseWeightsNUA) {fHistoConfig->Fill(4.5, 1.);}
  if (fGetEtaGap) {fHistoConfig->Fill(5.5, fEtaGap);}
}

// ------------------------------------------------------------------------- //
void AliAnalysisTaskHOCFA::UserExec(Option_t *option)
{
// Execute the analysis for each event in the input sample.

// Get the centrality and multiplicity of the trimmed event.
  fMultiplicity = fInputList->GetEntriesFast();
  fCentralityBin = GetCentralityBin(fCentrality);

// Reject all events with not enough tracks to calculate the correlators.
  if (fMultiplicity < fMultiplicityMin) {return;}
  fHistoCent[fCentralityBin]->Fill(fCentrality);
  fHistoMulti[fCentralityBin]->Fill(fMultiplicity);

// Get the information on the selected tracks.
  double *iEta = new double[fMultiplicity]();
  double *iPhi = new double[fMultiplicity]();
  double *iWeights = new double[fMultiplicity]();
  double iEffCorr = 1.;         // Efficiency (pT-weight = 1/efficiency).
  double iPhiModuleCorr = 1.;   // (phi, eta, PVz)-weight.

  for (Long64_t iTrack = 0; iTrack < fMultiplicity; iTrack++) {
    AliJBaseTrack *aTrack = (AliJBaseTrack*)fInputList->At(iTrack);
    if (!aTrack) {continue;}
    iEta[iTrack] = aTrack->Eta();
    iPhi[iTrack] = aTrack->Phi();

    if (fUseWeightsNUE) {iEffCorr = aTrack->GetTrackEff();}
    if (fUseWeightsNUA) {iPhiModuleCorr = aTrack->GetWeight();}
    if (fDebugLevel > 10) printf("iEffCorr: %.6f iPhiModuleCorr: %.6f \n", iEffCorr, iPhiModuleCorr);
    iWeights[iTrack] = (1.0/iEffCorr)/iPhiModuleCorr;

    fHistoPt[fCentralityBin]->Fill((1./iEffCorr)*aTrack->Pt());
    fHistoEta[fCentralityBin]->Fill(iEta[iTrack]);
    fHistoPhi[fCentralityBin]->Fill((1./iPhiModuleCorr)*iPhi[iTrack]);
    fHistoCharge[fCentralityBin]->Fill(aTrack->GetCharge());<commit_msg>(PWG-CF) Correct error in histogram filling<commit_after>/*************************************************************************
* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
*                                                                        *
* Author: The ALICE Off-line Project.                                    *
* Contributors are mentioned in the code where appropriate.              *
*                                                                        *
* Permission to use, copy, modify and distribute this software and its   *
* documentation strictly for non-commercial purposes is hereby granted   *
* without fee, provided that the above copyright notice appears in all   *
* copies and that both the copyright notice and this permission notice   *
* appear in the supporting documentation. The authors make no claims     *
* about the suitability of this software for any purpose. It is          *
* provided "as is" without express or implied warranty.                  * 
**************************************************************************/

#include "AliAnalysisTaskHOCFA.h"
#include "TSystem.h"
#include "Riostream.h"
#include "TClonesArray.h"
#include "TList.h"
#include "TString.h"
#include "TComplex.h"
#include "TH1I.h"
#include "TH1F.h"
#include "TH1D.h"
#include "TProfile.h"
#include "AliJBaseTrack.h"
#include "TMath.h"

#include <sstream>

using std::cout;
using std::endl;

ClassImp(AliAnalysisTaskHOCFA)

/* -------------------------------------------------------------------------- /
/ Methods inherited from AliAnalysisTaskSE.                                   /
/ -------------------------------------------------------------------------- */
AliAnalysisTaskHOCFA::AliAnalysisTaskHOCFA():
  fInputList(0),
  fDebugLevel(0),
  fMainList(0),
  fNCentralityBins(9), fCentrality(-1.), fCentralityBin(-1),
  fMultiplicity(0), fMultiplicityMin(10),
  fPtMin(0.2), fPtMax(5.),
  fUseWeightsNUE(kTRUE), fUseWeightsNUA(kFALSE),
  fGetSC3h(kTRUE),
  fGetEtaGap(kFALSE), fEtaGap(0.),
  fNCombi(6),
  fHistoConfig(0)
{
// Dummy constructor of the class.
  printf("AliAnalysisTaskHOCFA Dummy constructor\n");
  InitialiseArrayMembers();
}

// ------------------------------------------------------------------------- //
AliAnalysisTaskHOCFA::AliAnalysisTaskHOCFA(const char *name):
  fInputList(0),
  fDebugLevel(0),
  fMainList(0),
  fNCentralityBins(9), fCentrality(-1.), fCentralityBin(-1),
  fMultiplicity(0), fMultiplicityMin(10),
  fPtMin(0.2), fPtMax(5.),
  fUseWeightsNUE(kTRUE), fUseWeightsNUA(kFALSE),
  fGetSC3h(kTRUE),
  fGetEtaGap(kFALSE), fEtaGap(0.),
  fNCombi(6),
  fHistoConfig(0)
{
// Constructor of the class.
  printf("AliAnalysisTaskHOCFA Constructor\n");
  InitialiseArrayMembers();

// Define the main TList.
  fMainList = new TList();
  fMainList->SetName("analysisCFA");
  fMainList->SetOwner(kTRUE);
}

// ------------------------------------------------------------------------- //
AliAnalysisTaskHOCFA::~AliAnalysisTaskHOCFA()
{
// Destructor of the class.
  if (fMainList) {delete fMainList;}
}

// ------------------------------------------------------------------------- //
void AliAnalysisTaskHOCFA::UserCreateOutputObjects()
{
// Declare the output of the task at the beginning of the analysis.
  if (fDebugLevel > 1) {
    printf("AliAnalysisTaskHOCFA::UserCreateOutputObjects() reached.\n");
  }

  BookFinalResults();

  // Save the configuration of the analysis.
  fHistoConfig->Fill(0.5, fPtMin);
  fHistoConfig->Fill(1.5, fPtMax);
  fHistoConfig->Fill(2.5, fMultiplicityMin);
  if (fUseWeightsNUE) {fHistoConfig->Fill(3.5, 1.);}
  if (fUseWeightsNUA) {fHistoConfig->Fill(4.5, 1.);}
  if (fGetEtaGap) {fHistoConfig->Fill(5.5, fEtaGap);}
}

// ------------------------------------------------------------------------- //
void AliAnalysisTaskHOCFA::UserExec(Option_t *option)
{
// Execute the analysis for each event in the input sample.

// Get the centrality and multiplicity of the trimmed event.
  fMultiplicity = fInputList->GetEntriesFast();
  fCentralityBin = GetCentralityBin(fCentrality);

// Reject all events with not enough tracks to calculate the correlators.
  if (fMultiplicity < fMultiplicityMin) {return;}
  fHistoCent[fCentralityBin]->Fill(fCentrality);
  fHistoMulti[fCentralityBin]->Fill(fMultiplicity);

// Get the information on the selected tracks.
  double *iEta = new double[fMultiplicity]();
  double *iPhi = new double[fMultiplicity]();
  double *iWeights = new double[fMultiplicity]();
  double iEffCorr = 1.;         // Efficiency (pT-weight = 1/efficiency).
  double iPhiModuleCorr = 1.;   // (phi, eta, PVz)-weight.

  for (Long64_t iTrack = 0; iTrack < fMultiplicity; iTrack++) {
    AliJBaseTrack *aTrack = (AliJBaseTrack*)fInputList->At(iTrack);
    if (!aTrack) {continue;}
    iEta[iTrack] = aTrack->Eta();
    iPhi[iTrack] = aTrack->Phi();

    if (fUseWeightsNUE) {iEffCorr = aTrack->GetTrackEff();}
    if (fUseWeightsNUA) {iPhiModuleCorr = aTrack->GetWeight();}
    if (fDebugLevel > 10) printf("iEffCorr: %.6f iPhiModuleCorr: %.6f \n", iEffCorr, iPhiModuleCorr);
    iWeights[iTrack] = (1.0/iEffCorr)/iPhiModuleCorr;

    fHistoPt[fCentralityBin]->Fill(aTrack->Pt(), (1./iEffCorr));
    fHistoEta[fCentralityBin]->Fill(iEta[iTrack]);
    fHistoPhi[fCentralityBin]->Fill(iPhi[iTrack], (1./iPhiModuleCorr));
    fHistoCharge[fCentralityBin]->Fill(aTrack->GetCharge());
{'fraction_non_alphanumeric': 0.22688530665184362, 'fraction_numerical': 0.013340744858254585, 'mean_word_length': 2.6408094435075884, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5321918', 'n_tokens_mistral': 3447, 'n_tokens_neox': 3365, 'n_words': 728}