use ESD based tracking methods
[u/mrichter/AliRoot.git] / MONITOR / AliMonitorTPC.cxx
index 94b8181b52f0efb8711445bf5f2441edff743b75..0fcc98b49133ac21e0e85a9bbedee2c0a41eb004 100644 (file)
 
 
 #include "AliMonitorTPC.h"
 
 
 #include "AliMonitorTPC.h"
+#include "AliMonitorDataTPC.h"
+#include "AliMonitorHisto.h"
+#include "AliMonitorTrend.h"
+#include "AliTPCParam.h"
 #include "AliTPCRawStream.h"
 #include "AliTPCClustersRow.h"
 #include "AliTPCclusterMI.h"
 #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>
 
 
 
 
-ClassImp(AliMonitorDataTPC) 
-
+ClassImp(AliMonitorTPC) 
 
 
-//_____________________________________________________________________________
-AliMonitorDataTPC::AliMonitorDataTPC()
-{
-  fPt = fEta = fPhi = NULL;
-  fSize = 0;
-}
 
 //_____________________________________________________________________________
 
 //_____________________________________________________________________________
-AliMonitorDataTPC::AliMonitorDataTPC(Int_t size)
+AliMonitorTPC::AliMonitorTPC(AliTPCParam* param)
 {
 {
-  fPt = new Float_t[size];
-  fEta = new Float_t[size];
-  fPhi = new Float_t[size];
-  fSize = size;
-}
+// create a TPC monitor object with the given parameters
 
 
-//_____________________________________________________________________________
-AliMonitorDataTPC::~AliMonitorDataTPC()
-{
-  delete[] fPt;
-  delete[] fEta;
-  delete[] fPhi;
+  fParam = param;
+  fData = new AliMonitorDataTPC(10000);
 }
 
 //_____________________________________________________________________________
 }
 
 //_____________________________________________________________________________
-void AliMonitorDataTPC::SetSize(Int_t size)
+AliMonitorTPC::AliMonitorTPC(const AliMonitorTPC& monitor) :
+  AliMonitor(monitor)
 {
 {
-  if (size > fSize) {
-    delete[] fPt;
-    delete[] fEta;
-    delete[] fPhi;
-    fPt = new Float_t[size];
-    fEta = new Float_t[size];
-    fPhi = new Float_t[size];
-    fSize = size;
-  }
+  Fatal("AliMonitorTPC", "copy constructor not implemented");
 }
 
 }
 
-
-
-ClassImp(AliMonitorTPC) 
-
-
 //_____________________________________________________________________________
 //_____________________________________________________________________________
-AliMonitorTPC::AliMonitorTPC(AliTPCParam* param)
+AliMonitorTPC& AliMonitorTPC::operator = (const AliMonitorTPC& /*monitor*/)
 {
 {
-// create a TPC monitor object with the given parameters
-
-  fParam = param;
-  fData = new AliMonitorDataTPC(10000);
+  Fatal("operator =", "assignment operator not implemented");
+  return *this;
 }
 
 //_____________________________________________________________________________
 }
 
 //_____________________________________________________________________________
@@ -126,21 +105,41 @@ void AliMonitorTPC::CreateHistos(TFolder* folder)
 
   fTrackPt = CreateHisto1("TrackPt", "pt distribution of tracks", 
                          90, 0, 3, "p_{t} [GeV/c]", "#Delta N/N",
 
   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", 
 
   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.");
 
                           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::kNormNone);
+
   fTrackDEdxVsP = CreateHisto2("TrackDEdxVsP", "dE/dx of tracks", 
                               100, 0, 3, 100, 0, 200, 
                               "p [GeV/c]", "dE/dx", "#Delta N/N",
                               AliMonitorHisto::kNormEntries);
   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);
+
 }
 
 
 }
 
 
@@ -155,7 +154,7 @@ void AliMonitorTPC::CreateBranches(TTree* tree)
 
 //_____________________________________________________________________________
 void AliMonitorTPC::FillHistos(AliRunLoader* runLoader, 
 
 //_____________________________________________________________________________
 void AliMonitorTPC::FillHistos(AliRunLoader* runLoader, 
-                              AliRawReader* rawReader)
+                              AliRawReader* rawReader, AliESD* esd)
 {
 // fill the TPC monitor histogrms
 
 {
 // fill the TPC monitor histogrms
 
@@ -199,27 +198,34 @@ void AliMonitorTPC::FillHistos(AliRunLoader* runLoader,
   tpcLoader->UnloadRecPoints();
 
 
   tpcLoader->UnloadRecPoints();
 
 
-  tpcLoader->LoadTracks();
-  TTree* tracks = tpcLoader->TreeT();
-  if (!tracks) return;
-  AliTPCtrack* track = new AliTPCtrack;
-  tracks->SetBranchAddress("tracks", &track);
-
-  fNTracks->Fill(tracks->GetEntries());
-  fData->fNTracks = (Int_t) tracks->GetEntries();
-  fData->SetSize(fData->fNTracks);
-  for (Int_t i = 0; i < tracks->GetEntries(); i++) {
-    tracks->GetEntry(i);
-    fTrackPt->Fill(track->Pt());
-    fTrackEta->Fill(track->Eta());
-    fTrackPhi->Fill(track->Phi() * TMath::RadToDeg());
-    fTrackDEdxVsP->Fill(track->P(), track->GetdEdx());
-
-    fData->fPt[i] = track->Pt();
-    fData->fEta[i] = track->Eta();
-    fData->fPhi[i] = track->Phi() * TMath::RadToDeg();
-  }
+  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());
 
 
-  delete track;
-  tpcLoader->UnloadTracks();
+    fData->SetData(i, pt, eta, phi); 
+  }
+  fNTracks->Fill(nTracks);
+  fData->SetNTracks(nTracks);
 }
 }