Line data Source code
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 <AliITSdigitSPD.h>
17 : #include <TArrayI.h>
18 : #include <iostream>
19 :
20 : ///////////////////////////////////////////////////////////////////
21 : // //
22 : // Class defining the digit object
23 : // for SPD
24 : // Inherits from AliITSdigit
25 : // //
26 : ///////////////////////////////////////////////////////////////////
27 :
28 118 : ClassImp(AliITSdigitSPD)
29 :
30 : //______________________________________________________________________
31 33 : AliITSdigitSPD::AliITSdigitSPD():AliITSdigit(),
32 165 : fSignalSPD(0){
33 : // default constructor, zero coordinates and set array
34 : // elements to clearly unphysical values. A value of 0 may
35 : // be a valide track of hit number.
36 : Int_t i;
37 :
38 726 : for(i=0;i<fgkSize;i++) fTracks[i] = -3;
39 726 : for(i=0;i<fgkSize;i++) fHits[i] = -1;
40 66 : }
41 : //______________________________________________________________________
42 0 : AliITSdigitSPD::AliITSdigitSPD(const Int_t *digits):
43 0 : fSignalSPD(digits[2]){
44 : // Creates a SPD digit object
45 : Int_t i;
46 :
47 0 : for(i=0;i<fgkSize;i++) fTracks[i] = -3;
48 0 : for(i=0;i<fgkSize;i++) fHits[i] = -1;
49 0 : fCoord1 = digits[0];
50 0 : fCoord2 = digits[1];
51 0 : fSignal = 1;
52 0 : }
53 : //______________________________________________________________________
54 0 : AliITSdigitSPD::AliITSdigitSPD(const Int_t *digits,const Int_t *tracks,
55 : const Int_t *hits):
56 0 : fSignalSPD(digits[2]){
57 : // Creates a simulated SPD digit object
58 :
59 0 : for(Int_t i=0; i<fgkSize; i++) {
60 0 : fTracks[i] = tracks[i];
61 0 : fHits[i] = hits[i];
62 : } // end for i
63 0 : fCoord1 = digits[0];
64 0 : fCoord2 = digits[1];
65 0 : fSignal = 1;
66 0 : }
67 : //______________________________________________________________________
68 : Int_t AliITSdigitSPD::GetListOfTracks(TArrayI &t){
69 : // Fills the TArrayI t with the tracks found in fTracks removing
70 : // duplicated tracks, but otherwise in the same order. It will return
71 : // the number of tracks and fill the remaining elements to the array
72 : // t with -1.
73 : // Inputs:
74 : // TArrayI &t Reference to a TArrayI to contain the list of
75 : // nonduplicated track numbers.
76 : // Output:
77 : // TArrayI &t The input array filled with the nonduplicated track
78 : // numbers.
79 : // Return:
80 : // Int_t The number of none -1 entries in the TArrayI t.
81 0 : Int_t nt = t.GetSize();
82 0 : Int_t nth = this->GetNTracks();
83 : Int_t n = 0,i,j;
84 : Bool_t inlist = kFALSE;
85 :
86 0 : t.Reset(-1); // -1 array.
87 0 : for(i=0;i<nth;i++) {
88 0 : if(this->GetTrack(i) == -1) continue;
89 : inlist = kFALSE;
90 0 : for(j=0;j<n;j++)if(this->GetTrack(i) == t.At(j)) inlist = kTRUE;
91 0 : if(!inlist){ // add to end of list
92 0 : t.AddAt(this->GetTrack(i),n);
93 0 : if(n<nt) n++;
94 : } // end if
95 : } // end for i
96 0 : return n;
97 : }
98 : //______________________________________________________________________
99 : void AliITSdigitSPD::Print(ostream *os){
100 : //Standard output format for this class
101 : Int_t i;
102 :
103 0 : AliITSdigit::Print(os);
104 0 : for(i=0;i<fgkSize;i++) *os <<","<< fTracks[i];
105 0 : for(i=0;i<fgkSize;i++) *os <<","<< fHits[i];
106 0 : *os << "," << fSignalSPD;
107 0 : }
108 : //______________________________________________________________________
109 : void AliITSdigitSPD::Read(istream *os){
110 : //Standard input for this class
111 : Int_t i;
112 :
113 0 : AliITSdigit::Read(os);
114 0 : for(i=0;i<fgkSize;i++) *os >> fTracks[i];
115 0 : for(i=0;i<fgkSize;i++) *os >> fHits[i];
116 0 : *os >> fSignalSPD;
117 0 : }
118 : //______________________________________________________________________
119 : ostream &operator<<(ostream &os,AliITSdigitSPD &source){
120 : // Standard output streaming function.
121 :
122 0 : source.Print(&os);
123 0 : return os;
124 : }
125 : //______________________________________________________________________
126 : istream &operator>>(istream &os,AliITSdigitSPD &source){
127 : // Standard output streaming function.
128 :
129 0 : source.Read(&os);
130 0 : return os;
131 : }
|