]>
Commit | Line | Data |
---|---|---|
dd162229 | 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" | |
65521adf | 25 | #include "AliT0RecoParam.h" |
dd162229 | 26 | #include "AliT0CalibTimeEq.h" |
27 | #include "AliCDBStorage.h" | |
28 | #include "AliCDBMetaData.h" | |
29 | #include "AliCDBManager.h" | |
612737bb | 30 | #include "AliCTPTimeParams.h" |
31 | #include "AliLHCClockPhase.h" | |
65521adf | 32 | #include "AliT0CalibSeasonTimeShift.h" |
612737bb | 33 | #include "AliT0CalibLatency.h" |
dd162229 | 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(): | |
65521adf | 48 | TNamed("AliT0PreprocessorOffline","AliT0PreprocessorOffline"), |
bb54f817 | 49 | startRun(0), |
50 | endRun(0), | |
51 | startTime(0), | |
52 | endTime(0), | |
16beeccf | 53 | ocdbStorage(""), |
cdd58213 | 54 | fNewDArun(9999999), |
55 | fStatusDelay(0), | |
56 | fStatusAdjust(0) | |
16beeccf | 57 | |
dd162229 | 58 | { |
59 | //constructor | |
60 | } | |
61 | //____________________________________________________ | |
62 | ||
63 | AliT0PreprocessorOffline::~AliT0PreprocessorOffline() | |
64 | { | |
65 | //destructor | |
66 | ||
67 | } | |
68 | //____________________________________________________ | |
65521adf | 69 | void AliT0PreprocessorOffline::Process(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage) |
70 | { | |
cdd58213 | 71 | if ( ustartRun < fNewDArun) |
16beeccf | 72 | CalibOffsetChannels(filePhysName, ustartRun, uendRun, pocdbStorage); |
65521adf | 73 | CalibT0sPosition(filePhysName, ustartRun, uendRun, pocdbStorage); |
74 | } | |
dd162229 | 75 | //____________________________________________________ |
76 | ||
65521adf | 77 | void AliT0PreprocessorOffline::CalibOffsetChannels(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage) |
dd162229 | 78 | { |
79 | ||
b0ab3f59 | 80 | Float_t zero_timecdb[24]={0}; |
81 | Float_t *timecdb = zero_timecdb; | |
82 | Float_t *cfdvalue = zero_timecdb; | |
b9dd81a7 | 83 | Int_t badpmt=-1; |
dd162229 | 84 | //Processing data from DAQ Physics run |
85 | AliInfo("Processing Time Offset between channels"); | |
b0ab3f59 | 86 | if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage; |
87 | else | |
88 | ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; | |
13366e78 | 89 | |
b0ab3f59 | 90 | AliT0CalibTimeEq *offline = new AliT0CalibTimeEq(); |
32d3e409 | 91 | Int_t writeok = offline->ComputeOfflineParams(filePhysName.Data(), timecdb, cfdvalue, badpmt); |
92 | printf(" AliT0PreprocessorOffline::CalibOffsetChannels :: writeok %i \n", writeok); | |
b0ab3f59 | 93 | AliCDBMetaData metaData; |
94 | metaData.SetBeamPeriod(1); | |
95 | metaData.SetResponsible("Alla Maevskaya"); | |
96 | metaData.SetComment("Time equalizing result with slew"); | |
cdd58213 | 97 | fStatusDelay = writeok; |
32d3e409 | 98 | if (writeok<=0) { |
b0ab3f59 | 99 | AliCDBId* id1=NULL; |
100 | id1=new AliCDBId("T0/Calib/TimeDelay", ustartRun, uendRun ); | |
101 | AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage); | |
102 | gStorage->Put(offline, (*id1), &metaData); | |
103 | } | |
104 | else { | |
105 | ||
106 | AliWarning(Form("writeok = %d data is not OK to be in OCDB",writeok)); | |
dd162229 | 107 | } |
b0ab3f59 | 108 | |
109 | delete offline; | |
110 | ||
dd162229 | 111 | } |
65521adf | 112 | //------------------------------------------------------------------------------------- |
113 | void AliT0PreprocessorOffline::CalibT0sPosition(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage) | |
114 | { | |
16beeccf | 115 | printf(" AliT0PreprocessorOffline::CalibT0sPosition \n"); |
b0ab3f59 | 116 | Float_t zero_timecdb[4]={0}; |
117 | Float_t *timecdb = zero_timecdb; | |
118 | if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage; | |
119 | else | |
120 | ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; | |
b0ab3f59 | 121 | |
122 | AliT0CalibSeasonTimeShift *offline = new AliT0CalibSeasonTimeShift(); | |
32d3e409 | 123 | Int_t writeok = offline->SetT0Par(filePhysName.Data(), timecdb); |
124 | printf(" AliT0PreprocessorOffline::CalibT0sPosition :: writeok %i \n", writeok); | |
b0ab3f59 | 125 | AliCDBMetaData metaData; |
126 | metaData.SetBeamPeriod(1); | |
127 | metaData.SetResponsible("Alla Maevskaya"); | |
128 | metaData.SetComment("Time equalizing result with slew"); | |
cdd58213 | 129 | fStatusAdjust = writeok; |
32d3e409 | 130 | if (writeok <= 0) { |
b0ab3f59 | 131 | AliCDBId* id1=NULL; |
bb54f817 | 132 | id1=new AliCDBId("T0/Calib/TimeAdjust", ustartRun, uendRun); |
133 | AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage); | |
134 | gStorage->Put(offline, (*id1), &metaData); | |
b0ab3f59 | 135 | } |
136 | ||
65521adf | 137 | } |
cdd58213 | 138 | //_____________________________________________________________________________ |
139 | Int_t AliT0PreprocessorOffline::GetStatus() const | |
140 | { | |
141 | // | |
142 | // Checks the status | |
143 | // fStatusPos: errors | |
144 | // fStatusNeg: only info | |
145 | // | |
146 | ||
147 | return fStatusAdjust ; | |
148 | } |