]>
Commit | Line | Data |
---|---|---|
73d51118 | 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 | // // | |
19 | // blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa // | |
20 | // // | |
21 | /////////////////////////////////////////////////////////////////////////////// | |
22 | #include "AliTPCAnalysisTaskcalib.h" | |
23 | #include "TChain.h" | |
24 | #include "AliTPCcalibBase.h" | |
25 | #include "AliESDEvent.h" | |
26 | #include "AliESDfriend.h" | |
27 | #include "AliESDfriendTrack.h" | |
28 | #include "AliTPCseed.h" | |
29 | #include "AliESDInputHandler.h" | |
30 | #include "AliAnalysisManager.h" | |
31 | ||
32 | ClassImp(AliTPCAnalysisTaskcalib) | |
33 | ||
34 | AliTPCAnalysisTaskcalib::AliTPCAnalysisTaskcalib(const char *name) | |
35 | :AliAnalysisTask(name,""), | |
36 | fCalibJobs(0), | |
0db06ea6 | 37 | fESD(0), |
38 | fESDfriend(0) | |
73d51118 | 39 | { |
40 | // | |
41 | // Constructor | |
42 | // | |
43 | DefineInput(0, TChain::Class()); | |
44 | DefineOutput(0, TObjArray::Class()); | |
45 | } | |
46 | ||
47 | AliTPCAnalysisTaskcalib::~AliTPCAnalysisTaskcalib() { | |
48 | // | |
49 | // destructor | |
50 | // | |
51 | } | |
52 | ||
53 | void AliTPCAnalysisTaskcalib::Exec(Option_t *) { | |
54 | // | |
55 | // Exec function | |
56 | // Loop over tracks and call Process function | |
57 | if (!fESD) { | |
58 | Printf("ERROR: fESD not available"); | |
59 | return; | |
60 | } | |
61 | fESDfriend=static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend")); | |
62 | if (!fESDfriend) { | |
63 | Printf("ERROR: fESDfriend not available"); | |
64 | return; | |
65 | } | |
66 | Int_t n=fESD->GetNumberOfTracks(); | |
67 | for (Int_t i=0;i<n;++i) { | |
68 | AliESDfriendTrack *friendTrack=fESDfriend->GetTrack(i); | |
0db06ea6 | 69 | TObject *calibObject=0; |
73d51118 | 70 | AliTPCseed *seed=0; |
0db06ea6 | 71 | for (Int_t j=0;(calibObject=friendTrack->GetCalibObject(j));++j) |
72 | if ((seed=dynamic_cast<AliTPCseed*>(calibObject))) | |
73d51118 | 73 | break; |
74 | if (seed) | |
75 | Process(seed); | |
76 | } | |
77 | PostData(0,&fCalibJobs); | |
78 | } | |
79 | ||
80 | void AliTPCAnalysisTaskcalib::ConnectInputData(Option_t *) { | |
81 | // | |
82 | // | |
83 | // | |
84 | TTree* tree=dynamic_cast<TTree*>(GetInputData(0)); | |
85 | if (!tree) { | |
86 | Printf("ERROR: Could not read chain from input slot 0"); | |
87 | } | |
88 | else { | |
89 | AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); | |
90 | if (!esdH) { | |
91 | Printf("ERROR: Could not get ESDInputHandler"); | |
92 | } | |
93 | else { | |
94 | fESD = esdH->GetEvent(); | |
95 | Printf("*** CONNECTED NEW EVENT ****"); | |
96 | } | |
97 | } | |
98 | } | |
99 | ||
100 | void AliTPCAnalysisTaskcalib::CreateOutputObjects() { | |
101 | // | |
102 | // | |
103 | // | |
104 | } | |
0db06ea6 | 105 | void AliTPCAnalysisTaskcalib::Terminate(Option_t */*option*/) { |
73d51118 | 106 | } |
107 | ||
108 | // we could have been living inside a master class... | |
109 | void AliTPCAnalysisTaskcalib::Process(AliESDEvent *event) { | |
110 | TIterator *i=fCalibJobs.MakeIterator(); | |
111 | AliTPCcalibBase *job; | |
0db06ea6 | 112 | while ((job=dynamic_cast<AliTPCcalibBase*>(i->Next()))) |
73d51118 | 113 | job->Process(event); |
114 | } | |
115 | ||
116 | void AliTPCAnalysisTaskcalib::Process(AliTPCseed *track) { | |
117 | TIterator *i=fCalibJobs.MakeIterator(); | |
118 | AliTPCcalibBase *job; | |
0db06ea6 | 119 | while ((job=dynamic_cast<AliTPCcalibBase*>(i->Next()))) |
73d51118 | 120 | job->Process(track); |
121 | } | |
122 | ||
123 | Long64_t AliTPCAnalysisTaskcalib::Merge(TCollection *li) { | |
124 | TIterator *i=fCalibJobs.MakeIterator(); | |
125 | AliTPCcalibBase *job; | |
126 | Long64_t n=0; | |
0db06ea6 | 127 | while ((job=dynamic_cast<AliTPCcalibBase*>(i->Next()))) |
73d51118 | 128 | n+=job->Merge(li); |
129 | return n; | |
130 | } | |
131 | ||
132 | void AliTPCAnalysisTaskcalib::Analyze() { | |
133 | TIterator *i=fCalibJobs.MakeIterator(); | |
134 | AliTPCcalibBase *job; | |
0db06ea6 | 135 | while ((job=dynamic_cast<AliTPCcalibBase*>(i->Next()))) |
73d51118 | 136 | job->Analyze(); |
137 | } |