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.                  *
**************************************************************************/
//
// Class for PID QA
// Several studies done on clean samples of electrons, pions and kaons
// coming from V0 PID
// More information can be found in the implementation file
//
#ifndef ALIHFEPIDQA_H
#define ALIHFEPIDQA_H

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

class TList;
class TObjArray;
class TPDGCode;
class TParticle;
class TFile;
class TMultiLayerPerceptron;

class AliAODTrack;
class AliESDtrack;
class AliMCEvent;
class AliVEvent;
class AliPIDResponse;
class AliExternalTrackParam;
class AliLog;

class AliHFEV0pidMC;
class AliHFEcollection;
class AliHFEtrdPIDqa;
class AliHFEV0pid;
class AliHFEpidTRD;


class AliHFEpidQA : public TObject{
  public:
    AliHFEpidQA();
    ~AliHFEpidQA();
    AliHFEpidQA(const AliHFEpidQA &ref);
    AliHFEpidQA &operator=(const AliHFEpidQA &ref);
    virtual void Copy(TObject &o) const;

    void Init();
    void Process();

    TList *GetOutput();
    TList *GetV0pidQA();
    TList *GetV0pidMC();

    Bool_t   HasV0pidQA() const { return TestBit(kV0pidQA); };
    Bool_t   HasRecalculateTRDpid() const { return TestBit(kRecalculateTRDpid); };

    void     SetEvent(AliVEvent* const ev) { fEvent = ev; };
    void     SetMCEvent(AliMCEvent * const mc) { fMC = mc; };
    void     SetV0pidQA(Bool_t v0pidQA = kTRUE) { SetBit(kV0pidQA, v0pidQA); };
    void     SetRecalculateTRDpid(Bool_t recal = kTRUE) { SetBit(kRecalculateTRDpid, recal); };
    void     SetTRDTotalChargeInSlice0() { fTRDTotalChargeInSlice0 = kTRUE; }

    void     SetPIDResponse(AliPIDResponse* const pid) { fESDpid = pid; }
    Float_t  TOFbeta(const AliESDtrack* const track) const;

    void     CheckEvent();
    void     SetNNref(TFile *f) { fNNref = f; };
    
    AliHFEtrdPIDqa *GetTRDQA() const { return fTRDpidQA; }

    Int_t GetCentrality(AliVEvent*  const fInputEvent);
    Int_t GetMultiplicityITS(AliVEvent*  const fInputEvent) const;
    void SetPbPb() { fIsPbPb = kTRUE; };
    void SetPP() { fIsPbPb = kFALSE; };
    void SetPPMultiBin() { fIsppMultiBin = kFALSE; };
    Bool_t IsPbPb() const { return fIsPbPb; };
    Bool_t IsPP() const { return !fIsPbPb; };
    Bool_t IsPPMultiBin() const { return fIsppMultiBin; };

  protected:
    enum{
      kV0pidQA = BIT(14),
      kRecalculateTRDpid = BIT(15)
    };
    enum{  // detectors for histogram names
      kITS = 0,
      kTPC = 1,
      kTRD = 2,
      kTOF = 3
    };

    TObjArray *MakeTrackList(const TObjArray *tracks) const;
    TObjArray *MakeCleanListElectrons(const TObjArray *tracks) const;

    void MakePurity(const TObjArray *tracks, Int_t species);
    TObjArray *MakeCleanListForTRD(const TObjArray * const track, Int_t species);
    void FillElectronLikelihoods(const TObjArray * const particles, Int_t species);
    void FillPIDresponse(const TObjArray * const particles, Int_t species);
    void FillIllumination(const TObjArray *const particles, Int_t species);
    void FillTPCinfo(AliESDtrack * const track, Int_t species);
    void TestTRDResponse(const TObjArray * const tracks, Int_t species);
    void RecalculateTRDpid(AliESDtrack *track, Double_t *pidProbs) const;
    void RecalculateTRDpid(AliAODTrack *track, Double_t *pidProbs) const;
    void CheckTenderV0pid(const TObjArray * const particles, Int_t species);
    Int_t GetTenderV0pid(AliESDtrack * const track);
    
    Double_t TRDlikeTracklet(Int_t layer, AliESDtrack * const track, Double_t *likelihood);
    Int_t TRDmomBin(Double_t p) const;




 protected:
    Int_t GetMaxPID(const Double_t *pidProbs) const;
    Int_t GetPDG(Int_t index);
    
  private:
    AliVEvent         *fEvent;        // event pointer
    AliMCEvent        *fMC;           // MC Event
    AliHFEV0pid       *fV0pid;        // V0 PID 
    AliHFEV0pidMC     *fV0pidMC;      // V0 MC PID
    AliHFEtrdPIDqa    *fTRDpidQA;     //! TRD PID QA object
    AliHFEcollection  *fOutput;       // Output container
    AliPIDResponse    *fESDpid;       // ESD PID object
 private:
    TFile             *fNNref;        // reference file for NN pid 
    TMultiLayerPerceptron *fNet[11];  //  reference networks
    Bool_t fTRDTotalChargeInSlice0;     // Fix for Foreward/Backward compatibility

    Bool_t             fIsPbPb;        // Analysis Type: pp or PbPb
    Bool_t             fIsppMultiBin;  // pp multiplicity bin analysis

