- moved AliHLTDisplay files from TPCLib to TPCLib/OnlineDisplay
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 8 Sep 2006 09:13:08 +0000 (09:13 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 8 Sep 2006 09:13:08 +0000 (09:13 +0000)
- added the AliHLTTPCDisplay library to the module

26 files changed:
HLT/BASE/Makefile.am
HLT/ChangeLog
HLT/README
HLT/TPCLib/AliHLTTPCDigitReader.h
HLT/TPCLib/AliHLTTPCDigitReaderRaw.cxx
HLT/TPCLib/AliHLTTPCDigitReaderRaw.h
HLT/TPCLib/AliHLTTPCDisplay.cxx [deleted file]
HLT/TPCLib/AliHLTTPCDisplay.h [deleted file]
HLT/TPCLib/AliHLTTPCStandardIncludes.h [deleted file]
HLT/TPCLib/Makefile.am
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplay3D.cxx [new file with mode: 0644]
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplay3D.h [new file with mode: 0644]
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayCharge.cxx [new file with mode: 0644]
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayCharge.h [new file with mode: 0644]
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayFront.cxx [new file with mode: 0644]
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayFront.h [new file with mode: 0644]
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayMain.cxx [new file with mode: 0644]
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayMain.h [new file with mode: 0644]
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayPad.cxx [new file with mode: 0644]
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayPad.h [new file with mode: 0644]
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayPadRow.cxx [new file with mode: 0644]
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayPadRow.h [new file with mode: 0644]
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayResiduals.cxx [new file with mode: 0644]
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayResiduals.h [new file with mode: 0644]
HLT/TPCLib/OnlineDisplay/Makefile.am [new file with mode: 0644]
HLT/configure.ac

index 971f2c3..1deb437 100644 (file)
@@ -41,7 +41,7 @@ pkginclude_HEADERS            =  $(CLASS_HDRS) \
 noinst_HEADERS                 =  AliHLTStdIncludes.h
 
 # version info for the library
-libHLTbase_la_LDFLAGS          =  -version-info 1:0:0
+libHLTbase_la_LDFLAGS          =  -version-info 1:1:0
 
 # automatic generation of data and time of library build
 COMPILE_INFO                   =  HLTBaseCompileInfo.cxx
index e6c1f97..1a9e051 100644 (file)
@@ -1,17 +1,15 @@
-2006-09-06 intermediate
-       - parameter protection in the TPC raw reader class
+2006-09-07 HLT-v0-4
        - TPC digit reader classes fetch row range from AliHLTTPCTransform
+        - code from TPC commissioning version merged
+         - DigitReaderRaw added with different read modes (sorted/unsorted;
+           several data specifications to adapt to the real data)
+         - DigitReaderPacked capable of sorting incoming data 
+         - straight line fit implemented in Conformal Mapping Fit
+       - TPCDisplay library added
        - bugfix HLTComponentHandler::CreateComponent: result handling after DoInit
        - bugfix ClusterFinder: index check for arrays of fixed size
-       - base line calculation and zero suppression fully implemented into
+       - base line calculation and zero suppression implemented into
          Cluster Finder: new argument 'adc-threshold' for ClusterFinderComponent 
-       - code documetation
-       - effective C++ corrections
-2006-08-31 code from TPC commissioning version merged
-       - DigitReaderRaw added with different read modes (sorted/unsorted;
-         several data specifications to adapt to the real data)
-       - quick hack to sort incoming data in DigitReaderPacked 
-       - straight line fit implemented in Conformal Mapping Fit
 2006-08-23 version HLT-v0-3
        - check for AliRoot features/libs/files and corresponding conditional
          build
index cb9ff7f..1c925e1 100644 (file)
@@ -37,6 +37,14 @@ usual way (ROOTSYS, ALICE_ROOT, library locations evtl. specified in
 LD_LIBRARY_PATH, ...). Actually, the BASE and SampleLib modules are
 not dependend on AliRoot. The TPCLib does.
 
+To set up a version retrieved from CVS, autoconf 2.57, automake 1.6
+,and libtool 1.4 or higher versions are required. Thats the versions
+which come with the Scientific Linux CERN 3. The same applies if
+you want to change the Makefiles.
+
+If your GNU build tools are too old, ask the maintainers for a distributed
+package.  
+
 Setting up a version retrieved from CVS
 =======================================
 Skip this section if you have started from the tar ball.
index d149f46..7dd6e47 100644 (file)
@@ -56,7 +56,7 @@ public:
    * @param patch     patch (readout partition) number within the slice
    * @param slice     sector no (0 to 35)
    */
-  int InitBlock(void* ptr,unsigned long size,Int_t firstrow,Int_t lastrow, Int_t patch, Int_t slice);
+  virtual int InitBlock(void* ptr,unsigned long size,Int_t firstrow,Int_t lastrow, Int_t patch, Int_t slice);
 
   /**
    * Set the reader position to the next value.
index 2526cd7..c32c40f 100644 (file)
@@ -32,7 +32,7 @@ using namespace std;
 #include "AliHLTTPCDigitReaderRaw.h"
 #include "AliHLTTPCTransform.h"
 #include "AliHLTTPCRootTypes.h"
-#include "AliHLTTPCStandardIncludes.h"
+#include "AliHLTStdIncludes.h"
 #include "AliHLTTPCLogging.h"
 
 ClassImp(AliHLTTPCDigitReaderRaw)
@@ -136,6 +136,10 @@ AliHLTTPCDigitReaderRaw::~AliHLTTPCDigitReaderRaw(){
     }
 }
 
+int AliHLTTPCDigitReaderRaw::InitBlock(void* ptr,unsigned long size,Int_t firstrow,Int_t lastrow, Int_t patch, Int_t slice) {
+  return AliHLTTPCDigitReader::InitBlock(ptr, size, firstrow, lastrow, patch, slice);
+}
+
 int AliHLTTPCDigitReaderRaw::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice){
 
     fBuffer = (AliHLTUInt8_t*) ptr;
index 28489ae..c142345 100644 (file)
@@ -61,6 +61,22 @@ public:
    */
   virtual int InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice);
 
+  /**
+   * Old Init function.
+   * <b>Note:</b> This method is for backward compatibility only, not for further
+   * use. The <i>firstrow</i> and <i>lastrow</i> parameters are fetched from
+   * @ref AliHLTTPCTransform. The method is implemented in the raw reader base class
+   * but is defined here to keep the signature of the library interface.
+   *
+   * @param ptr       pointer to data buffer
+   * @param size      size of the data buffer
+   * @param firstrow  first row occuring in the data
+   * @param lastrow   last row occuring in the data
+   * @param patch     patch (readout partition) number within the slice
+   * @param slice     sector no (0 to 35)
+   */
+  int InitBlock(void* ptr,unsigned long size,Int_t firstrow,Int_t lastrow, Int_t patch, Int_t slice);
+
   // Deliver values sorted for format 0, otherwise pass through to corresponding *Real* method
   virtual bool Next();
   virtual int GetRow();
