ROOT logo
/**************************************************************************
* 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.                  *
**************************************************************************/
//
// PID Response class for the TRD detector
// Based on 1D Likelihood approach
// For further information see implementation file
//
#ifndef ALITRDPIDRESPONSE_H
#define ALITRDPIDRESPONSE_H

#ifndef ROOT_TObject
#include <TObject.h>
#endif

#ifndef ALIPID_H
#include "AliPID.h"
#endif

class TObjArray;
class AliVTrack;
class AliTRDPIDResponseObject;
class AliTRDdEdxParams;

class AliTRDPIDResponse : public TObject {
  public:
    enum ETRDPIDResponseStatus {
      kIsOwner = BIT(14)
    };
    enum ETRDPIDResponseDef {
	kNlayer = 6
       ,kNPBins = 6
    };
    enum ETRDPIDMethod {
	kNN   = 0,
	kLQ2D = 1,
	kLQ1D = 2
    };
    enum ETRDPIDNMethod {
	kNMethod=3
    };
    enum ETRDNslices {
	kNslicesLQ1D = 1,
	kNslicesLQ2D = 2,
	kNslicesNN = 7
    };
    AliTRDPIDResponse();
    AliTRDPIDResponse(const AliTRDPIDResponse &ref);
    AliTRDPIDResponse& operator=(const AliTRDPIDResponse &ref);
    ~AliTRDPIDResponse();
    
    Double_t GetNumberOfSigmas(const AliVTrack *track, AliPID::EParticleType type) const;
    Double_t GetSignalDelta( const AliVTrack* track, AliPID::EParticleType type, Bool_t ratio=kFALSE, Double_t *info=0x0) const;
    static Double_t MeandEdx(const Double_t * xx, const Float_t * par);
    static Double_t MeanTR(const Double_t * xx, const Float_t * par);
    static Double_t MeandEdxTR(const Double_t * xx, const Float_t * par);
    static Double_t ResolutiondEdxTR(const Double_t * xx,  const Float_t * par);

    Int_t    GetResponse(Int_t n, const Double_t * const dedx, const Float_t * const p, Double_t prob[AliPID::kSPECIES],ETRDPIDMethod PIDmethod=kLQ1D, Bool_t kNorm=kTRUE) const;
    inline ETRDNslices  GetNumberOfSlices(ETRDPIDMethod PIDmethod=kLQ1D) const;
    
    Bool_t    IsOwner() const {return TestBit(kIsOwner);}
    
    void      SetOwner();
    void      SetGainNormalisationFactor(Double_t gainFactor) { fGainNormalisationFactor = gainFactor; }

    Bool_t SetPIDResponseObject(const AliTRDPIDResponseObject * obj);
    Bool_t SetdEdxParams(const AliTRDdEdxParams * par);
    
    Bool_t    Load(const Char_t *filename = NULL);
  
    Bool_t    IdentifiedAsElectron(Int_t nTracklets, const Double_t *like, Double_t p, Double_t level,Double_t centrality=-1,ETRDPIDMethod PIDmethod=kLQ1D) const;
  
  private:
    Bool_t    CookdEdx(Int_t nSlice, const Double_t * const in, Double_t *out,ETRDPIDMethod PIDmethod=kLQ1D) const;
    Double_t  GetProbabilitySingleLayer(Int_t species, Double_t plocal, Double_t *dEdx,ETRDPIDMethod PIDmethod=kLQ1D) const;
    
    const AliTRDPIDResponseObject *fkPIDResponseObject;   // PID References and Params
    const AliTRDdEdxParams * fkTRDdEdxParams; //parametrisation for truncated mean
    Double_t  fGainNormalisationFactor;         // Gain normalisation factor
  
  ClassDef(AliTRDPIDResponse, 3)    // Tool for TRD PID
};