  ClassDef(AliHFEpidQA, 1)            // PID QA tool
};
#endif
 AliHFEpidQA.h:1
 AliHFEpidQA.h:2
 AliHFEpidQA.h:3
 AliHFEpidQA.h:4
 AliHFEpidQA.h:5
 AliHFEpidQA.h:6
 AliHFEpidQA.h:7
 AliHFEpidQA.h:8
 AliHFEpidQA.h:9
 AliHFEpidQA.h:10
 AliHFEpidQA.h:11
 AliHFEpidQA.h:12
 AliHFEpidQA.h:13
 AliHFEpidQA.h:14
 AliHFEpidQA.h:15
 AliHFEpidQA.h:16
 AliHFEpidQA.h:17
 AliHFEpidQA.h:18
 AliHFEpidQA.h:19
 AliHFEpidQA.h:20
 AliHFEpidQA.h:21
 AliHFEpidQA.h:22
 AliHFEpidQA.h:23
 AliHFEpidQA.h:24
 AliHFEpidQA.h:25
 AliHFEpidQA.h:26
 AliHFEpidQA.h:27
 AliHFEpidQA.h:28
 AliHFEpidQA.h:29
 AliHFEpidQA.h:30
 AliHFEpidQA.h:31
 AliHFEpidQA.h:32
 AliHFEpidQA.h:33
 AliHFEpidQA.h:34
 AliHFEpidQA.h:35
 AliHFEpidQA.h:36
 AliHFEpidQA.h:37
 AliHFEpidQA.h:38
 AliHFEpidQA.h:39
 AliHFEpidQA.h:40
 AliHFEpidQA.h:41
 AliHFEpidQA.h:42
 AliHFEpidQA.h:43
 AliHFEpidQA.h:44
 AliHFEpidQA.h:45
 AliHFEpidQA.h:46
 AliHFEpidQA.h:47
 AliHFEpidQA.h:48
 AliHFEpidQA.h:49
 AliHFEpidQA.h:50
 AliHFEpidQA.h:51
 AliHFEpidQA.h:52
 AliHFEpidQA.h:53
 AliHFEpidQA.h:54
 AliHFEpidQA.h:55
 AliHFEpidQA.h:56
 AliHFEpidQA.h:57
 AliHFEpidQA.h:58
 AliHFEpidQA.h:59
 AliHFEpidQA.h:60
 AliHFEpidQA.h:61
 AliHFEpidQA.h:62
 AliHFEpidQA.h:63
 AliHFEpidQA.h:64
 AliHFEpidQA.h:65
 AliHFEpidQA.h:66
 AliHFEpidQA.h:67
 AliHFEpidQA.h:68
 AliHFEpidQA.h:69
 AliHFEpidQA.h:70
 AliHFEpidQA.h:71
 AliHFEpidQA.h:72
 AliHFEpidQA.h:73
 AliHFEpidQA.h:74
 AliHFEpidQA.h:75
 AliHFEpidQA.h:76
 AliHFEpidQA.h:77
 AliHFEpidQA.h:78
 AliHFEpidQA.h:79
 AliHFEpidQA.h:80
 AliHFEpidQA.h:81
 AliHFEpidQA.h:82
 AliHFEpidQA.h:83
 AliHFEpidQA.h:84
 AliHFEpidQA.h:85
 AliHFEpidQA.h:86
 AliHFEpidQA.h:87
 AliHFEpidQA.h:88
 AliHFEpidQA.h:89
 AliHFEpidQA.h:90
 AliHFEpidQA.h:91
 AliHFEpidQA.h:92
 AliHFEpidQA.h:93
 AliHFEpidQA.h:94
 AliHFEpidQA.h:95
 AliHFEpidQA.h:96
 AliHFEpidQA.h:97
 AliHFEpidQA.h:98
 AliHFEpidQA.h:99
 AliHFEpidQA.h:100
 AliHFEpidQA.h:101
 AliHFEpidQA.h:102
 AliHFEpidQA.h:103
 AliHFEpidQA.h:104
 AliHFEpidQA.h:105
 AliHFEpidQA.h:106
 AliHFEpidQA.h:107
 AliHFEpidQA.h:108
 AliHFEpidQA.h:109
 AliHFEpidQA.h:110
 AliHFEpidQA.h:111
 AliHFEpidQA.h:112
 AliHFEpidQA.h:113
 AliHFEpidQA.h:114
 AliHFEpidQA.h:115
 AliHFEpidQA.h:116
 AliHFEpidQA.h:117
 AliHFEpidQA.h:118
 AliHFEpidQA.h:119
 AliHFEpidQA.h:120
 AliHFEpidQA.h:121
 AliHFEpidQA.h:122
 AliHFEpidQA.h:123
 AliHFEpidQA.h:124
 AliHFEpidQA.h:125
 AliHFEpidQA.h:126
 AliHFEpidQA.h:127
 AliHFEpidQA.h:128
 AliHFEpidQA.h:129
 AliHFEpidQA.h:130
 AliHFEpidQA.h:131
 AliHFEpidQA.h:132
 AliHFEpidQA.h:133
 AliHFEpidQA.h:134
 AliHFEpidQA.h:135
 AliHFEpidQA.h:136
 AliHFEpidQA.h:137
 AliHFEpidQA.h:138
 AliHFEpidQA.h:139
 AliHFEpidQA.h:140
 AliHFEpidQA.h:141
 AliHFEpidQA.h:142
 AliHFEpidQA.h:143
 AliHFEpidQA.h:144
 AliHFEpidQA.h:145
 AliHFEpidQA.h:146