<commit_before>/**************************************************************************
 * Copyright(c) 1998-1999, 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.                  *
 **************************************************************************/

// The class AliCFTrackQualityCuts is designed to select reconstructed tracks
// of high quality and to provide corresponding QA histograms.
// This class inherits from the Analysis' Framework abstract base class
// AliAnalysisCuts and is a part of the Correction Framework.
// This class acts on single, reconstructed tracks, it is applicable on
// ESD and AOD data.
// It mainly consists of a IsSelected function that returns a boolean.
// This function checks whether the considered track passes a set of cuts:
// - number of clusters in the TPC
// - number of clusters in the ITS
// - chi2 / cluster in the TPC
// - chi2 / cluster in the ITS
// - successful TPC refit
// - successful ITS refit
// - covariance matrix diagonal elements
//
// The cut values for these cuts are set with the corresponding set functions.
// All cut classes provided by the correction framework are supposed to be
// added in the Analysis Framwork's class AliAnalysisFilter and applied by
// the filter via a loop.
//
// author: <NAME> (<EMAIL>)
// idea taken form
// AliESDtrackCuts writte by <NAME> and
// AliRsnDaughterCut class written by <NAME>.

#ifndef ALICFTRACKQUALITYCUTS_H
#define ALICFTRACKQUALITYCUTS_H

#include "AliCFCutBase.h"

class TH2;
class TBits;
class AliESDtrack ;

class AliCFTrackQualityCuts : public AliCFCutBase
{
 public :
  AliCFTrackQualityCuts() ;
  AliCFTrackQualityCuts(Char_t* name, Char_t* title) ;
  AliCFTrackQualityCuts(const AliCFTrackQualityCuts& c) ;
  AliCFTrackQualityCuts& operator=(const AliCFTrackQualityCuts& c) ;
  ~AliCFTrackQualityCuts();
  void Copy(TObject &c) const;

  void GetBitMap(TObject* obj, TBits *bitmap) ;
  Bool_t IsSelected(TObject* obj);
  void Init();

  // cut value setter
  void SetMinNClusterTPC(Int_t cluster=-1)		{fMinNClusterTPC = cluster;}
  void SetMinNClusterITS(Int_t cluster=-1)		{fMinNClusterITS = cluster;}
  void SetMaxChi2PerClusterTPC(Double_t chi=1e99)	{fMaxChi2PerClusterTPC = chi;}
  void SetMaxChi2PerClusterITS(Double_t chi=1e99)	{fMaxChi2PerClusterITS = chi;}
  void SetRequireTPCRefit(Bool_t b=kFALSE)		{fRequireTPCRefit = b;}
  void SetRequireITSRefit(Bool_t b=kFALSE)		{fRequireITSRefit = b;}
  void SetMaxCovDiagonalElements(Float_t c1=1e99, Float_t c2=1e99, Float_t c3=1e99, Float_t c4=1e99, Float_t c5=1e99) 
{fCovariance11Max=c1;fCovariance22Max=c2;fCovariance33Max=c3;fCovariance44Max=c4;fCovariance55Max=c5;}

