use ESD based tracking methods
[u/mrichter/AliRoot.git] / MONITOR / AliMonitorTPC.cxx
index 7cfca844e9f7365bd292eb3a763ca1df43c98f75..0fcc98b49133ac21e0e85a9bbedee2c0a41eb004 100644 (file)
@@ -30,8 +30,9 @@
 #include "AliTPCRawStream.h"
 #include "AliTPCClustersRow.h"
 #include "AliTPCclusterMI.h"
-#include "AliTPCtrack.h"
 #include "AliRunLoader.h"
+#include "AliRawReader.h"
+#include "AliESD.h"
 #include <TFolder.h>
 #include <TTree.h>
 
@@ -104,25 +105,41 @@ void AliMonitorTPC::CreateHistos(TFolder* folder)
 
   fTrackPt = CreateHisto1("TrackPt", "pt distribution of tracks", 
                          90, 0, 3, "p_{t} [GeV/c]", "#Delta N/N",
-                         AliMonitorHisto::kNormEntries);
+                         AliMonitorHisto::kNormNone);
 
   fTrackEta = CreateHisto1("TrackEta", "eta distribution of tracks", 
                           100, -2, 2, "#eta", "#Delta N/N",
                           AliMonitorHisto::kNormEntries);
 
   fTrackPhi = CreateHisto1("TrackPhi", "phi distribution of tracks", 
-                          120, 0, 360, "#phi [#circ]", "#Delta N/N",
+                          120, -180, 180, "#phi [#circ]", "#Delta N/N",
                           AliMonitorHisto::kNormEntries);
   fTrackPhi->SetDescription("The phi distribution should be flat on average.\nIf it is not flat check for dead TPC sectors.");
 
   fTrackNCl = CreateHisto1("TrackNCl", "Number of clusters per track", 
                           200, 0, 200, "N_{clusters}", "#Delta N/N",
-                          AliMonitorHisto::kNormEntries);
+                          AliMonitorHisto::kNormNone);
 
   fTrackDEdxVsP = CreateHisto2("TrackDEdxVsP", "dE/dx of tracks", 
                               100, 0, 3, 100, 0, 200, 
                               "p [GeV/c]", "dE/dx", "#Delta N/N",
                               AliMonitorHisto::kNormEntries);
+
+  fTrackDEdx = CreateHisto1("TrackDEdx", "dE/dx of tracks with 0.4<p<1.0 GeV/c", 
+                              50, 0, 100, 
+                              "dE/dx", "#Delta N/N",
+                              AliMonitorHisto::kNormEntries);
+
+  fTrackEtaVsPhi = CreateHisto2("TrackEtaVsPhi", "#phi vs #eta", 
+                              20, -1, 1, 25, 0, 360, 
+                              "#eta", "#phi", "#Delta N/N",
+                              AliMonitorHisto::kNormNone);
+
+  fPtEtaVsPhi = CreateHisto2("PtEtaVsPhi", "#phi vs #eta", 
+                              20, -1, 1, 25, 0, 360, 
+                              "#eta", "#phi", "#Delta N/N",
+                              AliMonitorHisto::kNormNone);
+
 }
 
 
@@ -137,7 +154,7 @@ void AliMonitorTPC::CreateBranches(TTree* tree)
 
 //_____________________________________________________________________________
 void AliMonitorTPC::FillHistos(AliRunLoader* runLoader, 
-                              AliRawReader* rawReader)
+                              AliRawReader* rawReader, AliESD* esd)
 {
 // fill the TPC monitor histogrms
 
@@ -181,27 +198,34 @@ void AliMonitorTPC::FillHistos(AliRunLoader* runLoader,
   tpcLoader->UnloadRecPoints();
 
 
-  tpcLoader->LoadTracks();
-  TTree* tracks = tpcLoader->TreeT();
-  if (!tracks) return;
-  AliTPCtrack* track = new AliTPCtrack;
-  tracks->SetBranchAddress("tracks", &track);
+  Int_t nTracks = 0;
+  for (Int_t i = 0; i < esd->GetNumberOfTracks(); i++) {
+    AliESDtrack* track = esd->GetTrack(i);
+    if (!track || ((track->GetStatus() | AliESDtrack::kTPCin) == 0)) continue;
+    nTracks++;
+
+    Double_t pxyz[3];
+    track->GetInnerPxPyPz(pxyz);
+    TVector3 pTrack(pxyz);
+    Double_t p = pTrack.Mag();
+    Double_t pt = pTrack.Pt();
+    Double_t eta = pTrack.Eta();
+    Double_t phi = pTrack.Phi() * TMath::RadToDeg();
+
+    fTrackPt->Fill(pt);
+    fTrackEta->Fill(eta);
+    fTrackPhi->Fill(phi);
+    if (pt > 3.) {
+      fTrackEtaVsPhi->Fill(eta, phi);
+      fPtEtaVsPhi->Fill(eta, phi, pTrack.Pt());
+    }
+    fTrackNCl->Fill(track->GetTPCclusters(NULL));
+    fTrackDEdxVsP->Fill(p, track->GetTPCsignal());
+    if(p>0.4 && p<1.0)
+      fTrackDEdx->Fill(track->GetTPCsignal());
 
-  Int_t nTracks = (Int_t) tracks->GetEntries();
+    fData->SetData(i, pt, eta, phi); 
+  }
   fNTracks->Fill(nTracks);
   fData->SetNTracks(nTracks);
-  for (Int_t i = 0; i < nTracks; i++) {
-    tracks->GetEntry(i);
-    fTrackPt->Fill(track->Pt());
-    fTrackEta->Fill(track->Eta());
-    fTrackPhi->Fill(track->Phi() * TMath::RadToDeg());
-    fTrackNCl->Fill(track->GetNumberOfClusters());
-    fTrackDEdxVsP->Fill(track->P(), track->GetdEdx());
-
-    fData->SetData(i, track->Pt(), track->Eta(), 
-                  track->Phi() * TMath::RadToDeg());
-  }
-
-  delete track;
-  tpcLoader->UnloadTracks();
 }