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