]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
introduce tracking efficiency for each species
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Oct 2008 15:09:38 +0000 (15:09 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Oct 2008 15:09:38 +0000 (15:09 +0000)
TRD/AliTRDgtuTrack.cxx
TRD/AliTRDtrack.cxx
TRD/Cal/AliTRDCalPID.cxx
TRD/Cal/AliTRDCalPID.h
TRD/Cal/AliTRDCalPIDNN.cxx
TRD/qaRec/AliTRDpidChecker.cxx
TRD/qaRec/AliTRDpidRefMaker.cxx
TRD/qaRec/AliTRDpidRefMaker.h
TRD/qaRec/AliTRDtrackInfoGen.cxx
TRD/qaRec/AliTRDtrackingEfficiency.cxx
TRD/qaRec/AliTRDtrackingEfficiency.h

index 26ab6ac2284a9b322484688c612fdbfd55b4e421..0f34c7198754ec9d842d0a0b289b0a99c8cd18c5 100644 (file)
@@ -461,7 +461,7 @@ void AliTRDgtuTrack::MakePID()
                // attached to charge slices and track length are dummy
                 Float_t dedx[3];
                 dedx[0] = dedx[1] = q*3.; dedx[2] = 0.;
-                Float_t length = 3.7;
+                //Float_t length = 3.7;
 
     //probEle *= pd->GetProbability(0, TMath::Abs(fPt), dedx, length, 0);
     //probPio *= pd->GetProbability(2, TMath::Abs(fPt), dedx, length, 0);
index cd4dd0d398ed3810959bed4530e2ec72b1937245..4df4749a96c677a1fffd8b2b275a94049c2e6bf5 100644 (file)
@@ -676,7 +676,7 @@ Bool_t AliTRDtrack::CookPID(Int_t &pidQuality)
   }
 
   // Calculate the input for the NN if fPIDmethod is kNN
-  Float_t ldEdxNN[AliTRDCalPID::kNPlane * kNMLPslice], *dedx = 0x0;
+  Float_t ldEdxNN[AliTRDgeometry::kNlayer * kNMLPslice], *dedx = 0x0;
   if(fPIDmethod == kNN) {
     CookdEdxNN(&ldEdxNN[0]);
   }
index 9469ac40faa08a0c2cbd244255ba735f31abe656..c4df831481ed7471fed07d067dd33d5565cf4aeb 100644 (file)
@@ -31,7 +31,6 @@
 #include <TROOT.h>
 
 #include "AliLog.h"
-#include "AliPID.h"
 #include "AliESD.h"
 #include "AliESDtrack.h"
 
@@ -42,9 +41,10 @@ ClassImp(AliTRDCalPID)
 
 Char_t* AliTRDCalPID::fPartName[AliPID::kSPECIES] = { "electron", "muon", "pion", "kaon", "proton"};
 Char_t* AliTRDCalPID::fPartSymb[AliPID::kSPECIES] = { "EL", "MU", "PI", "KA", "PR"};
-Float_t AliTRDCalPID::fTrackMomentum[kNMom]       = {  0.6,  0.8,  1.0,  1.5,  2.0
-                                                   ,   3.0,  4.0,  5.0,  6.0,  8.0
-                                                   ,  10.0};
+Color_t AliTRDCalPID::fPartColor[AliPID::kSPECIES] = { kRed, kGreen, kBlue, kYellow, kMagenta};
+Float_t AliTRDCalPID::fTrackMomentum[kNMom]       = {  
+    0.6,  0.8,  1.0,  1.5,  2.0
+   ,3.0,  4.0,  5.0,  6.0,  8.0, 10.0};
 
 //_________________________________________________________________________
 AliTRDCalPID::AliTRDCalPID()
@@ -80,3 +80,12 @@ AliTRDCalPID::~AliTRDCalPID()
   }
 
 }
+
+//_________________________________________________________________________
+Int_t AliTRDCalPID::GetPartIndex(Int_t pdg)
+{
+  for(Int_t is=0; is<AliPID::kSPECIES; is++){
+    if(TMath::Abs(pdg) == AliPID::ParticleCode(is)) return is;
+  }
+  return -1;
+}
index 9440134ecc501d6a114a9c70f2394357737fa0d2..cb52e8e91cf83c0ee667d98f77d5f3eb3c8283e2 100644 (file)
 #include <TNamed.h>
 #endif
 
