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