  // QA histograms
  void FillHistogramsBeforeCuts(TObject* obj) {return FillHistograms(obj,kFALSE);}
  void FillHistogramsAfterCuts(TObject* obj)  {return FillHistograms(obj,kTRUE);}
  void DrawHistograms(Bool_t drawLogScale=kTRUE);
  void SaveHistograms(const Char_t* dir = 0);
  void AddQAHistograms(TList *qaList) const;
  // QA histogram setter
  // please use indices from the enumeration below
  void SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins);
  void SetHistogramBins(Int_t index, Int_t nbins, Double_t xmin, Double_t xmax);

  // indeces/counters for single selections
  enum { 
    kCutClusterTPC=0,	// number of clusters in TPC
    kCutClusterITS,	// number of clusters in ITS
    kCutChi2TPC,	// chi2 per cluster in TPC
    kCutChi2ITS,	// chi2 per cluster in ITS
    kCutRefitTPC,	// require TPC refit
    kCutRefitITS,	// require ITS refit
    kCutCovElement11,	// diagonal element 11 of covariance matrix
    kCutCovElement22,	// diagonal element 22 of covariance matrix
    kCutCovElement33,	// diagonal element 33 of covariance matrix
    kCutCovElement44,	// diagonal element 44 of covariance matrix
    kCutCovElement55,	// diagonal element 55 of covariance matrix
    kNCuts=11,		// number of single selections
    kNStepQA=2,		// number of QA steps (before/after the cuts)
    kNHist=11		// number of QA histograms
  };

 private:
  TBits* SelectionBitMap(TObject* obj);
  void DefineHistograms(); 		// books histograms and TList
  void Initialise();			// sets everything to 0
  void FillHistograms(TObject* obj, Bool_t b);
					// Fills histograms before and after cuts
  Double_t fMinNClusterTPC;		// min number of clusters in TPC
  Double_t fMinNClusterITS;		// min number of clusters in ITS
  Double_t fMaxChi2PerClusterTPC;	// max chi2 per clusters in TPC
  Double_t fMaxChi2PerClusterITS;	// max chi2 per clusters in ITS
  Bool_t fRequireTPCRefit;		// require TPC refit
  Bool_t fRequireITSRefit;		// require ITS refit

  Double_t fCovariance11Max ;		// max covariance matrix element 11
  Double_t fCovariance22Max ;		// max covariance matrix element 22
  Double_t fCovariance33Max ;		// max covariance matrix element 33
  Double_t fCovariance44Max ;		// max covariance matrix element 44
  Double_t fCovariance55Max ;		// max covariance matrix element 55

  TH1F* fhCutStatistics;              // Histogram: statistics of what cuts the tracks did not survive
  TH2F* fhCutCorrelation;             // Histogram: 2d statistics plot

  TH1F* fhQA[kNHist][kNStepQA];		// QA Histograms
  TBits *fBitmap ; 				// stores single selection decisions

  // QA histogram setters
  Int_t fhNBinsClusterTPC;		// number of bins: cluster TPC
  Int_t fhNBinsClusterITS;		// number of bins: cluster ITS
  Int_t fhNBinsChi2TPC;			// number of bins: chi2 per cluster TPC
  Int_t fhNBinsChi2ITS;			// number of bins: chi2 per cluster ITS
  Int_t fhNBinsRefitTPC;			// number of bins: require refit TPC
  Int_t fhNBinsRefitITS;			// number of bins: require refit ITS  
  Int_t fhNBinsCovariance11;		// number of bins: covariance matrix element 11
  Int_t fhNBinsCovariance22;		// number of bins: covariance matrix element 22
  Int_t fhNBinsCovariance33;		// number of bins: covariance matrix element 33
  Int_t fhNBinsCovariance44;		// number of bins: covariance matrix element 44
  Int_t fhNBinsCovariance55;		// number of bins: covariance matrix element 55
  
  Double_t *fhBinLimClusterTPC;	// bin limits: cluster TPC
  Double_t *fhBinLimClusterITS;	// bin limits: cluster ITS
  Double_t *fhBinLimChi2TPC;	// bin limits: chi2 per cluster TPC
  Double_t *fhBinLimChi2ITS;	// bin limits: chi2 per cluster ITS
  Double_t *fhBinLimRefitTPC;	// bin limits: require refit TPC
  Double_t *fhBinLimRefitITS;	// bin limits: require refit ITS
  Double_t *fhBinLimCovariance11;	// bin limits: covariance matrix element 11
  Double_t *fhBinLimCovariance22;	// bin limits: covariance matrix element 22
  Double_t *fhBinLimCovariance33;	// bin limits: covariance matrix element 33
  Double_t *fhBinLimCovariance44;	// bin limits: covariance matrix element 44
  Double_t *fhBinLimCovariance55;	// bin limits: covariance matrix element 55
  
  ClassDef(AliCFTrackQualityCuts,1);
};

#endif
<commit_msg>some cleanup+ fix QA histos (I.Kraus)<commit_after>/**************************************************************************
 * Copyright(c) 1998-1999, 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.                  *
 **************************************************************************/