+#ifndef ALIPID_H
+#include "AliPID.h"
+#endif
+
 class AliTRDCalPID : public TNamed
 {
 
  public:
 
   enum {
-    kNMom   = 11,
-    kNPlane = 6
+    kNMom   = 11
   };
 
   AliTRDCalPID();
@@ -34,14 +37,13 @@ class AliTRDCalPID : public TNamed
   virtual         ~AliTRDCalPID();
 
   virtual Bool_t   LoadReferences(Char_t *refFile) = 0;
-  static  Double_t GetMomentum(Int_t ip)            
-                                                      { return (ip<0 || ip>=kNMom) 
-                                                        ? -1.0 
-                                                        : fTrackMomentum[ip]; 
-                                                      }
+  static  Double_t GetMomentum(Int_t ip) { 
+    return (ip<0 || ip>=kNMom) ? -1.0 : fTrackMomentum[ip]; }
   virtual TObject *GetModel(Int_t ip, Int_t iType, Int_t iPlane) const = 0;
   virtual Double_t GetProbability(Int_t spec, Float_t mom, Float_t *dedx
                                 , Float_t length, Int_t plane) const = 0;
+  static  Color_t  GetPartColor(Int_t i)              { return fPartColor[i]; }
+  static  Int_t    GetPartIndex(Int_t pdg);
   static  Char_t  *GetPartName(Int_t i)               { return fPartName[i]; }
   static  Char_t  *GetPartSymb(Int_t i)               { return fPartSymb[i]; }
 
@@ -60,9 +62,9 @@ class AliTRDCalPID : public TNamed
 
  protected:
 
-  static  Char_t   *fPartName[5];          //! Names of particle species
-  static  Char_t   *fPartSymb[5];          //! Symbols of particle species
-
+  static  Char_t   *fPartName[AliPID::kSPECIES]; //! Names of particle species
+  static  Char_t   *fPartSymb[AliPID::kSPECIES]; //! Symbols of particle species
+  static  Color_t  fPartColor[AliPID::kSPECIES]; //! Colors of particle species
   static  Float_t   fTrackMomentum[kNMom]; //  Track momenta for which response functions are available
   TObjArray        *fModel;                //  Model for probability estimate
 
index 2d13049b57fc7e8fee5de9fdd84df309375b4029..8047dd48466bfd70bfe84e690a89d0433dd6fc4f 100644 (file)
@@ -35,6 +35,7 @@
 #include "AliESDtrack.h"
 #include "AliTRDtrack.h"
 
+#include "AliTRDgeometry.h"
 #include "AliTRDCalPIDNN.h"
 #include "AliTRDcalibDB.h"
 
@@ -106,7 +107,7 @@ Bool_t AliTRDCalPIDNN::LoadReferences(Char_t *refFile)
 
   // Read Networks
   for (Int_t imom = 0; imom < kNMom; imom++) {
-    for (Int_t iplane = 0; iplane < kNPlane; iplane++) {
+    for (Int_t iplane = 0; iplane < AliTRDgeometry::kNlayer; iplane++) {
       TMultiLayerPerceptron *nn = (TMultiLayerPerceptron *)
          nnFile->Get(Form("NN_Mom%d_Plane%d",imom,iplane));
       fModel->AddAt(nn,GetModelID(imom,0,iplane));
@@ -200,7 +201,7 @@ void AliTRDCalPIDNN::Init()
   // Initialization
   //
 
-  fModel = new TObjArray(AliTRDCalPID::kNPlane * AliTRDCalPID::kNMom);
+  fModel = new TObjArray(AliTRDgeometry::kNlayer * AliTRDCalPID::kNMom);
   fModel->SetOwner();
   
 }
index 3aaf522c176fc513fe1444a76da3683c61dea5bd..a29c607774e711ea72e4885902f798862e0ce166 100644 (file)
@@ -173,8 +173,8 @@ void AliTRDpidChecker::Exec(Option_t *)
   AliTrackReference     *ref = 0x0;
   AliExternalTrackParam *esd = 0x0;
 
-  AliTRDseedV1 *TRDtracklet[AliTRDCalPID::kNPlane];
-  for(Int_t iChamb = 0; iChamb < AliTRDCalPID::kNPlane; iChamb++)
+  AliTRDseedV1 *TRDtracklet[AliTRDgeometry::kNlayer];
+  for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++)
     TRDtracklet[iChamb] = 0x0;
 
   AliTRDcluster *TRDcluster = 0x0;
@@ -189,7 +189,7 @@ void AliTRDpidChecker::Exec(Option_t *)
     //&&(track->GetNumberOfClustersRefit()
 
     // use only tracks that hit 6 chambers
-    if(!(TRDtrack->GetNumberOfTracklets() == AliTRDCalPID::kNPlane)) continue;
+    if(!(TRDtrack->GetNumberOfTracklets() == AliTRDgeometry::kNlayer)) continue;
      
     ref = track->GetTrackRef(0);
     esd = track->GetOuterParam();
@@ -251,8 +251,8 @@ void AliTRDpidChecker::Exec(Option_t *)
     if(fDebugLevel>=4) Printf("PIDmethod[%d] Slices[%d] PDG[%d] LQLike[%f]", fReconstructor->GetPIDMethod(), fReconstructor->GetNdEdxSlices(), track->GetPDG(), TRDtrack -> GetPID(0));
 
 
-    Float_t SumdEdx[AliTRDCalPID::kNPlane];
-    for(Int_t iChamb = 0; iChamb < AliTRDCalPID::kNPlane; iChamb++){
+    Float_t SumdEdx[AliTRDgeometry::kNlayer];
+    for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){
       TRDtracklet[iChamb] = TRDtrack -> GetTracklet(iChamb);
       SumdEdx[iChamb] = 0.;
       fdEdx = TRDtracklet[iChamb] -> GetdEdx();
@@ -263,61 +263,61 @@ void AliTRDpidChecker::Exec(Option_t *)
     case kElectron:
     case kPositron:
       hPIDLQ[AliPID::kElectron][iMomBin] -> Fill(TRDtrack -> GetPID(0));
-      for(Int_t iChamb = 0; iChamb < AliTRDCalPID::kNPlane; iChamb++){
+      for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){
         hdEdx[AliPID::kElectron][iMomBin] -> Fill(SumdEdx[iChamb]);
-       for(Int_t iClus = 0; iClus < AliTRDtrackerV1::GetNTimeBins(); iClus++){
-         if(!(TRDcluster = (AliTRDcluster*)TRDtracklet[iChamb] -> GetClusters(iClus)))
-           continue;
-         hPH[AliPID::kElectron][iMomBin] -> Fill(TRDcluster -> GetLocalTimeBin(), TRDtracklet[iChamb] -> GetdQdl(iClus));
-       }
+        for(Int_t iClus = 0; iClus < AliTRDtrackerV1::GetNTimeBins(); iClus++){
+          if(!(TRDcluster = (AliTRDcluster*)TRDtracklet[iChamb] -> GetClusters(iClus)))
+            continue;
+          hPH[AliPID::kElectron][iMomBin] -> Fill(TRDcluster -> GetLocalTimeBin(), TRDtracklet[iChamb] -> GetdQdl(iClus));
+        }
       }
       break;
     case kMuonPlus:
     case kMuonMinus:
       hPIDLQ[AliPID::kMuon][iMomBin] -> Fill(TRDtrack -> GetPID(0));
-      for(Int_t iChamb = 0; iChamb < AliTRDCalPID::kNPlane; iChamb++){
+      for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){
         hdEdx[AliPID::kMuon][iMomBin] -> Fill(SumdEdx[iChamb]);
-       for(Int_t iClus = 0; iClus < AliTRDtrackerV1::GetNTimeBins(); iClus++){
-         if(!(TRDcluster = (AliTRDcluster*)TRDtracklet[iChamb] -> GetClusters(iClus)))
-           continue;
-         hPH[AliPID::kMuon][iMomBin] -> Fill(TRDcluster -> GetLocalTimeBin(), TRDtracklet[iChamb] -> GetdQdl(iClus));
-       }
+        for(Int_t iClus = 0; iClus < AliTRDtrackerV1::GetNTimeBins(); iClus++){
+          if(!(TRDcluster = (AliTRDcluster*)TRDtracklet[iChamb] -> GetClusters(iClus)))
+            continue;
+          hPH[AliPID::kMuon][iMomBin] -> Fill(TRDcluster -> GetLocalTimeBin(), TRDtracklet[iChamb] -> GetdQdl(iClus));
+        }
       }
       break;
     case kPiPlus:
     case kPiMinus:
       hPIDLQ[AliPID::kPion][iMomBin] -> Fill(TRDtrack -> GetPID(0));
-      for(Int_t iChamb = 0; iChamb < AliTRDCalPID::kNPlane; iChamb++){
+      for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){
         hdEdx[AliPID::kPion][iMomBin] -> Fill(SumdEdx[iChamb]);
-       for(Int_t iClus = 0; iClus < AliTRDtrackerV1::GetNTimeBins(); iClus++){
-         if(!(TRDcluster = (AliTRDcluster*)TRDtracklet[iChamb] -> GetClusters(iClus)))
-           continue;
-         hPH[AliPID::kPion][iMomBin] -> Fill(TRDcluster -> GetLocalTimeBin(), TRDtracklet[iChamb] -> GetdQdl(iClus));
-       }
+        for(Int_t iClus = 0; iClus < AliTRDtrackerV1::GetNTimeBins(); iClus++){
+          if(!(TRDcluster = (AliTRDcluster*)TRDtracklet[iChamb] -> GetClusters(iClus)))
+            continue;
+          hPH[AliPID::kPion][iMomBin] -> Fill(TRDcluster -> GetLocalTimeBin(), TRDtracklet[iChamb] -> GetdQdl(iClus));
+        }
       }
       break;
     case kKPlus:
     case kKMinus:
       hPIDLQ[AliPID::kKaon][iMomBin] -> Fill(TRDtrack -> GetPID(0));
-      for(Int_t iChamb = 0; iChamb < AliTRDCalPID::kNPlane; iChamb++){
+      for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){
         hdEdx[AliPID::kKaon][iMomBin] -> Fill(SumdEdx[iChamb]);
-       for(Int_t iClus = 0; iClus < AliTRDtrackerV1::GetNTimeBins(); iClus++){
-         if(!(TRDcluster = (AliTRDcluster*)TRDtracklet[iChamb] -> GetClusters(iClus)))
-           continue;
-         hPH[AliPID::kKaon][iMomBin] -> Fill(TRDcluster -> GetLocalTimeBin(), TRDtracklet[iChamb] -> GetdQdl(iClus));
-       }
+        for(Int_t iClus = 0; iClus < AliTRDtrackerV1::GetNTimeBins(); iClus++){
+          if(!(TRDcluster = (AliTRDcluster*)TRDtracklet[iChamb] -> GetClusters(iClus)))
+            continue;
+          hPH[AliPID::kKaon][iMomBin] -> Fill(TRDcluster -> GetLocalTimeBin(), TRDtracklet[iChamb] -> GetdQdl(iClus));
+        }
       }
       break;
     case kProton:
     case kProtonBar:
       hPIDLQ[AliPID::kProton][iMomBin] -> Fill(TRDtrack -> GetPID(0));
-      for(Int_t iChamb = 0; iChamb < AliTRDCalPID::kNPlane; iChamb++){
+      for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){
         hdEdx[AliPID::kProton][iMomBin] -> Fill(SumdEdx[iChamb]);
-       for(Int_t iClus = 0; iClus < AliTRDtrackerV1::GetNTimeBins(); iClus++){
-         if(!(TRDcluster = (AliTRDcluster*)TRDtracklet[iChamb] -> GetClusters(iClus)))
-           continue;
-         hPH[AliPID::kProton][iMomBin] -> Fill(TRDcluster -> GetLocalTimeBin(), TRDtracklet[iChamb] -> GetdQdl(iClus));
-       }
+        for(Int_t iClus = 0; iClus < AliTRDtrackerV1::GetNTimeBins(); iClus++){
+          if(!(TRDcluster = (AliTRDcluster*)TRDtracklet[iChamb] -> GetClusters(iClus)))
+            continue;
+          hPH[AliPID::kProton][iMomBin] -> Fill(TRDcluster -> GetLocalTimeBin(), TRDtracklet[iChamb] -> GetdQdl(iClus));
+        }
       }
       break;
     }
index aff51e40904d638da7a926db620581ce2eb193bb..31f6f5ad51032e183521c1b5373c7134c722d608 100644 (file)
@@ -8,7 +8,6 @@
 #include "TEventList.h"
 #include "TMultiLayerPerceptron.h"
 
-#include "AliPID.h"
 #include "AliESDEvent.h"
 #include "AliESDInputHandler.h"
 #include "AliTrackReference.h"
@@ -53,10 +52,10 @@ AliTRDpidRefMaker::AliTRDpidRefMaker()
   memset(fv0pid, 0, AliPID::kSPECIES*sizeof(Float_t));
   memset(fdEdx, 0, 10*sizeof(Float_t));
 
-  const Int_t nnSize = AliTRDCalPID::kNMom * AliTRDCalPID::kNPlane;
+  const Int_t nnSize = AliTRDCalPID::kNMom * AliTRDgeometry::kNlayer;
   memset(fTrain, 0, nnSize*sizeof(TEventList*));
   memset(fTest, 0, nnSize*sizeof(TEventList*));
-  memset(fNet, 0, AliTRDCalPID::kNPlane*sizeof(TMultiLayerPerceptron*));
+  memset(fNet, 0, AliTRDgeometry::kNlayer*sizeof(TMultiLayerPerceptron*));
 
   DefineOutput(1, TTree::Class());
   DefineOutput(2, TTree::Class());
@@ -94,7 +93,7 @@ AliTRDpidRefMaker::AliTRDpidRefMaker(const Char_t *InFileNN, const Char_t *InFil
   fLQ = (TTree*)fInFileLQ -> Get("LQ");
 
   for(Int_t iMom = 0; iMom < AliTRDCalPID::kNMom; iMom++){
-    for(Int_t ily = 0; ily < AliTRDCalPID::kNPlane; ily++){
+    for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++){
       fTrain[iMom][ily] = new TEventList(Form("fTrainMom%d_%d", iMom, ily), Form("Training list for momentum intervall %d and plane %d", iMom, ily));
       fTest[iMom][ily] = new TEventList(Form("fTestMom%d_%d", iMom, ily), Form("Test list for momentum intervall %d and plane %d", iMom, ily));
     }
@@ -187,7 +186,7 @@ void AliTRDpidRefMaker::Exec(Option_t *)
     //&&(track->GetNumberOfClustersRefit()
 
     // use only tracks that hit 6 chambers
-    if(!(TRDtrack->GetNumberOfTracklets() == AliTRDCalPID::kNPlane)) continue;
+    if(!(TRDtrack->GetNumberOfTracklets() == AliTRDgeometry::kNlayer)) continue;
      
     ref = track->GetTrackRef(0);
     esd = track->GetOuterParam();
@@ -234,7 +233,7 @@ void AliTRDpidRefMaker::Exec(Option_t *)
 
     // fill the dE/dx information for NN
     fReconstructor -> SetOption("nn");
-    for(Int_t ily = 0; ily < AliTRDCalPID::kNPlane; ily++){
+    for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++){
       if(!(TRDtracklet = TRDtrack -> GetTracklet(ily))) continue;
       TRDtracklet->CookdEdx(AliTRDReconstructor::kNNslices);
       dedx = TRDtracklet->GetdEdx();
@@ -249,7 +248,7 @@ void AliTRDpidRefMaker::Exec(Option_t *)
 
     // fill the dE/dx information for LQ
     fReconstructor -> SetOption("!nn");
-    for(Int_t ily = 0; ily < AliTRDCalPID::kNPlane; ily++){
+    for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++){
       if(!(TRDtracklet = TRDtrack -> GetTracklet(ily))) continue;
       TRDtracklet->CookdEdx(AliTRDReconstructor::kLQslices);
       dedx = TRDtracklet->GetdEdx();
@@ -464,12 +463,12 @@ void AliTRDpidRefMaker::MakeTrainingLists()
     // set electrons
     if(fv0pid[0] == 1){
       if(nPart[0][iMomBin] < iTrain[iMomBin]){
-       for(Int_t ily = 0; ily < AliTRDCalPID::kNPlane; ily++)
+       for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++)
          fTrain[iMomBin][ily] -> Enter(iEv + ily);
        nPart[0][iMomBin]++;
       }
       else if(nPart[0][iMomBin] < iTest[iMomBin]+iTrain[iMomBin]){
-       for(Int_t ily = 0; ily < AliTRDCalPID::kNPlane; ily++)
+       for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++)
          fTest[iMomBin][ily] -> Enter(iEv + ily);
        nPart[0][iMomBin]++;
       }
@@ -479,12 +478,12 @@ void AliTRDpidRefMaker::MakeTrainingLists()
     // set muons
     else if(fv0pid[1] == 1){
       if(nPart[1][iMomBin] < iTrain[iMomBin]){
-       for(Int_t ily = 0; ily < AliTRDCalPID::kNPlane; ily++)
+       for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++)
          fTrain[iMomBin][ily] -> Enter(iEv + ily);
        nPart[1][iMomBin]++;
       }
       else if(nPart[1][iMomBin] < iTest[iMomBin]+iTrain[iMomBin]){
-       for(Int_t ily = 0; ily < AliTRDCalPID::kNPlane; ily++)
+       for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++)
          fTest[iMomBin][ily] -> Enter(iEv + ily);
        nPart[1][iMomBin]++;
       }
@@ -494,12 +493,12 @@ void AliTRDpidRefMaker::MakeTrainingLists()
     // set pions
     else if(fv0pid[2] == 1){
       if(nPart[2][iMomBin] < iTrain[iMomBin]){
-       for(Int_t ily = 0; ily < AliTRDCalPID::kNPlane; ily++)
+       for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++)
          fTrain[iMomBin][ily] -> Enter(iEv + ily);
        nPart[2][iMomBin]++;
       }
       else if(nPart[2][iMomBin] < iTest[iMomBin]+iTrain[iMomBin]){
-       for(Int_t ily = 0; ily < AliTRDCalPID::kNPlane; ily++)
+       for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++)
          fTest[iMomBin][ily] -> Enter(iEv + ily);
        nPart[2][iMomBin]++;
       }
@@ -509,12 +508,12 @@ void AliTRDpidRefMaker::MakeTrainingLists()
     // set kaons
     else if(fv0pid[3] == 1){
       if(nPart[3][iMomBin] < iTrain[iMomBin]){
-       for(Int_t ily = 0; ily < AliTRDCalPID::kNPlane; ily++)
+       for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++)
          fTrain[iMomBin][ily] -> Enter(iEv + ily);
        nPart[3][iMomBin]++;
       }
       else if(nPart[3][iMomBin] < iTest[iMomBin]+iTrain[iMomBin]){
-       for(Int_t ily = 0; ily < AliTRDCalPID::kNPlane; ily++)
+       for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++)
          fTest[iMomBin][ily] -> Enter(iEv + ily);
        nPart[3][iMomBin]++;
       }
@@ -524,12 +523,12 @@ void AliTRDpidRefMaker::MakeTrainingLists()
     // set protons
     else if(fv0pid[4] == 1){
       if(nPart[4][iMomBin] < iTrain[iMomBin]){
-       for(Int_t ily = 0; ily < AliTRDCalPID::kNPlane; ily++)
+       for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++)
          fTrain[iMomBin][ily] -> Enter(iEv + ily);
        nPart[4][iMomBin]++;
       }
       else if(nPart[4][iMomBin] < iTest[iMomBin]+iTrain[iMomBin]){
-       for(Int_t ily = 0; ily < AliTRDCalPID::kNPlane; ily++)
+       for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++)
          fTest[iMomBin][ily] -> Enter(iEv + ily);
        nPart[4][iMomBin]++;
       }
@@ -565,13 +564,13 @@ void AliTRDpidRefMaker::TrainNetworks(Int_t mombin)
   gSystem->Exec(Form("mkdir ./Networks_%d/MomBin_%d",fDate, mombin));
 
   // variable to check if network can load weights from previous training
-  Bool_t bFirstLoop[AliTRDCalPID::kNPlane];
-  memset(bFirstLoop, kTRUE, AliTRDCalPID::kNPlane*sizeof(Bool_t));
+  Bool_t bFirstLoop[AliTRDgeometry::kNlayer];
+  memset(bFirstLoop, kTRUE, AliTRDgeometry::kNlayer*sizeof(Bool_t));
  
   // train networks over several loops and save them after each loop
   for(Int_t iLoop = 0; iLoop < kMoniTrain; iLoop++){
     // loop over chambers
-    for(Int_t iChamb = 0; iChamb < AliTRDCalPID::kNPlane; iChamb++){
+    for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){
       // set the event lists
       fNN -> SetEventList(fTrain[mombin][iChamb]);
       fNN -> SetEventList(fTest[mombin][iChamb]);
index eae7058252c38312f562629ada183e79fe1b51cf..4e0d653eb4c3c5771221e288b483d0090ffc2bb3 100644 (file)
 #include "AliTRDrecoTask.h"
 #endif
 
+#ifndef ALIPID_H
+#include "AliPID.h"
+#endif
+
+#ifndef ALITRDGEOMETRY_H
+#include "AliTRDgeometry.h"
+#endif
+
 class TTree;
 class TEventList;
 class TMultiLayerPerceptron;
@@ -77,9 +85,9 @@ private:
   AliTRDReconstructor *fReconstructor;     //! reconstructor needed for recalculation the PID
   TTree         *fNN;                      // NN data
   TTree         *fLQ;                      // LQ data
-  TEventList *fTrain[AliTRDCalPID::kNMom][AliTRDCalPID::kNPlane];          // Training list for each momentum 
-  TEventList *fTest[AliTRDCalPID::kNMom][AliTRDCalPID::kNPlane];           // Test list for each momentum 
-  TMultiLayerPerceptron *fNet[AliTRDCalPID::kNPlane]; // artificial neural network
+  TEventList *fTrain[AliTRDCalPID::kNMom][AliTRDgeometry::kNlayer];          // Training list for each momentum 
+  TEventList *fTest[AliTRDCalPID::kNMom][AliTRDgeometry::kNlayer];           // Test list for each momentum 
+  TMultiLayerPerceptron *fNet[AliTRDgeometry::kNlayer]; // artificial neural network
 /*   TMultiLayerPerceptron *fNet[AliTRDCalPID::kNMom][AliTRDCalPID::kNPlane]; // artificial neural network */
 
   Int_t         fLayer;                    // TRD layer index 
index 40ba294a40c9204bac01262d103651abae796a46..d36a4db445da6480f41814f9dbbaa13e456cbf3b 100644 (file)
@@ -201,14 +201,6 @@ void AliTRDtrackInfoGen::Exec(Option_t *){
         op->Global2LocalPosition(xyz, op->GetAlpha());
         if(fDebugLevel>=2) printf("op @ X[%7.3f]\n", xyz[0]);
     }
-/*             if(xyz[0] < 270.){ 
-        printf("TPC track missing\n");
-    } else { */
-//                     op->GetXYZAt(ref->LocalX(), AliTracker::GetBz(), xyz);
-//                     op->Global2LocalPosition(xyz, op->GetAlpha());
-//                     dy = ref->LocalY()- xyz[1];
-//                     dz = ref->Z() - xyz[2];
-//     }
 
     // read MC info
     Int_t fPdg = -1;
@@ -217,7 +209,11 @@ void AliTRDtrackInfoGen::Exec(Option_t *){
       label = esdTrack->GetLabel();
       if(label < fMC->GetNumberOfTracks()) trackMap[TMath::Abs(label)] = kTRUE; // register the track
       //if (TMath::Abs(label) > mStack->GetNtrack()) continue; 
-      AliMCParticle *mcParticle = fMC->GetTrack(TMath::Abs(label));
+      AliMCParticle *mcParticle = 0x0; 
+      if(!(mcParticle = fMC->GetTrack(TMath::Abs(label)))){
+        printf("E - AliTRDtrackInfoGen::Exec() : MC particle missing for ESD label %d\n", label);
+        continue;
+      }
       fPdg = mcParticle->Particle()->GetPdgCode();
       Int_t nRefs = mcParticle->GetNumberOfTrackReferences();
       Int_t iref = 0; AliTrackReference *ref = 0x0; 
@@ -227,17 +223,6 @@ void AliTRDtrackInfoGen::Exec(Option_t *){
         //printf("\ttrackRef[%2d] @ %7.3f\n", iref, ref->LocalX());
         iref++;
       }
-      if(iref == nRefs){
-//                     if(!esdTrack->GetNcls(2)) continue;
-/*                     printf("No TRD Track References in the Track [%d] I\n", itrk);
-        printf("Label = %d ITS[%d] TPC[%d] TRD[%d]\n", label, esdTrack->GetITSLabel(), esdTrack->GetTPCLabel(), esdTrack->GetTRDLabel());
-        Int_t kref = 0;
-        while(kref<nRefs){
-          ref = mcParticle->GetTrackReference(kref);
-          printf("\ttrackRef[%2d] @ %7.3f\n", kref, ref->LocalX());
-          kref++;
-        }*/
-      }
 
       new(fTrackInfo) AliTRDtrackInfo();
       fTrackInfo->SetPDG(fPdg);
index 356e3f127d7755a270cb40c950a36cd91af46bb4..c048ad98f517d5df3a371b18b8bdc094a58633f1 100644 (file)
@@ -29,6 +29,7 @@
 #include <TProfile.h>
 #include "TTreeStream.h"
 
+#include "AliPID.h"
 #include "AliESDtrack.h"
 #include "AliTrackReference.h"
 #include "AliExternalTrackParam.h"
@@ -36,6 +37,7 @@
 #include "AliMagFMaps.h"
 #include "AliAnalysisManager.h"
 
+#include "Cal/AliTRDCalPID.h"
 #include "AliTRDtrackingEfficiency.h"
 #include "AliTRDtrackInfo/AliTRDtrackInfo.h"
 
@@ -68,10 +70,19 @@ void  AliTRDtrackingEfficiency::CreateOutputObjects()
   //
 
   OpenFile(0, "RECREATE");
-  const Int_t nbins = 11;
+  const Int_t nbins = AliTRDCalPID::kNMom;
   Float_t xbins[nbins+1] = {.5, .7, .9, 1.3, 1.7, 2.4, 3.5, 4.5, 5.5, 7., 9., 11.};
+
+  TH1 *h = 0x0;
   fContainer = new TObjArray();
-  fContainer->Add(new TProfile("h", "", nbins, xbins));
+  for(Int_t is=0; is<AliPID::kSPECIES; is++){
+    fContainer->Add(h = new TProfile(Form("h%s", AliTRDCalPID::GetPartSymb(is)), "", nbins, xbins));
+    h->SetLineColor(AliTRDCalPID::GetPartColor(is));
+    h->SetMarkerColor(AliTRDCalPID::GetPartColor(is));
+    h->SetMarkerStyle(7);
+  }
+  fContainer->Add(h = new TProfile("h", "", nbins, xbins));
+  h->SetMarkerStyle(7);
 } 
 
 //____________________________________________________________________
@@ -81,12 +92,8 @@ void AliTRDtrackingEfficiency::Exec(Option_t *)
   // Do it
   //
 
-  if(!AliTracker::GetFieldMap()){
-    AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., AliMagFMaps::k5kG);
-    AliTracker::SetFieldMap(field, kTRUE);
-  }
-  TProfile *h = (TProfile*)fContainer->At(0);  
-       Int_t labelsacc[10000]; memset(labelsacc, 0, sizeof(Int_t) * 10000);
+  Int_t labelsacc[10000]; 
+  memset(labelsacc, 0, sizeof(Int_t) * 10000);
        
   if(!fMissed){ 
     fMissed = new TClonesArray("AliTRDtrackInfo", 10);
@@ -95,45 +102,42 @@ void AliTRDtrackingEfficiency::Exec(Option_t *)
 
   Float_t mom;
   Int_t selection[10000], nselect = 0;
-  ULong_t status;
+  ULong_t status; Int_t pidx;
   Int_t nTRD = 0, nTPC = 0, nMiss = 0;
   AliTRDtrackInfo     *track = 0x0;
   AliTrackReference     *ref = 0x0;
   AliExternalTrackParam *esd = 0x0;
   for(Int_t itrk=0; itrk<fTracks->GetEntriesFast(); itrk++){
     track = (AliTRDtrackInfo*)fTracks->UncheckedAt(itrk);
+
                if(!track->HasESDtrack()) continue;
     status = track->GetStatus();
-    if(!(status&AliESDtrack::kTPCout)){ 
-      // missing TPC propagation - interesting for SA
-      continue;
-    }
 
+    // missing TPC propagation - interesting for SA
+    if(!(status&AliESDtrack::kTPCout)) continue;
+
+    // missing MC info.
+    if(HasMCdata() && track->GetNTrackRefs() <= 1) continue;
+   
     nTPC++;
     selection[nselect++]=itrk;
+    ref  = track->GetTrackRef(0);
+    esd  = track->GetOuterParam();
+    mom  = ref ? ref->P(): esd->P();
+    pidx = AliTRDCalPID::GetPartIndex(track->GetPDG());
+    pidx = TMath::Max(pidx, 0);
 
     //Int_t n = track->GetNumberOfClusters(); 
     // where are this tracklets ???
     //if(ncls0 > ncls1) printf("%3d ESD[%3d] TRD[%3d|%3d]\n", itrk, ncls0, ncls1, n);
     if(track->GetNumberOfClustersRefit()){ 
-      ref = track->GetTrackRef(0);
-      esd = track->GetOuterParam();
-      mom = ref ? ref->P(): esd->P();
-      //printf("FOUND Id[%d] mom[%f]\n", itrk, mom);
-      h->Fill(mom, 1.);
+      ((TProfile*)fContainer->At(pidx))->Fill(mom, 1.);
                        labelsacc[nTRD] = track->GetLabel();
       nTRD++;
       continue;
     }
 
 
-    Int_t nrefs = track->GetNTrackRefs();
-    if(nrefs<=1){ 
-      nTPC--;
-      // we don't have MC info.
-      // we should discard this track 
-      continue;
-    }
 
     Float_t xmed, xleng;
     Int_t iref = 1; Bool_t found = kFALSE;
@@ -156,7 +160,7 @@ void AliTRDtrackingEfficiency::Exec(Option_t *)
     new ((*fMissed)[nMiss]) AliTRDtrackInfo(*track);
     nMiss++;
   }
-  if(fDebugLevel>=1) printf("%3d Tracks: ESD[%3d] TPC[%3d] TRD[%3d | %5.2f%%] Off[%d]\n", (Int_t)AliAnalysisManager::GetAnalysisManager()->GetCurrentEntry(), fTracks->GetEntriesFast(), nTPC, nTRD, nTPC ? 1.E2*nTRD/float(nTPC) : 0., fMissed->GetEntriesFast());
+  if(fDebugLevel>=2) printf("%3d Tracks: ESD[%3d] TPC[%3d] TRD[%3d | %5.2f%%] Off[%d]\n", (Int_t)AliAnalysisManager::GetAnalysisManager()->GetCurrentEntry(), fTracks->GetEntriesFast(), nTPC, nTRD, nTPC ? 1.E2*nTRD/float(nTPC) : 0., fMissed->GetEntriesFast());
 
 
   // Find double tracks
@@ -228,13 +232,14 @@ void AliTRDtrackingEfficiency::Exec(Option_t *)
     else{ 
       ref = tt->GetTrackRef(0);
       mom = ref ? ref->P(): op->P();
-      h->Fill(mom, 0.);
-      printf("\tNOT FOUND Id[%d] Mom[%f]\n", tt->GetTrackId(), mom);
+      pidx = AliTRDCalPID::GetPartIndex(tt->GetPDG());
+      pidx = TMath::Max(pidx, 0);
+      ((TProfile*)fContainer->At(pidx))->Fill(mom, 0.);
+      if(fDebugLevel>=2) printf("\tNOT FOUND Id[%d] Mom[%f]\n", tt->GetTrackId(), mom);
     }
   }
 
-  //if(fDebugLevel>=1)
-  printf("%3d Tracks: ESD[%3d] TPC[%3d] TRD[%3d | %5.2f%%] Off[%d]\n", (Int_t)AliAnalysisManager::GetAnalysisManager()->GetCurrentEntry(), fTracks->GetEntriesFast(), nTPC, nTRD, nTPC ? 1.E2*nTRD/float(nTPC) : 0., fMissed->GetEntriesFast());
+  if(fDebugLevel>=2) printf("%3d Tracks: ESD[%3d] TPC[%3d] TRD[%3d | %5.2f%%] Off[%d]\n", (Int_t)AliAnalysisManager::GetAnalysisManager()->GetCurrentEntry(), fTracks->GetEntriesFast(), nTPC, nTRD, nTPC ? 1.E2*nTRD/float(nTPC) : 0., fMissed->GetEntriesFast());
 
   //fMissed->Delete();
        // check for double countings
@@ -268,3 +273,29 @@ void AliTRDtrackingEfficiency::Terminate(Option_t *)
 
 }
 
+
+
+//____________________________________________________________________
+void AliTRDtrackingEfficiency::GetRefFigure(Int_t ifig, Int_t &first, Int_t &last, Option_t *opt)
+{
+  switch(ifig){
+  case 0:
+    first = 5; last = 6; opt="e2"; 
+    break;
+  case 1:
+    first = 0; last = 5; opt="e2"; 
+    break;
+  }
+}
+
+
+//____________________________________________________________________
+Bool_t AliTRDtrackingEfficiency::PostProcess()
+{
+  TProfile *h = (TProfile*)fContainer->At(AliPID::kSPECIES);
+  for(Int_t is=0; is<AliPID::kSPECIES; is++){
+    h->Add((TProfile*)fContainer->At(is));
+  }
+  fNRefFigures = HasMCdata() ? 2 : 1; 
+  return kTRUE;
+}
index 68d7b2ca978764cb60f450d50068b5c609adf416..8858a5d0943619113c581a2202549eea80eb8664 100644 (file)
@@ -24,9 +24,11 @@ class AliTRDtrackingEfficiency : public AliTRDrecoTask
 public:
   AliTRDtrackingEfficiency();
   virtual ~AliTRDtrackingEfficiency();
-  void  CreateOutputObjects();
-  void  Exec(Option_t *);
-  void  Terminate(Option_t *);
+  void    CreateOutputObjects();
+  void    Exec(Option_t *);
+  void    GetRefFigure(Int_t ifig, Int_t &first, Int_t &last, Option_t *opt);
+  Bool_t  PostProcess();
+  void    Terminate(Option_t *);
 
 private:
   AliTRDtrackingEfficiency(const AliTRDtrackingEfficiency&);