AliTRDPIDResponse::ETRDNslices AliTRDPIDResponse::GetNumberOfSlices(ETRDPIDMethod PIDmethod) const {
  // Get the current number of slices
  ETRDNslices slices = kNslicesLQ1D;
  switch(PIDmethod){
    case kLQ1D: slices = kNslicesLQ1D; break;
    case kLQ2D: slices = kNslicesLQ2D; break;
    case kNN:   slices = kNslicesNN; break;
  };
  return slices;
}
#endif

 AliTRDPIDResponse.h:1
 AliTRDPIDResponse.h:2
 AliTRDPIDResponse.h:3
 AliTRDPIDResponse.h:4
 AliTRDPIDResponse.h:5
 AliTRDPIDResponse.h:6
 AliTRDPIDResponse.h:7
 AliTRDPIDResponse.h:8
 AliTRDPIDResponse.h:9
 AliTRDPIDResponse.h:10
 AliTRDPIDResponse.h:11
 AliTRDPIDResponse.h:12
 AliTRDPIDResponse.h:13
 AliTRDPIDResponse.h:14
 AliTRDPIDResponse.h:15
 AliTRDPIDResponse.h:16
 AliTRDPIDResponse.h:17
 AliTRDPIDResponse.h:18
 AliTRDPIDResponse.h:19
 AliTRDPIDResponse.h:20
 AliTRDPIDResponse.h:21
 AliTRDPIDResponse.h:22
 AliTRDPIDResponse.h:23
 AliTRDPIDResponse.h:24
 AliTRDPIDResponse.h:25
 AliTRDPIDResponse.h:26
 AliTRDPIDResponse.h:27
 AliTRDPIDResponse.h:28
 AliTRDPIDResponse.h:29
 AliTRDPIDResponse.h:30
 AliTRDPIDResponse.h:31
 AliTRDPIDResponse.h:32
 AliTRDPIDResponse.h:33
 AliTRDPIDResponse.h:34
 AliTRDPIDResponse.h:35
 AliTRDPIDResponse.h:36
 AliTRDPIDResponse.h:37
 AliTRDPIDResponse.h:38
 AliTRDPIDResponse.h:39
 AliTRDPIDResponse.h:40
 AliTRDPIDResponse.h:41
 AliTRDPIDResponse.h:42
 AliTRDPIDResponse.h:43
 AliTRDPIDResponse.h:44
 AliTRDPIDResponse.h:45
 AliTRDPIDResponse.h:46
 AliTRDPIDResponse.h:47
 AliTRDPIDResponse.h:48
 AliTRDPIDResponse.h:49
 AliTRDPIDResponse.h:50
 AliTRDPIDResponse.h:51
 AliTRDPIDResponse.h:52
 AliTRDPIDResponse.h:53
 AliTRDPIDResponse.h:54
 AliTRDPIDResponse.h:55
 AliTRDPIDResponse.h:56
 AliTRDPIDResponse.h:57
 AliTRDPIDResponse.h:58
 AliTRDPIDResponse.h:59
 AliTRDPIDResponse.h:60
 AliTRDPIDResponse.h:61
 AliTRDPIDResponse.h:62
 AliTRDPIDResponse.h:63
 AliTRDPIDResponse.h:64
 AliTRDPIDResponse.h:65
 AliTRDPIDResponse.h:66
 AliTRDPIDResponse.h:67
 AliTRDPIDResponse.h:68
 AliTRDPIDResponse.h:69
 AliTRDPIDResponse.h:70
 AliTRDPIDResponse.h:71
 AliTRDPIDResponse.h:72
 AliTRDPIDResponse.h:73
 AliTRDPIDResponse.h:74
 AliTRDPIDResponse.h:75
 AliTRDPIDResponse.h:76
 AliTRDPIDResponse.h:77
 AliTRDPIDResponse.h:78
 AliTRDPIDResponse.h:79
 AliTRDPIDResponse.h:80
 AliTRDPIDResponse.h:81
 AliTRDPIDResponse.h:82
 AliTRDPIDResponse.h:83
 AliTRDPIDResponse.h:84
 AliTRDPIDResponse.h:85
 AliTRDPIDResponse.h:86
 AliTRDPIDResponse.h:87
 AliTRDPIDResponse.h:88
 AliTRDPIDResponse.h:89
 AliTRDPIDResponse.h:90
 AliTRDPIDResponse.h:91
 AliTRDPIDResponse.h:92
 AliTRDPIDResponse.h:93
 AliTRDPIDResponse.h:94
 AliTRDPIDResponse.h:95
 AliTRDPIDResponse.h:96
 AliTRDPIDResponse.h:97
 AliTRDPIDResponse.h:98
 AliTRDPIDResponse.h:99
 AliTRDPIDResponse.h:100
 AliTRDPIDResponse.h:101
 AliTRDPIDResponse.h:102
 AliTRDPIDResponse.h:103
 AliTRDPIDResponse.h:104
 AliTRDPIDResponse.h:105
 AliTRDPIDResponse.h:106
 AliTRDPIDResponse.h:107