]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSdigitSSD.cxx
Coding conventions
[u/mrichter/AliRoot.git] / ITS / AliITSdigitSSD.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 #include <AliITSdigitSSD.h>
17 #include <TArrayI.h>
18
19 ///////////////////////////////////////////////////////////////////
20 //                                                               //
21 // Class defining the digit object
22 // for SSD
23 // Inherits from AliITSdigit
24 //                                                               //
25 ///////////////////////////////////////////////////////////////////
26
27 ClassImp(AliITSdigitSSD)
28
29 //______________________________________________________________________
30 AliITSdigitSSD::AliITSdigitSSD():AliITSdigit(){
31     // default constructor
32     Int_t i;
33
34     for(i=0; i<fgkSize; i++) fTracks[i] = -3;
35     for(i=0; i<fgkSize; i++) fHits[i] = -1;
36 }
37 //__________________________________________________________________________
38 AliITSdigitSSD::AliITSdigitSSD(const Int_t *digits):AliITSdigit(digits){
39     // Creates a real SSD digit object
40 }
41 //_____________________________________________________________________________
42 AliITSdigitSSD::AliITSdigitSSD(const Int_t *digits,const Int_t *tracks,
43                                const Int_t *hits):AliITSdigit(digits){
44     // Creates a simulated SSD digit object
45
46     for(Int_t i=0; i<fgkSize; i++) {
47         fTracks[i] = tracks[i];
48         fHits[i]   = hits[i];
49     } // end for i
50 }
51 //______________________________________________________________________
52 Int_t AliITSdigitSSD::GetListOfTracks(TArrayI &t){
53     // Fills the TArrayI t with the tracks found in fTracks removing
54     // duplicated tracks, but otherwise in the same order. It will return
55     // the number of tracks and fill the remaining elements to the array
56     // t with -1.
57     // Inputs:
58     //   TArrayI  &t Reference to a TArrayI to contain the list of
59     //               nonduplicated track numbers.
60     // Output:
61     //   TArrayI  &t The input array filled with the nonduplicated track
62     //               numbers.
63     // Return:
64     //   Int_t The number of none -1 entries in the TArrayI t.
65     Int_t nt = t.GetSize();
66     Int_t nth = this->GetNTracks();
67     Int_t n = 0,i,j;
68     Bool_t inlist = kFALSE;
69
70     t.Reset(-1); // -1 array.
71     for(i=0;i<nth;i++) {
72         if(this->GetTrack(i) == -1) continue;
73         inlist = kFALSE;
74         for(j=0;j<n;j++)if(this->GetTrack(i) == t.At(j)) inlist = kTRUE;
75         if(!inlist){ // add to end of list
76             t.AddAt(this->GetTrack(i),n);
77             if(n<nt) n++;
78         } // end if
79     } // end for i
80     return n;
81 }
82 //______________________________________________________________________
83 void AliITSdigitSSD::Print(ostream *os){
84     //Standard output format for this class
85     Int_t i;
86
87     AliITSdigit::Print(os);
88     for(i=0; i<fgkSize; i++) *os <<","<< fTracks[i];
89     for(i=0; i<fgkSize; i++) *os <<","<< fHits[i];
90 }
91 //______________________________________________________________________
92 void AliITSdigitSSD::Read(istream *os){
93     //Standard input for this class
94     Int_t i;
95
96     AliITSdigit::Read(os);
97     for(i=0; i<fgkSize; i++) *os >> fTracks[i];
98     for(i=0; i<fgkSize; i++) *os >> fHits[i];
99 }
100 //______________________________________________________________________
101 ostream &operator<<(ostream &os,AliITSdigitSSD &source){
102     // Standard output streaming function.
103
104     source.Print(&os);
105     return os;
106 }
107 //______________________________________________________________________
108 istream &operator>>(istream &os,AliITSdigitSSD &source){
109     // Standard output streaming function.
110
111     source.Read(&os);
112     return os;
113 }