]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/comp/AliHLTTPCCompModelAnalysis.h
get rid of coding violations and warnings (Jochen)
[u/mrichter/AliRoot.git] / HLT / TPCLib / comp / AliHLTTPCCompModelAnalysis.h
1 // XEmacs -*-C++-*-
2 // $Id$
3
4 #ifndef ALIHLTTPCCOMPMODELANALYSIS_H
5 #define ALIHLTTPCCOMPMODELANALYSIS_H
6 //* This file is property of and copyright by the ALICE HLT Project        * 
7 //* ALICE Experiment at CERN, All rights reserved.                         *
8 //* See cxx source for full Copyright notice                               *
9
10 /** @file   AliHLTTPCCompModelAnalysis.h
11     @author J. Wagner
12     @date   17-11-2007
13     @brief   A HLT processing component for the Vestbo-compression-model */
14
15 #include "AliHLTTPCTrackArray.h"
16 #include "AliHLTTPCTrackletDataFormat.h"
17 #include "AliHLTTPCClusterDataFormat.h"
18 #include "AliHLTTPCTrack.h"
19 #include "AliHLTTPCModelTrack.h"
20 #include "TFile.h"
21 #include "TH1.h"
22 #include "AliHLTLogging.h"
23
24 /**
25  * @class AliHLTTPCCompModelAnalysis
26  * @brief A HLT processing component for the Vestbo-compression-model 
27  *
28  * An implementiation of a class that is used to analyse the 
29  * loss due to the conversion / compression in the Vestbo-model
30  * resolution change due to Vestbo-model on tracking performance
31  * @ingroup alihlt_tpc
32  */
33 class AliHLTTPCCompModelAnalysis: public AliHLTLogging
34 {
35 public:
36
37
38   /** type needed to build list with discarded tracks or tracks to compare */
39   struct AliHLTTPCTrackList
40   {
41     AliHLTTPCTrackList() : 
42       track(),
43       pythiatrack(),
44       wronglydiscarded(kFALSE),
45       matchingindicator(0),
46       next(NULL),
47       matchingtrack(NULL)
48     {}
49
50     AliHLTTPCTrackList (const AliHLTTPCTrackList&);
51     AliHLTTPCTrackList& operator= (const AliHLTTPCTrackList&);
52
53     AliHLTTPCTrack track;       // store information of found discarded track   
54     AliHLTTPCTrack pythiatrack; // store pythia information about this found discarded track
55     Bool_t wronglydiscarded;    // flag to mark if track and pythia track information match together
56     Int_t matchingindicator;    // only for trackanalysis the higher the number, the more probable it is that tracks match
57     AliHLTTPCTrackList* next;   // pointer to next struct
58     AliHLTTPCTrackList* matchingtrack; // pointer to matching track (only used in trackanalysis)
59   };
60   typedef struct AliHLTTPCTrackList AliHLTTPCTrackList;
61
62   AliHLTTPCCompModelAnalysis(Bool_t modelanalysis, Bool_t trackanalysis, TString dumpfilename, TString graphfilename);
63   virtual ~AliHLTTPCCompModelAnalysis();
64
65   /** initialise track or cluster arrays depending on the analysis to be made
66    * @return 0 upon success
67    */  
68   Int_t Init();
69
70   /** display results for respective analysis type (track comparison or model loss analysis) 
71    * @return 0 upon success
72    */
73   Int_t DisplayResults();
74
75   /** function to retrieve private member variable fModelAnalysis used in ModelConverter 
76    * @return 0 if fModelAnalysis is switched off
77    * @return 1 if fModelAnalysis is switched on
78    */
79   Bool_t GetfModelAnalysis() {return fModelAnalysis;};
80
81   /** function to retrieve private member variable fTrackAnalysis used in ModelConverter
82    * @return 0 if fTrackAnalysis is switched off
83    * @return 1 if fTrackAnalysis is switched on
84    */
85   Bool_t GetfTrackAnalysis() {return fTrackAnalysis;};
86
87   /** fill track arrays with track data from original and secondary tracking 
88    * @param tracklets           pointer to track array to be filled
89    * @param fillingfirsttracks  boolean to decide which track array is to be filled (1 for first, 0 for second)
90    * @return 0 upon success
91    */
92   Int_t SetTracks(AliHLTTPCTrackletData* tracklets, Bool_t fillingfirsttracks);
93
94   /** fill cluster arrays with cluster data from original and secondary clusters 
95    * @param clusters              pointer to cluster data array to be filled
96    * @param slice                 slice number where clusters come from
97    * @param patch                 patch number where clusters come from
98    * @param fillingfirstclusters  boolean to decide which track array is to be filled (1 for first, 0 for second)
99    * @return 0 upon success
100    */
101   Int_t SetClusters(AliHLTTPCClusterData* clusters, UInt_t slice, UInt_t patch, Bool_t fillingfirstclusters);
102
103  /** store discarded tracks in model analysis to be displayed in @ref DisplayModelResults(),
104   * uses @ref GetTrashTrackPythiaInfo
105   * @param lowpttrack  pointer to discarded track which is to be remembered for analysis
106   * @return 0 upon success
107   */
108   Int_t MarkTrashTrack(AliHLTTPCTrack* lowpttrack);
109
110   /** store discarded cluster not assigned to any track in model analysis to be displayed in @ref DisplayModelResults(),
111    * uses @ref GetClusterPythiaInfo
112    * @param discardedcluster  cluster data of discarded cluster
113    * @param slice             slice where discarded cluster occurrs
114    * @param patch             patch where discarded cluster occurrs
115    * @return 0 upon success
116    */
117   Int_t MarkTrashCluster(AliHLTTPCClusterData *discardedcluster, UInt_t slice, UInt_t patch);
118  
119 private:
120   /** copy constructor prohibited */
121   AliHLTTPCCompModelAnalysis (const AliHLTTPCCompModelAnalysis&); 
122
123   /** assignment operator prohibited */
124   AliHLTTPCCompModelAnalysis& operator= (const AliHLTTPCCompModelAnalysis&);
125
126   /** private function to display results from model loss analysis
127    * @return 0 upon success
128    */
129   Int_t DisplayModelResults();
130
131   /** private function to display results from track comparison 
132    * @return 0 upon success
133    */
134   Int_t DisplayTrackResults();
135
136  /** compare tracks and store differences to be displayed in @ref DisplayTrackResults() 
137   * @return 0 upon success
138   */
139   Int_t CompareTracks();
140
141   /** compare clusters for all tracks and create graphs out of the differences 
142    *  function used in @ref DisplayTrackResults()
143    * @return 0 upon success
144    */
145   Int_t CompareClusters(Bool_t relativedifferences = 1);
146
147   /** get Pythia information about tracks in track comparison
148    * @param comparabletrack track to look for pythia information
149    * @return pythiatrack    track information from pythia lookup
150    */
151   AliHLTTPCTrack GetComparableTrackPythiaInfo(AliHLTTPCTrack comparabletrack);
152
153   /** compare discarded track parameters with parameters from Pythia event
154    * @param discardedtrack  pointer to a discarded track (usually with low pt)
155    * @return 0 upon correct decision (track with low pt accoridng to Pythia, i.e. track = delta-electron or similar noise)
156    * @return 1 upon wrong decision (track wrongly discarded, should by taken into account according to Pythia information)
157    */
158   Bool_t GetTrashTrackPythiaInfo(AliHLTTPCTrack* discardedtrack);
159
160   /** compare information of a cluster not assigned to any track with its Pythia information
161    * @param discardedcluster  pointer to discarded cluster
162    * @return 0 upon correct decision (cluster not assigned to any track is true in Pythia, i.e. cluster = noise cluster)
163    * @return 1 upon wrong decision (cluster wrongly discarded, i.e. it belongs to a valuable track according to Pythia)
164    */
165   Bool_t GetClusterPythiaInfo(AliHLTTPCClusterData* discardedcluster);
166
167   /** compare two tracks in order to find if the match
168    * @param firsttracklistelement   track from orignal tracking, stored in AliHLTTPCTrackList
169    * @param secondtracklistelement  track from secondary tracking, stored in AliHLTTPCTrackList
170    * @return matchingindicator      if all parameters are equal: matchingindicator = 10
171    */
172   Int_t CompareTrackInfo(AliHLTTPCTrackList* firsttracklistelement, AliHLTTPCTrackList* secondtracklistelement);
173
174   /** compare two pythia tracks in order to find if the match
175    * @param firsttracklistelement   track from orignal tracking, stored in AliHLTTPCTrackList
176    * @param secondtracklistelement  track from secondary tracking, stored in AliHLTTPCTrackList
177    * @return matchingindicator      if all pythia parameters are equal: matchingindicator = 10 (should be so!)
178    */
179   Int_t ComparePythiaTrackInfo(AliHLTTPCTrackList* firsttracklistelement, AliHLTTPCTrackList* secondtracklistelement);
180
181   /** if -graphfile <filename>.root is given as input parameter, histrograms are created
182    * @param relativedifferences boolean to decide whether to plot histograms 
183    *                            with relative differences in track paramters (1) or not (0), 1 by default
184    * @return 0 upon success
185    */
186   Int_t CreateGraphs(Bool_t relativedifferences = 1);
187
188   /** flag to decide wheter to do track or model loss analysis */
189   Bool_t fModelAnalysis; // switch on model analysis
190   Bool_t fTrackAnalysis; // switch on track analysis
191
192   /** name of humanly readable dump file for analysis results */
193   TString fDumpFileName;
194   /** name of root file name to store histograms of track comparison */
195   TString fGraphFileName;
196  
197   /** members for track analysis:  */
198   /** array with original tracks from first tracking */
199   AliHLTTPCTrackArray fFirstTrackArray;  // array to store tracks of first tracking
200   /** array with tracks from secondary tracking with Vestbo-decompressed clusters */
201   AliHLTTPCTrackArray fSecondTrackArray; // array to store tracks of second tracking (after compression/expansion of model)
202   /** pointer to first element of first track list containing tracks and their pythia information  */
203   AliHLTTPCTrackList* fFirstTrackList;
204   /** pointer to first element of second track list containing tracks and their pythia information */
205   AliHLTTPCTrackList* fSecondTrackList;
206   /** array of original clusters for deviation analysis to secondary clusters */
207   AliHLTTPCClusterData* fOriginalClusters[36][6];
208   /** array of secondary clusters for deviation analysis to origin clusters */
209   AliHLTTPCClusterData* fSecondaryClusters[36][6];
210   /** number of tracks with pt < 0.1GeV in first array */
211   Int_t fFirstTrashTracks;
212   /** number of tracks with pt < 0.1GeV in second array */
213   Int_t fSecondTrashTracks;
214   /** total number of compared tracks */
215   Int_t fTotalComparedTracks;
216   /** number of matched tracks under 0.1 GeV in first array */
217   Int_t fMatchedFirstTrashTracks;
218   /** number of matched tracks under 0.1 GeV in second array */
219   Int_t fMatchedSecondTrashTracks;
220   /** number of original tracks that do not have secondary track matches */
221   Int_t fFirstUnmatchedTracks;
222   /** number of secondary tracks that do not have original track matches */
223   Int_t fSecondUnmatchedTracks;
224   /** tolerance limits of relative deviation of compared track quantities, set in Init() */
225   Float_t fToleranceDeviation;  // (firstparameter - secondparameter)/firstparameter <= fToleranceDeviation
226
227   /** members for model analysis: */
228   /** pointer to list of discarded tracks */
229   AliHLTTPCTrackList* fTrackListPointer; // pointer to list of discarded tracks
230   /** array of discarded clusters */
231   AliHLTTPCClusterData* fDiscardedClusters[36][6]; // array of discarded valuable clusters
232   
233   /** total number of discarded clusters not assigned to any track per event */
234   Int_t fTotalDiscardedClusters;    // number of discarded clusters
235   /** total number of wrongly discarded clusters according to Pythia information per event */
236   Int_t fValuableDiscardedClusters; // number of discarded clusters which should be assigned to a track 
237   /** total number of discarded tracks per event */
238   Int_t fTrashTracks;               // number of discarded tracks (pt lower 0.1 GeV)
239
240   ClassDef(AliHLTTPCCompModelAnalysis, 1)
241   
242 };
243 #endif