]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FASTSIM/AliFastDetector.cxx
Warning message and error related to copy constructor corrected.
[u/mrichter/AliRoot.git] / FASTSIM / AliFastDetector.cxx
CommitLineData
8bb5c9a6 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
803d1ab0 16/* $Id$ */
8bb5c9a6 17
18#include "AliFastDetector.h"
19#include "AliFastResponse.h"
20#include "AliGeometry.h"
21
22#include <TList.h>
23#include <TIterator.h>
24#include <TString.h>
25
26ClassImp(AliFastDetector)
27AliFastDetector::AliFastDetector()
28{
29// Default Constructor
30 fName = "FastDetector";
31 fTitle = "Fast Detector Base Class";
32 fLnkD = 0;
33 fLnkR = 0;
34
35 fResponses = 0;
36 fSubdetectors = 0;
37}
38
39AliFastDetector::AliFastDetector(char* Name, char* Title):
40 TNamed(Name, Title)
41{
42// Constructor
43 fSubdetectors = new TList();
44 fResponses = new TList();
45}
46
47AliFastDetector::~AliFastDetector()
48{
49// Destructor
50 delete fSubdetectors;
51 delete fResponses;
52}
53
54
55void AliFastDetector::Init()
56{
57//
58// Initialisation
59//
60 TIter nextRes(fResponses);
61 AliFastResponse *res;
62 //
63 // Loop over responses and initialize
64 while((res = (AliFastResponse*)nextRes())) {
65 res->Init();
66 }
67
68 TIter nextDet(fSubdetectors);
69 AliFastDetector *det;
70 //
71 // Loop over subdetectors and initialize
72 while((det = (AliFastDetector*)nextDet())) {
73 det->Init();
74 }
75 //
76 TObject* obj;
77
78 if ((obj = fResponses->FindObject("Efficiency")))
79 {
80
81 fEfficiency = (AliFastResponse*) obj;
82 printf("Detector %s provides Efficiency: %s\n",
83 fName.Data(), fEfficiency->GetTitle());
84 }
85
86 if ((obj = fResponses->FindObject("Resolution")))
87 {
88 fResolution = (AliFastResponse*) obj;
89 printf("Detector %s provides Resolution: %s\n",
90 fName.Data(), fResolution->GetTitle());
91 }
92}
93
94Float_t AliFastDetector::EvaluateEfficiency(AliFastParticle* part)
95{
96 TIter nextDet(fSubdetectors);
97 AliFastDetector *det;
98 //
99 // Loop over subdetectors
100 Float_t eff = 1;
101 while((det = (AliFastDetector*)nextDet())) {
102 eff *= det->EvaluateEfficiency(part);
103 }
104 return eff;
105}
106
107Bool_t AliFastDetector::EvaluateAcceptance(AliFastParticle* part)
108{
109 //
110 // Loop over subdetectors
111 Bool_t acc = kFALSE;
112
113 if (fSubdetectors) {
114 TIter nextDet(fSubdetectors);
115 AliFastDetector *det;
116 while((det = (AliFastDetector*)nextDet()) && !acc) {
117 acc = (acc || det->EvaluateAcceptance(part));
118 }
119 } else {
120 if (fGeometry)
121 acc = fGeometry->Impact((TParticle*) part);
122 }
123
124 return acc;
125}
126
127void AliFastDetector::EvaluateResponse(AliFastParticle* part)
128{
129 ;
130}
131
132void AliFastDetector::
133AddSubdetector(AliFastDetector *Detector, char* Name)
134{
135//
136// Add detector to list
137 fSubdetectors->Add(Detector);
138}
139
140
141
142void AliFastDetector::
143AddResponse(AliFastResponse *Response)
144{
145//
146// Add detector to list
147 fResponses->Add(Response);
148}
149
150
151AliFastDetector* AliFastDetector::FirstSubdetector()
152{
153// Iterator over generators: Initialisation
154 fLnkD = fSubdetectors->FirstLink();
155 if (fLnkD) {
156 return (AliFastDetector*) (fLnkD->GetObject());
157 } else {
158 return 0;
159 }
160}
161
162AliFastDetector* AliFastDetector::NextSubdetector()
163{
164// Iterator over generators: Increment
165 fLnkD = fLnkD->Next();
166 if (fLnkD) {
167 return (AliFastDetector*) (fLnkD->GetObject());
168 } else {
169 return 0;
170 }
171}
172
173
174AliFastResponse* AliFastDetector::FirstResponse()
175{
176// Iterator over generators: Initialisation
177 fLnkR = fResponses->FirstLink();
178 if (fLnkR) {
179 return (AliFastResponse*) (fLnkR->GetObject());
180 } else {
181 return 0;
182 }
183}
184
185AliFastResponse* AliFastDetector::NextResponse()
186{
187// Iterator over generators: Increment
188 fLnkR = fLnkR->Next();
189 if (fLnkR) {
190 return (AliFastResponse*) (fLnkR->GetObject());
191 } else {
192 return 0;
193 }
194}
195
196