242b332c |
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 | /////////////////////////////////////////////////////////////////////////////// |
18 | // // |
6769d914 |
19 | // ALICE Reconstruction parameterization: // |
20 | // // |
21 | // // |
22 | // Base Class for Detector reconstruction parameters // |
23 | // Revision: cvetan.cheshkov@cern.ch 12/06/2008 // |
24 | // Its structure has been revised and it is interfaced to AliEventInfo. // |
242b332c |
25 | // // |
26 | /////////////////////////////////////////////////////////////////////////////// |
27 | |
28 | #include "TObjArray.h" |
29 | #include "AliDetectorRecoParam.h" |
30 | |
6bcbb25b |
31 | #include "AliLog.h" |
242b332c |
32 | #include "AliRecoParam.h" |
33 | |
34 | |
35 | ClassImp(AliRecoParam) |
36 | |
6769d914 |
37 | AliRecoParam::AliRecoParam(): |
38 | TNamed("",""), |
39 | fRecoParamArray(0) |
242b332c |
40 | { |
6769d914 |
41 | // Default constructor |
42 | // ... |
242b332c |
43 | } |
44 | |
6769d914 |
45 | AliRecoParam::AliRecoParam(const char *detector): |
46 | TNamed(detector,detector), |
242b332c |
47 | fRecoParamArray(0) |
48 | { |
6769d914 |
49 | // Default constructor |
50 | // ... |
242b332c |
51 | } |
52 | |
53 | AliRecoParam::~AliRecoParam(){ |
6769d914 |
54 | // Destructor |
55 | // ... |
56 | // Delete the array with the reco-param objects |
242b332c |
57 | if (fRecoParamArray){ |
58 | fRecoParamArray->Delete(); |
59 | delete fRecoParamArray; |
60 | } |
61 | } |
62 | |
6769d914 |
63 | void AliRecoParam::Print(Option_t *option) const { |
242b332c |
64 | // |
65 | // Print reconstruction setup |
66 | // |
6769d914 |
67 | printf("AliRecoParam object for %s\n",GetName()); |
242b332c |
68 | if (!fRecoParamArray) return; |
69 | Int_t nparam = fRecoParamArray->GetEntriesFast(); |
70 | for (Int_t iparam=0; iparam<nparam; iparam++){ |
71 | AliDetectorRecoParam * param = (AliDetectorRecoParam *)fRecoParamArray->At(iparam); |
72 | if (!param) continue; |
73 | param->Print(option); |
74 | } |
75 | } |
76 | |
6bcbb25b |
77 | AliDetectorRecoParam *AliRecoParam::GetRecoParam(const AliEventInfo &/*evInfo*/) const { |
78 | // To be implemented by the detectors |
79 | // Here we return the last AliDetectorRecoParam!! |
80 | if (!fRecoParamArray) return NULL; |
81 | if (fRecoParamArray->GetEntriesFast() != 1) |
82 | AliWarning(Form("Method not implemented by the detector %s, using the last AliDetectorRecoParam !",GetName())); |
83 | |
84 | return (AliDetectorRecoParam *)fRecoParamArray->Last(); |
85 | } |
86 | |
6769d914 |
87 | void AliRecoParam::AddRecoParam(AliDetectorRecoParam* param){ |
88 | // Add an instance of reco params object into |
89 | // the fRecoParamArray |
242b332c |
90 | // |
91 | if (!fRecoParamArray) fRecoParamArray = new TObjArray; |
92 | fRecoParamArray->AddLast(param); |
93 | } |