<commit_before>#ifndef FT2_H
#define FT2_H
#include <TObject.h>
#include <TBits.h>
#include "AliExternalTrackParam.h"
#include "AliITSUAux.h"
#include "AliESDpid.h"
#include "AliPIDResponse.h"
#include "AliITSURecoLayer.h"

//#define DEBUG 11
//#define DEBUG 1

class AliITSUReconstructor;
class AliITSURecoDet;
class AliITSURecoSens;
class TParticle;
class AliVertex;

const float kRidiculous = 999999;
const float kMaxZTPC = 250;
const double kTrackToler = 1.e-6; // tracking tolerance

class FTProbe : public AliExternalTrackParam
{
 public:
  FTProbe(){};
  virtual ~FTProbe(){};
  virtual Double_t GetTPCmomentum() const {return fTPCmomentum;}
  virtual Double_t GetTPCsignal() const {return fTPCSignal;}
  virtual UShort_t GetTPCsignalN() const {return fTPCSignalN;}
  virtual Int_t GetTPCTrackingPID() const {return fAbsPdgCodeForTracking;}
	
 protected:
  Double_t fProbeMass;	// true mass
  Double_t fTPCmomentum;	// momentum after TPC reconstruction
  Double_t fTPCSignal;	// TPC signal
  UShort_t fTPCSignalN;
  Double_t fAbsPdgCode;	// pdg code of particle
  Int_t fAbsPdgCodeForTracking;
  ClassDef(FTProbe,1)
};


class FT2 : public TObject
{
 public:
  enum {kMaxITSLr=7, kMaxHitPerLr=2};
  struct FT2TPCLayer {
  FT2TPCLayer(int id=-1,float xr=0,float x2x=0,float resRPhi=0,float resZ=0,float effL=0) :
    rowId(id),x(xr),x2x0(x2x),rphiRes(resRPhi),zRes(resZ),eff(effL),isDead(resRPhi>kRidiculous||resZ>kRidiculous),
      hitY(0),hitZ(0),hitSect(-1) {if (isDead) effL=-1;}
    Int_t    rowId;
    Float_t  x;
    Float_t  x2x0;
    Float_t  rphiRes;
    Float_t  zRes;
    Float_t  eff;
    Bool_t   isDead;
    //
    Float_t  hitY;
    Float_t  hitZ;
    Float_t  hitSect;
  };
  typedef struct FT2TPCLayer FT2TPCLayer_t;
	
	
  FT2();
  virtual ~FT2();
	