// The class AliCFTrackQualityCuts is designed to select reconstructed tracks
// of high quality and to provide corresponding QA histograms.
// This class inherits from the Analysis' Framework abstract base class
// AliAnalysisCuts and is a part of the Correction Framework.
// This class acts on single, reconstructed tracks, it is applicable on
// ESD and AOD data.
// It mainly consists of a IsSelected function that returns a boolean.
// This function checks whether the considered track passes a set of cuts:
// - number of clusters in the TPC
// - number of clusters in the ITS
// - chi2 / cluster in the TPC
// - chi2 / cluster in the ITS
// - successful TPC refit
// - successful ITS refit
// - covariance matrix diagonal elements
//
// The cut values for these cuts are set with the corresponding set functions.
// All cut classes provided by the correction framework are supposed to be
// added in the Analysis Framwork's class AliAnalysisFilter and applied by
// the filter via a loop.
//
// author: <NAME> (<EMAIL>)
// idea taken form
// AliESDtrackCuts writte by <NAME> and
// AliRsnDaughterCut class written by <NAME>.

#ifndef ALICFTRACKQUALITYCUTS_H
#define ALICFTRACKQUALITYCUTS_H

#include "AliCFCutBase.h"

class TH2 ;
class TBits;
class AliESDtrack ;

class AliCFTrackQualityCuts : public AliCFCutBase
{
 public :
  AliCFTrackQualityCuts() ;
  AliCFTrackQualityCuts(Char_t* name, Char_t* title) ;
  AliCFTrackQualityCuts(const AliCFTrackQualityCuts& c) ;
  AliCFTrackQualityCuts& operator=(const AliCFTrackQualityCuts& c) ;
  ~AliCFTrackQualityCuts();
  void Copy(TObject &c) const;

  void GetBitMap(TObject* obj, TBits *bitmap) ;
  Bool_t IsSelected(TObject* obj);
  void Init();

  // cut value setter
  void SetMinNClusterTPC(Int_t cluster=-1)		{fMinNClusterTPC = cluster;}
  void SetMinNClusterITS(Int_t cluster=-1)		{fMinNClusterITS = cluster;}
  void SetMaxChi2PerClusterTPC(Double_t chi=1e99)	{fMaxChi2PerClusterTPC = chi;}
  void SetMaxChi2PerClusterITS(Double_t chi=1e99)	{fMaxChi2PerClusterITS = chi;}
  void SetRequireTPCRefit(Bool_t b=kFALSE)		{fRequireTPCRefit = b;}
  void SetRequireITSRefit(Bool_t b=kFALSE)		{fRequireITSRefit = b;}
  void SetMaxCovDiagonalElements(Float_t c1=1e99, Float_t c2=1e99, Float_t c3=1e99, Float_t c4=1e99, Float_t c5=1e99) 
{fCovariance11Max=c1;fCovariance22Max=c2;fCovariance33Max=c3;fCovariance44Max=c4;fCovariance55Max=c5;}

