]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/UPGRADE/ITSUpgradeBase/AliITSDigitUpgrade.cxx
ITS UPGRADE
[u/mrichter/AliRoot.git] / ITS / UPGRADE / ITSUpgradeBase / AliITSDigitUpgrade.cxx
CommitLineData
1d9af2d5 1/**************************************************************************
2 * Copyright(c) 2004-2006, 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#include "AliITSDigitUpgrade.h"
19#include "AliITSsegmentationUpgrade.h"
20#include "AliLog.h"
21
22///////////////////////////////////////////////////////////////////
23// //
28798685 24// Class defining the digit object //
25// for ITS upgrade //
26// Inherits from AliDigit //
1d9af2d5 27// //
28///////////////////////////////////////////////////////////////////
29
30ClassImp(AliITSDigitUpgrade)
31//______________________________________________________________________
28798685 32 AliITSDigitUpgrade::AliITSDigitUpgrade():
33 AliDigit(),
34 fPixId(9999),
35 fSignal(0),
36 fNLayer(0),
37 fModule(0),
38 fNelectrons(0),
39 fNTracksIdMC(0)
9b615954 40{
9e7c5dbf 41 //
42 // default constructor
43 //
9b615954 44 for(Int_t i=0; i<kMaxLab ; i++) {
45 fTrackIdMC[i]=-1;
46 fSignalID[i]=-1;
47 }
9e7c5dbf 48}
1d9af2d5 49//_______________________________________________________________________
28798685 50AliITSDigitUpgrade::AliITSDigitUpgrade(Int_t *digits):
51 AliDigit(digits),
52 fPixId(9999),
53 fSignal(0),
54 fNLayer(0),
55 fModule(0),
56 fNelectrons(0),
57 fNTracksIdMC(0)
9b615954 58{
9e7c5dbf 59 //
60 // constructor
61 //
9b615954 62 for(Int_t i=0; i<kMaxLab ; i++) {
63 fTrackIdMC[i]=-1;
64 fSignalID[i]=-1;
65 }
9e7c5dbf 66}
1d9af2d5 67//____________________________________________________________________________________________________
28798685 68AliITSDigitUpgrade::AliITSDigitUpgrade(ULong_t pixid, Float_t eloss):
69 AliDigit(),
70 fPixId(pixid),
71 fSignal(eloss),
72 fNLayer(0),
73 fModule(0),
74 fNelectrons(0),
75 fNTracksIdMC(0)
9b615954 76{
9e7c5dbf 77 //
78 // Used constructor in simulation
79 //
9b615954 80 for(Int_t i=0; i<kMaxLab ; i++) {
81 fTrackIdMC[i]=-1;
82 fSignalID[i]=-1;
83 }
9e7c5dbf 84}
1d9af2d5 85//____________________________________________________________________________________________________
28798685 86AliITSDigitUpgrade::AliITSDigitUpgrade(const AliITSDigitUpgrade &d):
87 AliDigit(d),
88 fPixId(d.fPixId),
89 fSignal(d.fSignal),
90 fNLayer(d.fNLayer),
91 fModule(d.fModule),
92 fNelectrons(d.fNelectrons),
93 fNTracksIdMC(d.fNTracksIdMC)
9b615954 94{
9e7c5dbf 95 //
96 // copy constructor
97 //
9b615954 98 for(Int_t i=0; i<kMaxLab ; i++) {
99 fTrackIdMC[i]=d.fTrackIdMC[i];
100 fSignalID[i]=d.fSignalID[i];
101 }
102 for(Int_t i=0; i<3 ; i++) fSignalID[i]=d.fSignalID[i];
9e7c5dbf 103}
9b615954 104
105//____________________________________________________________________________________________________
106void AliITSDigitUpgrade::AddTrackID(Int_t tid) {
107 //
108 // Add an MC label (track ID) to the "expanded list"
109 //
110 if (fNTracksIdMC==kMaxLab) {
111 AliWarning("Max. numbers of labels reached!");
112 } else {
113 fTrackIdMC[fNTracksIdMC]=tid;
114 fNTracksIdMC++;
115 }
116}
117
1d9af2d5 118//____________________________________________________________________________________________________
119void AliITSDigitUpgrade::GetPosition(Int_t ilayer, Int_t nx, Int_t nz, Double_t &xloc, Double_t &zloc){
28798685 120 //
121 // Determines the local coordinates of the center of the pixel (a digit is a pixel)
122 //
123
1d9af2d5 124 AliITSsegmentationUpgrade *s =new AliITSsegmentationUpgrade();
125 if(s->GetCellSizeX(ilayer)!=0) xloc= (nx)*(s->GetCellSizeX(ilayer))+0.5*(s->GetCellSizeX(ilayer));
126 else AliError("Upgrade segmentation not initalized");
127
128 if(s->GetCellSizeZ(ilayer)!=0)
129 zloc=(nz)*(s->GetCellSizeZ(ilayer))+0.5*(s->GetCellSizeZ(ilayer))-(s->GetHalfLength(ilayer));
130 else AliError("Upgrade segmentation not initalized");
131 delete s;
132}
133//____________________________________________________________________________________________________
134void AliITSDigitUpgrade::PrintInfo(){
28798685 135 //
1d9af2d5 136 //Standard output format for this class
28798685 137 //
138
1d9af2d5 139 Double_t xz[2]={-1,-1};
140 GetPosition(fNLayer,GetxPixelNumber(),GetzPixelNumber(),xz[0],xz[1]);
141
29b562a5 142 printf("pixid %10.0i (%6.3f,%6.3f) in layer %i \n",(Int_t)fPixId,xz[0],xz[1],fNLayer);
0ac80088 143 printf("pixid %u ",(UInt_t)fPixId);
144 printf(" (xloc, zloc)= (%6.3f, %6.3f) in layer %i and module %i \n",xz[0],xz[1],fNLayer, fModule);
9b615954 145 printf(" Eloss %f Nel %f \n ",fSignal, fNelectrons);
146 printf(" MC Track Ids =(");
147 if (kMaxLab<=fNTracksIdMC) {
148 for (Int_t i=0; i<kMaxLab; i++) { printf("%d,",fTrackIdMC[i]); }
149 printf(")\n ElossID = (");
150 for (Int_t i=0; i<kMaxLab; i++) { printf("%lf,",fSignalID[i]); }
151 } else {
152 for (Int_t i=0; i<fNTracksIdMC; i++) { printf("%d,",fTrackIdMC[i]); }
153 printf(")\n ElossID = (");
154 for (Int_t i=0; i<fNTracksIdMC; i++) { printf("%lf,",fSignalID[i]); }
155 }
156 printf(")\n");
1d9af2d5 157}
158