]> git.uio.no Git - u/mrichter/AliRoot.git/blob - DISPLAY/AliDisplayHLT.cxx
o) Added DrawHistograms function
[u/mrichter/AliRoot.git] / DISPLAY / AliDisplayHLT.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 /////////////////////////////////////////////////////////////////////////
16 // ALICE HLT DISPLAY CLASS                                             //
17 // Author: Mayeul   ROUSSELET                                          //
18 // e-mail: Mayeul.Rousselet@cern.ch                                    //
19 // Last update:26/08/2003                                              //
20 /////////////////////////////////////////////////////////////////////////
21
22 #include <TPolyMarker3D.h>
23
24 #include "AliDisplayHLT.h"
25 #include "AliDisplay2.h"
26 #include "AliModuleInfo.h"
27 #ifdef ALI_HLT
28 #include <stdlib.h>
29 #include "AliL3MemHandler.h"
30 #include "AliL3SpacePointData.h"
31 #include "AliL3Transform.h"
32 #include "AliL3Logging.h"
33 #endif
34
35 ClassImp(AliDisplayHLT)
36
37 //_____________________________________________________________
38 AliDisplayHLT::AliDisplayHLT()
39 {
40   // Default constructor
41   fPoints = new TPolyMarker3D[gAliDisplay2->GetNbModules()];
42   fName = new char*[gAliDisplay2->GetNbModules()];
43   fNb=0;
44   for(Int_t i=0;i<gAliDisplay2->GetNbModules();i++){
45     fPoints[i].SetMarkerSize(0.2); 
46     fPoints[i].SetMarkerColor(2); 
47     fPoints[i].SetMarkerStyle(1);
48   }
49 }
50
51 //_____________________________________________________________
52 AliDisplayHLT::~AliDisplayHLT()
53 {
54   delete [] fPoints;
55 }
56
57 //_____________________________________________________________
58 void AliDisplayHLT::LoadHLT(const char *name,Int_t nevent)
59 {
60   // Loads HLT clusters of TPC
61   if(strstr(name,"TPC")) LoadHLTTPC(nevent);
62 }
63
64 //_____________________________________________________________
65 void AliDisplayHLT::LoadHLTTPC(Int_t nevent)
66 {
67   //load TPC Clusters from the raw data
68   //raw data must be in the directorie $ALICE_ROOT/raw
69   //First we read the data from files
70   //do_mc MUST BE DEFINED AND USED FOR RAW DATA GENERATION
71 #ifdef ALI_HLT
72
73   fName[fNb]=new char[strlen("TPC")];
74   strcpy(fName[fNb],"TPC");
75   Char_t fname[256];
76   AliL3MemHandler *clusterfile[36][6];
77   AliL3SpacePointData *fClusters[36][6];
78   UInt_t fNcl[36][6];
79   memset(fClusters,0,36*6*sizeof(AliL3SpacePointData*));
80   //  strcpy(path,gSystem->Getenv("ALICE_ROOT"));
81   //strcat(path,"/raw");
82   //printf("\nRaw data path %s",path);
83   char path[128];
84   strcpy(path,gAliDisplay2->GetRawDataPath());
85   for(Int_t s=0; s<36; s++)
86     {
87       for(Int_t p=0; p<AliL3Transform::GetNPatches(); p++)
88         {
89           Int_t patch;
90           patch=-1;
91           clusterfile[s][p] = new AliL3MemHandler();
92           if(nevent<0)
93             sprintf(fname,"%s/points_%d_%d.raw",path,s,patch);
94           else
95             sprintf(fname,"%s/points_%d_%d_%d.raw",path,nevent,s,patch);
96           if(!clusterfile[s][p]->SetBinaryInput(fname))
97             {
98               LOG(AliL3Log::kError,"AliL3Evaluation::Setup","File Open")
99                 <<"Inputfile "<<fname<<" does not exist"<<ENDLOG; 
100               delete clusterfile[s][p];
101               clusterfile[s][p] = 0; 
102               continue;
103             }
104           fClusters[s][p] = (AliL3SpacePointData*)clusterfile[s][p]->Allocate();
105           clusterfile[s][p]->Binary2Memory(fNcl[s][p],fClusters[s][p]);
106           clusterfile[s][p]->CloseBinaryInput();
107           break;
108         }
109     }
110
111   //Second step: we assign the clusters to the fPoints array
112   Int_t nbc=0;
113   for(Int_t s=0; s<36; s++){
114       for(Int_t p=0;p<6;p++){
115           AliL3SpacePointData *points = fClusters[s][p];
116           if(!points) continue;
117           Float_t xyz[3];
118           for(UInt_t i=0; i<fNcl[s][p]; i++){
119               xyz[0] = points[i].fX;
120               xyz[1] = points[i].fY;
121               xyz[2] = points[i].fZ;
122               fPoints[fNb].SetPoint(i+nbc,xyz[0],xyz[1],xyz[2]);
123             }
124             nbc += fNcl[s][p];
125         }
126     }
127   fNb++;
128 #else
129   printf("This is event %d\n",nevent);
130 #endif
131 }
132
133 //_____________________________________________________________
134 void AliDisplayHLT::Draw()
135 {
136   // Draws HLT clusters
137   for(Int_t i=0;i<fNb;i++){
138    if(gAliDisplay2->GetModuleInfo()->IsEnabled(fName[i])) fPoints[i].Draw();
139   }
140 }
141