]> git.uio.no Git - u/mrichter/AliRoot.git/blob - T0/AliT0PreprocessorOffline.cxx
adding helper component for the automatic generation of compressed TPC cluster data...
[u/mrichter/AliRoot.git] / T0 / AliT0PreprocessorOffline.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 */   
19 // T0 preprocessor:
20 // 2) takes data after  pass0 , 
21 // processes it, and stores either to OCDB .
22
23
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 "AliCTPTimeParams.h"
31 #include "AliLHCClockPhase.h"
32 #include "AliT0CalibSeasonTimeShift.h"
33 #include "AliT0CalibLatency.h"
34 #include "AliCDBEntry.h"
35 #include "AliLog.h"
36
37 #include <TTimeStamp.h>
38 #include <TFile.h>
39 #include <TObjString.h>
40 #include <TNamed.h>
41 #include "TClass.h"
42
43
44 ClassImp(AliT0PreprocessorOffline)
45
46 //____________________________________________________
47 AliT0PreprocessorOffline::AliT0PreprocessorOffline():
48 TNamed("AliT0PreprocessorOffline","AliT0PreprocessorOffline"),
49   startRun(0),      
50   endRun(0),  
51   startTime(0),    
52   endTime(0),     
53   ocdbStorage(""),
54   fNewDArun(9999999)
55   
56 {
57   //constructor
58 }
59 //____________________________________________________
60
61 AliT0PreprocessorOffline::~AliT0PreprocessorOffline()
62 {
63   //destructor
64
65 }
66 //____________________________________________________
67 void AliT0PreprocessorOffline::Process(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage)
68 {
69   if ( ustartRun < fNewDArun)
70     CalibOffsetChannels(filePhysName, ustartRun, uendRun, pocdbStorage);
71   CalibT0sPosition(filePhysName, ustartRun, uendRun, pocdbStorage);
72 }
73 //____________________________________________________
74
75 void AliT0PreprocessorOffline::CalibOffsetChannels(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage)
76 {
77
78   Float_t zero_timecdb[24]={0};
79   Float_t *timecdb = zero_timecdb;
80   Float_t *cfdvalue = zero_timecdb;
81   Int_t badpmt=-1;
82   //Processing data from DAQ Physics run
83   AliInfo("Processing Time Offset between channels");
84   if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage;
85   else
86     ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
87  
88   AliT0CalibTimeEq *offline = new AliT0CalibTimeEq();
89   Int_t writeok = offline->ComputeOfflineParams(filePhysName.Data(), timecdb, cfdvalue, badpmt);
90   printf(" AliT0PreprocessorOffline::CalibOffsetChannels :: writeok %i \n", writeok);
91   AliCDBMetaData metaData;
92   metaData.SetBeamPeriod(1);
93   metaData.SetResponsible("Alla Maevskaya");
94   metaData.SetComment("Time equalizing result with slew");
95   if (writeok<=0)  {
96     AliCDBId* id1=NULL;
97     id1=new AliCDBId("T0/Calib/TimeDelay", ustartRun, uendRun );
98     AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage);
99     gStorage->Put(offline, (*id1), &metaData);
100   }
101   else {
102     
103     AliWarning(Form("writeok = %d data is not OK to be in OCDB",writeok));
104       }           
105   
106   delete offline;
107  
108 }
109 //-------------------------------------------------------------------------------------
110 void AliT0PreprocessorOffline::CalibT0sPosition(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage)
111 {
112   printf(" AliT0PreprocessorOffline::CalibT0sPosition \n");
113   Float_t zero_timecdb[4]={0};
114   Float_t *timecdb = zero_timecdb;
115   if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage;
116   else
117     ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
118   
119   AliT0CalibSeasonTimeShift *offline = new AliT0CalibSeasonTimeShift();
120   Int_t writeok = offline->SetT0Par(filePhysName.Data(), timecdb);
121   printf(" AliT0PreprocessorOffline::CalibT0sPosition :: writeok %i \n", writeok);
122   AliCDBMetaData metaData;
123   metaData.SetBeamPeriod(1);
124   metaData.SetResponsible("Alla Maevskaya");
125   metaData.SetComment("Time equalizing result with slew");
126   
127   if (writeok <= 0)  {
128     AliCDBId* id1=NULL;
129     id1=new AliCDBId("T0/Calib/TimeAdjust", ustartRun, uendRun);
130     AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage);
131     gStorage->Put(offline, (*id1), &metaData);
132   }
133
134 }