diff --git a/HLT/TPCLib/AliHLTTPCDisplay.cxx b/HLT/TPCLib/AliHLTTPCDisplay.cxx
deleted file mode 100644 (file)
index e050631..0000000
+++ /dev/null
@@ -1,1183 +0,0 @@
-// @(#) $Id$
-// Original: AliL3Display.cxx,v 1.26 2005/06/14 10:55:21 cvetan 
-
-/** \class AliHLTTPCDisplay
-<pre>
-//_____________________________________________________________
-// AliHLTTPCDisplay
-//
-// Display class for the HLT TPC events.
-</pre>
-*/
-// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
-//         Anders Vestbo <mailto:vestbo@fi.uib.no>      
-//*-- Copyright &copy ALICE HLT Group 
-
-#define TRACKHELIX 0
-#define TRACKPOLYMARKER 0
-#define BACKWARD 0
-#define FIRSTLASTPOINT 0
-
-#define TRACKCOLOR 
-#define USEDCLUSTERCOLOR
-#define UNUSEDCLUSTERCOLOR
-
-#include <TView.h>
-#include <TPolyMarker3D.h>
-#include <TPolyLine3D.h>
-#include <TH2.h>
-#include <TTree.h>
-#include <TNode.h>
-#include <TGeometry.h>
-#include <TShape.h>
-#include <TParticle.h>
-#include <TFile.h>
-#include <THelix.h>
-#include <TStyle.h>
-#include <TGraph.h>
-#include <TMultiGraph.h>
-#include <TAttText.h>
-#include <TAxis.h>
-
-#if TRACKHELIX
-#include <THelix.h>
-#endif
-
-#ifdef use_aliroot
-#include <TClonesArray.h>
-#include <AliRun.h>
-#include <AliSimDigits.h>
-#include <AliTPCParam.h>
-#endif
-
-#include "AliHLTTPCLogging.h"
-#include "AliHLTTPCDisplay.h"
-#include "AliHLTTPCTransform.h"
-#include "AliHLTTPCTrack.h"
-#include "AliHLTTPCTrackArray.h"
-#include "AliHLTTPCSpacePointData.h"
-#include "AliHLTTPCMemHandler.h"
-#include "AliHLTTPCDigitReaderPacked.h"
-
-#if __GNUC__ == 3
-using namespace std;
-#endif
-
-ClassImp(AliHLTTPCDisplay)
-
-// #############################################################################
-void AliHLTTPCDisplay::InitDisplay(Char_t *gfile) {
-    //constructor
-    memset(fClusters,0,36*6*sizeof(AliHLTTPCSpacePointData*));
-    memset(fNcl, 0, 36*6*sizeof(UInt_t)); 
-
-    fTracks = NULL;
-    fHistrawcl = NULL;
-    fHistraw = NULL;
-    fHistpad1 = NULL;
-    fHistpad2 = NULL;
-    fHistpad3 = NULL;
-    fHistallresidualsY = NULL;   
-    fHistallresidualsZ = NULL;
-    fHistcharge = NULL;
-    fGraphresidualsY = NULL;
-    fGraphresidualsZ = NULL;
-    fGraphresidualsYLength = NULL;
-    fGraphresidualsZLength = NULL;
-
-
-    fGeom = NULL;
-// ---------------------------------------------------
-// In order to be backward compatible
-// ---------------------------------------------------
-#if BACKWARD
-    //fc1 = NULL;
-#endif 
-// ---------------------------------------------------
-    fNPads = 0;
-    fNTimes = 0;
-    fMinHits = 0;
-    fPtThreshold = 0.;
-    fPad = -1;
-    fPadRow = 0;
-    fSlicePadRow = 0; 
-    fSelectTrack = -1;
-    fSelectTrackSlice = 0;
-    fSelectTrackSwitch = kFALSE;
-    fSelectCluster = 0;
-
-    fMinSlice = 0;
-    fMaxSlice = 35;
-    fSlicePair = kFALSE;
-
-    SetSliceArray();
-
-    fBackColor = 1; 
-    fLineColor = 0;
-    fKeepView = kFALSE;
-
-    fSwitch3DCluster = kFALSE;
-    fSwitch3DTracks = kFALSE;
-    fSwitch3DPadRow = kFALSE;
-    fSwitch3DGeometry = kFALSE;
-
-    AliHLTTPCTransform::SetBField(0.4);
-    LoadGeometrie(gfile);
-}
-
-
-// #############################################################################
-AliHLTTPCDisplay::~AliHLTTPCDisplay() {
-    //destructor
-    if(fTracks) delete fTracks;
-    fTracks = NULL;
-}
-
-// #############################################################################
-Bool_t AliHLTTPCDisplay::LoadGeometrie(Char_t *gfile) {
-    if (gfile) {
-       TFile *file = TFile::Open(gfile);
-       if(!file) {
-           LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::AliHLTTPCDisplay","File Open") <<"Geometry file " << gfile << " does not exist!"<<ENDLOG;
-           return kFALSE;
-       }
-       
-       fGeom = (TGeometry*)file->Get("AliceGeom");
-
-       file->Close();
-       delete file;
-    }
-    return kTRUE;
-}
-
-// #############################################################################
-//                 EXECUTER
-// #############################################################################
-void AliHLTTPCDisplay::ExecPadRow(){
-   int event = gPad->GetEvent();
-   if (event != 11) return;
-
-   printf("TEST !!!!!!!!!!!!!!!");
-/*   int px = gPad->GetEventX();
-   TObject *select = gPad->GetSelected();
-   if (!select) return;
-   if (select->InheritsFrom("TH1")) {
-      TH1 *h = (TH1*)select;
-      Float_t xx = gPad->AbsPixeltoX(px);
-      Float_t x  = gPad->PadtoX(xx);
-      Int_t binx = h->GetXaxis()->FindBin(x);
-      printf("event=%d, hist:%s, bin=%d, content=%f\n",event,h->GetName(),binx,h->GetBinContent(binx));
-   }
-
-*/
-
-}
-
-// #############################################################################
-//                 SETTER
-// #############################################################################
-void AliHLTTPCDisplay::SetHistPadRowAxis() {
-    // Set Axis range of Histogramm, due to variable NPads per padrow
-
-    fNPads = AliHLTTPCTransform::GetNPads(fPadRow);
-    fHistrawcl->SetAxisRange(0,fNPads);
-    fHistraw->SetAxisRange(0,fNPads);
-    fHistrawcl->SetAxisRange(0,fNTimes,"Y");
-    fHistraw->SetAxisRange(0,fNTimes,"Y");
-}
-
-void AliHLTTPCDisplay::SetSliceArray() {
-    Int_t slice=0;
-    Int_t minSlice = fMinSlice; 
-    Int_t maxSlice = fMaxSlice; 
-    Int_t realslice = 0;
-
-    for (slice=0;slice<=35;slice++){
-       fSliceArray[slice] = kFALSE;
-    }
-
-    // Single Slice, or Range
-    if (minSlice > maxSlice) maxSlice += 17;
-       
-    for (slice=minSlice;slice<=maxSlice;slice++){
-       realslice = slice % 18;
-       fSliceArray[realslice] = kTRUE;
-       fSliceArray[realslice+18] = kTRUE;
-    }
-
-    // Pair of Slices
-    if (fSlicePair) {
-       minSlice = fMinSlice + 9;
-       maxSlice = fMaxSlice + 9;
-       
-       if (minSlice > maxSlice) maxSlice += 17;
-       
-       for (slice=minSlice;slice<=maxSlice;slice++){
-           realslice = slice % 18;
-           fSliceArray[realslice] = kTRUE;     
-           fSliceArray[realslice+18] = kTRUE;
-       }
-    }
-}
-
-// #############################################################################
-//                 SETUP
-// #############################################################################
-void AliHLTTPCDisplay::SetupCluster(Int_t slice, Int_t patch, UInt_t nofClusters, AliHLTTPCSpacePointData* data)  {  
-
-    if (data && slice>=0 && slice<36 && patch>=0 && patch<AliHLTTPCTransform::GetNPatches()) {
-       if (fClusters[slice][patch]!=NULL) {
-           delete(fClusters[slice][patch]);
-           fClusters[slice][patch]=NULL;
-       }
-       Int_t arraysize=nofClusters*sizeof(AliHLTTPCSpacePointData);
-       fClusters[slice][patch] = (AliHLTTPCSpacePointData*)new Byte_t[arraysize];
-       if (fClusters[slice][patch]) {
-           memcpy(fClusters[slice][patch], data, arraysize);
-           fNcl[slice][patch]=nofClusters;
-       } else {
-           fNcl[slice][patch]=nofClusters;
-           LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::SetupCluster","memory allocation") << "memory allocation failed "<<ENDLOG; 
-       }
-    } else LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::SetupCluster","argument check") << "invalid argument "<<ENDLOG; 
-}
-
-// #############################################################################
-void AliHLTTPCDisplay::SetupTracks(AliHLTTPCTrackArray *tracks) {
-    fTracks=tracks;
-
-    // Set USED cluster
-    Int_t ntracks = fTracks->GetNTracks();
-
-    for(Int_t j=0; j<ntracks; j++) {   
-       AliHLTTPCTrack *gtrack = fTracks->GetCheckedTrack(j); 
-       if(!gtrack) continue;
-
-       Int_t nHits = gtrack->GetNHits();
-       UInt_t *hitnum = gtrack->GetHitNumbers();
-
-       for(Int_t h=0; h<nHits; h++){
-         
-           UInt_t id=hitnum[h];
-           Int_t slice = (id>>25) & 0x7f;
-           Int_t patch = (id>>22) & 0x7;
-           UInt_t pos = id&0x3fffff;       
-               
-           AliHLTTPCSpacePointData *points = fClusters[slice][patch];
-           
-           if(!points) {
-               LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::Draw3D","Clusterarray") <<"No points at slice "<<slice<<" patch "<<patch<<" pos "<<pos<<ENDLOG;
-               continue;
-           }
-           if(pos>=fNcl[slice][patch]) {
-               LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::Draw3D","Clusterarray") <<"Pos is too large: pos "<<pos <<" ncl "<<fNcl[slice][patch]<<ENDLOG;
-               continue;
-           }
-           points[pos].fUsed = kTRUE;
-           points[pos].fTrackN = j;
-       }
-    }
-}
-
-// #############################################################################
-void AliHLTTPCDisplay::SetupHist(){
-
-    Int_t maxpads = 150;
-    fNTimes = AliHLTTPCTransform::GetNTimeBins();
-
-    if ( fHistraw ){
-       delete fHistraw;
-       fHistraw = NULL;
-    }
-    if ( fHistrawcl ){
-       delete fHistrawcl;
-       fHistrawcl = NULL;
-    }
-
-    if ( fHistpad1 ){
-       delete fHistpad1;
-       fHistpad1 = NULL;
-    }
-
-    if ( fHistpad2 ){
-       delete fHistpad2;
-       fHistpad2 = NULL;
-    }
-
-    if ( fHistpad3 ){
-       delete fHistpad3;
-       fHistpad3 = NULL;
-    }
-
-    if ( fHistallresidualsY){
-       delete fHistallresidualsY;
-       fHistallresidualsY = NULL;
-    }
-
-    if ( fHistallresidualsZ){
-       delete fHistallresidualsZ;
-       fHistallresidualsZ = NULL;
-    }
-    if ( fHistcharge){
-       delete fHistcharge;
-       fHistcharge = NULL;
-    }
-
-    // Setup the histograms
-    Int_t padbinning = maxpads*10;
-    fHistraw = new TH2F("fHistraw","Selected PadRow with found Clusters;Pad #;Timebin #",maxpads,0,maxpads-1,fNTimes,0,fNTimes-1);
-    fHistrawcl = new TH1F("fHistrawcl","",padbinning,0,maxpads-1);
-    fHistpad1 = new TH1F ("fHistpad1","Selected Pad -1;Timebin #",fNTimes,0,fNTimes-1);
-    fHistpad2 = new TH1F ("fHistpad2","Selected Pad;Timebin #",fNTimes,0,fNTimes-1); 
-    fHistpad3 = new TH1F ("fHistpad3","Selected Pad +1;Timebin #",fNTimes,0,fNTimes-1);
-    fHistallresidualsY = new TH1F ("fHistallresiduals","Y Residuals of all Tracks in selected slices;residuals",5000,-100,100);
-    fHistallresidualsZ = new TH1F ("fHistallresiduals","Z Residuals of all Tracks in selected slices;residuals",5000,-100,100);
-    fHistcharge = new TH1F ("fHistcharge","Cluster distribution per charge;charge;#cluster",5000,0,30000);
-
-    fHistraw->SetOption("COLZ"); 
-
-    fHistallresidualsY->SetTitleSize(0.03);
-    fHistallresidualsY->GetXaxis()->SetLabelSize(0.03);
-    fHistallresidualsY->GetXaxis()->SetTitleSize(0.03);
-    fHistallresidualsY->GetYaxis()->SetLabelSize(0.03);
-    fHistallresidualsY->GetYaxis()->SetTitleSize(0.03);
-
-    fHistallresidualsZ->SetTitleSize(0.03);
-    fHistallresidualsZ->GetXaxis()->SetLabelSize(0.03);
-    fHistallresidualsZ->GetXaxis()->SetTitleSize(0.03);
-    fHistallresidualsZ->GetYaxis()->SetLabelSize(0.03);
-    fHistallresidualsZ->GetYaxis()->SetTitleSize(0.03);
-
-    fHistcharge->SetTitleSize(0.03);
-    fHistcharge->GetXaxis()->SetLabelSize(0.03);
-    fHistcharge->GetXaxis()->SetTitleSize(0.03);
-    fHistcharge->GetYaxis()->SetLabelSize(0.03);
-    fHistcharge->GetYaxis()->SetTitleSize(0.03);
-
-    fHistraw->SetTitleSize(0.03);
-    fHistraw->GetXaxis()->SetLabelSize(0.03);
-    fHistraw->GetXaxis()->SetTitleSize(0.03);
-    fHistraw->GetYaxis()->SetLabelSize(0.03);
-    fHistraw->GetYaxis()->SetTitleSize(0.03);
-
-    fHistpad1->SetTitleSize(0.03);
-    fHistpad1->GetXaxis()->SetLabelSize(0.03);
-    fHistpad1->GetXaxis()->SetTitleSize(0.03);
-    fHistpad1->GetYaxis()->SetLabelSize(0.03);
-    fHistpad1->GetYaxis()->SetTitleSize(0.03);
-
-    fHistpad2->SetTitleSize(0.03);
-    fHistpad2->GetXaxis()->SetLabelSize(0.03);
-    fHistpad2->GetXaxis()->SetTitleSize(0.03);
-    fHistpad2->GetYaxis()->SetLabelSize(0.03);
-    fHistpad2->GetYaxis()->SetTitleSize(0.03);
-
-    fHistpad3->SetTitleSize(0.03);
-    fHistpad3->GetXaxis()->SetLabelSize(0.03);
-    fHistpad3->GetXaxis()->SetTitleSize(0.03);
-    fHistpad3->GetYaxis()->SetLabelSize(0.03);
-    fHistpad3->GetYaxis()->SetTitleSize(0.03);
-
-    gStyle->SetPalette(1);
-    
-    SetHistPadRowAxis();
-}
-
-// ####################################################################################################
-void AliHLTTPCDisplay::FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLen){
-#if defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H)
-    AliHLTTPCDigitReader* digitReader = new AliHLTTPCDigitReaderPacked();
-    bool readValue = true;
-    Int_t rowOffset = 0;
-
-    // Initialize RAW DATA
-    Int_t firstRow = AliHLTTPCTransform::GetFirstRow(patch);
-    Int_t lastRow = AliHLTTPCTransform::GetLastRow(patch);
-
-    // Outer sector, patches 2, 3, 4, 5 -  start counting in patch 2 with row 0
-    if ( patch >= 2 ) rowOffset = AliHLTTPCTransform::GetFirstRow( 2 );
-
-    // Initialize block for reading packed data
-    void* tmpdataBlock = (void*) dataBlock;
-    digitReader->InitBlock(tmpdataBlock,dataLen,firstRow,lastRow,patch,0);
-
-    readValue = digitReader->Next();
-
-    if (!readValue){   
-       LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::FillPadRow","Read first value") << "No value in data block" << ENDLOG;
-       return;
-    }
-    
-    // FILL PADROW 3D --- Initialize the colorbins
-    if (fSwitch3DPadRow){
-       for (UInt_t ii=0;ii < 20;ii++){
-           fbinct[ii] = 0;
-           fcolorbin[ii] = 0;
-       }
-
-       // read number of entries in colorbin
-       while ( readValue ){ 
-
-           Int_t row = digitReader->GetRow() + rowOffset;
-           
-           if (row == fPadRow){    
-               UInt_t charge = digitReader->GetSignal();
-               
-               for (UInt_t ii=0;ii < 19;ii++){
-                   if ( charge > (ii*15) && charge <= ((ii*15) + 15) ) fcolorbin[ii]++;
-               }
-                // larger than 19 * 15 
-               if (charge > 285 ) fcolorbin[19]++;
-           }
-
-           // read next value
-           readValue = digitReader->Next();
-      
-           if(!readValue) break; //No more value
-       } 
-       //Initialize fpmarr[color][3*colorbin[ii]]  
-       fpmarr[0] = new Float_t[fcolorbin[0]*3]; 
-       fpmarr[1] = new Float_t[fcolorbin[1]*3]; 
-       fpmarr[2] = new Float_t[fcolorbin[2]*3]; 
-       fpmarr[3] = new Float_t[fcolorbin[3]*3]; 
-       fpmarr[4] = new Float_t[fcolorbin[4]*3];  
-       fpmarr[5] = new Float_t[fcolorbin[5]*3]; 
-       fpmarr[6] = new Float_t[fcolorbin[6]*3]; 
-       fpmarr[7] = new Float_t[fcolorbin[7]*3]; 
-       fpmarr[8] = new Float_t[fcolorbin[8]*3]; 
-       fpmarr[9] = new Float_t[fcolorbin[9]*3]; 
-       fpmarr[10] = new Float_t[fcolorbin[10]*3]; 
-       fpmarr[11] = new Float_t[fcolorbin[11]*3]; 
-       fpmarr[12] = new Float_t[fcolorbin[12]*3]; 
-       fpmarr[13] = new Float_t[fcolorbin[13]*3]; 
-       fpmarr[14] = new Float_t[fcolorbin[14]*3]; 
-       fpmarr[15] = new Float_t[fcolorbin[15]*3]; 
-       fpmarr[16] = new Float_t[fcolorbin[16]*3]; 
-       fpmarr[17] = new Float_t[fcolorbin[17]*3]; 
-       fpmarr[18] = new Float_t[fcolorbin[18]*3]; 
-       fpmarr[19] = new Float_t[fcolorbin[19]*3]; 
-       
-       // Rewind the raw reader and fill the polymarker3D
-       digitReader->InitBlock(tmpdataBlock,dataLen,firstRow,lastRow,patch,0);
-       
-       readValue = digitReader->Next();
-    } // END if (fSwitch3DPadRow)
-
-    // -- Fill Raw Data
-    while ( readValue ){ 
-
-       Int_t row = digitReader->GetRow() + rowOffset;
-
-       // select padrow to fill in histogramm
-       if (row == fPadRow){    
-           UChar_t pad = digitReader->GetPad();
-           UShort_t time = digitReader->GetTime();
-           UInt_t charge = digitReader->GetSignal();
-           Float_t xyz[3];
-           fHistraw->Fill(pad,time,charge);
-
-           if (pad == (fPad-1) ) fHistpad1->Fill(time,charge);
-           if (pad == fPad) fHistpad2->Fill(time,charge);
-           if (pad == (fPad+1) ) fHistpad3->Fill(time,charge);
-
-           if (fSwitch3DPadRow) {
-               // Transform raw coordinates to local coordinates
-               AliHLTTPCTransform::RawHLT2Global(xyz, fSlicePadRow, fPadRow, pad, time);
-
-               for (UInt_t ii=0;ii < 19;ii++){
-                   if ( charge > (ii*15) && charge <= ((ii*15) + 15) ){
-                       fpmarr[ii][fbinct[ii]] = xyz[0];
-                       fpmarr[ii][fbinct[ii]+1] = xyz[1];
-                       fpmarr[ii][fbinct[ii]+2] = xyz[2];
-                       fbinct[ii] += 3;
-                   }
-               }
-               // larger than 19 * 15
-               if (charge > 285 ) {
-                   fpmarr[19][fbinct[19]] = xyz[0];
-                   fpmarr[19][fbinct[19]+1] = xyz[1];
-                   fpmarr[19][fbinct[19]+2] = xyz[2];
-                   fbinct[19] += 3;
-               }
-           } // END if (fSwitch3DPadRow)
-       
-       }
-       
-       // read next value
-       readValue = digitReader->Next();
-      
-       //Check where to stop:
-       if(!readValue) break; //No more value
-    } 
-    
-    if ( digitReader )
-       delete digitReader;
-    digitReader = NULL;
-
-    AliHLTTPCSpacePointData *points = fClusters[fSlicePadRow][patch];
-    if(!points) return;
-    Int_t npoints = fNcl[fSlicePadRow][patch];
-    
-    Float_t xyz[3];
-    for(Int_t i=0; i<npoints; i++){
-       xyz[0] = points[i].fX;
-       xyz[1] = points[i].fY;
-       xyz[2] = points[i].fZ;
-       
-       Int_t clrow = AliHLTTPCTransform::GetPadRow(xyz[0]);
-       // select padrow to fill in histogramm
-       if (clrow == fPadRow){
-           AliHLTTPCTransform::LocHLT2Raw(xyz, fSlicePadRow, fPadRow);
-           fHistrawcl->Fill(xyz[1],xyz[2]);
-       }
-    }
-#else //! if defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H)
-    HLTFatal("DigitReaderPacked not available - check your build");
-#endif //defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H)
-}
-
-// #############################################################################
-void AliHLTTPCDisplay::ResetHistPadRow(){  
-    fHistraw->Reset();   
-    fHistrawcl->Reset(); 
-    fHistpad1->Reset(); 
-    fHistpad2->Reset();  
-    fHistpad3->Reset(); 
-}
-
-// #############################################################################
-void AliHLTTPCDisplay::ResetHistResiduals(){  
-    fHistallresidualsY->Reset();
-    fHistallresidualsZ->Reset();
-}
-
-// #############################################################################
-void AliHLTTPCDisplay::ResetHistCharge(){  
-    fHistcharge->Reset();
-}
-
-
-// #############################################################################
-//                 DRAWER
-// #############################################################################
-void AliHLTTPCDisplay::DrawGeomSector(Int_t sector) {  
-  Char_t fname[256];
-  Int_t realsector = sector;// % 18;
-  
-  if (realsector < 10){
-    sprintf(fname,"LS0%d",realsector);
-    fGeom->GetNode(fname)->SetLineColor(fLineColor);
-    fGeom->GetNode(fname)->Draw("same");
-    sprintf(fname,"US0%d",realsector);
-    fGeom->GetNode(fname)->SetLineColor(fLineColor); 
-    fGeom->GetNode(fname)->Draw("same");
-  }
-  else {
-    sprintf(fname,"LS%d",realsector);
-    fGeom->GetNode(fname)->SetLineColor(fLineColor);
-    fGeom->GetNode(fname)->Draw("same");
-    sprintf(fname,"US%d",realsector);
-    fGeom->GetNode(fname)->SetLineColor(fLineColor); 
-    fGeom->GetNode(fname)->Draw("same");
-  }   
-}
-// #############################################################################
-void AliHLTTPCDisplay::DrawHistPadRow(){  
-    Char_t title[256];
-    sprintf(title,"Selected PadRow %d with found Clusters",fPadRow);
-
-    fHistraw->SetTitle(title);
-    fHistraw->SetStats(kFALSE);
-    fHistraw->Draw("COLZ");
-
-    fHistrawcl->SetStats(kFALSE);
-    fHistrawcl->SetMarkerStyle(28);
-    fHistrawcl->SetMarkerSize(2);
-    fHistrawcl->SetMarkerColor(1);
-    fHistrawcl->Draw("psame");
-}
-
-// #############################################################################
-void AliHLTTPCDisplay::DrawHistPad1(){  
-    Char_t title[256];
-    sprintf(title,"Selected Pad %d",fPad -1);
-    fHistpad1->SetStats(kFALSE);
-    fHistpad1->SetTitle(title);
-    fHistpad1->Draw();
-}
-
-// #############################################################################
-void AliHLTTPCDisplay::DrawHistPad2(){  
-    Char_t title[256];
-    sprintf(title,"Selected Pad %d",fPad);
-
-    fHistpad2->SetStats(kFALSE);
-    fHistpad2->SetTitle(title);
-    fHistpad2->Draw();
-}
-
-// #############################################################################
-void AliHLTTPCDisplay::DrawHistPad3(){  
-    Char_t title[256];
-    sprintf(title,"Selected Pad %d",fPad +1);
-
-    fHistpad3->SetStats(kFALSE);
-    fHistpad3->SetTitle(title);
-    fHistpad3->Draw();
-}
-
-// #############################################################################
-void AliHLTTPCDisplay::DrawHistResiduals(Bool_t ySwitch){  
-    if (fSwitch3DTracks){
-       if (ySwitch){
-           // Y Residual histogram for 1 track
-
-           if (fSelectTrackSwitch){
-               Char_t title[256];
-               sprintf(title,"Y Residuals of Track %d in Slice %d",fSelectTrack, fSelectTrackSlice );
-
-               TMultiGraph *mgY = new TMultiGraph();
-
-
-//             fGraphresidualsY->SetTitle(title);      
-               fGraphresidualsY->GetXaxis()->SetTitle("padrow");       
-               fGraphresidualsY->GetYaxis()->SetTitle("residuals");
-//             fGraphresidualsY->Draw("A*");
-               fGraphresidualsY->GetXaxis()->SetLabelSize(0.02);
-               fGraphresidualsY->GetXaxis()->SetTitleSize(0.02);
-               fGraphresidualsY->GetYaxis()->SetLabelSize(0.02);
-               fGraphresidualsY->GetYaxis()->SetTitleSize(0.02);
-               fGraphresidualsYLength->SetMarkerColor(2);
-               fGraphresidualsYLength->SetMarkerStyle(5);
-               fGraphresidualsY->SetMarkerColor(1);
-               fGraphresidualsY->SetMarkerStyle(3);
-
-//             fGraphresidualsY->Draw("A*");
-//             fGraphresidualsYLength->Draw("*");
-
-               mgY->Add(fGraphresidualsY);
-               mgY->Add(fGraphresidualsYLength);
-               mgY->SetTitle(title);
-//             mgY->GetXaxis()->SetTitle("padrow");    
-//             mgY->GetYaxis()->SetTitle("residuals");
-               mgY->Draw("AP");
-           }
-           // Global residuals histogram
-           else{
-               fHistallresidualsY->SetStats(kFALSE);
-               fHistallresidualsY->Draw();
-           }
-       }
-       else {
-            // Z Residual histogram for 1 track
-           if (fSelectTrackSwitch){
-               Char_t title[256];
-               sprintf(title,"Z Residuals of Track %d in Slice %d",fSelectTrack, fSelectTrackSlice );
-
-               TMultiGraph *mgZ = new TMultiGraph();
-
-               fGraphresidualsZ->SetTitle(title);      
-               fGraphresidualsZ->GetXaxis()->SetTitle("padrow");       
-               fGraphresidualsZ->GetYaxis()->SetTitle("residuals");
-               fGraphresidualsZ->GetXaxis()->SetLabelSize(0.02);
-               fGraphresidualsZ->GetXaxis()->SetTitleSize(0.02);
-               fGraphresidualsZ->GetYaxis()->SetLabelSize(0.02);
-               fGraphresidualsZ->GetYaxis()->SetTitleSize(0.02);
-//             fGraphresidualsZLength->Draw("F*");
-//             fGraphresidualsZ->Draw("A*");
-       
-               mgZ->Add(fGraphresidualsZ);
-//             mgZ->Add(fGraphresidualsZLength);
-               mgZ->SetTitle(title);
-               mgZ->Draw("A*");
-           }
-           // Global residuals histogram
-           else{
-               fHistallresidualsZ->SetStats(kFALSE);
-               fHistallresidualsZ->Draw();
-           }
-       }
-    }
-}
-
-// #############################################################################
-void AliHLTTPCDisplay::DrawHistCharge(){  
-    if (fSwitch3DCluster){
-//     fHistcharge->SetStats(kFALSE);
-       fHistcharge->Draw();
-    }
-}
-
-// #############################################################################
-void AliHLTTPCDisplay::Draw3D(){       
-    
-    TView *v = new TView(1);
-    v->SetRange(-800,-800,-800,800,800,800);
-
-    Float_t* etaRange = NULL;   // ------  STILL TO FIX
-    
-
-    //--------------------------------------------------------------------------------------------
-    // DRAW 3D CLUSTER
-    //--------------------------------------------------------------------------------------------
-    if (fSwitch3DCluster){
-       Int_t maxCharge = 0;
-
-       for (Int_t slice=0; slice <= 35; slice++){
-
-           Int_t currenttrack = -1;
-
-           if (fSelectCluster == 1 && fSelectTrackSwitch && slice == fSelectTrackSlice ){
-
-               Int_t trackcounter = 0;
-               Int_t ntracks = fTracks->GetNTracks();
-       
-               for(Int_t j=0; j<ntracks; j++) {        
-
-                   AliHLTTPCTrack *gtrack = fTracks->GetCheckedTrack(j); 
-                   if(!gtrack) continue;
-
-                   Int_t nHits = gtrack->GetNHits();  // Number of associated hits to track
-                   Int_t tmpslice = gtrack->GetSector();
-
-                   // --- CHECK if track is should be drawn
-                   // select Single Track
-                   if(tmpslice != fSelectTrackSlice) continue;
-                       
-                   if (trackcounter != fSelectTrack){
-                       trackcounter++;  
-                       continue;
-                   }
-                   trackcounter++;
-
-                   if((fPtThreshold > 0) && (gtrack->GetPt()< fPtThreshold)) continue;
-                   if(nHits < fMinHits) continue;
-
-                   currenttrack = j;
-                   break;
-               }
-           }
-           
-           if (!fSliceArray[slice]) continue;
-           
-           for(Int_t p=0;p<6;p++){
-
-               AliHLTTPCSpacePointData *points = fClusters[slice][p];
-               if(!points) continue;
-               Int_t npoints = fNcl[slice][p];
-               TPolyMarker3D *pmUsed = new TPolyMarker3D(1,6);
-               TPolyMarker3D *pmUnused = new TPolyMarker3D(1,6);
-               Int_t nUsedCluster = 0;
-               Int_t nUnusedCluster = 0;
-
-               Float_t xyz[3];
-               for(Int_t i=0; i<npoints; i++){
-                   // Used  cluster only
-                   if (fSelectCluster == 1  && points[i].fUsed == kFALSE) continue; 
-                   // Unused cluster only
-                   if (fSelectCluster == 2  && points[i].fUsed == kTRUE) continue; 
-
-                   // if single track is selcted draw only cluster for this track
-                   if (fSelectCluster == 1 && fSelectTrackSwitch && points[i].fTrackN != currenttrack) continue;
-                   
-                   xyz[0] = points[i].fX;
-                   xyz[1] = points[i].fY;
-                   xyz[2] = points[i].fZ;
-                   
-                   if ( etaRange ){              
-                       // Do this before the transform, because the tracker also uses
-                       // local coordinates when using this limit to determine 
-                       // which clusters to use for tracking
-                       Double_t pointEta = AliHLTTPCTransform::GetEta( xyz );
-                       if ( pointEta<etaRange[0] || pointEta>etaRange[1] )
-                           continue;
-                   }
-
-                   AliHLTTPCTransform::Local2Global(xyz,slice);
-                
-                   if (points[i].fUsed == kTRUE){
-                       pmUsed->SetPoint(nUsedCluster,xyz[0],xyz[1],xyz[2]);
-                       nUsedCluster++;
-                   }
-                   else {
-                       pmUnused->SetPoint(nUnusedCluster,xyz[0],xyz[1],xyz[2]);
-                       nUnusedCluster++;
-                   }
-
-                   // Fill Charge Histogram
-                   fHistcharge->Fill(points[i].fCharge);
-                   if ((Int_t)points[i].fCharge > maxCharge ) maxCharge = (Int_t) points[i].fCharge; 
-               }
-               pmUsed->SetMarkerSize(1);
-               pmUsed->SetMarkerColor(3); 
-               pmUsed->Draw("");
-
-               pmUnused->SetMarkerSize(1);
-               pmUnused->SetMarkerColor(2); 
-               pmUnused->Draw("");
-           } // END - PATCH LOOP           
-       }  // END - SLICE LOOP
-       fHistcharge->SetAxisRange(0,maxCharge);
-    }   // END - DRAW 3D CLUSTER 
-
-    //--------------------------------------------------------------------------------------------
-    // DRAW 3D TRACKS
-    //--------------------------------------------------------------------------------------------
-    if (fSwitch3DTracks){
-
-       Int_t trackcounter = 0;
-       Int_t ntracks = fTracks->GetNTracks();
-       Double_t drawStep = 0.2;
-
-       Double_t maxResidualY = 0.;
-       Double_t maxResidualZ = 0.;
-
-       TPolyLine3D *line = new TPolyLine3D[ntracks];
-#if TRACKHELIX
-       THelix *helix = new THelix[ntracks];
-#endif
-       for(Int_t j=0; j<ntracks; j++) {        
-
-           AliHLTTPCTrack *gtrack = fTracks->GetCheckedTrack(j); 
-           if(!gtrack) continue;
-
-           Int_t nHits = gtrack->GetNHits();  // Number of associated hits to track
-           Int_t slice = gtrack->GetSector();
-
-            // --- CHECK if track is should be drawn
-           // select if slice should be displayed or not
-           if (!fSliceArray[slice]) continue;  
-           
-           // select Single Track
-           if (fSelectTrackSwitch){
-               if(slice != fSelectTrackSlice) continue;
-       
-               if (trackcounter != fSelectTrack){
-                   trackcounter++;  
-                   continue;
-               }
-               trackcounter++;
-           }
-    
-           if((fPtThreshold > 0) && (gtrack->GetPt()< fPtThreshold)) continue;
-           if(nHits < fMinHits) continue;
-           
-           TPolyMarker3D *pmL = new TPolyMarker3D(1,2);
-           TPolyMarker3D *pmF = new TPolyMarker3D(1,2);
-
-           Double_t radius = gtrack->GetRadius();      // radius
-           Double_t kappa = gtrack->GetKappa();        // curvature = 1/R , signed
-           Double_t lambda = atan( gtrack->GetTgl() ); // dipAngle lambda
-           Double_t phi0 = gtrack->GetPsi() + (gtrack->GetCharge() * AliHLTTPCTransform::PiHalf() ); // azimuthal angle of startingpoint, with respect to helix axis
-
-           Double_t xyzL[3];      // lastpoint of track
-           Double_t xyzF[3];      // firstpoint of track
-
-           xyzF[0] = gtrack->GetFirstPointX();
-           xyzF[1] = gtrack->GetFirstPointY();
-           xyzF[2] = gtrack->GetFirstPointZ();
-           pmF->SetPoint(0,xyzF[0],xyzF[1],xyzF[2]);
-
-           xyzL[0] = gtrack->GetLastPointX();
-           xyzL[1] = gtrack->GetLastPointY();
-           xyzL[2] = gtrack->GetLastPointZ();
-           pmL->SetPoint(0,xyzL[0],xyzL[1],xyzL[2]);
-
-           Double_t s = 0.;       // length of the track
-
-           // Calculate the length of the track. If it is to flat in in s,z plane use sxy, otherwise use sz
-           if (fabs(lambda) > 0.05){
-                // length of track calculated out of z
-               s = fabs( (xyzL[2] - xyzF[2]) / sin(lambda) ); // length of track calculated out of z
-           }
-           else {
-               Double_t d =  (xyzL[0] - xyzF[0])*(xyzL[0] - xyzF[0]) + (xyzL[1] - xyzF[1])*(xyzL[1] - xyzF[1]);
-               // length of track calculated out of xy
-               s = fabs ( acos( 0.5 * (2 - (d / (radius*radius)))) / ( kappa * cos(lambda) ) );                
-           }
-           
-           Int_t nTrackPoints = 2 + (Int_t) floor(s / drawStep);
-
-#if TRACKPOLYMARKER
-           TPolyMarker3D *pmT = new TPolyMarker3D(nTrackPoints,6);
-#endif
-
-           Double_t *xT = new Double_t[nTrackPoints];
-           Double_t *yT = new Double_t[nTrackPoints];
-           Double_t *zT = new Double_t[nTrackPoints];
-
-           //Write Track Parameters for single track
-           if (fSelectTrackSwitch){
-               fTrackParam.id = trackcounter - 1;
-               fTrackParam.nHits = nHits;
-               fTrackParam.charge = gtrack->GetCharge();
-               fTrackParam.lambda = lambda;
-               fTrackParam.kappa = kappa;
-               fTrackParam.radius = radius;
-               fTrackParam.slice = slice;
-               fTrackParam.phi0 = phi0;
-               fTrackParam.pt = gtrack->GetPt();
-               fTrackParam.bfield = AliHLTTPCTransform::GetBFieldValue();
-               fTrackParam.xyzF[0] = gtrack->GetFirstPointX();
-               fTrackParam.xyzF[1] = gtrack->GetFirstPointY();
-               fTrackParam.xyzF[2] = gtrack->GetFirstPointZ();
-               fTrackParam.xyzL[0] = gtrack->GetLastPointX();
-               fTrackParam.xyzL[1] = gtrack->GetLastPointY();
-               fTrackParam.xyzL[2] = gtrack->GetLastPointZ();
-               fTrackParam.psi = gtrack->GetPsi();
-               fTrackParam.s = s;
-           }
-
-           Int_t trackPointCounter = 0;
-
-           for (Double_t ds = 0.; ds < s; ds = ds + drawStep){
-               // FILL ARRAYS IN ORDER TO DRAW THE TRACKPOINTS, OUT OF THE PARAMETER
-               xT[trackPointCounter] = xyzF[0] + radius * ( cos( phi0 + (ds*kappa*cos(lambda)) ) - cos(phi0) );
-               yT[trackPointCounter] = xyzF[1] + radius * ( sin( phi0 + (ds*kappa*cos(lambda)) ) - sin(phi0) );
-               zT[trackPointCounter] = xyzF[2] + ds * sin(lambda);
-#if TRACKPOLYMARKER
-               pmT->SetPoint(trackPointCounter,xT[trackPointCounter],yT[trackPointCounter],zT[trackPointCounter]);
-#endif
-               trackPointCounter++;
-           }
-
-           xT[trackPointCounter] = xyzF[0] + radius * ( cos( phi0 + (s*kappa*cos(lambda)) ) - cos(phi0) );
-           yT[trackPointCounter] = xyzF[1] + radius * ( sin( phi0 + (s*kappa*cos(lambda)) ) - sin(phi0) );
-           zT[trackPointCounter] = xyzF[2] + s * sin(lambda);
-#if TRACKPOLYMARKER       
-           pmT->SetPoint(trackPointCounter,xT[trackPointCounter],yT[trackPointCounter],zT[trackPointCounter]);
-#endif
-           // --- RESIDUALS ---
-           gtrack->Rotate(slice,kTRUE);
-           Int_t nRes = 0;  // number of resiudals
-           
-           UInt_t *hitnum = gtrack->GetHitNumbers();
-
-           Double_t *resY= new Double_t[nHits];
-           Double_t *resZ= new Double_t[nHits];
-
-           Double_t *resYLength= new Double_t[2*nHits];
-           Double_t *resZLength= new Double_t[2*nHits];
-
-           Double_t *padrows = new Double_t[nHits];
-           Double_t *padrowsLength = new Double_t[2*nHits];
-
-           for(Int_t h=0; h<nHits; h++){
-               UInt_t id=hitnum[h];
-               Int_t patch = (id>>22) & 0x7;
-               UInt_t pos = id&0x3fffff; 
-
-               AliHLTTPCSpacePointData *points = fClusters[slice][patch];
-
-               Float_t xyzCtmp[3];    // cluster tmp
-               Float_t xyzTtmp[3];    // track tmp
-
-               xyzCtmp[0] = points[pos].fX;
-               xyzCtmp[1] = points[pos].fY;
-               xyzCtmp[2] = points[pos].fZ;
-
-               Int_t padrow = AliHLTTPCTransform::GetPadRow(points[pos].fX);
-               xyzTtmp[0] = gtrack->GetFirstPointX();
-               if(gtrack->GetCrossingPoint(padrow,xyzTtmp)) {
-
-                   Float_t deltaY = ( xyzCtmp[1] - xyzTtmp[1] );
-                   Float_t deltaZ = ( xyzCtmp[2] - xyzTtmp[2] );
-//                 Float_t residual = sqrt( deltaY*deltaY + deltaZ*deltaZ );
-                   
-                   padrows[nRes] = (Double_t) padrow;
-                   resY[nRes] = (Double_t) deltaY;
-                   resZ[nRes] = (Double_t) deltaZ;
-
-                   resYLength[(2*nRes)] = 0.5 * AliHLTTPCTransform::GetPadLength(padrow);
-                   resYLength[(2*nRes)+1] = -0.5 * AliHLTTPCTransform::GetPadLength(padrow);
-                   resZLength[nRes] = AliHLTTPCTransform::GetZLength();
-                   padrowsLength[(2*nRes)] = (Double_t) padrow;
-                   padrowsLength[(2*nRes)+1] = (Double_t) padrow;
-
-                   // FILL RESIDUALS HISTOGRAM
-                   fHistallresidualsY->Fill(resY[nRes]);
-                   fHistallresidualsZ->Fill(resZ[nRes]);
-                   if (resY[nRes] > maxResidualY ) maxResidualY = resY[nRes];
-                   if (resZ[nRes] > maxResidualZ ) maxResidualZ = resZ[nRes];
-                   nRes++;
-               }
-           }
-
-           gtrack->Rotate(slice,kFALSE);
-           // --- RESIDUALS ---
-
-           // Draw last point of Track
-           pmL->SetMarkerSize(3);
-           pmL->SetMarkerColor(4); 
-//         pmL->Draw();
-
-           // Draw first point of Track
-           pmF->SetMarkerSize(3);
-           pmF->SetMarkerColor(5); 
-//         pmF->Draw();
-
-#if TRACKPOLYMARKER
-           // Draw Track -- as polymarker
-           pmT->SetMarkerSize(3);
-           pmT->SetMarkerColor(3); 
-           pmT->Draw();
-#endif
-           // Draw Track -- as line
-           TPolyLine3D *currentline = &(line[j]);
-           currentline = new TPolyLine3D(nTrackPoints,xT,yT,zT,"");
-           currentline->SetLineColor(4);   
-           currentline->SetLineWidth(2);
-           currentline->Draw("same");
-
-#if TRACKHELIX
-           // Draw Track -- as helix
-            // works ok, execpt for very small dipangles -> track almost horizontal
-           Double_t hrange[2];
-           Double_t v0[3];
-           Double_t omega;
-           hrange[0] = xyzF[2];
-           hrange[1] = xyzL[2];
-           v0[0] = gtrack->GetPx();
-           v0[1] = gtrack->GetPy();
-           v0[2] = gtrack->GetPz();
-           omega = AliHLTTPCTransform::GetBFieldValue() * gtrack->GetCharge();
-
-           THelix *currenthelix = &(helix[j]);
-           currenthelix = new THelix(xyzF,v0,omega,hrange,kHelixZ,0);
-           currenthelix->SetLineColor(6);   
-           currenthelix->SetLineWidth(1);
-           currenthelix->Draw("same");             
-#endif
-
-           //Residuals
-           if ( fGraphresidualsY){
-               delete fGraphresidualsY;
-               fGraphresidualsY = NULL;
-           }
-
-           if ( fGraphresidualsZ){
-               delete fGraphresidualsZ;
-               fGraphresidualsZ = NULL;
-           }
-           //Residuals
-           if ( fGraphresidualsYLength){
-               delete fGraphresidualsYLength;
-               fGraphresidualsYLength = NULL;
-           }
-
-           if ( fGraphresidualsZLength){
-               delete fGraphresidualsZLength;
-               fGraphresidualsZLength = NULL;
-           }
-
-
-
-           // FILL Y RESIDUALS GRAPH
-           fGraphresidualsY = new TGraph(nRes-1,padrows,resY);
-           fGraphresidualsYLength = new TGraph((2*nRes)-2,padrowsLength,resYLength);
-           // FILL Z RESIDUALS GRAPH
-           fGraphresidualsZ = new TGraph(nRes-1,padrows,resZ);
-           fGraphresidualsZLength = new TGraph(nRes-1,padrows,resZLength);
-
-           if (xT) delete xT;
-           if (yT) delete yT;
-           if (zT) delete zT;
-
-       } // END for tracks
-
-       fHistallresidualsY->SetAxisRange(-maxResidualY,maxResidualY);
-       fHistallresidualsZ->SetAxisRange(-maxResidualZ,maxResidualZ);
-
-    }   // END - DRAW 3D Tracks
-
-    //--------------------------------------------------------------------------------------------
-    // DRAW 3D GEOMETRY
-    //--------------------------------------------------------------------------------------------
-    if (fSwitch3DGeometry){
-
-       for (Int_t slice=0; slice <= 17; slice++){
-           if (!fSliceArray[slice]) continue;
-           DrawGeomSector(slice);
-       }
-    }   // END - DRAW 3D GEOMETRY
-    
-    //--------------------------------------------------------------------------------------------
-    // DRAW 3D PadRow
-    //--------------------------------------------------------------------------------------------
-    if (fSwitch3DPadRow && fSliceArray[fSlicePadRow]){
-       Int_t markercolor = 51;
-
-       for (UInt_t ii=0;ii < 20;ii++){
-           if (fcolorbin[ii]> 0){
-               
-               TPolyMarker3D *pm = new TPolyMarker3D(fcolorbin[ii], fpmarr[ii], 7 );
-
-               pm->SetMarkerColor(markercolor); 
-               pm->Draw(""); 
-           }
-
-           // in order to have the SetPalette(1), so called "pretty"
-           if (ii % 2 == 0 ) markercolor += 2;
-           else  markercolor += 3;
-       }
-    }
-
-    //--------------------------------------------------------------------------------------------
-    // DRAW 3D 
-    //--------------------------------------------------------------------------------------------
-    v->ZoomView(0,4);
-    v->Draw();   
-}
-
-// ---------------------------------------------------
-// In order to be backward compatible
-// ---------------------------------------------------
-#if BACKWARD
-void AliHLTTPCDisplay::DisplayClusters(Bool_t x3don,Float_t* etaRange) {
-    if (!fc1){
-       fc1 = new TCanvas("c1","",900,900);
-       fc1->cd();
-    }
-
-    fSwitch3DTracks = kFALSE; 
-    fSwitch3DCluster = kTRUE; 
-    fSwitch3DPadRow = kFALSE; 
-    fSwitch3DGeometry = kFALSE;
-
-    Draw3D();
-}
-// ---------------------------------------------------
-void AliHLTTPCDisplay::DisplayTracks(Int_t minhits,Bool_t x3don,Float_t thr) {
-    if (!fc1){
-       fc1 = new TCanvas("c1","",900,900);
-       fc1->cd();
-    }
-
-    fMinHits = minhits; 
-    fPtThreshold = thr;
-    fSwitch3DTracks = kTRUE; 
-    fSwitch3DCluster = kFALSE; 
-    fSwitch3DPadRow = kFALSE; 
-    fSwitch3DGeometry = kFALSE;
-
-    Draw3D();
-}
-// ---------------------------------------------------
-void AliHLTTPCDisplay::DisplayAll(Int_t minhits,Bool_t clusterswitch,Bool_t trackswitch,Bool_t x3don, Float_t thr, Float_t* etaRange){
-    if (!fc1){
-       fc1 = new TCanvas("c1","",900,900);
-       fc1->cd();
-    }
-
-    fMinHits = minhits; 
-    fPtThreshold = thr;
-    fSwitch3DTracks = trackswitch; 
-    fSwitch3DCluster = clusterswitch; 
-    fSwitch3DPadRow = kFALSE; 
-    fSwitch3DGeometry = kFALSE;
-
-    Draw3D();
-}
-#endif
-// ---------------------------------------------------
diff --git a/HLT/TPCLib/AliHLTTPCDisplay.h b/HLT/TPCLib/AliHLTTPCDisplay.h
deleted file mode 100644 (file)
index 87f63f7..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-// @(#) $Id$
-// Original: AliL3Display.h,v 1.14 2004/06/30 08:30:14 loizides 
-
-#ifndef ALIHLTTPCDISPLAY_H
-#define ALIHLTTPCDISPLAY_H
-
-/** \class AliHLTTPCDisplay
-<pre>
-//_____________________________________________________________
-// AliHLTTPCDisplay
-//
-// Display class for the HLT TPC events.
-</pre>
-*/
-// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
-//         Anders Vestbo <mailto:vestbo@fi.uib.no>
-//*-- Copyright &copy ALICE HLT Group 
-
-#include <TGeometry.h>
-#include <TObject.h>
-#include <TCanvas.h>
-#include <TH2.h>
-#include <TGraph.h>
-#include "AliHLTLogging.h"
-
-class AliHLTTPCSpacePointData;
-class AliHLTTPCTrackArray;
-
-class AliHLTTPCDisplay : public TObject, public AliHLTLogging {
-
- public:
-    AliHLTTPCDisplay(Char_t *gfile="$(ALIHLT_BASEDIR)/geo/alice.geom") {InitDisplay(gfile);}
-    virtual ~AliHLTTPCDisplay();
-
-    void InitDisplay(Char_t *gfile);
-  
-    // SETUP
-    void SetupHist();
-    void SetupCluster(Int_t slice, Int_t patch, UInt_t nofClusters, AliHLTTPCSpacePointData* data);
-    void SetupTracks(AliHLTTPCTrackArray *tracks);
-    
-    // HISTOGRAM FILL/RESET FUNCTIONS
-    void FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLen);
-    void ResetHistPadRow();
-    void ResetHistResiduals();
-    void ResetHistCharge();
-
-    // DRAWER
-    void Draw3D();
-    void DrawHistPadRow(); 
-    void DrawGeomSector(Int_t sector);
-    void DrawHistPad1();
-    void DrawHistPad2();
-    void DrawHistPad3();
-    void DrawHistResiduals(Bool_t ySwitch);
-    void DrawHistCharge();
-    
-    // SETTER  
-    void SetSlices(){fMinSlice = 0; fMaxSlice = 35; fSlicePair = kFALSE; SetSliceArray();}
-    void SetSlices(Int_t s){fMinSlice = s; fMaxSlice = s; fSlicePair = kFALSE; SetSliceArray();}
-    void SetSlices(Int_t mins, Int_t maxs){fMinSlice = mins; fMaxSlice = maxs; fSlicePair = kFALSE; SetSliceArray();}
-    void SetSlicesPair(Int_t s){fMinSlice = s; fMaxSlice = s; fSlicePair = kTRUE; SetSliceArray();}
-    void SetSlicesPair(Int_t mins, Int_t maxs){fMinSlice = mins; fMaxSlice = maxs; fSlicePair = kTRUE; SetSliceArray();}
-
-    void SetPad(Int_t f){fPad = f;}
-    void SetPadRow(Int_t f){fPadRow = f;}
-    void SetSlicePadRow(Int_t f){fSlicePadRow = f;}
-
-    void SetMinHits(Int_t f){fMinHits = f;}
-    void SetPtThreshold(Float_t f){fPtThreshold = f;}
-
-    void SetSwitches(Bool_t f1, Bool_t f2, Bool_t f3, Bool_t f4) {fSwitch3DTracks = f1; fSwitch3DCluster = f2; fSwitch3DPadRow = f3; fSwitch3DGeometry = f4;} 
-    void Set3DSwitchTracks(Bool_t f1) {fSwitch3DTracks = f1;}
-    void Set3DSwitchCluster(Bool_t f1) {fSwitch3DCluster = f1;}
-    void Set3DSwitchPadRow(Bool_t f1) {fSwitch3DPadRow = f1;}
-    void Set3DSwitchGeometry(Bool_t f1) {fSwitch3DGeometry = f1;}
-
-    void SetSelectTrack(Int_t f) {fSelectTrack = f;}
-    void SetSelectTrackSlice(Int_t f) {fSelectTrackSlice = f;}
-    void SetSelectTrackSwitch(Bool_t f) {fSelectTrackSwitch = f;}
-    void SetSelectCluster(Int_t f) {fSelectCluster = f;}
-
-    void SetHistPadRowAxis();
-
-    void SetInvert() {Int_t tmp = fBackColor; fBackColor = fLineColor; fLineColor = tmp; }
-    void SetKeepView(Bool_t f){fKeepView = f;} 
-
-    // GETTER
-    Int_t GetPadRow(){return fPadRow;}
-    Int_t GetSlicePadRow(){return fSlicePadRow;}
-    Int_t GetNPads(){return fNPads;}
-    Int_t GetBackColor(){return fBackColor;}
-    Bool_t GetKeepView(){return fKeepView;}
-    
-    Bool_t Get3DSwitchTracks() {return fSwitch3DTracks;}
-    Bool_t Get3DSwitchCluster() {return fSwitch3DCluster;}
-    Bool_t Get3DSwitchPadRow() {return fSwitch3DPadRow;}
-
-    Bool_t GetSelectTrackSwitch() {return fSelectTrackSwitch;}
-
-    // EXECUTER
-    void ExecPadRow();
-
-    struct AliHLTTPCTrackParameter{
-       Int_t nHits;
-       Int_t charge;
-       Double_t kappa;
-       Double_t radius;
-       Double_t xyzF[3];
-       Double_t xyzL[3];
-       Int_t slice;
-       Double_t phi0;
-       Double_t psi;
-       Double_t lambda;
-       Double_t pt;
-       Int_t id;
-       Double_t bfield;
-       Double_t s;
-    };
-    
-    AliHLTTPCTrackParameter fTrackParam;
-
-// ---------------------------------------------------
-// In order to be backward compatible
-// ---------------------------------------------------
-/*
-    AliHLTTPCDisplay(Int_t *slice, Char_t *gfile ) { InitDisplay(gfile);}
-
-    // SETUP
-    void SetupClusterDataForPatch(Int_t slice, Int_t patch, UInt_t nofClusters, AliHLTTPCSpacePointData* data) {SetupCluster(slice, patch, nofClusters, data);}
-    void SetTracks(AliHLTTPCTrackArray *tracks) { SetupTracks(tracks);}
-    void DisplayClusters(Bool_t x3don=kTRUE,Float_t* etaRange=NULL);
-    void DisplayTracks(Int_t minhits=10,Bool_t x3don=kTRUE,Float_t thr=0.);
-    void DisplayAll(Int_t minhits=10,Bool_t clusterswitch=kTRUE,Bool_t trackswitch=kTRUE,Bool_t x3don=kTRUE, Float_t thr=0., Float_t* etaRange=NULL);
-*/
-// ---------------------------------------------------
- private:
-// ---------------------------------------------------
-// In order to be backward compatible
-// ---------------------------------------------------
-/*    TCanvas *fc1; */
-// ---------------------------------------------------
-    Bool_t LoadGeometrie(Char_t *gfile);
-    void SetSliceArray();
-
-    AliHLTTPCDisplay(const AliHLTTPCDisplay &/*d*/):TObject(){;}
-    AliHLTTPCDisplay& operator=(const AliHLTTPCDisplay &/*d*/){return *this;}
-    
-    AliHLTTPCSpacePointData *fClusters[36][6]; 
-    AliHLTTPCTrackArray *fTracks; 
-    
-    UInt_t fNcl[36][6];//number of cluster
-
-    TH1F *fHistrawcl;  // histogram for cluster in padrow
-    TH2F *fHistraw;    // histogram for signals in padrow
-    TH1F *fHistpad1;   // histogram for pad in padrow
-    TH1F *fHistpad2;   // histogram for pad in padrow
-    TH1F *fHistpad3;   // histogram for pad in padrow
-    TH1F *fHistallresidualsY;//histogram for all Y residuals
-    TH1F *fHistallresidualsZ;//histogram for all Z residuals
-    TH1F *fHistcharge; // histogram for clustercharge
-    
-    TGraph *fGraphresidualsY; // graph of the Y residuals for one track
-    TGraph *fGraphresidualsZ; // graph of the Z residuals for one track
-    TGraph *fGraphresidualsYLength; // graph of the Y residuals for one track
-    TGraph *fGraphresidualsZLength; // graph of the Z residuals for one track
-
-
-    TGeometry *fGeom;  // geometry
-    Int_t fBackColor;  // Background color
-    Int_t fLineColor;  // Line color
-    Bool_t fKeepView;  // Keep View when redisplaying
-    
-    Int_t fPad;        // pad
-    Int_t fPadRow;     // padrow
-    Int_t fSlicePadRow;// slice where padrow is in
-    Int_t fNPads;      // number of pads in padrow
-    Int_t fNTimes;     // number of timebins
-    Int_t fMinHits;    // minimum cluster per track
-    Float_t fPtThreshold;// pt threshold for tracks
-    
-    Bool_t fSelectTrackSwitch;// switch ti single track mode
-    Int_t fSelectTrack;// select single track
-    Int_t fSelectTrackSlice; // select slice for single track
-    
-    Int_t fSelectCluster; // select all=0, used=1, unused=2 cluster
-    
-    Int_t fMinSlice;   //min slice
-    Int_t fMaxSlice;   //max slice
-    Bool_t fSlicePair; //draw pair of slices;
-    Bool_t fSliceArray[36];//Array if slice should be drawn or not
-    
-    Bool_t fDrawGeo;
-    Int_t fcolorbin[20]; // number of entries per colorbin
-    Int_t fbinct[20];    // index of colorbin
-    Float_t *fpmarr[20]; // contains point data
-    
-    Bool_t fSwitch3DCluster;
-    Bool_t fSwitch3DTracks;
-    Bool_t fSwitch3DPadRow;
-    Bool_t fSwitch3DGeometry;
-
-    ClassDef(AliHLTTPCDisplay,1) //Display class
-};
-
-#endif
diff --git a/HLT/TPCLib/AliHLTTPCStandardIncludes.h b/HLT/TPCLib/AliHLTTPCStandardIncludes.h
deleted file mode 100644 (file)
index 8c5e0d8..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-// @(#) $Id$
-// Original: AliL3StandardIncludes.h,v 1.5 2005/06/14 10:55:21 cvetan 
-#ifndef ALIHLTTPCSTANDARDINCLUDESH
-#define ALIHLTTPCSTANDARDINCLUDESH
-
-#if __GNUC__ >= 3
-#include <fstream>
-#include <iostream>
-
-#include <cstdio>
-#include <cmath>
-#include <cstring>
-#include <ctime>
-#include <cstdlib>
-
-/* Use these only if absolutely necessary 
-eg. in inline functions defined in header files */
-#define STDCOUT std::cout
-#define STDCERR std::cerr
-#define STDENDL std::endl
-#define STDIF   std::ifstream
-#define STDOF   std::ofstream
-
-#else
-#include <iostream.h>
-#include <fstream.h>
-
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <time.h>
-#include <stdlib.h>
-
-/* Use these only if absolutely necessary 
-eg. in inline functions defined in header files */
-#define STDCOUT cout
-#define STDCERR cerr
-#define STDENDL endl
-#define STDIF   ifstream
-#define STDOF   ofstream
-
-#endif //__GNUC__
-
-#endif
-
index b5d4371..59cb03b 100644 (file)
@@ -54,7 +54,6 @@ libAliHLTTPC_la_SOURCES               = AliHLTTPCLog.cxx \
                                  AliHLTTPCInterMerger.cxx \
                                  AliHLTTPC.cxx \
                                  AliHLTTPCPad.cxx \
