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