d90e2ed240ee76835721c4dec7f60706b7fc8538
[u/mrichter/AliRoot.git] / PMD / AliPMDReconstructor.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 ///////////////////////////////////////////////////////////////////////////////
17 //                                                                           //
18 // class for PMD reconstruction                                              //
19 //                                                                           //
20 ///////////////////////////////////////////////////////////////////////////////
21
22 #include "Riostream.h"
23 #include "AliPMDReconstructor.h"
24 #include "AliRunLoader.h"
25 #include "AliRun.h"
26 #include "AliPMDClusterFinder.h"
27 #include "AliPMDtracker.h"
28 #include "AliRawReader.h"
29 #include "AliESDPmdTrack.h"
30 #include "AliESD.h"
31
32 ClassImp(AliPMDReconstructor)
33
34
35 //_____________________________________________________________________________
36 void AliPMDReconstructor::Reconstruct(AliRunLoader* runLoader) const
37 {
38 // reconstruct clusters from digits file
39
40   AliPMDClusterFinder *pmdClus = new AliPMDClusterFinder(runLoader);
41   pmdClus->Load();
42   //  pmdClus->SetDebug(1);
43   for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++)
44     {
45       pmdClus->Digits2RecPoints(iEvent);
46     }
47   pmdClus->UnLoad();
48   delete pmdClus;
49
50 }
51 //_____________________________________________________________________________
52 void AliPMDReconstructor::Reconstruct(AliRunLoader* runLoader,
53                                       AliRawReader *rawReader) const
54 {
55 // reconstruct clusters from Raw Data
56
57   AliPMDClusterFinder pmdClus(runLoader);
58   pmdClus.LoadClusters();
59
60   Int_t iEvent = 0;
61   while (rawReader->NextEvent()) {
62     //    pmdClus.SetDebug(1);
63     pmdClus.Digits2RecPoints(iEvent,rawReader);
64     
65     iEvent++;
66   }
67   pmdClus.UnLoadClusters();
68   
69 }
70
71 // ------------------------------------------------------------------------ //
72
73 void AliPMDReconstructor::FillESD(AliRunLoader* runLoader,AliESD* esd) const
74 {
75   AliLoader* loader = runLoader->GetLoader("PMDLoader");
76   if (!loader) {
77     Error("Reconstruct", "PMD loader not found");
78     return;
79   }
80   loader->LoadRecPoints("READ");
81
82   TTree *treeR = loader->TreeR();
83   AliPMDtracker pmdtracker;
84   pmdtracker.LoadClusters(treeR);
85   pmdtracker.Clusters2Tracks(esd);
86   loader->UnloadRecPoints();
87 }