]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFReconstructor.cxx
code cleanup: unused define
[u/mrichter/AliRoot.git] / TOF / AliTOFReconstructor.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 TOF reconstruction                                              //
21 //                                                                           //
22 ///////////////////////////////////////////////////////////////////////////////
23
24 #include "TFile.h"
25 #include "TObjArray.h"
26 #include "TString.h"
27
28 #include "AliLog.h"
29 #include "AliRawReader.h"
30 #include "AliCDBManager.h"
31 #include "AliCDBEntry.h"
32
33 #include "AliTOFClusterFinder.h"
34 #include "AliTOFcalib.h"
35 #include "AliTOFtrackerMI.h"
36 #include "AliTOFtracker.h"
37 #include "AliTOFtrackerV1.h"
38 #include "AliTOFReconstructor.h"
39 #include "AliTOFFormatDCS.h"
40
41 class TTree;
42
43 class AliESDEvent;
44
45 extern TDirectory *gDirectory;
46 extern TFile *gFile;
47
48 ClassImp(AliTOFReconstructor)
49
50  //____________________________________________________________________
51 AliTOFReconstructor::AliTOFReconstructor() 
52   : AliReconstructor(),
53     fTOFcalib(0)
54 {
55 //
56 // ctor
57 //
58
59 //reading DCS DP processing result
60
61   AliCDBManager *man = AliCDBManager::Instance();
62   Char_t *sel = "TOF/Calib/DCSData" ;
63   Char_t  out[100];
64   sprintf(out,"%s",sel); 
65   if (!man->Get(out,-1)) { 
66     AliInfo("No DCS data found in CDB");
67   }
68   else{
69     AliCDBEntry *entry = man->Get(out,-1);
70     if(!entry->GetObject()){
71       AliInfo("No DCS array found in CDB entry");
72     }
73      
74    else {
75       TObjArray *array = (TObjArray*)entry->GetObject();
76       TString alias[4]={"tof_lv_i48","tof_lv_v48","tof_lv_i33","tof_lv_v33"};
77       for (Int_t jj=0;jj<4;jj++){
78         AliInfo(Form("Alias = %s",alias[jj].Data()));
79         
80         AliTOFFormatDCS *dcs = (AliTOFFormatDCS*)array->At(jj);
81         for (Int_t i=0;i<3;i++){
82           AliInfo(Form("set value %i to %f at %f",i,dcs->GetFloat(i),dcs->GetTimeStampFloat(i)));
83         }
84         for (Int_t i=0;i<2;i++){
85           AliInfo(Form("set variation %i to %f at %f",i,dcs->GetDelta(i),dcs->GetTimeStampDelta(i)));
86         }
87         
88       }
89     }
90   }
91   
92   //Retrieving the TOF calibration info  
93   fTOFcalib    = new AliTOFcalib();
94   fTOFcalib->CreateCalArrays();
95   if(!fTOFcalib->ReadParOnlineFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
96   if(!fTOFcalib->ReadParOfflineFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
97 }
98
99 //------------------------------------------------------------------------
100 AliTOFReconstructor::AliTOFReconstructor(const AliTOFReconstructor &source)
101   : AliReconstructor(),
102     fTOFcalib(0)
103 {
104 //
105 // copy ctor
106 //
107   this->fTOFcalib=source.fTOFcalib;
108 }
109
110 //------------------------------------------------------------------------
111 AliTOFReconstructor & AliTOFReconstructor::operator=(const AliTOFReconstructor &source)
112 {
113 //
114 // assignment op.
115 //
116   this->fTOFcalib=source.fTOFcalib;
117   return *this;
118 }
119 //_____________________________________________________________________________
120 AliTOFReconstructor::~AliTOFReconstructor() 
121 {
122 //
123 // dtor
124 //
125   delete fTOFcalib;
126 }
127
128 //_____________________________________________________________________________
129 void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
130                                       TTree *clustersTree) const
131 {
132 // reconstruct clusters from Raw Data
133
134   AliTOFClusterFinder tofClus(fTOFcalib);
135   tofClus.Digits2RecPoints(rawReader, clustersTree);
136
137 }
138
139 //_____________________________________________________________________________
140 void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
141                                       TTree *clustersTree) const
142 {
143 // reconstruct clusters from Raw Data
144
145   AliDebug(2,Form("Global Event loop mode: Creating Recpoints from Digits Tree")); 
146   AliTOFClusterFinder tofClus(fTOFcalib);
147   tofClus.Digits2RecPoints(digitsTree, clustersTree);
148
149 }
150 //_____________________________________________________________________________
151   void AliTOFReconstructor::ConvertDigits(AliRawReader* reader, TTree* digitsTree) const
152 {
153 // reconstruct clusters from digits
154
155   AliDebug(2,Form("Global Event loop mode: Converting Raw Data to a Digits Tree")); 
156   AliTOFClusterFinder tofClus(fTOFcalib);
157   tofClus.Raw2Digits(reader, digitsTree);
158
159 }
160
161 //_____________________________________________________________________________
162 AliTracker* AliTOFReconstructor::CreateTracker() const
163 {
164 // create a TOF tracker
165
166   TString selectedTracker = GetOption();
167   // use MI tracker if selected
168   if (selectedTracker.Contains("MI")) return new AliTOFtrackerMI();
169   if (selectedTracker.Contains("V1")) return new AliTOFtrackerV1();
170   return new AliTOFtracker();
171 }
172