]>
Commit | Line | Data |
---|---|---|
4c039060 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | /* | |
17 | $Log$ | |
18 | */ | |
19 | ||
8c555625 | 20 | //----------------------------------------------------------------------------- |
21 | // | |
22 | // Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk | |
23 | // | |
24 | // Implementation of class AliTPCD | |
25 | // | |
26 | //----------------------------------------------------------------------------- | |
27 | ||
28 | #include <TMath.h> | |
29 | #include "AliTPCParam.h" | |
30 | #include "AliTPCRF1D.h" | |
31 | #include "AliTPCPRF2D.h" | |
32 | #include "AliTPCD.h" | |
33 | #include "TClonesArray.h" | |
34 | #include "TClass.h" | |
35 | #include "TBranchClones.h" | |
36 | #include "TTree.h" | |
37 | #include "TDirectory.h" | |
38 | ||
39 | ||
40 | ||
41 | // other include files follow here | |
42 | ||
43 | ||
44 | ClassImp(AliTPCD) | |
45 | //_____________________________________________________________ | |
46 | AliTPCD::AliTPCD(Text_t * name, | |
47 | AliTPCParam * param, AliTPCPRF2D* prf, AliTPCRF1D* prfz) | |
48 | { | |
49 | //construct new object's or accept objects sent to constructor | |
50 | //AliTPCD handle sent object and is repsonsible for | |
51 | //deleting it | |
52 | ||
53 | //Begin_Html | |
54 | /* | |
1439f98e | 55 | <img src="picts/alitpcd.gif"> |
8c555625 | 56 | */ |
57 | //End_Html | |
58 | SetName(name); | |
59 | if ((param!=0) && | |
60 | ( (param->IsA()->InheritsFrom("AliTPCParam")==kTRUE ) )) | |
61 | fParam=param; | |
62 | else | |
63 | fParam= new AliTPCParam; | |
64 | if ( (prf!=0) && (prf->IsA()->InheritsFrom("AliTPCPRF2D")==kTRUE) ) | |
65 | fPRF=prf; | |
66 | else | |
67 | fPRF = new AliTPCPRF2D; | |
68 | if ( (prfz!=0) && (prfz->IsA()->InheritsFrom("AliTPCRF1D")==kTRUE) ) | |
69 | fRF=prfz; | |
70 | else | |
71 | fRF = new AliTPCRF1D(kTRUE); | |
72 | fDigits = new TClonesArray("AliTPCdigit",5000); | |
73 | fpthis=this; | |
74 | } | |
75 | ||
76 | AliTPCD::~AliTPCD() | |
77 | { | |
78 | if (fParam!=0) fParam->Delete(); | |
79 | if (fPRF!=0) fPRF->Delete(); | |
80 | if (fRF!=0) fRF->Delete(); | |
81 | if (fDigits!=0) fDigits->Delete(); | |
82 | } | |
83 | ||
84 | ||
85 | Bool_t AliTPCD::SetTree(Int_t nevent, TDirectory *dir ) | |
86 | { | |
87 | char treeName[100]; | |
88 | // Get Hits Tree header from file | |
89 | sprintf(treeName,"TreeD%d_%s",nevent,GetName()); | |
90 | fTreeD = (TTree*)dir->Get(treeName); | |
91 | if (fTreeD == 0) return kFALSE; | |
92 | //set Digit branch | |
93 | TBranch *b = fTreeD->GetBranch("Digits"); | |
94 | if (b==0) return kFALSE; | |
95 | b->SetAddress(&fDigits); | |
96 | return kTRUE; | |
97 | } | |
98 | ||
99 | ||
100 | Bool_t AliTPCD::MakeTree(Int_t nevent) | |
101 | { | |
102 | char treeName[100]; | |
103 | // Get Hits Tree header from file | |
104 | sprintf(treeName,"TreeD%d_%s",nevent,GetName()); | |
105 | fTreeD = new TTree(treeName,treeName); | |
106 | if (fTreeD == 0) return kFALSE; | |
107 | //set Digit branch | |
108 | TBranch *b = fTreeD->Branch("Digits",&fDigits,40000); | |
109 | if (b==0) return kFALSE; | |
110 | b->SetAddress(&fDigits); | |
111 | ||
112 | return kTRUE; | |
113 | } | |
114 | ||
115 | void AliTPCD::Fill() | |
116 | { | |
117 | if (fTreeD!=0) fTreeD->Fill(); | |
118 | } | |
119 | ||
120 | ||
121 | ||
122 | ||
123 | ||
124 | void AliTPCD::Streamer(TBuffer &R__b) | |
125 | { | |
126 | // Stream an object of class AliTPCD. | |
127 | if (R__b.IsReading()) { | |
128 | Version_t R__v = R__b.ReadVersion(); if (R__v) { } | |
129 | TNamed::Streamer(R__b); | |
130 | if (fParam!=0) { | |
131 | fParam->Delete(); | |
132 | fParam = new AliTPCParam; | |
133 | } | |
134 | if (fPRF!=0) { | |
135 | fPRF->Delete(); | |
136 | fPRF = new AliTPCPRF2D; | |
137 | } | |
138 | if (fRF!=0) { | |
139 | fRF->Delete(); | |
140 | fRF = new AliTPCRF1D; | |
141 | } | |
142 | if (fTreeD!=0) { | |
143 | fRF->Delete(); | |
144 | fRF = new AliTPCRF1D; | |
145 | } | |
146 | R__b >>fParam; | |
147 | R__b >>fPRF; | |
148 | R__b >>fRF; | |
149 | SetTree(); | |
150 | } else { | |
151 | R__b.WriteVersion(AliTPCD::IsA()); | |
152 | TNamed::Streamer(R__b); | |
153 | R__b <<fParam; | |
154 | R__b <<fPRF; | |
155 | R__b <<fRF; | |
156 | if (fTreeD!=0) fTreeD->Write(); | |
157 | } | |
158 | } |