]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsimulationFastPointsV0.cxx
Example macro for the creation of tags (P.Christakoglou)
[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   AliITSRecPoint rpSPD;
132
133   rpSPD.fTracks[0]=trackNumber;
134   rpSPD.fTracks[1]=-3;
135   rpSPD.fTracks[2]=-3;
136   rpSPD.SetX(fSx->GetMean());
137   rpSPD.SetZ(fSz->GetMean());
138   rpSPD.SetdEdX(e);
139   rpSPD.SetQ(1.0);
140   a1 = fSx->GetRMS(); a1 *= a1; a1 += kRMSx*kRMSx;
141   //  if(a1>1.E5) printf("addSPD: layer=%d track #%d dedx=%e sigmaX2= %e ",
142   //                mod->GetLayer(),trackNumber,e,a1);
143   rpSPD.SetSigmaX2(a1);
144   a2 = fSz->GetRMS(); a2 *= a2; a2 += kRMSz*kRMSz;
145   //  if(a1>1.E5) printf(" sigmaZ2= %e\n",a2);
146   rpSPD.SetSigmaZ2(a2);
147
148   //(mod->GetITS())->AddRecPoint(rpSPD);
149   new (pt[fNrecp]) AliITSRecPoint(rpSPD);
150   fNrecp++;
151 }
152 //_______________________________________________________________________
153 void AliITSsimulationFastPointsV0::AddSDD(Float_t &e,
154                                           AliITSmodule* /*mod*/,Int_t trackNumber,TClonesArray* recp){
155   //
156   TClonesArray &pt=*recp;
157   const Float_t kmicronTocm = 1.0e-4;
158   const Float_t kdEdXtoQ = 2.778e+8; 
159   const Float_t kRMSx = 38.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
160   const Float_t kRMSz = 28.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
161   Float_t a1,a2; // general float.
162   AliITSRecPoint rpSDD;
163
164   rpSDD.fTracks[0]=trackNumber;
165   rpSDD.fTracks[1]=-3;
166   rpSDD.fTracks[2]=-3;
167   rpSDD.SetX(fSx->GetMean());
168   rpSDD.SetZ(fSz->GetMean());
169   rpSDD.SetdEdX(e);
170   rpSDD.SetQ(kdEdXtoQ*e);
171   a1 = fSx->GetRMS(); a1 *= a1; a1 += kRMSx*kRMSx;
172   //  if(a1>1.E5) printf("addSDD: layer=%d track #%d dedx=%e sigmaX2= %e ",
173   //                mod->GetLayer(),trackNumber,e,a1);
174   rpSDD.SetSigmaX2(a1);
175   a2 = fSz->GetRMS(); a2 *= a2; a2 += kRMSz*kRMSz;
176   //  if(a1>1.E5) printf(" sigmaZ2= %e\n",a2);
177   rpSDD.SetSigmaZ2(a2);
178
179   new (pt[fNrecp]) AliITSRecPoint(rpSDD);
180   fNrecp++;
181
182 }
183 //_______________________________________________________________________
184 void AliITSsimulationFastPointsV0::AddSSD(Float_t &e,
185                                           AliITSmodule* /*mod*/,Int_t trackNumber,TClonesArray* recp){
186   // 
187   TClonesArray &pt=*recp;
188   const Float_t kmicronTocm = 1.0e-4;
189   const Float_t kdEdXtoQ = 2.778e+8;
190   const Float_t kRMSx = 20.0*kmicronTocm;  // microns->cm ITS TDR Table 1.3
191   const Float_t kRMSz = 830.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
192   Float_t a1,a2; // general float.
193   AliITSRecPoint rpSSD;
194
195   rpSSD.fTracks[0]=trackNumber;
196   rpSSD.fTracks[1]=-3;
197   rpSSD.fTracks[2]=-3;
198   rpSSD.SetX(fSx->GetMean());
199   rpSSD.SetZ(fSz->GetMean());
200   rpSSD.SetdEdX(e);
201   rpSSD.SetQ(kdEdXtoQ*e);
202   a1 = fSx->GetRMS(); a1 *= a1; a1 += kRMSx*kRMSx;
203   //  if(a1>1.E5) printf("addSSD: layer=%d track #%d dedx=%e sigmaX2= %e ",
204   //                mod->GetLayer(),trackNumber,e,a1);
205   rpSSD.SetSigmaX2(a1);
206   a2 = fSz->GetRMS(); a2 *= a2; a2 += kRMSz*kRMSz;
207   //  if(a1>1.E5) printf(" sigmaZ2= %e RMSx=%e RMSz=%e\n",a2,fSx->GetRMS(),fSz->GetRMS());
208   rpSSD.SetSigmaZ2(a2);
209
210   new (pt[fNrecp]) AliITSRecPoint(rpSSD);
211   fNrecp++;
212
213
214 }
215 //_______________________________________________________________________
216