]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSRawClusterSDD.cxx
Error messages stored in the global raw-reader error log (Cvetan, Chiara)
[u/mrichter/AliRoot.git] / ITS / AliITSRawClusterSDD.cxx
1 /**************************************************************************
2  * Copyright(c) 2000-2004, 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 #include <Riostream.h>
16 #include <TMath.h>
17  
18 #include "AliITSRawClusterSDD.h"
19
20 ////////////////////////////////////////////////////
21 //  Cluster classes for set:ITS                   //
22 //  Raw Clusters for SDD                          //
23 //                                                //
24 ////////////////////////////////////////////////////
25
26 ClassImp(AliITSRawClusterSDD)
27 //______________________________________________________________________
28 AliITSRawClusterSDD::AliITSRawClusterSDD():
29 fX(0),
30 fZ(0),
31 fQ(0),
32 fWing(0),
33 fAnode(0),
34 fTime(0),
35 fAsigma(0),
36 fTsigma(0),
37 fPeakAmplitude(0),
38 fSumAmplitude(0),
39 fPeakPosition(-1),
40 fNanodes(1),
41 fTstart(0),
42 fTstop(0),
43 fTstartf(0),
44 fTstopf(0),
45 fAstart(0),
46 fAstop(0)
47 {
48         // default constructor
49   fMultiplicity = 0;
50 }
51
52 //______________________________________________________________________
53 AliITSRawClusterSDD::AliITSRawClusterSDD(Int_t wing,
54                                          Float_t Anode,Float_t Time,
55                                          Float_t Charge,Float_t PeakAmplitude,
56                                          Int_t PeakPosition,
57                                          Float_t Asigma,Float_t Tsigma,
58                                          Float_t DriftPath,
59                                          Float_t AnodeOffset,
60                                          Int_t Samples,Int_t Tstart,
61                                          Int_t Tstop,Int_t Tstartf,
62                                          Int_t Tstopf,Int_t Anodes, 
63                                          Int_t Astart, Int_t Astop):
64 fX(0),
65 fZ(0),
66 fQ(Charge),
67 fWing(wing),
68 fAnode(Anode),
69 fTime(Time),
70 fAsigma(Asigma),
71 fTsigma(Tsigma),
72 fPeakAmplitude(PeakAmplitude),
73 fSumAmplitude(0),
74 fPeakPosition(PeakPosition),
75 fNanodes(Anodes),
76 fTstart(Tstart),
77 fTstop(Tstop),
78 fTstartf(Tstartf),
79 fTstopf(Tstopf),
80 fAstart(Astart),
81 fAstop(Astop){
82     // constructor
83
84     Int_t sign = 1;
85     for(Int_t i=0;i<fWing; i++) sign *= (-1);
86     fX = DriftPath*sign/10000.;
87     fZ = AnodeOffset/10000.;
88     fMultiplicity = Samples;
89 }
90 //______________________________________________________________________
91 AliITSRawClusterSDD::AliITSRawClusterSDD(const AliITSRawClusterSDD & source):
92     AliITSRawCluster(source),
93 fX(source.fX),
94 fZ(source.fZ),
95 fQ(source.fQ),
96 fWing(source.fWing),
97 fAnode(source.fAnode),
98 fTime(source.fTime),
99 fAsigma(source.fAsigma),
100 fTsigma(source.fTsigma),
101 fPeakAmplitude(source.fPeakAmplitude),
102 fSumAmplitude(source.fSumAmplitude),
103 fPeakPosition(source.fPeakPosition),
104 fNanodes(source.fNanodes),
105 fTstart(source.fTstart),
106 fTstop(source.fTstop),
107 fTstartf(source.fTstartf),
108 fTstopf(source.fTstopf),
109 fAstart(source.fAstart),
110 fAstop(source.fAstop){
111     // copy constructor
112
113     fMultiplicity  = source.fMultiplicity;
114 }
115 //______________________________________________________________________
116 void AliITSRawClusterSDD::Add(AliITSRawClusterSDD* clJ) {
117     // add
118
119     fAnode = (fAnode*fQ + clJ->A()*clJ->Q())/(fQ+clJ->Q());
120     fTime  = ( fTime*fQ + clJ->T()*clJ->Q())/(fQ+clJ->Q());
121     fX     = (    fX*fQ + clJ->X()*clJ->Q())/(fQ+clJ->Q());
122     fZ     = (    fZ*fQ + clJ->Z()*clJ->Q())/(fQ+clJ->Q());
123     fQ += clJ->Q();
124     if(fSumAmplitude == 0) fSumAmplitude += fPeakAmplitude;
125     /*
126       fAnode = (fAnode*fSumAmplitude+clJ->A()*clJ->PeakAmpl())/
127                (fSumAmplitude+clJ->PeakAmpl());
128       fTime = (fTime*fSumAmplitude +clJ->T()*clJ->PeakAmpl())/
129               (fSumAmplitude+clJ->PeakAmpl());
130       fX = (fX*fSumAmplitude +clJ->X()*clJ->PeakAmpl())/
131            (fSumAmplitude+clJ->PeakAmpl());
132       fZ = (fZ*fSumAmplitude +clJ->Z()*clJ->PeakAmpl())/
133            (fSumAmplitude+clJ->PeakAmpl());
134     */
135     fSumAmplitude += clJ->PeakAmpl();
136
137     fTstart = clJ->Tstart();
138     fTstop  = clJ->Tstop();
139     if(fTstartf > clJ->Tstartf()) fTstartf = clJ->Tstartf();
140     if( fTstopf < clJ->Tstopf() ) fTstopf  = clJ->Tstopf();
141     if(  fAstop < clJ->Astop()  ) fAstop   = clJ->Astop();
142
143     fMultiplicity += (Int_t) (clJ->Samples());
144     (fNanodes)++;
145     if(clJ->PeakAmpl() > fPeakAmplitude) {
146         fPeakAmplitude = clJ->PeakAmpl();
147         fPeakPosition = clJ->PeakPos();
148     } // end if
149
150     return;
151 }
152 //______________________________________________________________________
153 Bool_t AliITSRawClusterSDD::Brother(AliITSRawClusterSDD* cluster,
154                                     Float_t danode,Float_t dtime) {
155   // compare this with "cluster"
156     Bool_t brother = kFALSE;
157     Bool_t test2 = kFALSE;
158     Bool_t test3 = kFALSE;
159     Bool_t test4 = kFALSE;
160     Bool_t test5 = kFALSE;
161   
162     if(fWing != cluster->W()) return brother;
163
164     if(fTstopf >= cluster->Tstart() &&
165        fTstartf <= cluster->Tstop()) test2 = kTRUE;
166     if(cluster->Astop() == (fAstop+1)) test3 = kTRUE;
167
168     if(TMath::Abs(fTime-cluster->T()) < dtime) test4 = kTRUE;
169     if(TMath::Abs(fAnode-cluster->A()) < danode) test5 = kTRUE;
170
171     if((test2 && test3) || (test4 && test5) ) {
172         return brother = kTRUE;
173     } // end if
174   
175     return brother;
176 }
177 //______________________________________________________________________
178 void AliITSRawClusterSDD::PrintInfo() const {
179     // print
180
181     cout << ", Anode " << fAnode << ", Time: " << fTime << ", Charge: " << fQ;
182     cout << ", Samples: " << fMultiplicity;
183     cout << ", X: " << fX << ", Z: " << fZ << "tstart " << fTstart 
184          << "tstop "<< fTstop <<endl;
185 }