  void InitEnvLocal();
  void InitTPCSignalFiles(const char *TPCsignalElectrons,const char *TPCsignalMuons,const char *TPCsignalPions,const char *TPCsignalKaons,const char *TPCsignalProtons);
  void InitTPCPIDResponse();
  void InitDetector(Bool_t addTPC=kTRUE, Float_t sigYTPC=0.1, Float_t sigZTPC=0.1,
		    Float_t effTPC=0.99, Float_t scEdge=2.6);
  //
  void PrintLayout();
  //
  Bool_t ProcessTrack(TParticle* trc, AliVertex* vtx);
  void   SetSimMat(Bool_t v=kTRUE) {fSimMat = v;}
  void   SetMinTPCHits(int v=60)  {fMinTPCHits=v;}
  void   SetMinITSLrHit(int v=4)  {fMinITSLrHit=v;}
  void   SetUsePIDForTracking(Bool_t usePID) {fUsePIDForTracking=usePID;}
  //
  Int_t    GetNClITSFakes()  const {return fNClITSFakes;}
  Int_t    GetNClITS()  const {return fNClITS;}
  Int_t    GetNClTPC()  const {return fNClTPC;}
  Double_t GetChi2ITS() const {return fChi2ITS;}
  Double_t GetChi2TPC() const {return fChi2TPC;}
  const TBits&   GetTPCHitMap() const {return fTPCMap;}
  FTProbe& GetProbe() const {return (FTProbe&)fProbe;}
  AliExternalTrackParam& GetKalmanOut(int i) {return (AliExternalTrackParam&)fKalmanOutward[i];}
  void   SetUseKalmanOut(Bool_t v=kTRUE)  {fUseKalmanOut = v;}
  Bool_t GetUseKalmanOut()   const {return fUseKalmanOut;}
  //
  const Double_t* GetDCA()    const {return &fDCA[0];}
  const Double_t* GetDCACov() const {return &fDCACov[0];}
  static float GetMaxStepTGeo() {return fgMaxStepTGeo;}
  static void  SetMaxStepTGeo(float stp=1.) {fgMaxStepTGeo = stp;}
  //
  void     SetAllocCorrelatedITSFakes(Bool_t v=kTRUE) {fAllocCorrelatedITSFakes=v;}
  Bool_t   GetAllocCorrelatedITSFakes()               {return fAllocCorrelatedITSFakes;}
  //
  Double_t GetNCorrelITSFakes(Int_t lr) const         {return fNCorrelITSFakes[lr];}
  Double_t GetCorrelITSFakesSigY(Int_t lr) const      {return fCorrelITSFakesSigY[lr];}
  Double_t GetCorrelITSFakesSigZ(Int_t lr) const      {return fCorrelITSFakesSigZ[lr];}
  //
  void     SetNCorrelITSFakes(Int_t lr, double v)     {fNCorrelITSFakes[lr] = v;}
  void     SetCorrelITSFakesSigY(Int_t lr, double v)  {fCorrelITSFakesSigY[lr] = v;}
  void     SetCorrelITSFakesSigZ(Int_t lr, double v)  {fCorrelITSFakesSigZ[lr] = v;}
  //
  void     SetdNdY(double v=-1) {fdNdY = v;}
  Double_t GetdNdY() const {return fdNdY;}
  Double_t HitDensity(double r2, double tgl) const;
  Bool_t   BiasAsFake(double yz[2], const double* extyz, const double *cov) const;
  Bool_t DiagonalizeErrors(const double *cov, double &sy2d, double &sz2d);
  Int_t  GetITSPattern() const {return fITSPattern;}
  Int_t  GetITSPatternFakes() const {return fITSPatternFake;}
  //
 protected:
  void AddTPC(Float_t sigY=0.1, Float_t sigZ=0.1, Float_t eff=0.99, Float_t scEdge=2.6);
  void AddTPCLayer(Int_t rowID, Float_t x, Float_t x2x0,Float_t sigY, Float_t sigZ, Float_t eff);
  Bool_t InitProbe(TParticle* trc);
  Bool_t MakeITSKalmanOut();
  Bool_t PrepareProbe();
  Bool_t ApplyMSEloss(double x2X0, double xrho);
  Bool_t PropagateToX(double xTgt, int dir,Bool_t propErr,Bool_t simMat,Bool_t useTGeo);
  Bool_t PropagateToR(double xTgt, int dir,Bool_t propErr,Bool_t simMat,Bool_t useTGeo);
  Bool_t IsZero(double val, double tol=1e-9) const {return TMath::Abs(val)<tol;}
  Bool_t PassActiveITSLayer(AliITSURecoLayer* lr);
  Bool_t GetRoadWidth(AliITSURecoLayer* lrA,double *pr,Int_t nstd = 3);
  void   ResetCovMat(AliExternalTrackParam* trc);
  Double_t UpdateKalman(AliExternalTrackParam* trc, double y,double z,double sigY,double sigZ,
			Bool_t randomize=kTRUE,double scly=1.,double sclz=1.);
  const AliExternalTrackParam* GetSmoothedEstimate(int ilr,const AliExternalTrackParam* trcInw, double* trPos,double* trCov);
  Int_t  ReconstructOnITSLayer(int ilr, double chi2Cut=70.);

