]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCclusterInfo.cxx
one more tpcrefit added
[u/mrichter/AliRoot.git] / TPC / AliTPCclusterInfo.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, 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 //-------------------------------------------------------
17 //          Implementation of the TPC cluster debug information
18 //
19 //   Origin: Marian Ivanov   Marian.Ivanov@cern.ch
20 //   
21 //   Additional cluster information to monitor clustering performance
22 //   and to extract a features of detector response
23 //   Information attached to the default cluster
24 //   ONLY in DEBUG MODE
25 //    
26 //-------------------------------------------------------
27
28 /* $Id$ */
29
30 #include "AliTPCclusterInfo.h"
31 #include "AliLog.h"
32
33 ClassImp(AliTPCclusterInfo)
34
35
36 AliTPCclusterInfo::AliTPCclusterInfo():
37   fNPads(0),
38   fNTimeBins(0),
39   fNBins(0),
40   fGraph(0)
41 {
42   //
43   // default constructor
44   //  
45   for (Int_t i=0; i<25;i++){
46     fMatrix[i] = i; 
47   }
48 }
49
50 AliTPCclusterInfo::AliTPCclusterInfo(const  AliTPCclusterInfo & info):
51   TObject(info),
52   fNPads(info.fNPads),
53   fNTimeBins(info.fNTimeBins),
54   fNBins(info.fNBins),
55   fGraph(0)    
56 {
57   //
58   // copy constructor
59   //
60   //  AliInfo("Copy constructor\n");
61   for (Int_t i=0; i<25;i++){
62     fMatrix[i] = info.fMatrix[i]; 
63   }
64   if (info.fGraph) {
65     fGraph = new Float_t[fNBins];
66     for (Int_t i=0;i<fNBins; i++){
67       fGraph[i] = info.fGraph[i];
68     }
69   }
70 }
71
72
73 AliTPCclusterInfo::AliTPCclusterInfo(Bool_t extend):
74   fNPads(0),
75   fNTimeBins(0),
76   fNBins(0),
77   fGraph(0)
78 {
79   //
80   // allocate dummy graph - neccessary for IO part to use automatic branching
81   //  
82   for (Int_t i=0; i<25;i++){
83     fMatrix[i] = i; 
84   }
85   if (extend){
86     fNBins = 1;
87     fGraph  = new Float_t[1];
88     fGraph[0]=-1;
89   }
90 }
91
92 AliTPCclusterInfo::AliTPCclusterInfo(Float_t *matrix, Int_t nbins, Float_t* graph):
93   fNPads(0),
94   fNTimeBins(0),
95   fNBins(0),
96   fGraph(0)
97 {
98   //
99   // constructor of the info
100   //
101   for (Int_t i=0;i<25;i++){
102     fMatrix[i]=matrix[i];
103   }
104   fNPads=0;
105   fNTimeBins=0;
106   Int_t center = 5+5+2;
107   for (Int_t i=-2; i<=2;i++) if (matrix[center+i]>0) fNTimeBins++;
108   for (Int_t i=-2; i<=2;i++) if (matrix[center+i*5]>0) fNPads++;
109   fNBins = nbins;
110   fGraph = 0;
111   if (fNBins>0) {
112     fGraph = new Float_t[fNBins];
113     for (Int_t i=0;i<fNBins; i++){
114       fGraph[i] = graph[i];
115     }
116   }
117 }
118
119 AliTPCclusterInfo& AliTPCclusterInfo::operator=(const AliTPCclusterInfo& info){
120   //
121   // assignment operator
122   // 
123   if (this == &info) return (*this);
124   if (this != &info) {
125     new (this) AliTPCclusterInfo(info);
126   }
127   return *this;
128 }
129
130
131 UChar_t AliTPCclusterInfo::GetNPads(Float_t threshold) const { 
132   //
133   //
134   Int_t nPads=0;
135   Int_t center = 5+5+2;
136   for (Int_t i=-2; i<=2;i++) if (fMatrix[center+i*5]>threshold) nPads++;
137   return nPads;
138 }
139
140 UChar_t AliTPCclusterInfo::GetNTimeBins(Float_t threshold) const { 
141   //
142   //
143   //
144   Int_t nTimeBins=0;
145   Int_t center = 5+5+2;
146   for (Int_t i=-2; i<=2;i++) if (fMatrix[center+i]>threshold) nTimeBins++;
147   return nTimeBins;
148 }
149
150
151
152
153 AliTPCclusterInfo::~AliTPCclusterInfo(){
154   //
155   // destructor
156   //
157   if (fGraph)  delete [] fGraph;
158 }
159