-                                 AliHLTTPCDisplay.cxx \
                                  AliHLTTPCDefinitions.cxx \
                                  AliHLTTPCRawDataUnpackerComponent.cxx \
                                  AliHLTTPCClusterFinderComponent.cxx \
@@ -63,6 +62,7 @@ libAliHLTTPC_la_SOURCES               = AliHLTTPCLog.cxx \
                                  AliHLTTPCGlobalMergerComponent.cxx
 
 
+#                                AliHLTTPCDisplay.cxx \
 #                                AliRawReaderMemory.cxx
 
 
@@ -106,7 +106,6 @@ CLASS_HDRS                  = AliHLTTPCLog.h \
                                  AliHLTTPC.h \
                                  AliHLTTPCPad.h \
                                  AliHLTTPCSpacePointData.h \
-                                 AliHLTTPCDisplay.h \
                                  AliHLTTPCDefinitions.h \
                                  AliHLTTPCRawDataUnpackerComponent.h \
                                  AliHLTTPCClusterFinderComponent.h \
@@ -117,7 +116,6 @@ CLASS_HDRS                  = AliHLTTPCLog.h \
 
 pkginclude_HEADERS             = $(CLASS_HDRS) \
                                  AliHLTTPCLogging.h \
-                                 AliHLTTPCStandardIncludes.h \
                                  AliHLTTPCRootTypes.h \
                                  AliHLTTPCDigitData.h \
                                  AliHLTTPCTrackSegmentData.h \
@@ -133,7 +131,7 @@ libAliHLTTPC_la_LDFLAGS             = -L@ROOTLIBDIR@ \
                                  @ROOTLIBS@ \
                                  @ALIROOT_LDFLAGS@ \
                                  @ALIROOT_LIBS@ \
-                                 -version-info 2:1:0
+                                 -version-info 3:0:0
 
 # set the file name for the generated root dictionary
 DICTCPP                                =  AliHLTTPC-DICT.cxx
@@ -144,7 +142,7 @@ CLEANFILES                  = $(BUILT_SOURCES)
 
 include $(top_srcdir)/make.dict
 
-SUBDIRS                        = .
+SUBDIRS                        = . OnlineDisplay
 
 $(TPC_MAPPING_INC): $(TPC_MAPPING_NOINST_PGM)
        ./$<
