]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsimulationFastPointsV0.cxx
merging RecPoints and ClustersV2. All ClusterFinders produce AliITSRecPoints objects...
[u/mrichter/AliRoot.git] / ITS / AliITSsimulationFastPointsV0.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 /* $Id$ */
17 /////////////////////////////////////////////////////////
18 //  fast simulation V0                                 //
19 //                                                     //
20 //                                                     //
21 /////////////////////////////////////////////////////////
22
23 #include "AliITS.h"
24 #include "AliITShit.h"
25 #include "AliITSRecPoint.h"
26 #include "AliITSmodule.h"
27 #include "AliITSsimulationFastPointsV0.h"
28 #include "AliITSstatistics.h"
29
30 ClassImp(AliITSsimulationFastPointsV0)
31
32 AliITSsimulationFastPointsV0::AliITSsimulationFastPointsV0()
33 {
34   // default constructor
35   fSx = 0;
36   fSz = 0;
37 }
38 AliITSsimulationFastPointsV0::AliITSsimulationFastPointsV0(const char *dataType){
39   //constructor
40   Info("AliITSsimulationFastPointsV0","Standard constructor %s",dataType);
41   fSx = new AliITSstatistics(2);
42   fSz = new AliITSstatistics(2);
43 }
44 //______________________________________________________________________
45 AliITSsimulationFastPointsV0::AliITSsimulationFastPointsV0(const AliITSsimulationFastPointsV0 &/*rec*/):AliITSsimulation(/*rec*/){
46     // Copy constructor. 
47
48   Error("Copy constructor","Copy constructor not allowed");
49   
50 }
51 //______________________________________________________________________
52 AliITSsimulationFastPointsV0& AliITSsimulationFastPointsV0::operator=(const AliITSsimulationFastPointsV0& /*source*/){
53     // Assignment operator. This is a function which is not allowed to be
54     // done.
55     Error("operator=","Assignment operator not allowed\n");
56     return *this; 
57 }
58
59 //----------------------------------------------------------
60 AliITSsimulationFastPointsV0::~AliITSsimulationFastPointsV0()
61 {
62   //destructor
63   if(fSx) delete fSx;
64   if(fSz) delete fSz;
65
66 }
67
68 //-------------------------------------------------------------
69 void AliITSsimulationFastPointsV0::CreateFastRecPoints(AliITSmodule *mod,Int_t module,TRandom *rndm, TClonesArray* recp) {
70   // Fast points simulator for all of the ITS.
71
72   Int_t   nhit,h,trk,ifirst;
73   Float_t x,y,z,t,e;// local coordinate (cm) and time of flight, and dedx.
74   Float_t x1,y1,z1;
75   AliITShit *hit;
76
77   if(rndm!=0) module=0; // fix unsued parameter warnings.
78   fSx->Reset(); // Start out with things clearly zeroed
79   fSz->Reset(); // Start out with things clearly zeroed
80   e = 0.; // Start out with things clearly zeroed
81   Double_t weight=1.;
82   nhit = mod->GetNhits();
83   ifirst = 1;
84   for(h=0;h<nhit;h++){
85     hit = mod->GetHit(h);
86     hit->GetPositionL(x,y,z,t);
87     if(ifirst) {x1=x;y1=y;z1=z;}
88     e += hit->GetIonization();
89     trk = hit->GetTrack();
90     fSx->AddValue((Double_t)x,weight);
91     fSz->AddValue((Double_t)z,weight);
92     ifirst = 0;
93     if(hit->StatusExiting()||  // leaving volume
94        hit->StatusDisappeared()|| // interacted/decayed...
95        hit->StatusStop() // dropped below E cuts.
96        ){ // exiting track, write out RecPoint.
97       //      if(fSz->GetRMS()>1.E-1) {
98       //        TParticle *part = hit->GetParticle();
99       //        printf("idpart %d energy %f \n",part->GetPdgCode(),part->Energy());
100       //        printf("diffx=%e diffy=%e diffz=%e\n",x-x1,y-y1,z-z1);
101       //      }
102       switch (mod->GetLayer()){
103       case 1: case 2:  // SPDs
104         AddSPD(e,mod,trk,recp);
105         break;
106       case 3: case 4:  // SDDs
107         AddSDD(e,mod,trk,recp);
108         break;
109       case 5: case 6:  // SSDs
110         AddSSD(e,mod,trk,recp);
111         break;
112       } // end switch
113       fSx->Reset();
114       fSz->Reset();
115       e = 0.;
116       ifirst = 1;
117       continue;
118     }// end if
119   } // end for h
120 }
121 //_______________________________________________________________________
122 void AliITSsimulationFastPointsV0::AddSPD(Float_t &e,
123                                           AliITSmodule* mod,Int_t trackNumber,TClonesArray* recp){
124   //
125   TClonesArray &pt=*recp;
126   const Float_t kmicronTocm = 1.0e-4;
127   //  const Float_t kdEdXtoQ = ;
128   const Float_t kRMSx = 12.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
129   const Float_t kRMSz = 70.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
130   Float_t a1,a2; // general float.
131   
132   AliITSgeom* gm = mod->GetITS()->GetITSgeom();
133
134   AliITSRecPoint rpSPD(gm);
135
136   rpSPD.SetLabel(trackNumber,0);
137   rpSPD.SetLabel(-3,1);
138   rpSPD.SetLabel(-3,2);
139   rpSPD.SetXZ(mod->GetIndex(),fSx->GetMean(),fSz->GetMean());
140   rpSPD.SetdEdX(e);
141   rpSPD.SetQ(1.0);
142   a1 = fSx->GetRMS(); a1 *= a1; a1 += kRMSx*kRMSx;
143   //  if(a1>1.E5) printf("addSPD: layer=%d track #%d dedx=%e sigmaX2= %e ",
144   //                mod->GetLayer(),trackNumber,e,a1);
145   rpSPD.SetSigmaDetLocX2(a1);
146   a2 = fSz->GetRMS(); a2 *= a2; a2 += kRMSz*kRMSz;
147   //  if(a1>1.E5) printf(" sigmaZ2= %e\n",a2);
148   rpSPD.SetSigmaZ2(a2);
149   rpSPD.SetDetectorIndex(mod->GetIndex());
150   rpSPD.SetLayer(mod->GetLayer());
151   //(mod->GetITS())->AddRecPoint(rpSPD);
152   new (pt[fNrecp]) AliITSRecPoint(rpSPD);
153   fNrecp++;
154 }
155 //_______________________________________________________________________
156 void AliITSsimulationFastPointsV0::AddSDD(Float_t &e,
157                                           AliITSmodule* mod,Int_t trackNumber,TClonesArray* recp){
158   //
159   TClonesArray &pt=*recp;
160   const Float_t kmicronTocm = 1.0e-4;
161   const Float_t kdEdXtoQ = 2.778e+8; 
162   const Float_t kRMSx = 38.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
163   const Float_t kRMSz = 28.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
164   Float_t a1,a2; // general float.
165   AliITSgeom* gm = mod->GetITS()->GetITSgeom();
166
167   AliITSRecPoint rpSDD(gm);
168
169   rpSDD.SetLabel(trackNumber,0);
170   rpSDD.SetLabel(-3,1);
171   rpSDD.SetLabel(-3,2);
172   rpSDD.SetXZ(mod->GetIndex(),fSx->GetMean(),fSz->GetMean());
173   rpSDD.SetdEdX(e);
174   rpSDD.SetQ(kdEdXtoQ*e);
175   a1 = fSx->GetRMS(); a1 *= a1; a1 += kRMSx*kRMSx;
176   //  if(a1>1.E5) printf("addSDD: layer=%d track #%d dedx=%e sigmaX2= %e ",
177   //                mod->GetLayer(),trackNumber,e,a1);
178   rpSDD.SetSigmaDetLocX2(a1);
179   a2 = fSz->GetRMS(); a2 *= a2; a2 += kRMSz*kRMSz;
180   //  if(a1>1.E5) printf(" sigmaZ2= %e\n",a2);
181   rpSDD.SetSigmaZ2(a2);
182   rpSDD.SetDetectorIndex(mod->GetIndex());
183   rpSDD.SetLayer(mod->GetLayer());
184   new (pt[fNrecp]) AliITSRecPoint(rpSDD);
185   fNrecp++;
186
187 }
188 //_______________________________________________________________________
189 void AliITSsimulationFastPointsV0::AddSSD(Float_t &e,
190                                           AliITSmodule* mod,Int_t trackNumber,TClonesArray* recp){
191   // 
192   TClonesArray &pt=*recp;
193   const Float_t kmicronTocm = 1.0e-4;
194   const Float_t kdEdXtoQ = 2.778e+8;
195   const Float_t kRMSx = 20.0*kmicronTocm;  // microns->cm ITS TDR Table 1.3
196   const Float_t kRMSz = 830.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
197   Float_t a1,a2; // general float.
198
199   AliITSgeom* gm = mod->GetITS()->GetITSgeom();
200  
201   AliITSRecPoint rpSSD(gm);
202
203   rpSSD.SetLabel(trackNumber,0);
204   rpSSD.SetLabel(-3,1);
205   rpSSD.SetLabel(-3,2);
206   rpSSD.SetXZ(mod->GetIndex(),fSx->GetMean(),fSz->GetMean());
207   rpSSD.SetdEdX(e);
208   rpSSD.SetQ(kdEdXtoQ*e);
209   a1 = fSx->GetRMS(); a1 *= a1; a1 += kRMSx*kRMSx;
210   //  if(a1>1.E5) printf("addSSD: layer=%d track #%d dedx=%e sigmaX2= %e ",
211   //                mod->GetLayer(),trackNumber,e,a1);
212   rpSSD.SetSigmaDetLocX2(a1);
213   a2 = fSz->GetRMS(); a2 *= a2; a2 += kRMSz*kRMSz;
214   //  if(a1>1.E5) printf(" sigmaZ2= %e RMSx=%e RMSz=%e\n",a2,fSx->GetRMS(),fSz->GetRMS());
215   rpSSD.SetSigmaZ2(a2);
216   rpSSD.SetDetectorIndex(mod->GetIndex());
217   rpSSD.SetLayer(mod->GetLayer());
218   new (pt[fNrecp]) AliITSRecPoint(rpSSD);
219   fNrecp++;
220
221
222 }
223 //_______________________________________________________________________
224