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 **************************************************************************/
20 // 2) takes data after pass0 ,
21 // processes it, and stores either to OCDB .
24 #include "AliT0PreprocessorOffline.h"
25 #include "AliT0RecoParam.h"
26 #include "AliT0CalibTimeEq.h"
27 #include "AliCDBStorage.h"
28 #include "AliCDBMetaData.h"
29 #include "AliCDBManager.h"
30 #include "AliT0CalibSeasonTimeShift.h"
32 #include "AliCDBEntry.h"
35 #include <TTimeStamp.h>
37 #include <TObjString.h>
42 ClassImp(AliT0PreprocessorOffline)
44 //____________________________________________________
45 AliT0PreprocessorOffline::AliT0PreprocessorOffline():
46 TNamed("AliT0PreprocessorOffline","AliT0PreprocessorOffline"),
47 startRun(0), // start Run - used to make fast selection in THnSparse
48 endRun(0), // end Run - used to make fast selection in THnSparse
49 startTime(0), // startTime - used to make fast selection in THnSparse
50 endTime(0), // endTime - used to make fast selection in THnSparse
51 ocdbStorage("") // path to the OCDB storage
56 //____________________________________________________
58 AliT0PreprocessorOffline::~AliT0PreprocessorOffline()
63 //____________________________________________________
64 void AliT0PreprocessorOffline::Process(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage)
66 CalibOffsetChannels(filePhysName, ustartRun, uendRun, pocdbStorage);
67 CalibT0sPosition(filePhysName, ustartRun, uendRun, pocdbStorage);
69 //____________________________________________________
71 void AliT0PreprocessorOffline::CalibOffsetChannels(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage)
74 Float_t *timecdb = 0x0;
75 for (Int_t i=0; i<24; i++) timecdb[i]=999;
77 //Processing data from DAQ Physics run
78 AliInfo("Processing Time Offset between channels");
82 if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage;
84 ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
85 // AliCDBManager* man = AliCDBManager::Instance();
86 // man->SetDefaultStorage("raw://");
87 // man->SetDefaultStorage("ocdbStorage");
88 // man->SetRun(ustartRun);
89 AliCDBEntry *entryCalib = AliCDBManager::Instance()->Get("T0/Calib/TimeDelay");
91 AliWarning(Form("Cannot find any AliCDBEntry for [Calib, TimeDelay]!"));
95 AliT0CalibTimeEq *clb = (AliT0CalibTimeEq*)entryCalib->GetObject();
96 timecdb = clb->GetTimeEq();
98 AliCDBEntry *entryCalibreco = AliCDBManager::Instance()->Get("T0/Calib/RecoParam");
100 AliT0RecoParam *rpr = (AliT0RecoParam*) entryCalibreco->GetObject();
101 badpmt = rpr->GetRefPoint();
102 printf(" bad PMT %i \n", badpmt);
104 AliT0CalibTimeEq *offline = new AliT0CalibTimeEq();
106 Bool_t writeok = offline->ComputeOfflineParams(filePhysName.Data(), timecdb, badpmt);
107 AliCDBMetaData metaData;
108 metaData.SetBeamPeriod(1);
109 metaData.SetResponsible("Alla Maevskaya");
110 metaData.SetComment("Time equalizing result with slew");
114 id1=new AliCDBId("T0/Calib/TimeDelay", ustartRun, uendRun );
115 AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage);
116 gStorage->Put(offline, (*id1), &metaData);
120 AliWarning(Form("writeok = %d data is not OK to be in OCDB",writeok));
128 //-------------------------------------------------------------------------------------
129 void AliT0PreprocessorOffline::CalibT0sPosition(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage)
133 if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage;
135 ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
137 AliT0CalibSeasonTimeShift *offline = new AliT0CalibSeasonTimeShift();
138 Bool_t writeok = offline->SetT0Par(filePhysName.Data());
139 AliCDBMetaData metaData;
140 metaData.SetBeamPeriod(1);
141 metaData.SetResponsible("Alla Maevskaya");
142 metaData.SetComment("Time equalizing result with slew");
146 id1=new AliCDBId("T0/Calib/TimeAdjust", ustartRun, uendRun);
147 AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage);
148 gStorage->Put(offline, (*id1), &metaData);