///////////////////////////////////////////////////////////////////////////////
#include "TFile.h"
+#include "TObjArray.h"
+#include "TString.h"
#include "AliLog.h"
#include "AliRawReader.h"
-#include "AliRunLoader.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
#include "AliTOFClusterFinder.h"
-#include "AliTOFGeometry.h"
+#include "AliTOFcalib.h"
#include "AliTOFtrackerMI.h"
#include "AliTOFtracker.h"
+#include "AliTOFtrackerV1.h"
#include "AliTOFReconstructor.h"
+#include "AliTOFFormatDCS.h"
class TTree;
-class AliESD;
+class AliESDEvent;
extern TDirectory *gDirectory;
extern TFile *gFile;
ClassImp(AliTOFReconstructor)
-//_____________________________________________________________________________
- void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader) const
+ //____________________________________________________________________
+AliTOFReconstructor::AliTOFReconstructor()
+ : AliReconstructor(),
+ fTOFcalib(0)
{
-// reconstruct clusters from digits
-
- AliTOFClusterFinder tofClus(runLoader);
- tofClus.Load();
- for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++)
- {
- tofClus.Digits2RecPoints(iEvent);
+//
+// ctor
+//
+
+//reading DCS DP processing result
+
+ AliCDBManager *man = AliCDBManager::Instance();
+ Char_t *sel = "TOF/Calib/DCSData" ;
+ Char_t out[100];
+ sprintf(out,"%s",sel);
+ if (!man->Get(out,-1)) {
+ AliInfo("No DCS data found in CDB");
+ }
+ else{
+ AliCDBEntry *entry = man->Get(out,-1);
+ if(!entry->GetObject()){
+ AliInfo("No DCS array found in CDB entry");
}
- tofClus.UnLoad();
+
+ else {
+ TObjArray *array = (TObjArray*)entry->GetObject();
+ TString alias[4]={"tof_lv_i48","tof_lv_v48","tof_lv_i33","tof_lv_v33"};
+ for (Int_t jj=0;jj<4;jj++){
+ AliInfo(Form("Alias = %s",alias[jj].Data()));
+
+ AliTOFFormatDCS *dcs = (AliTOFFormatDCS*)array->At(jj);
+ for (Int_t i=0;i<3;i++){
+ AliInfo(Form("set value %i to %f at %f",i,dcs->GetFloat(i),dcs->GetTimeStampFloat(i)));
+ }
+ for (Int_t i=0;i<2;i++){
+ AliInfo(Form("set variation %i to %f at %f",i,dcs->GetDelta(i),dcs->GetTimeStampDelta(i)));
+ }
+
+ }
+ }
+ }
+
+ //Retrieving the TOF calibration info
+ fTOFcalib = new AliTOFcalib();
+ fTOFcalib->CreateCalArrays();
+ if(!fTOFcalib->ReadParOnlineFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
+ if(!fTOFcalib->ReadParOfflineFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}
+}
+//------------------------------------------------------------------------
+AliTOFReconstructor::AliTOFReconstructor(const AliTOFReconstructor &source)
+ : AliReconstructor(),
+ fTOFcalib(0)
+{
+//
+// copy ctor
+//
+ this->fTOFcalib=source.fTOFcalib;
}
+//------------------------------------------------------------------------
+AliTOFReconstructor & AliTOFReconstructor::operator=(const AliTOFReconstructor &source)
+{
+//
+// assignment op.
+//
+ this->fTOFcalib=source.fTOFcalib;
+ return *this;
+}
//_____________________________________________________________________________
-void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader,
- AliRawReader *rawReader) const
+AliTOFReconstructor::~AliTOFReconstructor()
{
-// reconstruct clusters from Raw Data
-
- AliTOFClusterFinder tofClus(runLoader);
- tofClus.LoadClusters();
- Int_t iEvent = 0;
- while (rawReader->NextEvent()) {
- tofClus.Digits2RecPoints(iEvent,rawReader);
- //tofClus.Raw2Digits(iEvent,rawReader); // temporary solution
- iEvent++;
- }
- tofClus.UnLoadClusters();
-
+//
+// dtor
+//
+ delete fTOFcalib;
}
//_____________________________________________________________________________
{
// reconstruct clusters from Raw Data
- AliTOFClusterFinder tofClus;
+ AliTOFClusterFinder tofClus(fTOFcalib);
tofClus.Digits2RecPoints(rawReader, clustersTree);
}
//_____________________________________________________________________________
-AliTracker* AliTOFReconstructor::CreateTracker(AliRunLoader* runLoader) const
+void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
+ TTree *clustersTree) const
{
-// create a TOF tracker
+// reconstruct clusters from Raw Data
- AliTOFGeometry* geom = GetTOFGeometry(runLoader);
- if (!geom) return NULL;
- // Double_t parPID[] = {130., 5.};
- Double_t parPID[] = {80., 5.};
- TString selectedTracker = GetOption();
- // use MI tracker if selected
- if (selectedTracker.Contains("MI")) return new AliTOFtrackerMI(geom,parPID);
+ AliDebug(2,Form("Global Event loop mode: Creating Recpoints from Digits Tree"));
+ AliTOFClusterFinder tofClus(fTOFcalib);
+ tofClus.Digits2RecPoints(digitsTree, clustersTree);
- return new AliTOFtracker(geom, parPID);
}
-
//_____________________________________________________________________________
-void AliTOFReconstructor::FillESD(AliRunLoader* /*runLoader*/,
- AliESD* /*esd*/) const
+ void AliTOFReconstructor::ConvertDigits(AliRawReader* reader, TTree* digitsTree) const
{
-// nothing to be done
+// reconstruct clusters from digits
+
+ AliDebug(2,Form("Global Event loop mode: Converting Raw Data to a Digits Tree"));
+ AliTOFClusterFinder tofClus(fTOFcalib);
+ tofClus.Raw2Digits(reader, digitsTree);
}
//_____________________________________________________________________________
-AliTOFGeometry* AliTOFReconstructor::GetTOFGeometry(AliRunLoader* runLoader) const
+AliTracker* AliTOFReconstructor::CreateTracker() const
{
-// get the TOF parameters
-
- AliTOFGeometry *tofGeom;
-
- runLoader->CdGAFile();
- TDirectory *savedir=gDirectory;
- TFile *in=(TFile*)gFile;
- if (!in->IsOpen()) {
- AliWarning("Geometry file is not open default TOF geometry will be used");
- tofGeom = new AliTOFGeometry();
- }
- else {
- in->cd();
- tofGeom = (AliTOFGeometry*) in->Get("TOFgeometry");
- }
-
- savedir->cd();
+// create a TOF tracker
- if (!tofGeom) {
- AliError("no TOF geometry available");
- return NULL;
- }
- return tofGeom;
+ TString selectedTracker = GetOption();
+ // use MI tracker if selected
+ if (selectedTracker.Contains("MI")) return new AliTOFtrackerMI();
+ if (selectedTracker.Contains("V1")) return new AliTOFtrackerV1();
+ return new AliTOFtracker();
}
+