  // QA histograms
  void FillHistogramsBeforeCuts(TObject* obj) {return FillHistograms(obj,kFALSE);}
  void FillHistogramsAfterCuts(TObject* obj)  {return FillHistograms(obj,kTRUE);}
  void DrawHistograms(Bool_t drawLogScale=kTRUE);
  void SaveHistograms(const Char_t* dir = 0);
  void AddQAHistograms(TList *qaList) const;
  // QA histogram setter
  // please use indices from the enumeration below
  void SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins);
  void SetHistogramBins(Int_t index, Int_t nbins, Double_t xmin, Double_t xmax);

  // indeces/counters for single selections
  enum { 
    kCutClusterTPC=0,	// number of clusters in TPC
    kCutClusterITS,	// number of clusters in ITS
    kCutChi2TPC,	// chi2 per cluster in TPC
    kCutChi2ITS,	// chi2 per cluster in ITS
    kCutRefitTPC,	// require TPC refit
    kCutRefitITS,	// require ITS refit
    kCutCovElement11,	// diagonal element 11 of covariance matrix
    kCutCovElement22,	// diagonal element 22 of covariance matrix
    kCutCovElement33,	// diagonal element 33 of covariance matrix
    kCutCovElement44,	// diagonal element 44 of covariance matrix
    kCutCovElement55,	// diagonal element 55 of covariance matrix
    kNCuts=11,		// number of single selections
    kNStepQA=2,		// number of QA steps (before/after the cuts)
    kNHist=11		// number of QA histograms
  };

 private:
  TBits* SelectionBitMap(TObject* obj);
  void DefineHistograms(); 		// books histograms and TList
  void Initialise();			// sets everything to 0
  void FillHistograms(TObject* obj, Bool_t b);
					// Fills histograms before and after cuts
  Double_t fMinNClusterTPC;		// min number of clusters in TPC
  Double_t fMinNClusterITS;		// min number of clusters in ITS
  Double_t fMaxChi2PerClusterTPC;	// max chi2 per clusters in TPC
  Double_t fMaxChi2PerClusterITS;	// max chi2 per clusters in ITS
  Bool_t fRequireTPCRefit;		// require TPC refit
  Bool_t fRequireITSRefit;		// require ITS refit

  Double_t fCovariance11Max ;		// max covariance matrix element 11
  Double_t fCovariance22Max ;		// max covariance matrix element 22
  Double_t fCovariance33Max ;		// max covariance matrix element 33
  Double_t fCovariance44Max ;		// max covariance matrix element 44
  Double_t fCovariance55Max ;		// max covariance matrix element 55

  TH1F* fhCutStatistics;		// Histogram: statistics of what cuts the tracks did not survive
  TH2F* fhCutCorrelation;		// Histogram: 2d statistics plot

  TH1F* fhQA[kNHist][kNStepQA];		// QA Histograms
  TBits *fBitmap ; 			// stores single selection decisions

  // QA histogram setters
  Int_t fhNBinsClusterTPC;		// number of bins: cluster TPC
  Int_t fhNBinsClusterITS;		// number of bins: cluster ITS
  Int_t fhNBinsChi2TPC;			// number of bins: chi2 per cluster TPC
  Int_t fhNBinsChi2ITS;			// number of bins: chi2 per cluster ITS
  Int_t fhNBinsRefitTPC;		// number of bins: require refit TPC
  Int_t fhNBinsRefitITS;		// number of bins: require refit ITS  
  Int_t fhNBinsCovariance11;		// number of bins: covariance matrix element 11
  Int_t fhNBinsCovariance22;		// number of bins: covariance matrix element 22
  Int_t fhNBinsCovariance33;		// number of bins: covariance matrix element 33
  Int_t fhNBinsCovariance44;		// number of bins: covariance matrix element 44
  Int_t fhNBinsCovariance55;		// number of bins: covariance matrix element 55

  Double_t *fhBinLimClusterTPC;	//[fhNBinsClusterTPC] bin limits: cluster TPC
  Double_t *fhBinLimClusterITS;	//[fhNBinsClusterITS] bin limits: cluster ITS
  Double_t *fhBinLimChi2TPC;	//[fhNBinsChi2TPC] bin limits: chi2 per cluster TPC
  Double_t *fhBinLimChi2ITS;	//[fhNBinsChi2ITS] bin limits: chi2 per cluster ITS
  Double_t *fhBinLimRefitTPC;	//[fhNBinsRefitTPC] bin limits: require refit TPC
  Double_t *fhBinLimRefitITS;	//[fhNBinsRefitITS] bin limits: require refit ITS
  Double_t *fhBinLimCovariance11;//[fhNBinsCovariance11] bin limits: covariance matrix element 11
  Double_t *fhBinLimCovariance22;//[fhNBinsCovariance22] bin limits: covariance matrix element 22
  Double_t *fhBinLimCovariance33;//[fhNBinsCovariance33] bin limits: covariance matrix element 33
  Double_t *fhBinLimCovariance44;//[fhNBinsCovariance44] bin limits: covariance matrix element 44
  Double_t *fhBinLimCovariance55;//[fhNBinsCovariance55] bin limits: covariance matrix element 55

  ClassDef(AliCFTrackQualityCuts,2);
};

#endif

{'fraction_non_alphanumeric': 0.09007388371345969, 'fraction_numerical': 0.022229360745261804, 'mean_word_length': 3.6590841065549236, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3077479', 'n_tokens_mistral': 5441, 'n_tokens_neox': 4822, 'n_words': 1605}