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 TOF reconstruction //
22 ///////////////////////////////////////////////////////////////////////////////
25 #include "TObjArray.h"
29 #include "AliRawReader.h"
30 #include "AliCDBManager.h"
31 #include "AliCDBEntry.h"
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"
45 extern TDirectory *gDirectory;
48 ClassImp(AliTOFReconstructor)
50 //____________________________________________________________________
51 AliTOFReconstructor::AliTOFReconstructor()
59 //reading DCS DP processing result
61 AliCDBManager *man = AliCDBManager::Instance();
62 Char_t *sel = "TOF/Calib/DCSData" ;
64 sprintf(out,"%s",sel);
65 if (!man->Get(out,-1)) {
66 AliInfo("No DCS data found in CDB");
69 AliCDBEntry *entry = man->Get(out,-1);
70 if(!entry->GetObject()){
71 AliInfo("No DCS array found in CDB entry");
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()));
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)));
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)));
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);}
99 //------------------------------------------------------------------------
100 AliTOFReconstructor::AliTOFReconstructor(const AliTOFReconstructor &source)
101 : AliReconstructor(),
107 this->fTOFcalib=source.fTOFcalib;
110 //------------------------------------------------------------------------
111 AliTOFReconstructor & AliTOFReconstructor::operator=(const AliTOFReconstructor &source)
116 this->fTOFcalib=source.fTOFcalib;
119 //_____________________________________________________________________________
120 AliTOFReconstructor::~AliTOFReconstructor()
128 //_____________________________________________________________________________
129 void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
130 TTree *clustersTree) const
132 // reconstruct clusters from Raw Data
134 AliTOFClusterFinder tofClus(fTOFcalib);
135 tofClus.Digits2RecPoints(rawReader, clustersTree);
139 //_____________________________________________________________________________
140 void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
141 TTree *clustersTree) const
143 // reconstruct clusters from Raw Data
145 AliDebug(2,Form("Global Event loop mode: Creating Recpoints from Digits Tree"));
146 AliTOFClusterFinder tofClus(fTOFcalib);
147 tofClus.Digits2RecPoints(digitsTree, clustersTree);
150 //_____________________________________________________________________________
151 void AliTOFReconstructor::ConvertDigits(AliRawReader* reader, TTree* digitsTree) const
153 // reconstruct clusters from digits
155 AliDebug(2,Form("Global Event loop mode: Converting Raw Data to a Digits Tree"));
156 AliTOFClusterFinder tofClus(fTOFcalib);
157 tofClus.Raw2Digits(reader, digitsTree);
161 //_____________________________________________________________________________
162 AliTracker* AliTOFReconstructor::CreateTracker() const
164 // create a TOF tracker
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();