  Bool_t ReconstructProbe();<commit_msg>getted added<commit_after>#ifndef FT2_H
#define FT2_H
#include <TObject.h>
#include <TBits.h>
#include "AliExternalTrackParam.h"
#include "AliITSUAux.h"
#include "AliESDpid.h"
#include "AliPIDResponse.h"
#include "AliITSURecoLayer.h"

//#define DEBUG 11
//#define DEBUG 1

class AliITSUReconstructor;
class AliITSURecoDet;
class AliITSURecoSens;
class TParticle;
class AliVertex;

const float kRidiculous = 999999;
const float kMaxZTPC = 250;
const double kTrackToler = 1.e-6; // tracking tolerance

class FTProbe : public AliExternalTrackParam
{
 public:
  FTProbe(){};
  virtual ~FTProbe(){};
  virtual Double_t GetTPCmomentum() const {return fTPCmomentum;}
  virtual Double_t GetTPCsignal() const {return fTPCSignal;}
  virtual UShort_t GetTPCsignalN() const {return fTPCSignalN;}
  virtual Int_t GetTPCTrackingPID() const {return fAbsPdgCodeForTracking;}
	
 protected:
  Double_t fProbeMass;	// true mass
  Double_t fTPCmomentum;	// momentum after TPC reconstruction
  Double_t fTPCSignal;	// TPC signal
  UShort_t fTPCSignalN;
  Double_t fAbsPdgCode;	// pdg code of particle
  Int_t fAbsPdgCodeForTracking;
  ClassDef(FTProbe,1)
};


class FT2 : public TObject
{
 public:
  enum {kMaxITSLr=7, kMaxHitPerLr=2};
  struct FT2TPCLayer {
  FT2TPCLayer(int id=-1,float xr=0,float x2x=0,float resRPhi=0,float resZ=0,float effL=0) :
    rowId(id),x(xr),x2x0(x2x),rphiRes(resRPhi),zRes(resZ),eff(effL),isDead(resRPhi>kRidiculous||resZ>kRidiculous),
      hitY(0),hitZ(0),hitSect(-1) {if (isDead) effL=-1;}
    Int_t    rowId;
    Float_t  x;
    Float_t  x2x0;
    Float_t  rphiRes;
    Float_t  zRes;
    Float_t  eff;
    Bool_t   isDead;
    //
    Float_t  hitY;
    Float_t  hitZ;
    Float_t  hitSect;
  };
  typedef struct FT2TPCLayer FT2TPCLayer_t;
	
	
  FT2();
  virtual ~FT2();
	
