]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDReconstructor.cxx
Corrected forward declaration
[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 "AliTRDpidESD.h"
31 #include <TFile.h>
32 #include "AliRawReader.h"
33 #include "AliLog.h"
34
35 ClassImp(AliTRDReconstructor)
36
37
38 //_____________________________________________________________________________
39 void AliTRDReconstructor::Reconstruct(AliRunLoader* runLoader) const
40 {
41 // reconstruct clusters
42
43   AliLoader *loader=runLoader->GetLoader("TRDLoader");
44   loader->LoadRecPoints("recreate");
45
46   AliTRDclusterizerV1 clusterer("clusterer", "TRD clusterizer");
47   runLoader->CdGAFile();
48   AliTRDparameter* trdParam = GetTRDparameter(runLoader); 
49   if (!trdParam) {
50     Error("Reconstruct", "no TRD parameters found");
51     return;
52   }
53   trdParam->ReInit();
54   clusterer.SetParameter(trdParam);
55   Int_t nEvents = runLoader->GetNumberOfEvents();
56
57   for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
58     clusterer.Open(runLoader->GetFileName(), iEvent);
59     clusterer.ReadDigits();
60     clusterer.MakeClusters();
61     clusterer.WriteClusters(-1);
62   }
63
64   loader->UnloadRecPoints();
65 }
66
67 //_____________________________________________________________________________
68 void AliTRDReconstructor::Reconstruct(AliRunLoader* runLoader,
69                                       AliRawReader* rawReader) const
70 {
71 // reconstruct clusters
72
73   AliInfo("Reconstruct TRD clusters from RAW data");
74
75   AliLoader *loader=runLoader->GetLoader("TRDLoader");
76   loader->LoadRecPoints("recreate");
77
78   AliTRDclusterizerV1 clusterer("clusterer", "TRD clusterizer");
79   runLoader->CdGAFile();
80   AliTRDparameter* trdParam = GetTRDparameter(runLoader); 
81   if (!trdParam) {
82     Error("Reconstruct", "no TRD parameters found");
83     return;
84   }
85   trdParam->ReInit();
86   clusterer.SetParameter(trdParam);
87   Int_t nEvents = runLoader->GetNumberOfEvents();
88
89   for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
90     if (!rawReader->NextEvent()) break;
91     clusterer.Open(runLoader->GetFileName(), iEvent);
92     clusterer.ReadDigits(rawReader);
93     clusterer.MakeClusters();
94     clusterer.WriteClusters(-1);
95   }
96
97   loader->UnloadRecPoints();
98 }
99
100 //_____________________________________________________________________________
101 AliTracker* AliTRDReconstructor::CreateTracker(AliRunLoader* runLoader) const
102 {
103 // create a TRD tracker
104
105   runLoader->CdGAFile();
106   return new AliTRDtracker(gFile);
107 }
108
109 //_____________________________________________________________________________
110 void AliTRDReconstructor::FillESD(AliRunLoader* /*runLoader*/, 
111                                   AliESD* esd) const
112 {
113 // make PID
114
115   Double_t parTRD[] = {
116     280., // Min. Ionizing Particle signal.  Check it !!!
117     0.23, // relative resolution             Check it !!!
118     10.   // PID range (in sigmas)
119   };
120   AliTRDpidESD trdPID(parTRD);
121   trdPID.MakePID(esd);
122 }
123
124
125 //_____________________________________________________________________________
126 AliTRDparameter* AliTRDReconstructor::GetTRDparameter(AliRunLoader* runLoader) const
127 {
128 // get the TRD parameters
129
130   runLoader->CdGAFile();
131   AliTRDparameter* trdParam = (AliTRDparameter*) gFile->Get("TRDparameter"); 
132   if (!trdParam) {
133     Error("GetTRDparameter", "no TRD parameters available");
134     return NULL;
135   }
136   return trdParam;
137 }
138
139