1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "AliFastDetector.h"
19 #include "AliFastResponse.h"
20 #include "AliGeometry.h"
23 #include <TIterator.h>
26 ClassImp(AliFastDetector)
27 AliFastDetector::AliFastDetector()
29 // Default Constructor
30 fName = "FastDetector";
31 fTitle = "Fast Detector Base Class";
39 AliFastDetector::AliFastDetector(char* Name, char* Title):
43 fSubdetectors = new TList();
44 fResponses = new TList();
47 AliFastDetector::~AliFastDetector()
55 void AliFastDetector::Init()
60 TIter nextRes(fResponses);
63 // Loop over responses and initialize
64 while((res = (AliFastResponse*)nextRes())) {
68 TIter nextDet(fSubdetectors);
71 // Loop over subdetectors and initialize
72 while((det = (AliFastDetector*)nextDet())) {
78 if ((obj = fResponses->FindObject("Efficiency")))
81 fEfficiency = (AliFastResponse*) obj;
82 printf("Detector %s provides Efficiency: %s\n",
83 fName.Data(), fEfficiency->GetTitle());
86 if ((obj = fResponses->FindObject("Resolution")))
88 fResolution = (AliFastResponse*) obj;
89 printf("Detector %s provides Resolution: %s\n",
90 fName.Data(), fResolution->GetTitle());
94 Float_t AliFastDetector::EvaluateEfficiency(AliFastParticle* part)
96 TIter nextDet(fSubdetectors);
99 // Loop over subdetectors
101 while((det = (AliFastDetector*)nextDet())) {
102 eff *= det->EvaluateEfficiency(part);
107 Bool_t AliFastDetector::EvaluateAcceptance(AliFastParticle* part)
110 // Loop over subdetectors
114 TIter nextDet(fSubdetectors);
115 AliFastDetector *det;
116 while((det = (AliFastDetector*)nextDet()) && !acc) {
117 acc = (acc || det->EvaluateAcceptance(part));
121 acc = fGeometry->Impact((TParticle*) part);
127 void AliFastDetector::EvaluateResponse(AliFastParticle* /*part*/)
132 void AliFastDetector::
133 AddSubdetector(AliFastDetector *Detector, char* /*Name*/)
136 // Add detector to list
137 fSubdetectors->Add(Detector);
142 void AliFastDetector::
143 AddResponse(AliFastResponse *Response)
146 // Add detector to list
147 fResponses->Add(Response);
151 AliFastDetector* AliFastDetector::FirstSubdetector()
153 // Iterator over generators: Initialisation
154 fLnkD = fSubdetectors->FirstLink();
156 return (AliFastDetector*) (fLnkD->GetObject());
162 AliFastDetector* AliFastDetector::NextSubdetector()
164 // Iterator over generators: Increment
165 fLnkD = fLnkD->Next();
167 return (AliFastDetector*) (fLnkD->GetObject());
174 AliFastResponse* AliFastDetector::FirstResponse()
176 // Iterator over generators: Initialisation
177 fLnkR = fResponses->FirstLink();
179 return (AliFastResponse*) (fLnkR->GetObject());
185 AliFastResponse* AliFastDetector::NextResponse()
187 // Iterator over generators: Increment
188 fLnkR = fLnkR->Next();
190 return (AliFastResponse*) (fLnkR->GetObject());