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 ///////////////////////////////////////////////////////////////////////////////
20 // class for TPC reconstruction //
22 ///////////////////////////////////////////////////////////////////////////////
25 #include "AliTPCReconstructor.h"
26 #include "AliRunLoader.h"
28 #include "AliRawReader.h"
29 #include "AliTPCclustererMI.h"
30 #include "AliTPCtrackerMI.h"
31 #include "AliTPCpidESD.h"
32 #include "AliTPCParam.h"
33 #include "AliTPCParamSR.h"
34 #include "AliTPCcalibDB.h"
36 ClassImp(AliTPCReconstructor)
38 Double_t AliTPCReconstructor::fgCtgRange = 1.05;
39 Double_t AliTPCReconstructor::fgMaxSnpTracker = 0.95; // max tangent in tracker - correspond to 3
40 Double_t AliTPCReconstructor::fgMaxSnpTrack = 0.999; // tangent
41 Int_t AliTPCReconstructor::fgStreamLevel = 0; // stream (debug) level
42 //_____________________________________________________________________________
43 void AliTPCReconstructor::Reconstruct(AliRunLoader* runLoader) const
45 // reconstruct clusters
47 AliLoader* loader = runLoader->GetLoader("TPCLoader");
49 Error("Reconstruct", "TPC loader not found");
52 loader->LoadRecPoints("recreate");
53 loader->LoadDigits("read");
55 AliTPCParam* param = GetTPCParam(runLoader);
57 AliTPCclustererMI clusterer(param);
58 Int_t nEvents = runLoader->GetNumberOfEvents();
60 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
61 runLoader->GetEvent(iEvent);
63 TTree* treeClusters = loader->TreeR();
65 loader->MakeTree("R");
66 treeClusters = loader->TreeR();
68 TTree* treeDigits = loader->TreeD();
70 Error("Reconstruct", "Can't get digits tree !");
74 clusterer.SetInput(treeDigits);
75 clusterer.SetOutput(treeClusters);
76 clusterer.Digits2Clusters();
78 loader->WriteRecPoints("OVERWRITE");
81 loader->UnloadRecPoints();
82 loader->UnloadDigits();
85 //_____________________________________________________________________________
86 void AliTPCReconstructor::Reconstruct(AliRunLoader* runLoader,
87 AliRawReader* rawReader) const
89 // reconstruct clusters from raw data
91 AliLoader* loader = runLoader->GetLoader("TPCLoader");
93 Error("Reconstruct", "TPC loader not found");
96 loader->LoadRecPoints("recreate");
98 AliTPCParam* param = GetTPCParam(runLoader);
100 AliWarning("Loading default TPC parameters !");
101 param = new AliTPCParamSR;
103 AliTPCclustererMI clusterer(param);
105 TString option = GetOption();
106 if (option.Contains("PedestalSubtraction"))
107 clusterer.SetPedSubtraction(kTRUE);
108 if (option.Contains("OldRCUFormat"))
109 clusterer.SetOldRCUFormat(kTRUE);
112 while (rawReader->NextEvent() && iEvent<35) {
113 runLoader->GetEvent(iEvent++);
115 TTree* treeClusters = loader->TreeR();
117 loader->MakeTree("R");
118 treeClusters = loader->TreeR();
121 clusterer.SetOutput(treeClusters);
122 clusterer.Digits2Clusters(rawReader);
124 loader->WriteRecPoints("OVERWRITE");
127 loader->UnloadRecPoints();
130 //_____________________________________________________________________________
131 AliTracker* AliTPCReconstructor::CreateTracker(AliRunLoader* runLoader) const
133 // create a TPC tracker
135 AliTPCParam* param = GetTPCParam(runLoader);
137 AliWarning("Loading default TPC parameters !");
138 param = new AliTPCParamSR;
140 param->ReadGeoMatrices();
141 return new AliTPCtrackerMI(param);
144 //_____________________________________________________________________________
145 void AliTPCReconstructor::FillESD(AliRunLoader* /*runLoader*/,
150 Double_t parTPC[] = {47., 0.10, 10.};
151 AliTPCpidESD tpcPID(parTPC);
156 //_____________________________________________________________________________
157 AliTPCParam* AliTPCReconstructor::GetTPCParam(AliRunLoader* /*runLoader*/) const
159 // get the TPC parameters
161 // TDirectory* saveDir = gDirectory;
162 //runLoader->CdGAFile();
164 AliTPCParam* param = AliTPCcalibDB::Instance()->GetParameters();
166 // AliTPCParam* param = (AliTPCParam*) gDirectory->Get("75x40_100x60_150x60");
167 // if (!param) Error("GetTPCParam", "no TPC parameters found");