  void InitEnvLocal();
  void InitTPCSignalFiles(const char *TPCsignalElectrons,const char *TPCsignalMuons,const char *TPCsignalPions,const char *TPCsignalKaons,const char *TPCsignalProtons);
  void InitTPCPIDResponse();
  void InitDetector(Bool_t addTPC=kTRUE, Float_t sigYTPC=0.1, Float_t sigZTPC=0.1,
		    Float_t effTPC=0.99, Float_t scEdge=2.6);
  //
  void PrintLayout();
  //
  Bool_t ProcessTrack(TParticle* trc, AliVertex* vtx);
  void   SetSimMat(Bool_t v=kTRUE) {fSimMat = v;}
  void   SetMinTPCHits(int v=60)  {fMinTPCHits=v;}
  void   SetMinITSLrHit(int v=4)  {fMinITSLrHit=v;}
  void   SetUsePIDForTracking(Bool_t usePID) {fUsePIDForTracking=usePID;}
  //
  Int_t    GetNClITSFakes()  const {return fNClITSFakes;}
  Int_t    GetNClITS()  const {return fNClITS;}
  Int_t    GetNClTPC()  const {return fNClTPC;}
  Double_t GetChi2ITS() const {return fChi2ITS;}
  Double_t GetChi2TPC() const {return fChi2TPC;}
  const TBits&   GetTPCHitMap() const {return fTPCMap;}
  FTProbe& GetProbe() const {return (FTProbe&)fProbe;}
  AliExternalTrackParam& GetKalmanOut(int i) {return (AliExternalTrackParam&)fKalmanOutward[i];}
  void   SetUseKalmanOut(Bool_t v=kTRUE)  {fUseKalmanOut = v;}
  Bool_t GetUseKalmanOut()   const {return fUseKalmanOut;}
  //
  const Double_t* GetDCA()    const {return &fDCA[0];}
  const Double_t* GetDCACov() const {return &fDCACov[0];}
  static float GetMaxStepTGeo() {return fgMaxStepTGeo;}
  static void  SetMaxStepTGeo(float stp=1.) {fgMaxStepTGeo = stp;}
  //
  void     SetAllocCorrelatedITSFakes(Bool_t v=kTRUE) {fAllocCorrelatedITSFakes=v;}
  Bool_t   GetAllocCorrelatedITSFakes()               {return fAllocCorrelatedITSFakes;}
  //
  Double_t GetNCorrelITSFakes(Int_t lr) const         {return fNCorrelITSFakes[lr];}
  Double_t GetCorrelITSFakesSigY(Int_t lr) const      {return fCorrelITSFakesSigY[lr];}
  Double_t GetCorrelITSFakesSigZ(Int_t lr) const      {return fCorrelITSFakesSigZ[lr];}
  //
  void     SetNCorrelITSFakes(Int_t lr, double v)     {fNCorrelITSFakes[lr] = v;}
  void     SetCorrelITSFakesSigY(Int_t lr, double v)  {fCorrelITSFakesSigY[lr] = v;}
  void     SetCorrelITSFakesSigZ(Int_t lr, double v)  {fCorrelITSFakesSigZ[lr] = v;}
  //
  void     SetdNdY(double v=-1) {fdNdY = v;}
  Double_t GetdNdY() const {return fdNdY;}
  Double_t HitDensity(double r2, double tgl) const;
  Bool_t   BiasAsFake(double yz[2], const double* extyz, const double *cov) const;
  Bool_t DiagonalizeErrors(const double *cov, double &sy2d, double &sz2d);
  Int_t  GetITSPattern() const {return fITSPattern;}
  Int_t  GetITSPatternFakes() const {return fITSPatternFake;}
  //
  Double_t GetITSRMin() {return fITS->GetRMin();}
  //
 protected:
  void AddTPC(Float_t sigY=0.1, Float_t sigZ=0.1, Float_t eff=0.99, Float_t scEdge=2.6);
  void AddTPCLayer(Int_t rowID, Float_t x, Float_t x2x0,Float_t sigY, Float_t sigZ, Float_t eff);
  Bool_t InitProbe(TParticle* trc);
  Bool_t MakeITSKalmanOut();
  Bool_t PrepareProbe();
  Bool_t ApplyMSEloss(double x2X0, double xrho);
  Bool_t PropagateToX(double xTgt, int dir,Bool_t propErr,Bool_t simMat,Bool_t useTGeo);
  Bool_t PropagateToR(double xTgt, int dir,Bool_t propErr,Bool_t simMat,Bool_t useTGeo);
  Bool_t IsZero(double val, double tol=1e-9) const {return TMath::Abs(val)<tol;}
  Bool_t PassActiveITSLayer(AliITSURecoLayer* lr);
  Bool_t GetRoadWidth(AliITSURecoLayer* lrA,double *pr,Int_t nstd = 3);
  void   ResetCovMat(AliExternalTrackParam* trc);
  Double_t UpdateKalman(AliExternalTrackParam* trc, double y,double z,double sigY,double sigZ,
			Bool_t randomize=kTRUE,double scly=1.,double sclz=1.);
  const AliExternalTrackParam* GetSmoothedEstimate(int ilr,const AliExternalTrackParam* trcInw, double* trPos,double* trCov);
  Int_t  ReconstructOnITSLayer(int ilr, double chi2Cut=70.);

  Bool_t ReconstructProbe();
{'fraction_non_alphanumeric': 0.10814934482139651, 'fraction_numerical': 0.015616585891222402, 'mean_word_length': 4.978004291845494, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 12, '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': '3908980', 'n_tokens_mistral': 4642, 'n_tokens_neox': 4491, 'n_words': 942}