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