diff --git a/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplay3D.cxx b/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplay3D.cxx
new file mode 100644 (file)
index 0000000..d386502
--- /dev/null
@@ -0,0 +1,539 @@
+// $Id$
+
+/** \class AliHLTTPCDisplayPadRow
+<pre>
+//_____________________________________________________________
+// AliHLTTPCDisplay3D
+//
+// Display class for the HLT TPC-3D events.
+</pre>
+*/
+// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+//*-- Copyright &copy ALICE HLT Group 
+
+#define TRACKHELIX 0       // use THelix for tracks
+#define TRACKPOLYMARKER 0  // use TPolymarker3D for tracks
+#define FIRSTLASTPOINT 0   // show first / last point of tracks
+
+#define DRAWSTEP 0.2
+
+#define UNUSEDCLUSTERCOLOR 2
+#define USEDCLUSTERCOLOR 3
+#define TRACKCOLOR 4
+#define TRACKPOLYMARKERCOLOR 5
+#define TRACKHELIXCOLOR 6
+
+#include "AliHLTTPCDisplay3D.h"
+#include "AliHLTTPCDisplayPadRow.h"
+
+#include "AliHLTStdIncludes.h"
+#include <TView.h>
+#include <TPolyMarker3D.h>
+#include <TPolyLine3D.h>
+#include <TH2.h>
+#include <TTree.h>
+#include <TNode.h>
+#include <TGeometry.h>
+#include <TShape.h>
+#include <TParticle.h>
+#include <TFile.h>
+#include <THelix.h>
+#include <TStyle.h>
+#include <TGraph.h>
+#include <TMultiGraph.h>
+#include <TAttText.h>
+#include <TAxis.h>
+#include <TCanvas.h>
+
+#ifdef use_aliroot
+#include <TClonesArray.h>
+#include <AliRun.h>
+#include <AliSimDigits.h>
+#include <AliTPCParam.h>
+#endif
+
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTDataTypes.h"
+#include "AliHLTTPCSpacePointData.h"
+#include "AliHLTTPCClusterDataFormat.h"
+#include "AliHLTTPCTrackletDataFormat.h"
+
+
+#include "AliHLTTPCDigitReader.h"
+#include "AliHLT_C_Component_WrapperInterface.h"
+
+#include "AliHLTTPCDisplayMain.h"
+
+#include "AliHLTTPCLogging.h"
+#include "AliHLTTPCDisplay.h"
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCTrack.h"
+#include "AliHLTTPCTrackArray.h"
+#include "AliHLTTPCMemHandler.h"
+#include "AliHLTTPCDigitReaderPacked.h"
+
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+ClassImp(AliHLTTPCDisplay3D)
+
+//____________________________________________________________________________________________________
+AliHLTTPCDisplay3D::AliHLTTPCDisplay3D(AliHLTTPCDisplayMain* display, Char_t* gfile ) {
+    // constructor
+    fDisplay = display;
+    
+    fGeom = NULL;
+    LoadGeometrie(gfile);
+}
+
+//____________________________________________________________________________________________________
+AliHLTTPCDisplay3D::~AliHLTTPCDisplay3D() {
+    // destructor   
+
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplay3D::Save(){
+  fDisplay->GetCanvas3D()->SaveAs("HLT-3D-View.eps");
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplay3D::Draw(){
+    fDisplay->GetCanvas3D()->cd();
+    fDisplay->GetCanvas3D()->Clear();
+
+    TView *v = new TView(1);
+    //    TView v(1);
+    v->SetRange(-800,-800,-800,800,800,800);
+
+    Float_t* etaRange = NULL;   // ------  STILL TO FIX
+
+
+    //--------------------------------------------------------------------------------------------
+    // DRAW 3D GEOMETRY
+    //--------------------------------------------------------------------------------------------
+    if (fDisplay->Get3DSwitchGeometry()){
+
+       TList* masterNodeList = fGeom->GetListOfNodes();
+       TNode* masterNode=0;
+       TIter next(masterNodeList);
+       
+       while ((masterNode = static_cast<TNode*> (next()))) {  
+       
+           TList* nodeList = masterNode->GetListOfNodes();
+           TNode* node=0;
+           TIter next(nodeList);
+           
+           while ((node = static_cast<TNode*> (next()))) {  
+               
+               ULong_t tmpslice = atol(node->GetName() + 2);
+
+               if (fDisplay->GetDisplaySlice(tmpslice)) {
+                   node->SetVisibility(1);
+                   node->SetFillColor(0);
+                   node->SetLineColor(fDisplay->GetLineColor());
+               }
+               else node->SetVisibility(0);
+           } // end while son Nodes
+       } // end while master Node
+
+       fGeom->Draw("");
+    }   // END - DRAW 3D GEOMETRY
+
+    
+    //--------------------------------------------------------------------------------------------
+    // DRAW 3D CLUSTER
+    //--------------------------------------------------------------------------------------------
+    if (fDisplay->Get3DSwitchCluster() && fDisplay->ExistsClusterData()){
+
+       for (Int_t slice=0; slice <= 35; slice++){
+
+           Int_t currenttrack = -1;
+
+           if (fDisplay->ExistsTrackData() && fDisplay->GetSelectTrackSwitch()) currenttrack = fDisplay->GetGlobalTrack(slice);
+
+           if (!fDisplay->GetDisplaySlice(slice)) continue;
+           
+           for(Int_t patch=0;patch<6;patch++){
+
+               AliHLTTPCSpacePointData *points = fDisplay->GetSpacePointDataPointer(slice,patch);
+               if(!points) continue;
+
+               TPolyMarker3D *pmUsed = new TPolyMarker3D(1,6);
+               TPolyMarker3D *pmUnused = new TPolyMarker3D(1,6);
+               pmUnused->SetBit(kCanDelete);
+               pmUsed->SetBit(kCanDelete);
+
+
+               Int_t nUsedCluster = 0;
+               Int_t nUnusedCluster = 0;
+
+               Float_t xyz[3];    
+               for(Int_t i=0; i< fDisplay->GetNumberSpacePoints(slice,patch); i++){
+                   // Used  cluster only
+                   if (fDisplay->GetSelectCluster() == 1  && points[i].fUsed == kFALSE) continue; 
+                   // Unused cluster only
+                   if (fDisplay->GetSelectCluster() == 2  && points[i].fUsed == kTRUE) continue; 
+                   
+                   // if single track is selcted draw only cluster for this track
+                   if (fDisplay->GetSelectCluster() == 1 && fDisplay->GetSelectTrackSwitch() && points[i].fTrackN != currenttrack) continue;
+                   
+                   xyz[0] = points[i].fX;
+                   xyz[1] = points[i].fY;
+                   xyz[2] = points[i].fZ;
+                   
+                   if ( etaRange ){              
+                       // Do this before the transform, because the tracker also uses
+                       // local coordinates when using this limit to determine 
+                       // which clusters to use for tracking
+                       Double_t pointEta = AliHLTTPCTransform::GetEta( xyz );
+                       if ( pointEta<etaRange[0] || pointEta>etaRange[1] )
+                           continue;
+                   }
+                   
+                   AliHLTTPCTransform::Local2Global(xyz,slice);
+                   
+                   if (points[i].fUsed == kTRUE){
+                       pmUsed->SetPoint(nUsedCluster,xyz[0],xyz[1],xyz[2]);
+                       nUsedCluster++;
+                   }
+                   else {
+                       pmUnused->SetPoint(nUnusedCluster,xyz[0],xyz[1],xyz[2]);
+                       nUnusedCluster++;
+                   }
+                   
+               }
+               pmUsed->SetMarkerSize(1);
+               pmUsed->SetMarkerColor(USEDCLUSTERCOLOR); 
+               pmUsed->Draw("same");
+
+               pmUnused->SetMarkerSize(1);
+               pmUnused->SetMarkerColor(UNUSEDCLUSTERCOLOR); 
+               pmUnused->Draw("same");
+
+               fDisplay->GetCanvas3D()->Modified();
+               fDisplay->GetCanvas3D()->Update();
+
+           } // END - PATCH LOOP           
+       }  // END - SLICE LOOP  
+    }   // END - DRAW 3D CLUSTER 
+
+    //--------------------------------------------------------------------------------------------
+    // DRAW 3D TRACKS
+    //--------------------------------------------------------------------------------------------
+    if (fDisplay->Get3DSwitchTracks() && fDisplay->ExistsTrackData()){
+
+      AliHLTTPCTransform::SetBField( 0.5 );  // ++++++
+
+
+       AliHLTTPCTrackArray* tracks = fDisplay->GetTrackArrayPointer();
+       Int_t ntracks = tracks->GetNTracks();
+
+       //      TPolyLine3D **line = new (TPolyLine3D*)[ntracks];
+       //      for(Int_t j=0; j<ntracks; j++) line[j] = 0;
+#if TRACKHELIX
+       //      THelix **helix = new (THelix*)[ntracks];
+       //      for(Int_t j=0; j<ntracks; j++) helix[j] = 0;
+
+#endif
+       for(Int_t j=0; j<ntracks; j++) {        
+
+           AliHLTTPCTrack *gtrack = tracks->GetCheckedTrack(j); 
+           if(!gtrack) continue;
+
+           Int_t nHits = gtrack->GetNHits();  // Number of associated hits to track
+           Int_t slice = gtrack->GetSector();
+
+            // --- CHECK if track is should be drawn
+           // select if slice should be displayed or not
+           if (!fDisplay->GetDisplaySlice(slice)) continue;
+
+           if (fDisplay->GetSelectTrackSwitch() && fDisplay->GetGlobalTrack(slice) != j) continue;
+
+           Double_t radius = gtrack->GetRadius();      // radius
+           Double_t kappa = gtrack->GetKappa();        // curvature = 1/R , signed
+           Double_t lambda = atan( gtrack->GetTgl() ); // dipAngle lambda
+           Double_t phi0 = gtrack->GetPsi() + (gtrack->GetCharge() * AliHLTTPCTransform::PiHalf() ); // azimuthal angle of startingpoint, with respect to helix axis
+
+           if (kappa == 0 && AliHLTTPCTransform::GetBFieldValue() > 0.) {
+               printf("================================KAPPA == 0");
+               continue;
+           }
+
+           Double_t xyzL[3];      // lastpoint of track
+           Double_t xyzF[3];      // firstpoint of track
+
+           xyzF[0] = gtrack->GetFirstPointX();
+           xyzF[1] = gtrack->GetFirstPointY();
+           xyzF[2] = gtrack->GetFirstPointZ();
+
+           xyzL[0] = gtrack->GetLastPointX();
+           xyzL[1] = gtrack->GetLastPointY();
+           xyzL[2] = gtrack->GetLastPointZ();
+
+#if FIRSTLASTPOINT         
+           //      TPolyMarker3D *pmL = new TPolyMarker3D(1,2);
+           //TPolyMarker3D *pmF = new TPolyMarker3D(1,2);
+
+           TPolyMarker3D pmL(1,2);
+           TPolyMarker3D pmF(1,2);
+
+
+           pmF.SetPoint(0,xyzF[0],xyzF[1],xyzF[2]);
+           pmL.SetPoint(0,xyzL[0],xyzL[1],xyzL[2]);
+#endif
+
+           Double_t s = 0.;       // length of the track
+
+
+           if (  AliHLTTPCTransform::GetBFieldValue() == 0.) 
+               s = sqrt ( (xyzL[0] - xyzF[0])*(xyzL[0] - xyzF[0]) + (xyzL[1] - xyzF[1])*(xyzL[1] - xyzF[1]) ); 
+           else {
+               // Calculate the length of the track. If it is to flat in in s,z plane use sxy, otherwise use sz
+               if (fabs(lambda) > 0.05){
+                   // length of track calculated out of z
+                   s = fabs( (xyzL[2] - xyzF[2]) / sin(lambda) ); // length of track calculated out of z
+               }
+               else {
+                   Double_t d = (xyzL[0] - xyzF[0])*(xyzL[0] - xyzF[0]) + (xyzL[1] - xyzF[1])*(xyzL[1] - xyzF[1]); 
+                   // length of track calculated out of xy
+                   s = fabs ( acos( 0.5 * (2 - (d / (radius*radius)))) / ( kappa * cos(lambda) ) );            
+               }
+           }
+
+
+           // CUTS on tracks
+/*
+           if (nHits < fDisplay->GetCutHits() ) continue;
+           if (s < fDisplay->GetCutS() ) continue;
+           if (gtrack->GetPsi() < fDisplay->GetCutPsi() ) continue;
+           if (lambda < fDisplay->GetCutLambda() ) continue; 
+           if (gtrack->GetPt() < fDisplay->GetCutPt()  &&  AliHLTTPCTransform::GetBFieldValue() != 0. ) continue;
+           if ( AliHLTTPCTransform::GetPadRow((Float_t)xyzF[0]) >   fDisplay->GetIncidentPadrow() ) continue;
+*/    
+           Int_t nTrackPoints = 2 + (Int_t) floor(s / DRAWSTEP);
+                           
+#if TRACKPOLYMARKER
+           //    TPolyMarker3D *pmT = new TPolyMarker3D(nTrackPoints,6);
+           TPolyMarker3D pmT(nTrackPoints,6);
+
+#endif
+           Double_t *xT = new Double_t[nTrackPoints];
+           Double_t *yT = new Double_t[nTrackPoints];
+           Double_t *zT = new Double_t[nTrackPoints];
+
+           Int_t trackPointCounter = 0;
+
+           //Write Track Parameters for single track
+           if (fDisplay->GetSelectTrackSwitch() ){
+               fDisplay->fTrackParam.id = j;
+               fDisplay->fTrackParam.nHits = nHits;
+               fDisplay->fTrackParam.charge = gtrack->GetCharge();
+               fDisplay->fTrackParam.lambda = lambda;
+               fDisplay->fTrackParam.kappa = kappa;
+               fDisplay->fTrackParam.radius = radius;
+               fDisplay->fTrackParam.slice = slice;
+               fDisplay->fTrackParam.phi0 = phi0;
+               fDisplay->fTrackParam.pt = gtrack->GetPt();
+               fDisplay->fTrackParam.bfield = AliHLTTPCTransform::GetBFieldValue();
+               fDisplay->fTrackParam.psi = gtrack->GetPsi();
+               fDisplay->fTrackParam.s = s;
+           }
+
+
+           if (  AliHLTTPCTransform::GetBFieldValue() == 0.) {
+
+               for (Double_t ds = 0.; ds < s; ds = ds + DRAWSTEP){
+                   // FILL ARRAYS IN ORDER TO DRAW THE TRACKPOINTS, OUT OF THE PARAMETER
+                   xT[trackPointCounter] = xyzF[0] + ds * cos(phi0); 
+                   yT[trackPointCounter] = xyzF[1] + ds * sin(phi0);
+                   zT[trackPointCounter] = xyzF[2] + ds * sin(lambda);
+#if TRACKPOLYMARKER
+                   pmT.SetPoint(trackPointCounter,xT[trackPointCounter],yT[trackPointCounter],zT[trackPointCounter]);
+#endif
+                   trackPointCounter++;
+               }
+               
+               if (trackPointCounter > nTrackPoints) printf("N=%d  n=%d", nTrackPoints,trackPointCounter);
+               else {
+                   xT[trackPointCounter] = xyzF[0] + s * cos(phi0); 
+                   yT[trackPointCounter] = xyzF[1] + s * sin(phi0);
+                   zT[trackPointCounter] = xyzF[2] + s * sin(lambda);
+#if TRACKPOLYMARKER       
+                   pmT.SetPoint(trackPointCounter,xT[trackPointCounter],yT[trackPointCounter],zT[trackPointCounter]);
+#endif
+               }
+
+           }
+           else {
+
+               for (Double_t ds = 0.; ds < s; ds = ds + DRAWSTEP){
+                   // FILL ARRAYS IN ORDER TO DRAW THE TRACKPOINTS, OUT OF THE PARAMETER
+                   xT[trackPointCounter] = xyzF[0] + radius * ( cos( phi0 + (ds*kappa*cos(lambda)) ) - cos(phi0) );
+                   yT[trackPointCounter] = xyzF[1] + radius * ( sin( phi0 + (ds*kappa*cos(lambda)) ) - sin(phi0) );
+                   zT[trackPointCounter] = xyzF[2] + ds * sin(lambda);
+#if TRACKPOLYMARKER
+                   pmT.SetPoint(trackPointCounter,xT[trackPointCounter],yT[trackPointCounter],zT[trackPointCounter]);
+#endif
+                   trackPointCounter++;
+               }
+               
+               if (trackPointCounter > nTrackPoints) printf("N=%d  n=%d", nTrackPoints,trackPointCounter);
+               else {
+                   xT[trackPointCounter] = xyzF[0] + radius * ( cos( phi0 + (s*kappa*cos(lambda)) ) - cos(phi0) );
+                   yT[trackPointCounter] = xyzF[1] + radius * ( sin( phi0 + (s*kappa*cos(lambda)) ) - sin(phi0) );
+                   zT[trackPointCounter] = xyzF[2] + s * sin(lambda);
+#if TRACKPOLYMARKER       
+                   pmT.SetPoint(trackPointCounter,xT[trackPointCounter],yT[trackPointCounter],zT[trackPointCounter]);
+#endif
+               }
+           }
+
+           // Draw Track -- as line
+           //line[j] = new TPolyLine3D(nTrackPoints,xT,yT,zT,"");
+           //TPolyLine3D *currentline = line[j];
+           //* currentline = new TPolyLine3D(nTrackPoints,xT,yT,zT,"");
+           //      TPolyLine3D currentline(nTrackPoints,xT,yT,zT,"");
+
+           TPolyLine3D *currentline = new TPolyLine3D(nTrackPoints,xT,yT,zT,"");
+           currentline->SetBit(kCanDelete);
+           currentline->SetLineColor(TRACKCOLOR);   
+           currentline->SetLineWidth(2);
+           currentline->Draw("same");
+
+
+
+           // ---  ADDITIONAL DRAW OPTIONS
+#if FIRSTLASTPOINT
+           // Draw last point of Track
+           pmL.SetMarkerSize(3);
+           pmL.SetMarkerColor(4); 
+           pmL.Draw();
+
+           // Draw first point of Track
+           pmF.SetMarkerSize(3);
+           pmF.SetMarkerColor(5); 
+           pmF.Draw();
+#endif
+#if TRACKPOLYMARKER
+           // Draw Track -- as polymarker
+           pmT.SetMarkerSize(3);
+           pmT.SetMarkerColor(TRACKPOLYMARKERCOLOR); 
+           pmT.Draw();
+#endif
+#if TRACKHELIX
+           // Draw Track -- as helix
+            // works ok, execpt for very small dipangles -> track almost horizontal
+           Double_t hrange[2];
+           Double_t v0[3];
+           Double_t omega;
+           hrange[0] = xyzF[2];
+           hrange[1] = xyzL[2];
+           v0[0] = gtrack->GetPx();
+           v0[1] = gtrack->GetPy();
+           v0[2] = gtrack->GetPz();
+           omega = AliHLTTPCTransform::GetBFieldValue() * gtrack->GetCharge();
+
+           //      helix[j] = new THelix(xyzF,v0,omega,hrange,kHelixZ,0);
+           //      THelix *currenthelix = helix[j];
+           //      currenthelix = new THelix(xyzF,v0,omega,hrange,kHelixZ,0);
+           THelix currenthelix(xyzF,v0,omega,hrange,kHelixZ,0);
+           currenthelix.SetLineColor(TRACKHELIXCOLOR);   
+           currenthelix.SetLineWidth(1);
+           currenthelix.Draw("same");              
+#endif
+
+
+           // delete[]
+           //Double_t *xT = new Double_t[nTrackPoints];
+           //      Double_t *yT = new Double_t[nTrackPoints];
+           //      Double_t *zT = new Double_t[nTrackPoints];
+           if (xT){ 
+             delete[] xT; 
+             xT = NULL;
+           }
+           if (yT){ 
+             delete[] yT; 
+             yT = NULL;
+           }
+           if (zT){ 
+             delete[] zT; 
+             zT = NULL;
+           }
+
+       } // END for track loop
+
+
+       // NO !!! DELETE line #ifdef helix delete helix
+
+
+    }   // END - DRAW 3D Tracks
+
+    //--------------------------------------------------------------------------------------------
+    // DRAW 3D PadRow
+    //--------------------------------------------------------------------------------------------
+    if (fDisplay->Get3DSwitchPadRow() && fDisplay->GetDisplaySlice(fDisplay->GetSlicePadRow())){
+       fDisplay->GetPadRowPointer()->Draw3D();
+    }
+
+    //--------------------------------------------------------------------------------------------
+    // DRAW 3D 
+    //--------------------------------------------------------------------------------------------
+    // v->ZoomView(0,3);
+    // v->Draw();   
+
+    fDisplay->GetCanvas3D()->SetFillColor(fDisplay->GetBackColor());
+
+    if ( !fDisplay->GetKeepView() ){ 
+       fDisplay->GetCanvas3D()->SetTheta(fDisplay->GetTheta());
+       fDisplay->GetCanvas3D()->SetPhi(fDisplay->GetPhi());
+    }
+
+    fDisplay->GetCanvas3D()->Modified();
+    fDisplay->GetCanvas3D()->Update();
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplay3D::DrawGeomSector(Int_t sector) {  
+  /*
+    Char_t fname[256];
+    Int_t realsector = sector;// % 18;
+  
+    if (realsector < 10){
+       sprintf(fname,"LS0%d",realsector);
+       fGeom->GetNode(fname)->SetLineColor(fDisplay->GetLineColor());
+       fGeom->GetNode(fname)->Draw("same");
+       sprintf(fname,"US0%d",realsector);
+       fGeom->GetNode(fname)->SetLineColor(fDisplay->GetLineColor()); 
+       fGeom->GetNode(fname)->Draw("same");
+    }
+    else {
+       sprintf(fname,"LS%d",realsector);
+       fGeom->GetNode(fname)->SetLineColor(fDisplay->GetLineColor());
+       fGeom->GetNode(fname)->Draw("same");
+       sprintf(fname,"US%d",realsector);
+       fGeom->GetNode(fname)->SetLineColor(fDisplay->GetLineColor()); 
+       fGeom->GetNode(fname)->Draw("same");
+    }
+
+  */   
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplay3D::LoadGeometrie(Char_t *gfile) {
+    if (gfile) {
+       TFile *file = TFile::Open(gfile);
+       if(!file) {
+           LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay3D::AliHLTDisplay","File Open") 
+             <<"Geometry file " << gfile << " does not exist!"<<ENDLOG;
+           exit(-1);
+       }
+       
+       fGeom = (TGeometry*)file->Get("AliceGeom");
+
+       file->Close();
+       //delete file;  ####
+    }
+}
diff --git a/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplay3D.h b/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplay3D.h
new file mode 100644 (file)
index 0000000..6d854f1
--- /dev/null
@@ -0,0 +1,62 @@
+// XEmacs -*-C++-*-
+// $Id$
+
+#ifndef ALIHLTTPCDISPLAY3D_H
+#define ALIHLTTPCDISPLAY3D_H
+/** \class AliHLTTPCDisplay3D
+<pre>
+//_____________________________________________________________
+// AliHLTTPCDisplay3D
+//
+// Display class for the HLT TPC-3D events.
+</pre>
+*/
+// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+//*-- Copyright &copy ALICE HLT Group 
+
+#include <TCanvas.h>
+#include <TH1.h>
+#include <TH2F.h>
+#include <AliHLTTPCDisplayMain.h>
+
+class AliHLTTPCDisplay3D : public AliHLTLogging {  
+    
+ public:
+    AliHLTTPCDisplay3D(AliHLTTPCDisplayMain* display, Char_t *gfile ) ;
+    virtual ~AliHLTTPCDisplay3D();
+    
+    void Draw();
+    void Save();
+
+    struct AliHLTTPCTrackParameter{
+       Int_t nHits;
+       Int_t charge;
+       Double_t kappa;
+       Double_t radius;
+       Double_t xyzF[3];
+       Double_t xyzL[3];
+       Int_t slice;
+       Double_t phi0;
+       Double_t psi;
+       Double_t lambda;
+       Double_t pt;
+       Int_t id;
+       Double_t bfield;
+       Double_t s;
+    };
+    
+    AliHLTTPCTrackParameter fTrackParam;
+
+// ---------------------------------------------------
+ private:
+    void LoadGeometrie(Char_t *gfile);
+    void DrawGeomSector(Int_t sector);
+
+    AliHLTTPCDisplayMain* fDisplay;
+
+    TGeometry *fGeom;              // Geometry
+
+    ClassDef(AliHLTTPCDisplay3D,0) 
+};
+
+#endif //  ALIHLTTPCDISPLAY3D_H
diff --git a/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayCharge.cxx b/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayCharge.cxx
new file mode 100644 (file)
index 0000000..0bc931e
--- /dev/null
@@ -0,0 +1,175 @@
+// $Id$
+
+/** \class AliHLTTPCDisplayCharge
+<pre>
+//_____________________________________________________________
+// AliHLTTPCDisplayCharge
+//
+// Display class for the HLT TPC-Charge events.
+</pre>
+*/
+// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+//*-- Copyright &copy ALICE HLT Group 
+
+#include <TH2.h>
+#include <TFile.h>
+#include <TStyle.h>
+#include <TAttText.h>
+#include <TAxis.h>
+#include <TCanvas.h>
+
+#ifdef use_aliroot
+#include <TClonesArray.h>
+#include <AliRun.h>
+#include <AliSimDigits.h>
+#include <AliTPCParam.h>
+#endif
+
+#include "AliHLTStdIncludes.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTDataTypes.h"
+#include "AliHLTTPCSpacePointData.h"
+#include "AliHLTTPCClusterDataFormat.h"
+#include "AliHLTTPCLogging.h"
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCDigitReaderPacked.h"
+#include "AliHLTTPCTrack.h"
+#include "AliHLTTPCTrackArray.h"
+
+#include "AliHLTTPCDisplayMain.h"
+#include "AliHLTTPCDisplayCharge.h"
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+ClassImp(AliHLTTPCDisplayCharge)
+
+//____________________________________________________________________________________________________
+AliHLTTPCDisplayCharge::AliHLTTPCDisplayCharge(AliHLTTPCDisplayMain* display) {
+    // constructor
+    fDisplay = display;
+
+    fBinX[0] = 0;      
+    fBinX[1] = 1; 
+    fTmpEvent = 0;         
+    fMaxCharge = 0;
+
+    fHistcharge = new TH1F ("fHistcharge","Cluster distribution per charge;charge;#cluster",5000,0,30000);
+    fHistcharge->SetTitleSize(0.03);
+    fHistcharge->GetXaxis()->SetLabelSize(0.03);
+    fHistcharge->GetXaxis()->SetTitleSize(0.03);
+    fHistcharge->GetYaxis()->SetLabelSize(0.03);
+    fHistcharge->GetYaxis()->SetTitleSize(0.03);
+}
+
+//____________________________________________________________________________________________________
+AliHLTTPCDisplayCharge::~AliHLTTPCDisplayCharge() {
+    // destructor   
+    if ( fHistcharge){
+       delete fHistcharge;
+       fHistcharge = NULL;
+    }
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayCharge::Reset(){  
+    fHistcharge->Reset();
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayCharge::Save(){  
+  fDisplay->GetCanvasCharge()->SaveAs("HLT-ChargeView.eps"); 
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayCharge::Fill(){  
+    // Fill Charge Histogram
+
+    Int_t maxCharge = 0;
+
+    for (Int_t slice=0; slice <= 35; slice++){
+
+       Int_t currenttrack = -1;
+
+       if (fDisplay->ExistsTrackData() && fDisplay->GetSelectTrackSwitch()) currenttrack = fDisplay->GetGlobalTrack(slice);
+               
+       if (!fDisplay->GetDisplaySlice(slice)) continue;
+       
+       for(Int_t patch=0;patch<6;patch++){
+
+           AliHLTTPCSpacePointData *points = fDisplay->GetSpacePointDataPointer(slice,patch);
+           if(!points) continue;
+         
+           for(Int_t i=0; i< fDisplay->GetNumberSpacePoints(slice,patch); i++){
+               // Used  cluster only
+               if (fDisplay->GetSelectCluster() == 1  && points[i].fUsed == kFALSE) continue; 
+               // Unused cluster only
+               if (fDisplay->GetSelectCluster() == 2  && points[i].fUsed == kTRUE) continue; 
+
+               // if single track is selcted draw only cluster for this track
+               if (fDisplay->GetSelectCluster() == 1 && fDisplay->GetSelectTrackSwitch() && points[i].fTrackN != currenttrack) continue;
+               
+               // Fill Charge Histogram
+               fHistcharge->Fill(points[i].fCharge);
+               if ((Int_t)points[i].fCharge > maxCharge ) maxCharge = (Int_t) points[i].fCharge; 
+           }
+
+       } // END - PATCH LOOP       
+    }  // END - SLICE LOOP
+
+    fMaxCharge = maxCharge;     
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayCharge::Draw(){
+    fDisplay->GetCanvasCharge()->cd();
+    fDisplay->GetCanvasCharge()->Clear();
+
+    // Keep Zoom
+    if (!fDisplay->GetKeepView() || (fBinX[1]>fMaxCharge)){
+       fBinX[0] = 0;
+       fBinX[1] = fMaxCharge;
+    }
+
+    fHistcharge->SetAxisRange(fBinX[0],fBinX[1]);
+
+    fHistcharge->SetStats(kFALSE);
+    fHistcharge->Draw();       
+
+    fDisplay->GetCanvasCharge()->Modified();
+    fDisplay->GetCanvasCharge()->Update();
+
+    // Keep Zoom
+    fDisplay->GetCanvasCharge()->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","AliHLTTPCDisplayCharge",(void*) this,"ExecEvent(Int_t,Int_t,Int_t,TObject*)");
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayCharge::ExecEvent(Int_t event, Int_t px, Int_t py, TObject *selected){
+   // Saves the Zoom Position of the Histogram 
+
+   // - Mouse down on Axis : StartPoint of Range
+   if (event == 1 && selected->InheritsFrom("TAxis"))
+       fTmpEvent = 1;
+
+   // - Mouse pressed on Axis : Real Zoom process not only click
+   else if (event == 21 && selected->InheritsFrom("TAxis") && fTmpEvent == 1)
+       fTmpEvent = 21;
+
+   // - Mouse pressed on Axis : Still pressed
+   else if (event == 21 && selected->InheritsFrom("TAxis") && fTmpEvent == 21) 
+       return;
+
+    // - Mouse up on Axis : End Point of Rangex
+   else if (event == 11 && selected->InheritsFrom("TAxis") && fTmpEvent == 21){
+       TAxis * axis = (TAxis*) selected;
+       
+       if (selected == fHistcharge->GetXaxis() ){
+          fBinX[0] = axis->GetFirst() -1;
+          fBinX[1] = axis->GetLast() -1;
+       }
+
+       fTmpEvent = 0; 
+   }
+   else fTmpEvent = 0;
+}
diff --git a/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayCharge.h b/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayCharge.h
new file mode 100644 (file)
index 0000000..d1ade51
--- /dev/null
@@ -0,0 +1,45 @@
+// XEmacs -*-C++-*-
+// $Id$
+
+#ifndef ALIHLTTPCDISPLAYCHARGE_H
+#define ALIHLTTPCDISPLAYCHARGE_H
+/** \class AliHLTTPCDisplayCharge
+<pre>
+//_____________________________________________________________
+// AliHLTTPCDisplayCharge
+//
+// Display class for the HLT TPC-Charge events.
+</pre>
+*/
+// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+//*-- Copyright &copy ALICE HLT Group 
+
+#include <TCanvas.h>
+#include <TH1.h>
+#include <AliHLTTPCDisplayMain.h>
+
+class AliHLTTPCDisplayCharge : public AliHLTLogging {  
+    
+ public:
+    AliHLTTPCDisplayCharge(AliHLTTPCDisplayMain* display) ;
+    virtual ~AliHLTTPCDisplayCharge();
+    
+    void Fill();
+    void Draw();
+    void Reset();
+    void Save();
+    void ExecEvent(Int_t event, Int_t x, Int_t y, TObject *selected);
+
+ private:
+    AliHLTTPCDisplayMain* fDisplay;
+
+    TH1F *fHistcharge;             // histogram for clustercharge
+
+    Int_t fMaxCharge;              // Maximum of Charge
+    Int_t fBinX[2];                // Minimum / Maximum - Bin on X Axis
+    Int_t fTmpEvent;               // Tmp Event for get user range on Axis
+
+    ClassDef(AliHLTTPCDisplayCharge,0) 
+};
+
+#endif //  ALIHLTTPCDISPLAYCHARGE_H
diff --git a/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayFront.cxx b/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayFront.cxx
new file mode 100644 (file)
index 0000000..7b493c4
--- /dev/null
@@ -0,0 +1,206 @@
+// $Id$
+
+/** \class AliHLTTPCDisplayFront
+<pre>
+//_____________________________________________________________
+// AliHLTTPCDisplayFront
+//
+// Display class for the HLT TPC-Pad events.
+</pre>
+*/
+// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+//*-- Copyright &copy ALICE HLT Group 
+
+#include <TH2.h>
+#include <TFile.h>
+#include <TStyle.h>
+#include <TAttText.h>
+#include <TAxis.h>
+#include <TCanvas.h>
+
+#ifdef use_aliroot
+#include <TClonesArray.h>
+#include <AliRun.h>
+#include <AliSimDigits.h>
+#include <AliTPCParam.h>
+#endif
+
+#include "AliHLTStdIncludes.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTDataTypes.h"
+#include "AliHLTTPCSpacePointData.h"
+#include "AliHLTTPCClusterDataFormat.h"
+#include "AliHLTTPCLogging.h"
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCDigitReaderPacked.h"
+#include "AliHLTTPCDigitReaderRaw.h"
+
+#include "AliHLTTPCDisplayMain.h"
+#include "AliHLTTPCDisplayFront.h"
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+ClassImp(AliHLTTPCDisplayFront)
+
+//____________________________________________________________________________________________________
+AliHLTTPCDisplayFront::AliHLTTPCDisplayFront(AliHLTTPCDisplayMain* display) {
+    // constructor
+    fDisplay = display;
+
+    fNTimes = AliHLTTPCTransform::GetNTimeBins();
+
+    fBinY[0] = 0;
+    fBinY[1] = AliHLTTPCTransform::GetNRows() - 1;
+    fBinX[0] = 0;      
+    fBinX[1] = AliHLTTPCTransform::GetNPads(fBinY[1]);
+    fTmpEvent = 0;    
+
+    fHistfront = new TH2F("fHistfront","FrontView of selected slice;Pad #;Padrow #",fBinX[1]+1,fBinX[0],fBinX[1],fBinY[1]+1,fBinY[0],fBinY[1]);
+
+    fHistfront->SetOption("COLZ");  
+    fHistfront->SetTitleSize(0.03);
+    fHistfront->GetXaxis()->SetLabelSize(0.03);
+    fHistfront->GetXaxis()->SetTitleSize(0.03);
+    fHistfront->GetYaxis()->SetLabelSize(0.03);
+    fHistfront->GetYaxis()->SetTitleSize(0.03);
+}
+
+//____________________________________________________________________________________________________
+AliHLTTPCDisplayFront::~AliHLTTPCDisplayFront() {
+    // destructor   
+    if ( fHistfront ){
+        delete fHistfront;
+        fHistfront = NULL;
+    }
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayFront::Reset(){  
+    fHistfront->Reset(); 
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayFront::Save(){  
+    fCanvas->SaveAs("HLT-FrontView.eps"); 
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayFront::Fill(Int_t patch, ULong_t dataBlock, ULong_t dataLen){
+    // Fill Pad Histogram
+
+#if defined(HAVE_TPC_MAPPING)
+    AliHLTTPCDigitReaderRaw digitReader(0);
+
+    bool readValue = true;
+    Int_t rowOffset = 0;
+    
+    Int_t timebin = fDisplay->GetTimebin();
+    Bool_t allTimebins = fDisplay->GetAllTimebins();
+    Int_t slice = fDisplay->GetSlicePadRow();
+
+    // Initialize RAW DATA
+    Int_t firstRow = AliHLTTPCTransform::GetFirstRow(patch);
+    Int_t lastRow = AliHLTTPCTransform::GetLastRow(patch);
+
+    // Outer sector, patches 2, 3, 4, 5 -  start counting in patch 2 with row 0
+    if ( patch >= 2 ) rowOffset = AliHLTTPCTransform::GetFirstRow( 2 );
+
+    // Initialize block for reading packed data
+    void* tmpdataBlock = (void*) dataBlock;
+    digitReader.InitBlock(tmpdataBlock,dataLen,firstRow,lastRow,patch,slice);
+
+    readValue = digitReader.Next();
+
+    if (!readValue){   
+       LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplayFrontRow::Fill","Read first value") << "No value in data block" << ENDLOG;
+       return;
+    }
+
+    // -- Fill Raw Data
+    while ( readValue ){ 
+
+       UShort_t time = digitReader.GetTime();
+
+       // check if all timebins or just one
+       if (allTimebins || time == timebin ) 
+           fHistfront->Fill(digitReader.GetPad(),(digitReader.GetRow() + rowOffset),digitReader.GetSignal());
+       
+       // read next value
+       readValue = digitReader.Next();
+      
+       //Check where to stop:
+       if(!readValue) break; //No more value
+    } 
+#else //! defined(HAVE_TPC_MAPPING)
+      HLTFatal("DigitReaderRaw not available - check your build");
+#endif //defined(HAVE_TPC_MAPPING)
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayFront::Draw(){
+    fDisplay->GetCanvasFront()->cd();
+    fDisplay->GetCanvasFront()->Clear();
+
+    Char_t title[256];
+    sprintf(title,"FrontView of selected slice%d",fDisplay->GetSlicePadRow());
+
+    // Keep Zoom
+    if (!fDisplay->GetKeepView() ){
+       fBinY[0] = 0;
+       fBinY[1] = AliHLTTPCTransform::GetNRows() - 1;
+       fBinX[0] = 0;      
+       fBinX[1] = AliHLTTPCTransform::GetNPads(fBinY[1]);
+    }
+
+    fHistfront->SetAxisRange(fBinX[0],fBinX[1]);
+    fHistfront->SetAxisRange(fBinY[0],fBinY[1],"Y");
+
+    fHistfront->SetTitle(title);
+    fHistfront->SetStats(kFALSE);
+    fHistfront->Draw("COLZ");
+
+    fDisplay->GetCanvasFront()->Modified();
+    fDisplay->GetCanvasFront()->Update();
+
+    // Select Pad
+    // fCanvas->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","AliHLTTPCDisplayFront",(void*) fDisplay,"ExecPadEvent(Int_t,Int_t,Int_t,TObject*)");
+
+    // Keep Zoom
+    fDisplay->GetCanvasFront()->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","AliHLTTPCDisplayFront",(void*) this,"ExecEvent(Int_t,Int_t,Int_t,TObject*)");
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayFront::ExecEvent(Int_t event, Int_t px, Int_t py, TObject *selected){
+   // Saves the Zoom Position of the Histogram 
+
+   // - Mouse down on Axis : StartPoint of Range
+   if (event == 1 && selected->InheritsFrom("TAxis"))
+       fTmpEvent = 1;
+
+   // - Mouse pressed on Axis : Real Zoom process not only click
+   else if (event == 21 && selected->InheritsFrom("TAxis") && fTmpEvent == 1)
+       fTmpEvent = 21;
+
+   // - Mouse pressed on Axis : Still pressed
+   else if (event == 21 && selected->InheritsFrom("TAxis") && fTmpEvent == 21) 
+       return;
+
+    // - Mouse up on Axis : End Point of Rangex
+   else if (event == 11 && selected->InheritsFrom("TAxis") && fTmpEvent == 21){
+       TAxis * axis = (TAxis*) selected;
+       
+       if (selected == fHistfront->GetXaxis() || selected == fHistfront->GetXaxis()){ 
+          fBinX[0] = axis->GetFirst() -1;
+          fBinX[1] = axis->GetLast() -1;
+       }
+       else {
+          fBinY[0] = axis->GetFirst() -1;
+          fBinY[1] = axis->GetLast() -1;
+       }
+
+       fTmpEvent = 0; 
+   }
+   else fTmpEvent = 0;
+}
diff --git a/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayFront.h b/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayFront.h
new file mode 100644 (file)
index 0000000..e8f9249
--- /dev/null
@@ -0,0 +1,48 @@
+// XEmacs -*-C++-*-
+// $Id$
+
+#ifndef ALIHLTTPCDISPLAYFRONT_H
+#define ALIHLTTPCDISPLAYFRONT_H
+/** \class AliHLTTPCDisplayFront
+<pre>
+//_____________________________________________________________
+// AliHLTTPCDisplayFront
+//
+// Display class for the HLT TPC-Front view 
+</pre>
+*/
+// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+//*-- Copyright &copy ALICE HLT Group 
+
+#include <TCanvas.h>
+#include <TH2F.h>
+#include <AliHLTTPCDisplayMain.h>
+
+class AliHLTTPCDisplayFront : public AliHLTLogging  {  
+    
+ public:
+    AliHLTTPCDisplayFront(AliHLTTPCDisplayMain* display) ;
+    virtual ~AliHLTTPCDisplayFront();
+    
+    void Fill(Int_t patch, ULong_t dataBlock, ULong_t dataLen);
+    void Draw();
+    void Reset();
+    void Save();
+    void ExecEvent(Int_t event, Int_t x, Int_t y, TObject *selected);
+
+ private:
+    AliHLTTPCDisplayMain* fDisplay;
+    TCanvas * fCanvas;
+
+    TH2F *fHistfront;              // histogram for front view of one slice
+
+    Int_t fNTimes;
+
+    Int_t fBinX[2];                // Minimum / Maximum - Bin on X Axis
+    Int_t fBinY[2];                // Minimum / Maximum - Bin on Y Axis
+    Int_t fTmpEvent;               // Tmp Event for get user range on Axis
+
+    ClassDef(AliHLTTPCDisplayFront,0) 
+};
+
+#endif //  ALIHLTTPCDISPLAYFRONT_H
diff --git a/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayMain.cxx b/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayMain.cxx
new file mode 100644 (file)
index 0000000..773ce9b
--- /dev/null
@@ -0,0 +1,649 @@
+// $Id$
+
+/** \class AliHLTTPCDisplayMain
+<pre>
+//_____________________________________________________________
+// AliHLTTPCDisplayMain
+//
+// Display class for the HLT events.
+</pre>
+*/
+// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+//*-- Copyright &copy ALICE HLT Group 
+
+#define DEBUG 0
+
+
+#if defined(HAVE_HOMERREADER) 
+#include "HOMERReader.h"
+#endif // defined(HAVE_HOMERREADER) 
+//-----------
+#include "AliHLTTPCDisplayMain.h"
+#include "AliHLTTPCDisplayCharge.h"
+#include "AliHLTTPCDisplayPadRow.h"
+#include "AliHLTTPCDisplayPad.h"
+#include "AliHLTTPCDisplay3D.h"
+#include "AliHLTTPCDisplayResiduals.h"
+#include "AliHLTTPCDisplayFront.h"
+//-----------
+#include "AliHLTStdIncludes.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTDataTypes.h"
+#include "AliHLTTPCSpacePointData.h"
+#include "AliHLTTPCClusterDataFormat.h"
+#include "AliHLTTPCTrackletDataFormat.h"
+#include "AliHLTTPCDigitReader.h"
+#include "AliHLT_C_Component_WrapperInterface.h"
+#include "AliHLTTPCLogging.h"
+
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCTrack.h"
+#include "AliHLTTPCTrackArray.h"
+#include "AliHLTTPCMemHandler.h"
+#include "AliHLTTPCDigitReaderPacked.h"
+
+#ifdef use_aliroot
+#include <TClonesArray.h>
+#include <AliRun.h>
+#include <AliSimDigits.h>
+#include <AliTPCParam.h>
+#endif
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+ClassImp(AliHLTTPCDisplayMain)
+
+//____________________________________________________________________________________________________
+AliHLTTPCDisplayMain::AliHLTTPCDisplayMain(void* pt2GUI, void (*pt2Function)(void*, Int_t)) {
+    //constructor
+
+    // Set B-Field
+    AliHLTTPCTransform::SetBField( 0.8 );
+
+    //callback handler
+    fPt2Gui = pt2GUI;
+    fPadCallback = pt2Function;
+       
+    fReader = NULL;
+
+    fDisplayCharge = NULL; 
+    fDisplayPadRow = NULL;
+    fDisplayPad = NULL;
+    fDisplay3D = NULL;
+    fDisplayResiduals = NULL;
+    fDisplayFront = NULL;
+
+    fCanvasCharge = NULL;
+    fCanvasPadRow = NULL;
+    fCanvasPad = NULL;
+    fCanvas3D = NULL;
+    fCanvasResiduals = NULL;
+    fCanvasFront = NULL;
+    fCanvasHits_S = NULL;
+    fCanvasQ_Track = NULL;
+    fCanvasQ_S = NULL;
+
+    fConnect = kFALSE;
+
+    fExistsRawData = kFALSE;
+    fExistsClusterData = kFALSE;
+    fExistsTrackData = kFALSE;
+
+    AliHLTTPCTransform::SetBField(0.4);
+
+    memset(fClusters,0,36*6*sizeof(AliHLTTPCSpacePointData*));
+    memset(fNcl, 0, 36*6*sizeof(UInt_t)); 
+
+    fTracks = NULL;
+
+    fTheta = 90.;
+    fPhi = 0.;
+
+    fSwitch3DCluster = kFALSE;
+    fSwitch3DTracks = kFALSE;
+    fSwitch3DPadRow = kFALSE;
+    fSwitch3DGeometry = kTRUE;
+
+
+    // fMinHits = 0;
+    // fPtThreshold = 0.;
+
+    fCutHits = 0;
+    fCutPt = 0.;
+    fCutPsi = 0.;
+    fCutLambda = 0.;
+    fCut_S = 0.;
+    fCutPadrow = 159;
+
+    fNPads = AliHLTTPCTransform::GetNPads(0);
+    fPad = -1;
+    fPadRow = 0;
+    fTimebin = 0;
+
+    fAllTimebins = kTRUE;
+    fSplitPadRow = kFALSE;
+    
+    fSlicePadRow = 0; 
+    fSelectTrack = -1;
+    fSelectTrackSlice = 0;
+    fSelectTrackSwitch = kFALSE;
+    fSelectCluster = 0;
+
+    fMinSlice = 0;
+    fMaxSlice = 35;
+    fSlicePair = kFALSE;
+
+    SetSliceArray();
+
+    fBackColor = 1;
+    fLineColor = 0;
+    fKeepView = kTRUE;
+
+    fTrackParam.kappa = 0.;
+    fTrackParam.nHits = 0;
+    fTrackParam.charge = 0;
+    fTrackParam.radius = 0.;
+    fTrackParam.slice = 0;
+    fTrackParam.phi0 = 0.;
+    fTrackParam.psi = 0.;
+    fTrackParam.lambda = 0.;
+    fTrackParam.pt = 0.;
+    fTrackParam.id = 0;
+    fTrackParam.bfield = 0.;
+    fTrackParam.s = 0.;
+}
+
+//____________________________________________________________________________________________________
+AliHLTTPCDisplayMain::~AliHLTTPCDisplayMain() {
+    //destructor
+    if ( fTracks )  delete fTracks;
+    fTracks = NULL;
+
+#if defined(HAVE_HOMERREADER) 
+    HOMERReader* reader= (HOMERReader*) fReader;
+
+    if (reader)
+      delete reader;
+    fReader = NULL;
+#endif // defined(HAVE_HOMERREADER) 
+
+    if (fDisplayResiduals)
+      delete fDisplayResiduals;
+    fDisplayResiduals = NULL;
+
+    if (fDisplay3D)
+      delete fDisplay3D;
+    fDisplay3D = NULL;
+
+    if (fDisplayPad)
+      delete fDisplayPad;
+    fDisplayPad = NULL;
+
+    if (fDisplayPadRow)
+      delete fDisplayPadRow;
+    fDisplayPadRow = NULL;
+
+    if (fDisplayFront)
+      delete fDisplayFront;
+    fDisplayFront = NULL;
+
+    if (fDisplayCharge)
+      delete fDisplayCharge;
+    fDisplayCharge = NULL;
+}
+
+//____________________________________________________________________________________________________
+Int_t AliHLTTPCDisplayMain::Connect( unsigned int cnt, const char** hostnames, unsigned short* ports, Char_t *gfile){
+
+#if defined(HAVE_HOMERREADER) 
+    // -- input datatypes , reverse
+    Char_t* spptID="SRETSULC";
+    Char_t* trkID = "SGESKART";
+    Char_t* padrowID = "KPWR_LDD";
+     
+    Int_t ret;
+    Int_t tries = 0;
+    
+    while(1) {
+       HOMERReader* reader = new HOMERReader( cnt, (const char**) hostnames, ports );
+
+       ret=reader->GetConnectionStatus();
+
+       if ( ret ) {    
+           Int_t ndx = reader->GetErrorConnectionNdx();
+           if ( ndx < (Int_t) cnt) printf( "Error establishing connection to TCP source %s:%hu: %s (%d)\n", hostnames[ndx], ports[ndx], strerror(ret), ret );
+           else printf( "Error establishing connection to unknown source with index %d: %s (%d)\n",ndx, strerror(ret), ret );
+
+           delete reader;
+           reader = NULL;
+           return -1;
+       }
+
+       //cout << "TRY = " << tries << " || " ;
+       tries++;
+
+       Int_t  ret1 = reader->ReadNextEvent();
+       if ( ret1 ) {
+           Int_t ndx = reader->GetErrorConnectionNdx();
+           printf( "Error reading event from source %d: %s (%d)\n", ndx, strerror(ret1), ret1 );
+           delete reader;
+           reader = NULL;
+           continue;
+       }
+
+       unsigned long blockCnt = reader->GetBlockCnt();  // ####
+#if DEBUG
+       printf( "Event 0x%016LX (%Lu) with %lu blocks\n", (ULong64_t)reader->GetEventID(), (ULong64_t)reader->GetEventID(), blockCnt );
+#endif
+       if (blockCnt == 0){
+           delete reader;
+           reader = NULL;
+           continue;
+       }
+       
+       fReader = (void*) reader;
+
+       // Switch on the Display parts according what data types are present
+       for ( unsigned long i = 0; i < blockCnt; i++ ) {
+           char tmp1[9];
+           memset( tmp1, 0, 9 );
+           void *tmp11 = tmp1;
+           ULong64_t* tmp12 = (ULong64_t*)tmp11;
+           *tmp12 = reader->GetBlockDataType( i );
+           if (!strcmp(tmp1,padrowID)) fExistsRawData = kTRUE;
+           if (!strcmp(tmp1,spptID)) fExistsClusterData = kTRUE;
+           if (!strcmp(tmp1,trkID)) fExistsTrackData = kTRUE;            
+       }
+
+       break;
+    }
+    fConnect = kTRUE;  
+
+    // Initialize TPC Display Classes  -- IMPORTANT... don't change the order of them
+    fDisplay3D = new AliHLTTPCDisplay3D(this, gfile);
+    if (ExistsRawData()){
+       fDisplayPadRow = new AliHLTTPCDisplayPadRow(this);
+       fDisplayPad = new AliHLTTPCDisplayPad(this);
+       fDisplayFront = new AliHLTTPCDisplayFront(this);
+    }
+
+    if (ExistsClusterData()){
+       fDisplayCharge = new AliHLTTPCDisplayCharge(this);
+    }
+
+    if (ExistsTrackData() && ExistsClusterData() ){
+       fDisplayResiduals = new AliHLTTPCDisplayResiduals(this);
+    }
+
+    return 0;
+#else
+    HLTFatal("HOMER raeder not available");
+#endif // defined(HAVE_HOMERREADER) 
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayMain::ReadData(Bool_t nextSwitch){
+#if defined(HAVE_HOMERREADER) 
+    // READ CLUSTER and TRACK data
+    HOMERReader* reader = (HOMERReader*)fReader;
+
+    for(Int_t ii=0;ii<36;ii++) fTracksPerSlice[ii] = 0;
+
+    // -- input datatypes , reverse
+    Char_t* spptID="SRETSULC";
+    Char_t* trkID = "SGESKART";
+    Int_t ret;
+    ULong_t blk;
+
+    if (nextSwitch) {
+       while(1){
+           ret = reader->ReadNextEvent();
+           
+           if ( ret ) {
+               Int_t ndx = reader->GetErrorConnectionNdx();
+               printf( "------------ TRY AGAIN --------------->Error reading event from source %d: %s (%d)\n", ndx, strerror(ret), ret );
+               continue; 
+           }
+           break;
+       }
+    }
+
+    ULong_t blockCnt = reader->GetBlockCnt();
+#if DEBUG
+    printf( "Event 0x%016LX (%Lu) with %lu blocks\n", (ULong64_t)reader->GetEventID(), (ULong64_t)reader->GetEventID(), blockCnt );
+#endif    
+    for ( ULong_t i = 0; i < blockCnt; i++ ) {
+       Char_t tmp1[9], tmp2[5];
+       memset( tmp1, 0, 9 );
+       memset( tmp2, 0, 5 );
+       void *tmp11 = tmp1;
+       ULong64_t* tmp12 = (ULong64_t*)tmp11;
+       *tmp12 = reader->GetBlockDataType( i );
+       void *tmp21 = tmp2;
+       ULong_t* tmp22 = (ULong_t*)tmp21;
+       *tmp22 = reader->GetBlockDataOrigin( i );
+#if DEBUG
+       printf( "Block %lu length: %lu - type: %s - origin: %s\n",i, reader->GetBlockDataLength( i ), tmp1, tmp2 );
+#endif
+    }
+    
+    //--------------------------------------------------------------------------------------------
+    // READ CLUSTER DATA
+    //-------------------------------------------------------------------------------------------- 
+    blk = reader->FindBlockNdx( spptID, " CPT",0xFFFFFFFF );
+    
+    while ( blk != ~(ULong_t)0 ) {         
+#if DEBUG
+       printf( "Found clusters block %lu\n", blk );
+#endif
+       const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*)reader->GetBlockData( blk );
+       if ( !clusterData ) {
+#if DEBUG
+           printf( "No track data for block %lu\n", blk );
+#endif
+           continue;
+       }
+       
+       ULong_t spec = reader->GetBlockDataSpec( blk );
+       Int_t patch = AliHLTTPCDefinitions::GetMinPatchNr( spec );
+       Int_t slice = AliHLTTPCDefinitions::GetMinSliceNr( spec );
+#if DEBUG
+       printf( "%lu Clusters found for slice %u - patch %u\n", clusterData->fSpacePointCnt, slice, patch );
+#endif 
+       void* tmp30 = (void*)clusterData;
+       Byte_t* tmp31 = (Byte_t*)tmp30;
+       ULong_t offset;
+       offset = sizeof(clusterData->fSpacePointCnt);
+       if ( offset <= reader->GetBlockTypeAlignment( blk, 1 ) ) offset = reader->GetBlockTypeAlignment( blk, 1 );
+       tmp31 += offset;
+       tmp30 = tmp31;
+       AliHLTTPCSpacePointData* tmp32 = (AliHLTTPCSpacePointData*)tmp30;
+       
+       SetupCluster( slice, patch, clusterData->fSpacePointCnt, tmp32 );
+       
+       blk = reader->FindBlockNdx( spptID, " CPT", 0xFFFFFFFF, blk+1 );
+    }
+
+    //--------------------------------------------------------------------------------------------
+    // READ TRACKS
+    //-------------------------------------------------------------------------------------------- 
+    if ( fTracks ) delete fTracks; 
+    fTracks = new AliHLTTPCTrackArray;
+    
+    blk = reader->FindBlockNdx( trkID, " CPT", 0xFFFFFFFF );
+       
+    while ( blk != ~(ULong_t)0 ) {
+#if DEBUG
+       printf( "Found tracks in block %lu\n", blk );
+#endif
+       const AliHLTTPCTrackletData* trackData = (const AliHLTTPCTrackletData*)reader->GetBlockData( blk );
+       if ( !trackData ) {
+#if DEBUG
+           printf( "No track data for block %lu\n", blk );
+#endif
+           continue;
+       }
+       
+       ULong_t spec = reader->GetBlockDataSpec( blk ); 
+       Int_t slice = AliHLTTPCDefinitions::GetMinSliceNr( spec );  
+#if DEBUG
+       Int_t patchmin = AliHLTTPCDefinitions::GetMinPatchNr( spec );
+       Int_t patchmax = AliHLTTPCDefinitions::GetMaxPatchNr( spec );
+
+       printf( "%lu tracks found for slice %u - patch %u-%u\n", trackData->fTrackletCnt, slice, patchmin, patchmax );
+#endif 
+       fTracksPerSlice[slice] = trackData->fTrackletCnt; // Fill number if tracks per slice
+       
+       AliHLTTPCTrackSegmentData* tmp42 = (AliHLTTPCTrackSegmentData*) &(trackData->fTracklets[0]);
+       fTracks->FillTracks( trackData->fTrackletCnt, tmp42, slice );
+       
+       blk = reader->FindBlockNdx( trkID, " CPT", 0xFFFFFFFF, blk+1 ); 
+    }
+    
+    SetupTracks();  
+#else
+    HLTFatal("HOMER raeder not available");
+#endif // defined(HAVE_HOMERREADER) 
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayMain::DisplayEvent(){
+#if defined(HAVE_HOMERREADER) 
+    HOMERReader* reader = (HOMERReader*)fReader;
+
+    //--------------------------------------------------------------------------------------------
+    // READ RAW DATA for PADROW/PAD HISTOGRAM
+    //--------------------------------------------------------------------------------------------
+    if ( ExistsRawData() ){    
+       fDisplayPadRow->Reset();
+       fDisplayPad->Reset();
+       fDisplayFront->Reset();
+
+       char* rawID = "KPWR_LDD";
+       Int_t padrowpatch =  AliHLTTPCTransform::GetPatch(fPadRow);
+       Int_t maxpadrowpatch =  padrowpatch;
+       
+       if (fPadRow == 30 || fPadRow == 90 || fPadRow == 139) maxpadrowpatch++;
+
+       for (Int_t patch=0; patch < 6; patch++){
+           unsigned long blk;
+           AliHLTUInt32_t rawSpec = AliHLTTPCDefinitions::EncodeDataSpecification( (AliHLTUInt8_t) fSlicePadRow, (AliHLTUInt8_t) fSlicePadRow,
+                                                                                   (AliHLTUInt8_t) patch,(AliHLTUInt8_t) patch );
+           // READ RAW DATA BLOCK
+           blk = reader->FindBlockNdx( rawID, " CPT", rawSpec );       
+
+           if ( ~(unsigned long)0 != blk ){
+#if DEBUG
+               printf( "Raw Data found for slice %u/patch %u\n", fSlicePadRow, patch );
+#endif
+               unsigned long rawDataBlock = (unsigned long) reader->GetBlockData( blk );
+               unsigned long rawDataLen = reader->GetBlockDataLength( blk );
+           
+               fDisplayFront->Fill(patch, rawDataBlock, rawDataLen);
+
+               if (patch == padrowpatch || patch == maxpadrowpatch ) {
+                   fDisplayPadRow->Fill(patch, rawDataBlock, rawDataLen);
+                   fDisplayPad->Fill(patch, rawDataBlock, rawDataLen);
+               }
+           }
+       }
+
+       fDisplayPad->Draw();
+       fDisplayPadRow->Draw();
+       fDisplayFront->Draw();
+    }
+
+    //--------------------------------------------------------------------------------------------
+    // DRAW RESIDUALS
+    //--------------------------------------------------------------------------------------------
+    if ( ExistsClusterData() && ExistsTrackData() ){
+       fDisplayResiduals->Reset();
+       fDisplayResiduals->Fill();
+       fDisplayResiduals->Draw();
+    }
+
+    //--------------------------------------------------------------------------------------------
+    // DRAW CHARGE 
+    //--------------------------------------------------------------------------------------------
+    if ( ExistsClusterData() ){
+       fDisplayCharge->Reset();
+       fDisplayCharge->Fill();
+       fDisplayCharge->Draw();
+    }
+
+    //--------------------------------------------------------------------------------------------
+    // DRAW 3D
+    //--------------------------------------------------------------------------------------------
+
+    // TAKE CARE !!! EXISTSxxxData() HANDLING of 3D will be done IN this class !!!
+    fDisplay3D->Draw(); 
+#else
+    HLTFatal("HOMER raeder not available");
+#endif // defined(HAVE_HOMERREADER) 
+
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayMain::SaveHistograms(){    
+  // Save histograms as eps
+  fDisplayCharge->Save();
+  fDisplayPadRow->Save();
+  fDisplayPad->Save();
+  fDisplay3D->Save();
+  fDisplayResiduals->Save();
+  fDisplayFront->Save();
+  fDisplayCharge->Save();
+}
+
+//----------------------------------------------------------------------------------------------------
+//                 SETUP
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayMain::SetupCluster(Int_t slice, Int_t patch, UInt_t nofClusters, AliHLTTPCSpacePointData* data)  {  
+
+    if (data && slice>=0 && slice<36 && patch>=0 && patch<AliHLTTPCTransform::GetNPatches()) {
+       if (fClusters[slice][patch]!=NULL) {
+           delete(fClusters[slice][patch]);
+           fClusters[slice][patch]=NULL;
+       }
+       Int_t arraysize=nofClusters*sizeof(AliHLTTPCSpacePointData);
+       fClusters[slice][patch] = (AliHLTTPCSpacePointData*)new Byte_t[arraysize];
+       if (fClusters[slice][patch]) {
+           memcpy(fClusters[slice][patch], data, arraysize);
+           fNcl[slice][patch]=nofClusters;
+       } else {
+           fNcl[slice][patch]=nofClusters;
+           LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::SetupCluster","memory allocation") << "memory allocation failed "<<ENDLOG; 
+       }
+    } else LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::SetupCluster","argument check") << "invalid argument "<<ENDLOG; 
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayMain::SetupTracks() {
+
+    // Set USED cluster
+    Int_t ntracks = fTracks->GetNTracks();
+
+    for(Int_t j=0; j<ntracks; j++) {   
+       AliHLTTPCTrack *gtrack = fTracks->GetCheckedTrack(j); 
+       if(!gtrack) continue;
+
+       Int_t nHits = gtrack->GetNHits();
+       UInt_t *hitnum = gtrack->GetHitNumbers();
+
+       for(Int_t h=0; h<nHits; h++){
+         
+           UInt_t id=hitnum[h];
+           Int_t slice = (id>>25) & 0x7f;
+           Int_t patch = (id>>22) & 0x7;
+           UInt_t pos = id&0x3fffff;       
+               
+           AliHLTTPCSpacePointData *points = fClusters[slice][patch];
+           
+           if(!points) {
+               LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplayMain::SetupTracks","Clusterarray") 
+                 <<"No points at slice "<<slice<<" patch "<<patch<<" pos "<<pos<<ENDLOG;
+               continue;
+           }
+           if(pos>=fNcl[slice][patch]) {
+               LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplayMain::SetupTracks","Clusterarray") 
+                 <<"Pos is too large: pos "<<pos <<" ncl "<<fNcl[slice][patch]<<ENDLOG;
+               continue;
+           }
+           points[pos].fUsed = kTRUE;
+           points[pos].fTrackN = j;
+       }
+    }
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayMain::SetSliceArray() {
+    Int_t slice=0;
+    Int_t minSlice = fMinSlice; 
+    Int_t maxSlice = fMaxSlice; 
+    Int_t realslice = 0;
+
+    for (slice=0;slice< 36;slice++){
+       fSliceArray[slice] = kFALSE;
+    }
+
+    // Single Slice, or Range
+    if (minSlice > maxSlice) maxSlice += 17;
+       
+    for (slice=minSlice;slice<=maxSlice;slice++){
+       realslice = slice % 18;
+       fSliceArray[realslice] = kTRUE;
+       fSliceArray[realslice+18] = kTRUE;
+    }
+
+    // Pair of Slices
+    if (fSlicePair) {
+       minSlice = fMinSlice + 9;
+       maxSlice = fMaxSlice + 9;
+       
+       if (minSlice > maxSlice) maxSlice += 17;
+       
+       for (slice=minSlice;slice<=maxSlice;slice++){
+           realslice = slice % 18;
+           fSliceArray[realslice] = kTRUE;     
+           fSliceArray[realslice+18] = kTRUE;
+       }
+    }
+}
+
+//----------------------------------------------------------------------------------------------------
+//                 GETTER
+//____________________________________________________________________________________________________
+Int_t AliHLTTPCDisplayMain::GetGlobalTrack(Int_t slice){
+    // get global track out of the "selectTrack" parameters
+    Int_t currenttrack= -1;
+    Int_t trackcounter = 0;
+    Int_t ntracks = fTracks->GetNTracks();
+    
+    if ( slice == fSelectTrackSlice) {
+       for(Int_t j=0; j<ntracks; j++) {        
+           
+           AliHLTTPCTrack *gtrack = fTracks->GetCheckedTrack(j); 
+           if(!gtrack) continue;
+           
+           // --- CHECK if track is should be drawn
+           // select Single Track
+           if(gtrack->GetSector() != fSelectTrackSlice) continue;
+           
+           if (trackcounter != fSelectTrack){
+               trackcounter++;  
+               continue;
+           }
+           trackcounter++;
+           // +++
+           //if((fPtThreshold > 0) && (gtrack->GetPt()< fPtThreshold)) continue;
+           //if(gtrack->GetNHits() < fMinHits) continue;
+           
+           currenttrack = j;
+           break;
+       }
+    }
+
+    return currenttrack;
+}
+
+//----------------------------------------------------------------------------------------------------
+//                 EVENTS
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayMain::ExecPadEvent(Int_t event, Int_t px, Int_t py, TObject *selected){
+   TCanvas *c = (TCanvas *) gTQSender;
+
+   if (event == 11 &&selected->InheritsFrom("TH2F")) {
+       TH2F *hist = (TH2F*) selected;
+
+       Int_t binx = hist->GetXaxis()->FindBin(c->AbsPixeltoX(px)) -1 ;
+//     Int_t biny = hist->GetYaxis()->FindBin(c->AbsPixeltoY(py)) -1;
+
+        fPadCallback(fPt2Gui, binx);
+  }
+}
+
+
diff --git a/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayMain.h b/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayMain.h
new file mode 100644 (file)
index 0000000..4c4c2e5
--- /dev/null
@@ -0,0 +1,286 @@
+// XEmacs -*-C++-*-
+// $Id$
+
+#ifndef ALIHLTTPCDISPLAYMAIN_H
+#define ALIHLTTPCDISPLAYMAIN_H
+/** \class AliHLTTPCDisplayMain
+<pre>
+//_____________________________________________________________
+// AliHLTTPCDisplayMain
+//
+// Display class for the HLT events.
+</pre>
+*/
+// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+//*-- Copyright &copy ALICE HLT Group 
+
+#include <TGeometry.h>
+#include <TObject.h>
+#include <TCanvas.h>
+
+#include "AliHLTTPCTransform.h"
+#include "AliHLTLogging.h"
+
+class AliHLTTPCSpacePointData;
+class AliHLTTPCTrackArray;
+class AliHLTTPCDisplayCharge;
+class AliHLTTPCDisplayPadRow;
+class AliHLTTPCDisplayPad;
+class AliHLTTPCDisplay3D;
+class AliHLTTPCDisplayResiduals;
+class AliHLTTPCDisplayFront;
+
+class AliHLTTPCDisplayMain : public TObject , public AliHLTLogging {
+
+ public:
+    AliHLTTPCDisplayMain(void* pt2GUI, void (*pt2Function)(void*, Int_t));
+    virtual ~AliHLTTPCDisplayMain();
+
+    Int_t Connect( unsigned int cnt, const char** hostnames, unsigned short* ports,Char_t *gfile="$(ALIHLT_BASEDIR)/geo/alice.geom" );
+    
+    void ReadData(Bool_t nextSwitch = kTRUE);
+    void DisplayEvent();
+    void SaveHistograms();
+
+    // SETUP
+    void SetupCluster(Int_t slice, Int_t patch, UInt_t nofClusters, AliHLTTPCSpacePointData* data);
+    void SetupTracks();
+
+    // SETTER   
+    void SetConnectionStatus(Bool_t f) {fConnect = f;}
+
+    // canvas ----
+    void SetCanvasCharge(TCanvas *f){fCanvasCharge = f;}
+    void SetCanvasPadRow(TCanvas *f){fCanvasPadRow = f;}
+    void SetCanvasPad(TCanvas *f){fCanvasPad = f;}
+    void SetCanvas3D(TCanvas *f){fCanvas3D = f;}
+    void SetCanvasResiduals(TCanvas *f){fCanvasResiduals = f;}
+    void SetCanvasFront(TCanvas *f){fCanvasFront = f;}
+    void SetCanvasHits_S(TCanvas *f){fCanvasHits_S = f;}
+    void SetCanvasQ_Track(TCanvas *f){fCanvasQ_Track = f;}
+    void SetCanvasQ_S(TCanvas *f){fCanvasQ_S = f;}
+
+    // slices ----
+    void SetSlices(){fMinSlice = 0; fMaxSlice = 35; fSlicePair = kFALSE; SetSliceArray();}
+    void SetSlices(Int_t s){fMinSlice = s; fMaxSlice = s; fSlicePair = kFALSE; SetSliceArray();}
+    void SetSlices(Int_t mins, Int_t maxs){fMinSlice = mins; fMaxSlice = maxs; fSlicePair = kFALSE; SetSliceArray();}
+    void SetSlicesPair(Int_t s){fMinSlice = s; fMaxSlice = s; fSlicePair = kTRUE; SetSliceArray();}
+    void SetSlicesPair(Int_t mins, Int_t maxs){fMinSlice = mins; fMaxSlice = maxs; fSlicePair = kTRUE; SetSliceArray();}
+
+    // cuts ----
+    //    void SetCutHits(Int_t f){fMinHits = f;}
+    //    void SetCutPt(Float_t f){fPtThreshold = f;}
+    void SetCutHits(Int_t f){fCutHits = f;}
+    void SetCutPt(Float_t f){fCutPt = f;}
+    void SetCutPsi(Float_t f){fCutPsi = f;}
+    void SetCutLambda(Float_t f){fCutLambda = f;}
+    void SetCutS(Float_t f){fCut_S = f;}
+    void SetIncidentPadrow(Int_t f){fCutPadrow = f;}
+
+    void SetInvert() {Int_t tmp = fBackColor; fBackColor = fLineColor; fLineColor = tmp; }
+    void SetKeepView(Bool_t f){fKeepView = f;} 
+
+    // raw ----
+    void SetPad(Int_t f){fPad = f;}
+    void SetPadRow(Int_t f){fPadRow = f; fNPads = AliHLTTPCTransform::GetNPads(f); }
+    void SetSlicePadRow(Int_t f){fSlicePadRow = f;}
+    void SetTimebin(Int_t f){fTimebin = f;}
+
+    void SetAllTimebins(Bool_t f){fAllTimebins = f;}
+    void SetSplitPadRow(Bool_t f){fSplitPadRow = f;}
+
+    void SetSelectTrack(Int_t f) {fSelectTrack = f;}
+    void SetSelectTrackSlice(Int_t f) {fSelectTrackSlice = f;}
+    void SetSelectTrackSwitch(Bool_t f) {fSelectTrackSwitch = f;}
+    void SetSelectCluster(Int_t f) {fSelectCluster = f;}
+
+    void SetSwitches(Bool_t f1, Bool_t f2, Bool_t f3, Bool_t f4) {fSwitch3DTracks = f1; fSwitch3DCluster = f2; fSwitch3DPadRow = f3; fSwitch3DGeometry = f4;} 
+
+    void SetTheta(Float_t f) {fTheta = f;}
+
+
+    // GETTER
+    Bool_t GetConnectionStatus() {return fConnect;}
+
+    AliHLTTPCSpacePointData* GetSpacePointDataPointer(Int_t slice,Int_t patch){return fClusters[slice][patch];}
+    AliHLTTPCTrackArray* GetTrackArrayPointer() {return fTracks;}
+    AliHLTTPCDisplayPadRow * GetPadRowPointer() {return fDisplayPadRow;}
+    AliHLTTPCDisplayPad * GetPadPointer() {return fDisplayPad;}
+
+    // canvas ----
+    TCanvas * GetCanvasHits_S(){return fCanvasHits_S;}
+    TCanvas * GetCanvasQ_Track(){return fCanvasQ_Track;}
+    TCanvas * GetCanvasQ_S(){return fCanvasQ_S;}
+    TCanvas * GetCanvasResiduals(){return fCanvasResiduals;}
+    TCanvas * GetCanvasCharge(){return fCanvasCharge;}
+    TCanvas * GetCanvasPadRow(){return fCanvasPadRow;}
+    TCanvas * GetCanvasPad(){return fCanvasPad;}
+    TCanvas * GetCanvas3D(){return fCanvas3D;}
+    TCanvas * GetCanvasFront(){return fCanvasFront;}
+
+    // cuts ----
+    Int_t GetCutHits(){return fCutHits;}
+    Float_t GetCutPt(){return fCutPt;}
+    Float_t GetCutPsi(){return fCutPsi;}
+    Float_t GetCutLambda(){return fCutLambda;}
+    Float_t GetCutS(){return fCut_S;}
+    Int_t GetIncidentPadrow(){return fCutPadrow;}
+
+    Int_t GetNumberSpacePoints(Int_t slice,Int_t patch){return fNcl[slice][patch];}
+    Int_t GetTracksPerSlice(Int_t slice){return fTracksPerSlice[slice];}
+    Bool_t GetDisplaySlice(Int_t slice){ return fSliceArray[slice];}
+
+    Int_t GetSelectCluster(){return fSelectCluster;}
+    Bool_t GetSelectTrackSwitch() {return fSelectTrackSwitch;}
+    Int_t GetSelectTrack() {return fSelectTrack;}
+    Int_t GetSelectTrackSlice() {return fSelectTrackSlice;}
+
+    Int_t GetGlobalTrack(Int_t slice);
+
+    Int_t GetPad(){return fPad;}
+    Int_t GetPadRow(){return fPadRow;}
+    Int_t GetSlicePadRow(){return fSlicePadRow;}
+    Bool_t GetSplitPadRow(){return fSplitPadRow;}
+
+    Int_t GetNPads(){return fNPads;}
+    Int_t GetTimebin(){return fTimebin;}
+    Bool_t GetAllTimebins(){return fAllTimebins;}
+
+    Int_t GetLineColor(){return fLineColor;}
+    Int_t GetBackColor(){return fBackColor;}
+    Bool_t GetKeepView(){return fKeepView;}
+    Float_t GetTheta(){return fTheta;}
+    Float_t GetPhi(){return fPhi;}
+
+    Bool_t Get3DSwitchTracks() {return fSwitch3DTracks;}
+    Bool_t Get3DSwitchCluster() {return fSwitch3DCluster;}
+    Bool_t Get3DSwitchPadRow() {return fSwitch3DPadRow;}
+    Bool_t Get3DSwitchGeometry() {return fSwitch3DGeometry;}
+
+    Int_t GetTrackParamNHits(){ return fTrackParam.nHits;}
+
+#if 0
+    Char_t GetTrackParamSlice(){ return Char_t GetTrackParamId();
+    Char_t GetTrackParamKappa());
+    Char_t GetTrackParamPt());
+Char_t GetTrackParamNHits());
+Char_t GetTrackParamCharge());
+Char_t GetTrackParamRadius());
+Char_t GetTrackParamPhi0());
+Char_t GetTrackParamPsi());
+Char_t GetTrackParamLambda());
+Char_t GetTrackParamBfield());
+#endif
+    // EXISTS
+    Bool_t ExistsRawData() {return fExistsRawData;}   
+    Bool_t ExistsClusterData() {return fExistsClusterData;}   
+    Bool_t ExistsTrackData() {return fExistsTrackData;}   
+
+    // EVENTS
+    void ExecPadEvent(Int_t event, Int_t x, Int_t y, TObject *selected);
+
+    // Callback Handler
+    void * fPt2Gui;
+    void (*fPadCallback)(void*, Int_t);
+
+    struct AliHLTTPCTrackParameter{
+       Int_t nHits;
+       Int_t charge;
+       Double_t kappa;
+       Double_t radius;
+       Int_t slice;
+       Double_t phi0;
+       Double_t psi;
+       Double_t lambda;
+       Double_t pt;
+       Int_t id;
+       Double_t bfield;
+       Double_t s;
+    };
+    
+    AliHLTTPCTrackParameter fTrackParam;
+
+// ---------------------------------------------------
+ private:
+    AliHLTTPCDisplayMain(const AliHLTTPCDisplayMain &/*d*/):TObject(){;}
+    AliHLTTPCDisplayMain& operator=(const AliHLTTPCDisplayMain &/*d*/){return *this;}
+   
+    void SetSliceArray();
+
+    Bool_t fConnect;               // Connection status
+  
+    Bool_t fExistsRawData;         // Raw data present
+    Bool_t fExistsClusterData;     // Cluster data present
+    Bool_t fExistsTrackData;       // Track data present
+
+    void* fReader;                 // really HOMERReader*
+
+    Int_t fTracksPerSlice[36];     // TrackCount per slice
+
+    AliHLTTPCSpacePointData *fClusters[36][6]; 
+    AliHLTTPCTrackArray *fTracks; 
+    
+    UInt_t fNcl[36][6];            // Number of cluster
+
+    Int_t fMinSlice;               // Min slice
+    Int_t fMaxSlice;               // Max slice
+    Bool_t fSlicePair;             // Pair of slices;
+    Bool_t fSliceArray[36];        // Array if slice should be drawn or not
+
+    Int_t fSelectCluster;          // select all=0, used=1, unused=2 cluster
+
+    // cuts ----
+//    Int_t fMinHits;                // minimum cluster per track
+//    Float_t fPtThreshold;          // pt threshold for tracks
+    Int_t fCutHits;
+    Float_t fCutPt;
+    Float_t fCutPsi;
+    Float_t fCutLambda;
+    Float_t fCut_S;
+    Int_t fCutPadrow;
+
+    Int_t fBackColor;              // Background color
+    Int_t fLineColor;              // Line color
+    Bool_t fKeepView;              // Keep View when redisplaying
+
+    Bool_t fSwitch3DCluster;
+    Bool_t fSwitch3DTracks;
+    Bool_t fSwitch3DPadRow;
+    Bool_t fSwitch3DGeometry;
+
+    Int_t fPad;                    // pad
+    Int_t fPadRow;                 // padrow
+    Int_t fSlicePadRow;            // slice where padrow is in
+    Int_t fNPads;                  // number of pads in padrow
+    Int_t fTimebin;
+
+    Bool_t fAllTimebins;
+    Bool_t fSplitPadRow;
+
+    Bool_t fSelectTrackSwitch;     // switch ti single track mode
+    Int_t fSelectTrack;            // select single track
+    Int_t fSelectTrackSlice;       // select slice for single track
+
+    Float_t fTheta;
+    Float_t fPhi;
+
+    AliHLTTPCDisplayCharge* fDisplayCharge; 
+    AliHLTTPCDisplayPadRow* fDisplayPadRow;
+    AliHLTTPCDisplayPad* fDisplayPad;
+    AliHLTTPCDisplay3D* fDisplay3D;
+    AliHLTTPCDisplayResiduals* fDisplayResiduals;
+    AliHLTTPCDisplayFront * fDisplayFront;
+
+    TCanvas * fCanvasCharge;
+    TCanvas * fCanvasPadRow;
+    TCanvas * fCanvasPad;
+    TCanvas * fCanvas3D;
+    TCanvas * fCanvasResiduals;
+    TCanvas * fCanvasFront;
+    TCanvas * fCanvasHits_S;
+    TCanvas * fCanvasQ_Track;
+    TCanvas * fCanvasQ_S;
+
+    ClassDef(AliHLTTPCDisplayMain,0) //Display class
+};
+#endif
diff --git a/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayPad.cxx b/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayPad.cxx
new file mode 100644 (file)
index 0000000..17d3816
--- /dev/null
@@ -0,0 +1,244 @@
+// $Id$
+
+/** \class AliHLTTPCDisplayPad
+<pre>
+//_____________________________________________________________
+// AliHLTTPCDisplayPad
+//
+// Display class for the HLT TPC-Pad events.
+</pre>
+*/
+// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+//*-- Copyright &copy ALICE HLT Group 
+
+#include <TH2.h>
+#include <TFile.h>
+#include <TStyle.h>
+#include <TAttText.h>
+#include <TAxis.h>
+#include <TCanvas.h>
+
+#ifdef use_aliroot
+#include <TClonesArray.h>
+#include <AliRun.h>
+#include <AliSimDigits.h>
+#include <AliTPCParam.h>
+#endif
+
+#include "AliHLTStdIncludes.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTDataTypes.h"
+#include "AliHLTTPCSpacePointData.h"
+#include "AliHLTTPCClusterDataFormat.h"
+#include "AliHLTTPCLogging.h"
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCDigitReaderPacked.h"
+#include "AliHLTTPCDigitReaderRaw.h"
+
+#include "AliHLTTPCDisplayMain.h"
+#include "AliHLTTPCDisplayPad.h"
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+ClassImp(AliHLTTPCDisplayPad)
+
+//____________________________________________________________________________________________________
+AliHLTTPCDisplayPad::AliHLTTPCDisplayPad(AliHLTTPCDisplayMain* display) {
+    // constructor
+    fDisplay = display;
+
+    fNTimes = AliHLTTPCTransform::GetNTimeBins();
+
+    fBinX[0] = 0;      
+    fBinX[1] = fNTimes -1; 
+    fTmpEvent = 0;    
+
+    fHistpad1 = new TH1F ("fHistpad1","Selected Pad -1;Timebin #",fNTimes,0,fNTimes-1);
+    fHistpad2 = new TH1F ("fHistpad2","Selected Pad;Timebin #",fNTimes,0,fNTimes-1); 
+    fHistpad3 = new TH1F ("fHistpad3","Selected Pad +1;Timebin #",fNTimes,0,fNTimes-1);
+
+    fHistpad1->SetTitleSize(0.03);
+    fHistpad1->GetXaxis()->SetLabelSize(0.03);
+    fHistpad1->GetXaxis()->SetTitleSize(0.03);
+    fHistpad1->GetYaxis()->SetLabelSize(0.03);
+    fHistpad1->GetYaxis()->SetTitleSize(0.03);
+
+    fHistpad2->SetTitleSize(0.03);
+    fHistpad2->GetXaxis()->SetLabelSize(0.03);
+    fHistpad2->GetXaxis()->SetTitleSize(0.03);
+    fHistpad2->GetYaxis()->SetLabelSize(0.03);
+    fHistpad2->GetYaxis()->SetTitleSize(0.03);
+
+    fHistpad3->SetTitleSize(0.03);
+    fHistpad3->GetXaxis()->SetLabelSize(0.03);
+    fHistpad3->GetXaxis()->SetTitleSize(0.03);
+    fHistpad3->GetYaxis()->SetLabelSize(0.03);
+    fHistpad3->GetYaxis()->SetTitleSize(0.03);
+}
+
+//____________________________________________________________________________________________________
+AliHLTTPCDisplayPad::~AliHLTTPCDisplayPad() {
+    // destructor   
+    if ( fHistpad1 ){
+        delete fHistpad1;
+        fHistpad1 = NULL;
+    }
+
+    if ( fHistpad2 ){
+        delete fHistpad2;
+        fHistpad2 = NULL;
+    }
+
+    if ( fHistpad3 ){
+        delete fHistpad3;
+        fHistpad3 = NULL;
+    }  
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayPad::Reset(){  
+    fHistpad1->Reset(); 
+    fHistpad2->Reset();  
+    fHistpad3->Reset(); 
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayPad::Save(){  
+    fDisplay->GetCanvasPad()->SaveAs("HLT-PadView.eps"); 
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayPad::Fill(Int_t patch, ULong_t dataBlock, ULong_t dataLen){
+    // Fill Pad Histogram
+
+#if defined(HAVE_TPC_MAPPING)    
+    AliHLTTPCDigitReaderRaw digitReader(0);
+
+    bool readValue = true;
+    Int_t rowOffset = 0;
+    
+    Int_t slice = fDisplay->GetSlicePadRow();
+    Int_t padRow = fDisplay->GetPadRow();
+    Int_t pad = fDisplay->GetPad();
+
+    // Initialize RAW DATA
+    Int_t firstRow = AliHLTTPCTransform::GetFirstRow(patch);
+    Int_t lastRow = AliHLTTPCTransform::GetLastRow(patch);
+
+    // Outer sector, patches 2, 3, 4, 5 -  start counting in patch 2 with row 0
+    if ( patch >= 2 ) rowOffset = AliHLTTPCTransform::GetFirstRow( 2 );
+
+    // Initialize block for reading packed data
+    void* tmpdataBlock = (void*) dataBlock;
+    digitReader.InitBlock(tmpdataBlock,dataLen,firstRow,lastRow,patch,slice);
+
+    readValue = digitReader.Next();
+
+    if (!readValue){   
+       LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplayPadRow::Fill","Read first value") << "No value in data block" << ENDLOG;
+       return;
+    }
+
+    // -- Fill Raw Data
+    while ( readValue ){ 
+
+       Int_t row = digitReader.GetRow() + rowOffset;
+
+       // select padrow to fill in histogramm
+       if (row == padRow){    
+           UChar_t tmppad = digitReader.GetPad();
+           UShort_t time = digitReader.GetTime();
+           UInt_t charge = digitReader.GetSignal();
+
+           if (tmppad == (pad-1) ) fHistpad1->Fill(time,charge);
+           if (tmppad == pad) fHistpad2->Fill(time,charge);
+           if (tmppad == (pad+1) ) fHistpad3->Fill(time,charge);
+       }
+       
+       // read next value
+       readValue = digitReader.Next();
+      
+       //Check where to stop:
+       if(!readValue) break; //No more value
+    } 
+#else //! defined(HAVE_TPC_MAPPING)
+      HLTFatal("DigitReaderRaw not available - check your build");
+#endif //defined(HAVE_TPC_MAPPING)
+
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayPad::Draw(){
+    Char_t title[256];
+
+    fDisplay->GetCanvasPad()->cd();
+    fDisplay->GetCanvasPad()->Clear();
+    fDisplay->GetCanvasPad()->Divide(1,3);
+    
+    // Keep Zoom
+    if (!fDisplay->GetKeepView() || (fBinX[1]>fNTimes)){
+       fBinX[0] = 0;
+       fBinX[1] = fNTimes -1;
+    }
+    
+    fHistpad1->SetAxisRange(fBinX[0],fBinX[1]);
+    fHistpad2->SetAxisRange(fBinX[0],fBinX[1]);
+    fHistpad3->SetAxisRange(fBinX[0],fBinX[1]);
+
+
+    fDisplay->GetCanvasPad()->cd(1);
+    sprintf(title,"Selected Pad %d",fDisplay->GetPad() -1);
+    fHistpad1->SetStats(kFALSE);
+    fHistpad1->SetTitle(title);
+    fHistpad1->Draw();
+
+    fDisplay->GetCanvasPad()->cd(2); 
+    sprintf(title,"Selected Pad %d",fDisplay->GetPad() );
+    fHistpad2->SetStats(kFALSE);
+    fHistpad2->SetTitle(title);
+    fHistpad2->Draw();
+
+    fDisplay->GetCanvasPad()->cd(3);
+    sprintf(title,"Selected Pad %d",fDisplay->GetPad() +1);
+    fHistpad3->SetStats(kFALSE);
+    fHistpad3->SetTitle(title);
+    fHistpad3->Draw();
+
+    fDisplay->GetCanvasPad()->Modified();
+    fDisplay->GetCanvasPad()->Update();
+
+    // Keep Zoom
+    fDisplay->GetCanvasPad()->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","AliHLTTPCDisplayPad",(void*) this,"ExecEvent(Int_t,Int_t,Int_t,TObject*)");
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayPad::ExecEvent(Int_t event, Int_t px, Int_t py, TObject *selected){
+   // Saves the Zoom Position of the Histogram 
+
+   // - Mouse down on Axis : StartPoint of Range
+   if (event == 1 && selected->InheritsFrom("TAxis"))
+       fTmpEvent = 1;
+
+   // - Mouse pressed on Axis : Real Zoom process not only click
+   else if (event == 21 && selected->InheritsFrom("TAxis") && fTmpEvent == 1)
+       fTmpEvent = 21;
+
+   // - Mouse pressed on Axis : Still pressed
+   else if (event == 21 && selected->InheritsFrom("TAxis") && fTmpEvent == 21) 
+       return;
+
+    // - Mouse up on Axis : End Point of Rangex
+   else if (event == 11 && selected->InheritsFrom("TAxis") && fTmpEvent == 21){
+       TAxis * axis = (TAxis*) selected;
+       
+       if (selected == fHistpad1->GetXaxis() || selected == fHistpad2->GetXaxis() || selected == fHistpad3->GetXaxis()){ 
+          fBinX[0] = axis->GetFirst() -1;
+          fBinX[1] = axis->GetLast() -1;
+       }
+
+       fTmpEvent = 0; 
+   }
+   else fTmpEvent = 0;
+}
diff --git a/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayPad.h b/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayPad.h
new file mode 100644 (file)
index 0000000..974ee9f
--- /dev/null
@@ -0,0 +1,51 @@
+// XEmacs -*-C++-*-
+// $Id$
+
+#ifndef ALIHLTTPCDISPLAYPAD_H
+#define ALIHLTTPCDISPLAYPAD_H
+/** \class AliHLTTPCDisplayPad
+<pre>
+//_____________________________________________________________
+// AliHLTTPCDisplayPad
+//
+// Display class for the HLT TPC-Pad events.
+</pre>
+*/
+// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+//*-- Copyright &copy ALICE HLT Group 
+
+#include <TCanvas.h>
+#include <TH1.h>
+#include <TH2F.h>
+#include <AliHLTTPCDisplayMain.h>
+#include <AliHLTTPCDisplayPadRow.h>
+
+class AliHLTTPCDisplayPad : public AliHLTLogging {  
+  friend void AliHLTTPCDisplayPadRow::Draw();
+
+ public:
+    AliHLTTPCDisplayPad(AliHLTTPCDisplayMain* display) ;
+    virtual ~AliHLTTPCDisplayPad();
+    
+    void Fill(Int_t patch, ULong_t dataBlock, ULong_t dataLen);
+    void Draw();
+    void Reset();
+    void Save();
+    void ExecEvent(Int_t event, Int_t x, Int_t y, TObject *selected);
+
+   
+ private:
+    AliHLTTPCDisplayMain* fDisplay;
+
+    TH1F *fHistpad1;               // histogram for pad in padrow
+    TH1F *fHistpad2;               // histogram for pad in padrow
+    TH1F *fHistpad3;               // histogram for pad in padrow
+
+    Int_t fNTimes;
+    Int_t fBinX[2];                // Minimum / Maximum - Bin on X Axis
+    Int_t fTmpEvent;               // Tmp Event for get user range on Axis
+
+    ClassDef(AliHLTTPCDisplayPad,0) 
+};
+
+#endif //  ALIHLTTPCDISPLAYPAD_H
diff --git a/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayPadRow.cxx b/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayPadRow.cxx
new file mode 100644 (file)
index 0000000..d30f686
--- /dev/null
@@ -0,0 +1,359 @@
+// $Id$
+
+/** \class AliHLTTPCDisplayPadRow
+<pre>
+//_____________________________________________________________
+// AliHLTTPCDisplayPadRow
+//
+// Display class for the HLT TPC-PadRow events.
+</pre>
+*/
+// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+//*-- Copyright &copy ALICE HLT Group 
+
+#include <TH2.h>
+#include <TFile.h>
+#include <TStyle.h>
+#include <TAttText.h>
+#include <TAxis.h>
+#include <TCanvas.h>
+#include <TPolyMarker3D.h>
+
+#ifdef use_aliroot
+#include <TClonesArray.h>
+#include <AliRun.h>
+#include <AliSimDigits.h>
+#include <AliTPCParam.h>
+#endif
+
+#include "AliHLTStdIncludes.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTDataTypes.h"
+#include "AliHLTTPCSpacePointData.h"
+#include "AliHLTTPCClusterDataFormat.h"
+#include "AliHLTTPCLogging.h"
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCDigitReaderPacked.h"
+#include "AliHLTTPCDigitReaderRaw.h"
+
+
+#include "AliHLTTPCDisplayMain.h"
+#include "AliHLTTPCDisplayPadRow.h"
+#include "AliHLTTPCDisplayPad.h"
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+ClassImp(AliHLTTPCDisplayPadRow)
+
+//____________________________________________________________________________________________________
+AliHLTTPCDisplayPadRow::AliHLTTPCDisplayPadRow(AliHLTTPCDisplayMain* display) {
+    // constructor
+    fDisplay = display;
+
+    fNTimes = AliHLTTPCTransform::GetNTimeBins();
+    
+    fBinX[0] = 0;      
+    fBinX[1] = fDisplay->GetNPads(); 
+    fBinY[0] = 0;
+    fBinY[1] = fNTimes -1;
+    fTmpEvent = 0;         
+
+    for (Int_t ii = 0;ii < 20; ii++)
+      fpmarr[ii] = 0;
+
+    Int_t maxpads = 150;
+    Int_t padbinning = maxpads*10;
+
+    fHistraw = new TH2F("fHistraw","Selected PadRow with found Clusters;Pad #;Timebin #",maxpads,0,maxpads-1,fNTimes,0,fNTimes-1);
+    fHistrawcl = new TH1F("fHistrawcl","cvcv;ddd;kkk",padbinning,0,maxpads-1);
+
+    fHistraw->SetOption("COLZ");    
+    fHistraw->SetTitleSize(0.03);
+    fHistraw->GetXaxis()->SetLabelSize(0.03);
+    fHistraw->GetXaxis()->SetTitleSize(0.03);
+    fHistraw->GetYaxis()->SetLabelSize(0.03);
+    fHistraw->GetYaxis()->SetTitleSize(0.03);
+
+    gStyle->SetPalette(1);
+}
+
+//____________________________________________________________________________________________________
+AliHLTTPCDisplayPadRow::~AliHLTTPCDisplayPadRow() {
+    // destructor     
+    if ( fHistraw ){
+       delete fHistraw;
+       fHistraw = NULL;
+    }
+    if ( fHistrawcl ){
+       delete fHistrawcl;
+       fHistrawcl = NULL;
+    }
+    for (Int_t ii=19; ii <= 0; ii--){ // try fwd
+      if ( fpmarr[ii] ){
+       delete [] fpmarr[ii];
+       fpmarr[ii] = NULL;
+      }
+    }
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayPadRow::Reset(){  
+  fHistraw->Reset();   
+  fHistrawcl->Reset(); 
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayPadRow::Save(){  
+  fDisplay->GetCanvasCharge()->SaveAs("HLT-PadRowView.eps"); 
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayPadRow::Fill(Int_t patch, ULong_t dataBlock, ULong_t dataLen){
+    // Fill PadRow Histogram
+    
+#if defined(HAVE_TPC_MAPPING)
+    AliHLTTPCDigitReaderRaw digitReader(0);
+
+    bool readValue = true;
+    Int_t rowOffset = 0;
+    
+    Int_t padRow = fDisplay->GetPadRow();
+    Int_t slice = fDisplay->GetSlicePadRow();
+
+    // Initialize RAW DATA
+    Int_t firstRow = AliHLTTPCTransform::GetFirstRow(patch);
+    Int_t lastRow = AliHLTTPCTransform::GetLastRow(patch);
+
+    // Outer sector, patches 2, 3, 4, 5 -  start counting in patch 2 with row 0
+    if ( patch >= 2 ) rowOffset = AliHLTTPCTransform::GetFirstRow( 2 );
+
+    // Initialize block for reading packed data
+    void* tmpdataBlock = (void*) dataBlock;
+    digitReader.InitBlock(tmpdataBlock,dataLen,firstRow,lastRow,patch,slice);
+
+    readValue = digitReader.Next();
+
+    if (!readValue){   
+       LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplayPadRow::Fill","Read first value") << "No value in data block" << ENDLOG;
+       return;
+    }
+
+    // FILL PADROW 3D --- Initialize the colorbins
+    if ( fDisplay->Get3DSwitchPadRow() ){
+       for (UInt_t ii=0;ii < 20;ii++){
+           fbinct[ii] = 0;
+           fcolorbin[ii] = 0;
+       }
+
+       // read number of entries in colorbin
+       while ( readValue ){ 
+           
+           Int_t row = digitReader.GetRow() + rowOffset;
+           
+           if (row == padRow){    
+               UInt_t charge = digitReader.GetSignal();
+               
+               for (UInt_t ii=0;ii < 19;ii++){
+                   if ( charge > (ii*15) && charge <= ((ii*15) + 15) ) fcolorbin[ii]++;
+               }
+                // larger than 19 * 15 
+               if (charge > 285 ) fcolorbin[19]++;
+           }
+
+           // read next value
+           readValue = digitReader.Next();
+      
+           if(!readValue) break; //No more value
+       } 
+
+       // Initialize fpmarr[color][3*colorbin[ii]] 
+       for (Int_t ii = 0; ii < 20; ii++) {
+         if ( fpmarr[ii] ) delete[] fpmarr[ii];
+         fpmarr[ii] = new Float_t[fcolorbin[ii]*3]; 
+       }
+
+       // Rewind the raw reader and fill the polymarker3D
+       digitReader.InitBlock(tmpdataBlock,dataLen,firstRow,lastRow,patch,slice);
+       
+       readValue = digitReader.Next();
+    } // END if (fDisplay->Get3DSwitchPadRow())
+
+    // -- Fill Raw Data
+    while ( readValue ){ 
+
+       Int_t row = digitReader.GetRow() + rowOffset;
+
+       // select padrow to fill in histogramm
+       if (row == padRow){    
+           UChar_t pad = digitReader.GetPad();
+           UShort_t time = digitReader.GetTime();
+           UInt_t charge = digitReader.GetSignal();
+           Float_t xyz[3];
+           fHistraw->Fill(pad,time,charge);
+
+           if ( fDisplay->Get3DSwitchPadRow() ) {
+               // Transform raw coordinates to local coordinates
+               AliHLTTPCTransform::RawHLT2Global(xyz, slice, padRow, pad, time);
+
+               for (UInt_t ii=0;ii < 19;ii++){
+                   if ( charge > (ii*15) && charge <= ((ii*15) + 15) ){
+                       fpmarr[ii][fbinct[ii]] = xyz[0];
+                       fpmarr[ii][fbinct[ii]+1] = xyz[1];
+                       fpmarr[ii][fbinct[ii]+2] = xyz[2];
+                       fbinct[ii] += 3;
+                   }
+               }
+               // larger than 19 * 15
+               if (charge > 285 ) {
+                   fpmarr[19][fbinct[19]] = xyz[0];
+                   fpmarr[19][fbinct[19]+1] = xyz[1];
+                   fpmarr[19][fbinct[19]+2] = xyz[2];
+                   fbinct[19] += 3;
+               }
+           } // END if (fSwitch3DPadRow)
+       
+       } // END if (row == padRow){ 
+       
+       // read next value
+       readValue = digitReader.Next();
+      
+       //Check where to stop:
+       if(!readValue) break; //No more value
+    } 
+    
+     if (fDisplay->ExistsClusterData()){
+       AliHLTTPCSpacePointData *points = fDisplay->GetSpacePointDataPointer(slice,patch);
+       if(!points) return;
+       
+       Float_t xyz[3];
+       for(Int_t i=0; i< fDisplay->GetNumberSpacePoints(slice,patch); i++){
+           xyz[0] = points[i].fX;
+           xyz[1] = points[i].fY;
+           xyz[2] = points[i].fZ;
+       
+           // select padrow to fill in histogramm
+           if (padRow == AliHLTTPCTransform::GetPadRow(xyz[0])){
+               AliHLTTPCTransform::LocHLT2Raw(xyz, slice, padRow);
+               fHistrawcl->Fill(xyz[1],xyz[2]);
+           }
+       }
+     } // END if (fDisplay->ExistsClusterData()){
+#else //! defined(HAVE_TPC_MAPPING)
+      HLTFatal("DigitReaderRaw not available - check your build");
+#endif //defined(HAVE_TPC_MAPPING)
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayPadRow::Draw(){
+
+    fDisplay->GetCanvasPadRow()->cd();
+    fDisplay->GetCanvasPadRow()->Clear();
+
+    if (fDisplay->GetSplitPadRow()){
+       fDisplay->GetCanvasPadRow()->Divide(1,2);
+       fDisplay->GetCanvasPadRow()->cd(1);
+    }
+  
+    Char_t title[256];
+    sprintf(title,"Selected PadRow %d with found Clusters",fDisplay->GetPadRow());
+  
+    // Keep Zoom
+    if (!fDisplay->GetKeepView() || (fBinX[1]>fDisplay->GetNPads()) || (fBinY[1]>fNTimes)){
+       fBinX[0] = 0;
+       fBinX[1] = fDisplay->GetNPads();
+       fBinY[0] = 0;
+       fBinY[1] = fNTimes - 1;
+    }
+    
+    fHistraw->SetAxisRange(fBinX[0],fBinX[1]); 
+    fHistraw->SetAxisRange(fBinY[0],fBinY[1],"Y");
+    fHistraw->SetTitle(title);
+    fHistraw->SetStats(kFALSE);
+    fHistraw->Draw("COLZ");
+    
+    if ( fDisplay->ExistsClusterData() ){
+       cout << "XX" <<  endl;
+       fHistrawcl->SetAxisRange(fBinX[0],fBinX[1]);
+       fHistrawcl->SetAxisRange(fBinY[0],fBinY[1],"Y");
+       fHistrawcl->SetStats(kFALSE);
+       fHistrawcl->SetMarkerStyle(28);
+       fHistrawcl->SetMarkerSize(2);
+       fHistrawcl->SetMarkerColor(1);
+       fHistrawcl->Draw("psame");
+    }
+    
+    if (fDisplay->GetSplitPadRow()){
+       fDisplay->GetCanvasPadRow()->cd(2);
+       fDisplay->GetPadPointer()->fHistpad2->Draw();
+    }
+    
+    fDisplay->GetCanvasPadRow()->Modified();
+    fDisplay->GetCanvasPadRow()->Update();
+    
+    // Select Pad
+    fDisplay->GetCanvasPadRow()->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","AliHLTTPCDisplayMain",(void*) fDisplay,"ExecPadEvent(Int_t,Int_t,Int_t,TObject*)");
+    // Keep Zoom
+    fDisplay->GetCanvasPadRow()->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","AliHLTTPCDisplayPadRow",(void*) this,"ExecEvent(Int_t,Int_t,Int_t,TObject*)");
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayPadRow::Draw3D(){
+    Int_t markercolor = 51;
+    
+    for (UInt_t ii=0;ii < 20;ii++){
+       if (fcolorbin[ii]> 0){
+           
+           TPolyMarker3D* pm = new  TPolyMarker3D(fcolorbin[ii], fpmarr[ii], 7 );
+           pm->SetBit(kCanDelete);
+
+           pm->SetMarkerColor(markercolor); 
+           pm->Draw(""); 
+       }
+
+       // in order to have the SetPalette(1), so called "pretty"
+       if (ii % 2 == 0 ) markercolor += 2;
+       else  markercolor += 3;
+    }
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayPadRow::ExecEvent(Int_t event, Int_t px, Int_t py, TObject *selected){
+   // Saves the Zoom Position of the Histogram 
+
+   // - Mouse down on Axis : StartPoint of Range
+   if (event == 1 && selected->InheritsFrom("TAxis"))
+       fTmpEvent = 1;
+
+   // - Mouse pressed on Axis : Real Zoom process not only click
+   else if (event == 21 && selected->InheritsFrom("TAxis") && fTmpEvent == 1)
+       fTmpEvent = 21;
+
+   // - Mouse pressed on Axis : Still pressed
+   else if (event == 21 && selected->InheritsFrom("TAxis") && fTmpEvent == 21) 
+       return;
+
+    // - Mouse up on Axis : End Point of Rangex
+   else if (event == 11 && selected->InheritsFrom("TAxis") && fTmpEvent == 21){
+       TAxis * axis = (TAxis*) selected;
+       
+       if (selected == fHistraw->GetXaxis() || selected == fHistrawcl->GetXaxis()){ 
+          fBinX[0] = axis->GetFirst() -1;
+          fBinX[1] = axis->GetLast() -1;
+       }
+       else {
+          fBinY[0] = axis->GetFirst() -1;
+          fBinY[1] = axis->GetLast() -1;
+       }
+
+       
+       //    Reset();
+//     Fill();
+       //   Draw();
+
+       fTmpEvent = 0; 
+   }
+   else fTmpEvent = 0;
+}
diff --git a/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayPadRow.h b/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayPadRow.h
new file mode 100644 (file)
index 0000000..02f1e28
--- /dev/null
@@ -0,0 +1,52 @@
+// XEmacs -*-C++-*-
+// $Id$
+
+#ifndef ALIHLTTPCDISPLAYPADROW_H
+#define ALIHLTTPCDISPLAYPADROW_H
+/** \class AliHLTTPCDisplayPadRow
+<pre>
+//_____________________________________________________________
+// AliHLTTPCDisplayPadRow
+//
+// Display class for the HLT TPC-PadRow events.
+</pre>
+*/
+// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+//*-- Copyright &copy ALICE HLT Group 
+
+#include <TCanvas.h>
+#include <TH1.h>
+#include <TH2F.h>
+#include <AliHLTTPCDisplayMain.h>
+
+class AliHLTTPCDisplayPadRow : public AliHLTLogging  {  
+    
+ public:
+    AliHLTTPCDisplayPadRow(AliHLTTPCDisplayMain* display) ;
+    virtual ~AliHLTTPCDisplayPadRow();  
+
+    void Fill(Int_t patch, ULong_t dataBlock, ULong_t dataLen);
+    void Draw();
+    void Reset();
+    void Save();
+    void Draw3D();
+    void ExecEvent(Int_t event, Int_t x, Int_t y, TObject *selected);
+
+ private:
+    AliHLTTPCDisplayMain* fDisplay;
+
+    TH1F *fHistrawcl;              // histogram for cluster in padrow
+    TH2F *fHistraw;                // histogram for signals in padrow
+
+    Int_t fcolorbin[20];           // number of entries per colorbin
+    Int_t fbinct[20];              // index of colorbin
+    Float_t *fpmarr[20];           // contains point data
+    Int_t fNTimes;                 // number of timebins
+    Int_t fBinX[2];                // Minimum / Maximum - Bin on X Axis
+    Int_t fBinY[2];                // Minimum / Maximum - Bin on Y Axis
+    Int_t fTmpEvent;               // Tmp Event for get user range on Axis
+
+    ClassDef(AliHLTTPCDisplayPadRow,0) 
+};
+
+#endif //  ALIHLTTPCDISPLAYPADROW_H
diff --git a/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayResiduals.cxx b/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayResiduals.cxx
new file mode 100644 (file)
index 0000000..293d1b1
--- /dev/null
@@ -0,0 +1,507 @@
+// $Id$
+
+/** \class AliHLTTPCDisplayPadRow
+<pre>
+//_____________________________________________________________
+// AliHLTTPCDisplayResiduals
+//
+// Display class for the HLT TPC-Residuals events.
+</pre>
+*/
+// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+//*-- Copyright &copy ALICE HLT Group 
+
+#include "AliHLTTPCDisplayResiduals.h"
+#include "AliHLTTPCDisplayPadRow.h"
+
+#include "AliHLTStdIncludes.h"
+#include <TH2.h>
+#include <TFile.h>
+#include <TStyle.h>
+#include <TGraph.h>
+#include <TMultiGraph.h>
+#include <TAttText.h>
+#include <TAxis.h>
+#include <TCanvas.h>
+
+
+#ifdef use_aliroot
+#include <TClonesArray.h>
+#include <AliRun.h>
+#include <AliSimDigits.h>
+#include <AliTPCParam.h>
+#endif
+
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTDataTypes.h"
+#include "AliHLTTPCSpacePointData.h"
+#include "AliHLTTPCClusterDataFormat.h"
+#include "AliHLTTPCTrackletDataFormat.h"
+
+
+#include "AliHLTTPCDigitReader.h"
+#include "AliHLT_C_Component_WrapperInterface.h"
+
+#include "AliHLTTPCDisplayMain.h"
+
+#include "AliHLTTPCLogging.h"
+#include "AliHLTTPCDisplay.h"
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCTrack.h"
+#include "AliHLTTPCTrackArray.h"
+#include "AliHLTTPCMemHandler.h"
+#include "AliHLTTPCDigitReaderPacked.h"
+
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+ClassImp(AliHLTTPCDisplayResiduals)
+
+//____________________________________________________________________________________________________
+AliHLTTPCDisplayResiduals::AliHLTTPCDisplayResiduals(AliHLTTPCDisplayMain* display) {
+    // constructor
+    fDisplay = display;
+
+    fGraphresidualsY = NULL;
+    fGraphresidualsZ = NULL;
+    fGraphresidualsYLength = NULL;
+
+    fHistallresidualsY = new TH1F ("fHistallresidualsY","Y Residuals of all tracks in selected slices;residuals",5000,-100,100);
+    fHistallresidualsZ = new TH1F ("fHistallresidualsZ","Z Residuals of all tracks in selected slices;residuals",5000,-100,100);
+    fHistHits_S = new TH1F ("fHistHits_S","Number of cluster over track length;#Hits/s",20,0,20);
+    fHistQ_Track = new TH1F ("fHistQ_Track","Average cluster charge per track;<q>/track",500,0,500);
+    fHistQ_S   = new TH1F ("fHistQ_S","Total cluster charge over track length;Q/s",500,0,500);
+
+    fHistallresidualsY->SetTitleSize(0.03);
+    fHistallresidualsY->GetXaxis()->SetLabelSize(0.03);
+    fHistallresidualsY->GetXaxis()->SetTitleSize(0.03);
+    fHistallresidualsY->GetYaxis()->SetLabelSize(0.03);
+    fHistallresidualsY->GetYaxis()->SetTitleSize(0.03);
+
+    fHistallresidualsZ->SetTitleSize(0.03);
+    fHistallresidualsZ->GetXaxis()->SetLabelSize(0.03);
+    fHistallresidualsZ->GetXaxis()->SetTitleSize(0.03);
+    fHistallresidualsZ->GetYaxis()->SetLabelSize(0.03);
+    fHistallresidualsZ->GetYaxis()->SetTitleSize(0.03);
+
+    fHistHits_S->SetTitleSize(0.03);
+    fHistHits_S->GetXaxis()->SetLabelSize(0.03);
+    fHistHits_S->GetXaxis()->SetTitleSize(0.03);
+    fHistHits_S->GetYaxis()->SetLabelSize(0.03);
+    fHistHits_S->GetYaxis()->SetTitleSize(0.03);
+
+    fHistQ_Track->SetTitleSize(0.03);
+    fHistQ_Track->GetXaxis()->SetLabelSize(0.03);
+    fHistQ_Track->GetXaxis()->SetTitleSize(0.03);
+    fHistQ_Track->GetYaxis()->SetLabelSize(0.03);
+    fHistQ_Track->GetYaxis()->SetTitleSize(0.03);
+
+    fHistQ_S->SetTitleSize(0.03);
+    fHistQ_S->GetXaxis()->SetLabelSize(0.03);
+    fHistQ_S->GetXaxis()->SetTitleSize(0.03);
+    fHistQ_S->GetYaxis()->SetLabelSize(0.03);
+    fHistQ_S->GetYaxis()->SetTitleSize(0.03);
+}
+
+//____________________________________________________________________________________________________
+AliHLTTPCDisplayResiduals::~AliHLTTPCDisplayResiduals() {
+    // destructor   
+    if ( fHistallresidualsY){
+       delete fHistallresidualsY;
+       fHistallresidualsY = NULL;
+    }
+    fHistallresidualsY = NULL;
+    if ( fHistallresidualsZ){
+       delete fHistallresidualsZ;
+       fHistallresidualsZ = NULL;
+    }
+    if ( fHistHits_S){
+       delete fHistHits_S;
+       fHistHits_S = NULL;
+    }
+    if ( fHistQ_Track){
+       delete fHistQ_Track;
+       fHistQ_Track = NULL;
+    }
+    if ( fHistQ_S){
+       delete fHistQ_S;
+       fHistQ_S = NULL;
+    }
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayResiduals::Reset(){    
+    fHistallresidualsY->Reset();
+    fHistallresidualsZ->Reset();
+    fHistHits_S->Reset();              
+    fHistQ_Track->Reset();           
+    fHistQ_S->Reset();
+
+    fDisplay->GetCanvasResiduals()->Clear();
+    fDisplay->GetCanvasHits_S()->Clear();
+    fDisplay->GetCanvasQ_Track()->Clear();
+    fDisplay->GetCanvasQ_S()->Clear();
+}    
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayResiduals::Save(){  
+    fDisplay->GetCanvasResiduals()->SaveAs("HLT-ResidualsView.eps"); 
+    fDisplay->GetCanvasHits_S()->SaveAs("HLT-Hits_S.eps");
+    fDisplay->GetCanvasQ_Track()->SaveAs("HLT-Q_Track.eps");
+    fDisplay->GetCanvasQ_S()->SaveAs("HLT-Q_S.eps");
+}
+
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayResiduals::Fill(){
+    // Fill Resiudals Histograms / Graphs
+   
+    AliHLTTPCTrackArray* tracks = fDisplay->GetTrackArrayPointer();
+    Int_t ntracks = tracks->GetNTracks();
+
+    Double_t maxResidualY = 0.;
+    Double_t maxResidualZ = 0.;
+
+    fGraphresidualsY = NULL;
+    fGraphresidualsYLength = NULL;
+    fGraphresidualsZ = NULL;
+
+    for(Int_t j=0; j<ntracks; j++) {   
+       
+       AliHLTTPCTrack *gtrack = tracks->GetCheckedTrack(j); 
+       if(!gtrack) continue;   
+
+       // ---------------------------------------------------------------------
+       // ++ Select if slice should be displayed or not ( selection in DISPLAY )
+
+       Int_t slice = gtrack->GetSector();
+       if (!fDisplay->GetDisplaySlice(slice)) continue;
+       
+       // -------------------
+       // Get track parameter
+
+       Int_t nHits = gtrack->GetNHits();  // Number of associated hits to track
+       Double_t radius = gtrack->GetRadius();      // radius
+       Double_t kappa = gtrack->GetKappa();        // curvature = 1/R , signed
+       Double_t lambda = atan( gtrack->GetTgl() ); // dipAngle lambda
+       
+       // -----------------------------
+       // ++ Check for straightr tracks
+
+       if (kappa == 0 && AliHLTTPCTransform::GetBFieldValue() > 0.) {
+           printf("-#- KAPPA == 0 -#-");
+           // continue;
+       }
+
+       // ------------------------------------
+        // ++ Get first/last point of the track
+
+       Double_t xyzL[3];      // lastpoint of track
+       Double_t xyzF[3];      // firstpoint of track
+       
+       xyzF[0] = gtrack->GetFirstPointX();
+       xyzF[1] = gtrack->GetFirstPointY();
+       xyzF[2] = gtrack->GetFirstPointZ();
+       
+       xyzL[0] = gtrack->GetLastPointX();
+       xyzL[1] = gtrack->GetLastPointY();
+       xyzL[2] = gtrack->GetLastPointZ();
+
+       // --------------------------
+       // ++ Calculate length of the track
+       
+       Double_t s = 0.;       // length of the track
+       if (  AliHLTTPCTransform::GetBFieldValue() == 0. || kappa == 0 ) 
+         s = sqrt ( (xyzL[0] - xyzF[0])*(xyzL[0] - xyzF[0]) + (xyzL[1] - xyzF[1])*(xyzL[1] - xyzF[1]) ); 
+       else {
+         // Calculate the length of the track. If it is to flat in in s,z plane use sxy, otherwise use sz
+         if (fabs(lambda) > 0.05){
+           // length of track calculated out of z
+           s = fabs( (xyzL[2] - xyzF[2]) / sin(lambda) ); // length of track calculated out of z
+         }
+         else {
+           Double_t d = (xyzL[0] - xyzF[0])*(xyzL[0] - xyzF[0]) + (xyzL[1] - xyzF[1])*(xyzL[1] - xyzF[1]); 
+           // length of track calculated out of xy
+           s = fabs ( acos( 0.5 * (2 - (d / (radius*radius)))) / ( kappa * cos(lambda) ) );            
+         }
+       }
+       
+       // -----------------------
+       // ++ Apply cuts on tracks
+
+       if (nHits < fDisplay->GetCutHits() ) continue;
+       if (s < fDisplay->GetCutS() ) continue;
+       if (gtrack->GetPsi() < fDisplay->GetCutPsi() ) continue;
+       if (lambda < fDisplay->GetCutLambda() ) continue; 
+       if (gtrack->GetPt() < fDisplay->GetCutPt()  &&  AliHLTTPCTransform::GetBFieldValue() != 0. ) continue;
+       if ( AliHLTTPCTransform::GetPadRow((Float_t)xyzF[0]) >   fDisplay->GetIncidentPadrow() ) continue;
+
+       // ============================================
+       // ## ROTATED Track to local coordinates BEGINN
+
+       gtrack->Rotate(slice,kTRUE);
+       
+       Int_t nRes = 0;                                            // number of resiudals
+       Double_t totalQ = 0.;                                      // total charge of track
+       UInt_t *hitnum = gtrack->GetHitNumbers();                  // hist per track
+       
+       Double_t *resY= new Double_t[nHits];                       // Y residuals of every hit
+       Double_t *resZ= new Double_t[nHits];                       // Z residuals of every hit
+       
+       Double_t *resYLength= new Double_t[2*nHits];               // length of pad in y direction
+       
+       Double_t *padrows = new Double_t[nHits];                   
+       Double_t *padrowsLength = new Double_t[2*nHits];
+
+       // ---------------------
+       // ++ Loop over all hits
+       
+       for(Int_t h=0; h<nHits; h++){
+           UInt_t id=hitnum[h];
+           Int_t patch = (id>>22) & 0x7;
+           UInt_t pos = id&0x3fffff; 
+           
+           AliHLTTPCSpacePointData *points = fDisplay->GetSpacePointDataPointer(slice,patch);
+           if (!points) continue;
+
+           Float_t xyzCtmp[3];    // cluster tmp
+           Float_t xyzTtmp[3];    // track tmp
+           
+           // -------------------------
+           // ++ Get coordinates of Hit
+           xyzCtmp[0] = points[pos].fX;
+           xyzCtmp[1] = points[pos].fY;
+           xyzCtmp[2] = points[pos].fZ;
+           totalQ += points[pos].fCharge;
+
+           // ---------------------------------
+           // ++ Get X Coordinate of the padrow
+
+           Int_t padrow = AliHLTTPCTransform::GetPadRow(points[pos].fX);
+           xyzTtmp[0] = gtrack->GetFirstPointX();
+           
+           // --------------------------------------
+           // ++ Check for CrossingPoint with Padrow
+           if(gtrack->GetCrossingPoint(padrow,xyzTtmp)) {
+               
+               // ----------------------
+               // ++ Calculate Residuals
+
+               Float_t deltaY = ( xyzCtmp[1] - xyzTtmp[1] );
+               Float_t deltaZ = ( xyzCtmp[2] - xyzTtmp[2] );
+               
+               padrows[nRes] = (Double_t) padrow;
+               resY[nRes] = (Double_t) deltaY;
+               resZ[nRes] = (Double_t) deltaZ;
+               
+               resYLength[(2*nRes)] = 0.5 * AliHLTTPCTransform::GetPadLength(padrow);
+               resYLength[(2*nRes)+1] = -0.5 * AliHLTTPCTransform::GetPadLength(padrow);
+               padrowsLength[(2*nRes)] = (Double_t) padrow;
+               padrowsLength[(2*nRes)+1] = (Double_t) padrow;
+               
+               // ---------------------------
+               // ++ Fill residuals histogram
+
+               fHistallresidualsY->Fill(resY[nRes]);
+               fHistallresidualsZ->Fill(resZ[nRes]);
+
+               if (resY[nRes] > maxResidualY ) maxResidualY = resY[nRes];
+               if (resZ[nRes] > maxResidualZ ) maxResidualZ = resZ[nRes];
+               nRes++;
+
+           } // END CrossingPoint
+       } // END cluster loop
+
+       gtrack->Rotate(slice,kFALSE);
+
+       // ## ROTATED Track to local coordinates END
+       // =========================================
+
+       // -------------------------------------
+       // ++ Fill Number Hits over track length
+
+       Double_t hits_S = nHits / s;
+       fHistHits_S->Fill(hits_S);
+
+       // --------------------------------
+       // ++ Fill Average charge per track
+
+       Double_t q_Track = totalQ / nHits;
+       fHistQ_Track->Fill(q_Track);
+
+       // -------------------------------------
+       // ++ Fill total charge per track length
+
+       Double_t Q_S = totalQ / s;
+       fHistQ_S->Fill(Q_S);
+
+       // --------------------------
+       // ++ Fill Graphs for 1 track
+
+       if (fDisplay->GetSelectTrackSwitch() && fDisplay->GetGlobalTrack(slice) == j){
+           // FILL Y RESIDUALS GRAPH
+           fGraphresidualsY = new TGraph(nRes-1,padrows,resY);
+           fGraphresidualsYLength = new TGraph((2*nRes)-2,padrowsLength,resYLength);
+           // FILL Z RESIDUALS GRAPH
+           fGraphresidualsZ = new TGraph(nRes-1,padrows,resZ);
+       }
+       
+       // --------------
+       // ++ Free Memory
+       
+       if ( resY ){
+           delete [] resY;
+           resY = NULL;
+       }
+       if ( resZ ){
+           delete [] resZ;
+           resZ = NULL;
+       }
+       if ( resYLength ){
+           delete [] resYLength;
+           resYLength = NULL;
+       }
+       if ( padrows ){
+           delete [] padrows;
+           padrows = NULL;
+       }
+       if ( padrowsLength ){
+           delete [] padrowsLength;
+           padrowsLength = NULL;
+       }
+       
+    } // END track loop
+
+    // ----------------------------------------
+    // ++ Set Axis Range of residual histograms
+
+    fHistallresidualsY->SetAxisRange(-maxResidualY,maxResidualY);
+    fHistallresidualsZ->SetAxisRange(-maxResidualZ,maxResidualZ);
+}
+
+//____________________________________________________________________________________________________
+void AliHLTTPCDisplayResiduals::Draw(){
+
+    fDisplay->GetCanvasResiduals()->cd();
+    fDisplay->GetCanvasResiduals()->Clear();
+    
+    fDisplay->GetCanvasResiduals()->Divide(1,2);
+   
+    // ++ Y Residuals     
+    // ==============
+    fDisplay->GetCanvasResiduals()->cd(1);
+   
+    if (fDisplay->GetSelectTrackSwitch() && fGraphresidualsY){
+
+       // -------------------------
+       // ++ Y Graph for single track
+       
+       Char_t title[256];
+       sprintf(title,"Y Residuals of Track %d in Slice %d",fDisplay->GetSelectTrack(), fDisplay->GetSelectTrackSlice() );
+
+       TMultiGraph *mgY = new TMultiGraph() ;
+       mgY->SetBit(kCanDelete);
+       
+       fGraphresidualsY->GetXaxis()->SetTitle("padrow");       
+       fGraphresidualsY->GetYaxis()->SetTitle("residuals");
+       fGraphresidualsY->GetXaxis()->SetLabelSize(0.02);
+       fGraphresidualsY->GetXaxis()->SetTitleSize(0.02);
+       fGraphresidualsY->GetYaxis()->SetLabelSize(0.02);
+       fGraphresidualsY->GetYaxis()->SetTitleSize(0.02);
+
+       fGraphresidualsYLength->SetMarkerColor(2);
+       fGraphresidualsYLength->SetMarkerStyle(5);
+       fGraphresidualsY->SetMarkerColor(1);
+       fGraphresidualsY->SetMarkerStyle(3);
+
+       mgY->Add(fGraphresidualsY);
+       mgY->Add(fGraphresidualsYLength);
+       mgY->SetTitle(title);
+       mgY->Draw("AP");
+    }
+
+    else{
+
+       // -------------------------
+       // ++ Y Histogram  -> global
+       
+       fHistallresidualsY->SetStats(kFALSE);
+       fHistallresidualsY->Draw();
+    }
+    
+    // ++ Z Residuals     
+    // ==============
+    fDisplay->GetCanvasResiduals()->cd(2);
+
+    // graph for single track
+    if (fDisplay->GetSelectTrackSwitch() && fGraphresidualsZ){
+
+       // -------------------------
+       // ++ Z Graph for single track
+
+       Char_t title[256];
+       sprintf(title,"Z Residuals of Track %d in Slice %d",fDisplay->GetSelectTrack(), fDisplay->GetSelectTrackSlice() );
+       
+       TMultiGraph *mgZ = new TMultiGraph();
+       mgZ->SetBit(kCanDelete);
+
+       fGraphresidualsZ->SetTitle(title);      
+       fGraphresidualsZ->GetXaxis()->SetTitle("padrow");       
+       fGraphresidualsZ->GetYaxis()->SetTitle("residuals");
+       fGraphresidualsZ->GetXaxis()->SetLabelSize(0.02);
+       fGraphresidualsZ->GetXaxis()->SetTitleSize(0.02);
+       fGraphresidualsZ->GetYaxis()->SetLabelSize(0.02);
+       fGraphresidualsZ->GetYaxis()->SetTitleSize(0.02);
+       
+       mgZ->Add(fGraphresidualsZ);
+       mgZ->SetTitle(title);
+       mgZ->Draw("A*");
+    }
+    
+       // -------------------------
+       // ++ Z Histogram  -> global
+
+    else{
+       fHistallresidualsZ->SetStats(kFALSE);
+       fHistallresidualsZ->Draw();
+    }
+
+    fDisplay->GetCanvasResiduals()->Modified();
+    fDisplay->GetCanvasResiduals()->Update();
+
+    // -------------------------------------
+    // ++ Draw Number Hits over track length
+
+    fDisplay->GetCanvasHits_S()->cd ();
+    fDisplay->GetCanvasHits_S()->Clear();
+    
+    fHistHits_S->Draw();
+
+    fDisplay->GetCanvasHits_S()->Modified();
+    fDisplay->GetCanvasHits_S()->Update();
+
+    // --------------------------------
+    // ++ Draw Average charge per track
+
+    fDisplay->GetCanvasQ_Track()->cd();
+    fDisplay->GetCanvasQ_Track()->Clear();
+
+    fHistQ_Track->Draw();
+
+    fDisplay->GetCanvasQ_Track()->Modified();
+    fDisplay->GetCanvasQ_Track()->Update();
+
+    // -------------------------------------
+    // ++ Draw total charge per track length
+
+    fDisplay->GetCanvasQ_S()->cd();
+    fDisplay->GetCanvasQ_S()->Clear();
+    
+    fHistQ_S->Draw();
+  
+    fDisplay->GetCanvasQ_S()->Modified();
+    fDisplay->GetCanvasQ_S()->Update();
+}
+
diff --git a/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayResiduals.h b/HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayResiduals.h
new file mode 100644 (file)
index 0000000..2bb1427
--- /dev/null
@@ -0,0 +1,48 @@
+// XEmacs -*-C++-*-
+// $Id$
+
+#ifndef ALIHLTTPCDISPLAYRESIDUALS_H
+#define ALIHLTTPCDISPLAYRESIDUALS_H
+/** \class AliHLTTPCDisplayResiduals
+<pre>
+//_____________________________________________________________
+// AliHLTTPCDisplayResiduals
+//
+// Display class for the HLT TPC-Residuals events.
+</pre>
+*/
+// Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
+//*-- Copyright &copy ALICE HLT Group 
+
+#include <TH1.h>
+#include <TGraph.h>
+#include <AliHLTTPCDisplayMain.h>
+
+class AliHLTTPCDisplayResiduals {  
+    
+ public:
+    AliHLTTPCDisplayResiduals(AliHLTTPCDisplayMain* display) ;
+    virtual ~AliHLTTPCDisplayResiduals();
+    
+    void Draw();
+    void Reset();
+    void Fill();
+    void Save();
+ private:
+    AliHLTTPCDisplayMain* fDisplay;
+
+    TH1F *fHistallresidualsY;          // histogram for all Y residuals
+    TH1F *fHistallresidualsZ;          // histogram for all Z residuals
+
+    TH1F * fHistHits_S;                // histogram for Hits per track length
+    TH1F * fHistQ_Track;               // histogram for Charge per track
+    TH1F * fHistQ_S;                   // histogram for Charge per track length
+    
+    TGraph *fGraphresidualsY;          // graph of the Y residuals for one track
+    TGraph *fGraphresidualsZ;          // graph of the Z residuals for one track
+    TGraph *fGraphresidualsYLength;    // graph of the border of Y residuals for one track
+
+    ClassDef(AliHLTTPCDisplayResiduals,0) 
+};
+
+#endif //  ALIHLTTPCDISPLAYRESIDUALS_H
diff --git a/HLT/TPCLib/OnlineDisplay/Makefile.am b/HLT/TPCLib/OnlineDisplay/Makefile.am
new file mode 100644 (file)
index 0000000..96182a7
--- /dev/null
@@ -0,0 +1,56 @@
+# $Id$
+# Makefile template for the Alice HLT TPC display library
+
+MODULE                                 = AliHLTTPCDisplay
+
+AM_CPPFLAGS                    = @ALIROOT_CPPFLAGS@         \
+                                 @HOMER_CPPFLAGS@ \
+                                 -I$(top_srcdir)/BASE       \
+                                 -I$(srcdir)/../
+
+# library definition
+lib_LTLIBRARIES                        =  libAliHLTTPCDisplay.la
+
+# library sources
+libAliHLTTPCDisplay_la_SOURCES = AliHLTTPCDisplayMain.cxx \
+                                 AliHLTTPCDisplay.cxx  \
+                                 AliHLTTPCDisplay3D.cxx  \
+                                 AliHLTTPCDisplayCharge.cxx  \
+                                 AliHLTTPCDisplayFront.cxx  \
+                                 AliHLTTPCDisplayPad.cxx  \
+                                 AliHLTTPCDisplayPadRow.cxx  \
+                                 AliHLTTPCDisplayResiduals.cxx
+
+# class header files, the link definition for the root dictionary
+# will be created from the names of the header files
+CLASS_HDRS                     = 
+
+
+pkginclude_HEADERS             = $(CLASS_HDRS) \
+                                 AliHLTTPCDisplayMain.h  \
+                                 AliHLTTPCDisplay.h  \
+                                 AliHLTTPCDisplay3D.h  \
+                                 AliHLTTPCDisplayCharge.h  \
+                                 AliHLTTPCDisplayFront.h  \
+                                 AliHLTTPCDisplayPad.h  \
+                                 AliHLTTPCDisplayPadRow.h  \
+                                 AliHLTTPCDisplayResiduals.h
+
+
+
+
+# version info for the library
+libAliHLTTPCDisplay_la_LDFLAGS = -L@ROOTLIBDIR@ \
+                                 @ROOTLIBS@ \
+                                 @ALIROOT_LDFLAGS@ \
+                                 @ALIROOT_LIBS@ \
+                                 @HOMER_LDFLAGS@ \
+                                 -version-info 1:0:0
+
+# set the file name for the generated root dictionary
+DICTCPP                                =  AliHLTTPCDisplay-DICT.cxx
+nodist_libAliHLTTPCDisplay_la_SOURCES  =  $(DICTCPP)
+
+CLEANFILES                     = 
+
+include $(top_srcdir)/make.dict
index a715607..9dc85f1 100644 (file)
@@ -222,6 +222,45 @@ AC_SUBST([ALIROOT_LIBS])
 CPPFLAGS="$CPPFLAGS -DROOTVERSION=\\\"`${ROOTCONF} --version`\\\""
 
 dnl ------------------------------------------------------------------
+dnl check for the HLT PubSub Framework
+AC_MSG_CHECKING([for HLT PubSub Framework])
+AC_ARG_WITH(pubsub, [installation path of the HLT PubSub framework],
+                   [],
+                   [ test -n $ALIHLT_DC_DIR && with_pubsub=$ALIHLT_DC_DIR ])
+if test -z $with_pubsub || ! test -d $with_pubsub ; then
+  with_pubsub=no
+fi
+AC_MSG_RESULT([$with_pubsub])
+
+AH_TEMPLATE([HAVE_HOMERREADER],[the HLT PubSub Homer Reader interface])
+if test "x$with_pubsub" != "xno" ; then
+  save_CPPFLAGS=$CPPFLAGS
+  save_LDFLAGS=$LDFLAGS
+  save_LIBS=$LIBS
+  HOMER_CPPFLAGS="-I${with_pubsub}/include/HOMER/reader"
+  HOMER_LDFLAGS="-L${with_pubsub}/lib/`uname -s`-`uname -p`"
+  CPPFLAGS="$save_CPPFLAGS $HOMER_CPPFLAGS"
+  LDFLAGS="$save_LDFLAGS $HOMER_LDFLAGS"
+  LIBS="$save_LIBS "
+  with_homer=no
+  AC_LANG_PUSH(C++)
+  AC_CHECK_HEADER([HOMERReader.h],
+    [ AC_CHECK_LIB([HOMERReader],[_init],[with_homer=yes])])
+  AC_LANG_POP(C++)
+  if test "x$with_homer" = "xno" ; then
+    HOMER_CPPFLAGS=
+    HOMER_LDFLAGS=
+  else
+    AC_DEFINE(HAVE_HOMERREADER)
+  fi
+  CPPFLAGS="$save_CPPFLAGS"
+  LDFLAGS="$save_LDFLAGS"
+  LIBS="$save_LIBS"  
+fi
+AC_SUBST([HOMER_CPPFLAGS])
+AC_SUBST([HOMER_LDFLAGS])
+
+dnl ------------------------------------------------------------------
 AC_MSG_CHECKING([whether to impose strict coding conventions])
 AC_ARG_ENABLE(strict,
   [AC_HELP_STRING([--enable-strict],
@@ -336,6 +375,7 @@ AC_CONFIG_FILES([Makefile
                 SampleLib/Makefile
                 TPCLib/Makefile
                 TPCLib/mapping2array.cxx
+                TPCLib/OnlineDisplay/Makefile
                 doc/Makefile
                 doc/doxygen.conf])