Splitting of TRD library (T.Kuhr)
[u/mrichter/AliRoot.git] / TRD / AliTRDReconstructor.cxx
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 /* $Id$ */
17
18 ///////////////////////////////////////////////////////////////////////////////
19 //                                                                           //
20 // class for TRD reconstruction                                              //
21 //                                                                           //
22 ///////////////////////////////////////////////////////////////////////////////
23
24
25 #include "AliTRDReconstructor.h"
26 #include "AliRunLoader.h"
27 #include "AliTRDparameter.h"
28 #include "AliTRDclusterizerV1.h"
29 #include "AliTRDtracker.h"
30 #include <TFile.h>
31
32
33 ClassImp(AliTRDReconstructor)
34
35
36 //_____________________________________________________________________________
37 void AliTRDReconstructor::Reconstruct(AliRunLoader* runLoader) const
38 {
39 // reconstruct clusters
40
41   AliLoader *loader=runLoader->GetLoader("TRDLoader");
42   loader->LoadRecPoints("recreate");
43
44   AliTRDclusterizerV1 clusterer("clusterer", "TRD clusterizer");
45   runLoader->CdGAFile();
46   AliTRDparameter* trdParam = GetTRDparameter(runLoader); 
47   if (!trdParam) {
48     Error("Reconstruct", "no TRD parameters found");
49     return;
50   }
51   trdParam->ReInit();
52   clusterer.SetParameter(trdParam);
53   Int_t nEvents = runLoader->GetNumberOfEvents();
54
55   for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
56     clusterer.Open(runLoader->GetFileName(), iEvent);
57     clusterer.ReadDigits();
58     clusterer.MakeClusters();
59     clusterer.WriteClusters(-1);
60   }
61 }
62
63 //_____________________________________________________________________________
64 AliTracker* AliTRDReconstructor::CreateTracker(AliRunLoader* runLoader) const
65 {
66 // create a TRD tracker
67
68   runLoader->CdGAFile();
69   return new AliTRDtracker(gFile);
70 }
71
72 //_____________________________________________________________________________
73 void AliTRDReconstructor::FillESD(AliRunLoader* /*runLoader*/, 
74                                   AliESD* /*esd*/) const
75 {
76 }
77
78
79 //_____________________________________________________________________________
80 AliTRDparameter* AliTRDReconstructor::GetTRDparameter(AliRunLoader* runLoader) const
81 {
82 // get the TRD parameters
83
84   runLoader->CdGAFile();
85   AliTRDparameter* trdParam = (AliTRDparameter*) gFile->Get("TRDparameter"); 
86   if (!trdParam) {
87     Error("GetTRDparameter", "no TRD parameters available");
88     return NULL;
89   }
90   return trdParam;
91 }
92
93