]>
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), | |
53 | ocdbStorage("") | |
dd162229 | 54 | { |
55 | //constructor | |
56 | } | |
57 | //____________________________________________________ | |
58 | ||
59 | AliT0PreprocessorOffline::~AliT0PreprocessorOffline() | |
60 | { | |
61 | //destructor | |
62 | ||
63 | } | |
64 | //____________________________________________________ | |
65521adf | 65 | void AliT0PreprocessorOffline::Process(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage) |
66 | { | |
e24f582d | 67 | CalibOffsetChannels(filePhysName, ustartRun, uendRun, pocdbStorage); |
65521adf | 68 | CalibT0sPosition(filePhysName, ustartRun, uendRun, pocdbStorage); |
69 | } | |
dd162229 | 70 | //____________________________________________________ |
71 | ||
65521adf | 72 | void AliT0PreprocessorOffline::CalibOffsetChannels(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage) |
dd162229 | 73 | { |
74 | ||
b0ab3f59 | 75 | Float_t zero_timecdb[24]={0}; |
76 | Float_t *timecdb = zero_timecdb; | |
77 | Float_t *cfdvalue = zero_timecdb; | |
65521adf | 78 | Int_t badpmt=0; |
dd162229 | 79 | //Processing data from DAQ Physics run |
80 | AliInfo("Processing Time Offset between channels"); | |
b0ab3f59 | 81 | if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage; |
82 | else | |
83 | ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; | |
13366e78 | 84 | |
b0ab3f59 | 85 | AliCDBEntry *entryCalib = AliCDBManager::Instance()->Get("T0/Calib/TimeDelay"); |
86 | if(!entryCalib) { | |
87 | AliWarning(Form("Cannot find any AliCDBEntry for [Calib, TimeDelay]!")); | |
88 | } | |
89 | else | |
dd162229 | 90 | { |
b0ab3f59 | 91 | AliT0CalibTimeEq *clb = (AliT0CalibTimeEq*)entryCalib->GetObject(); |
612737bb | 92 | timecdb = clb->GetTimeEq(); |
93 | cfdvalue = clb->GetCFDvalue(); | |
b0ab3f59 | 94 | } |
bb54f817 | 95 | //AliCDBEntry *entryCalibreco = AliCDBManager::Instance()->Get("T0/Calib/RecoParam"); |
96 | // if(entryCalibreco) { | |
97 | // AliT0RecoParam *rpr = (AliT0RecoParam*) entryCalibreco->GetObject(); | |
98 | // badpmt = rpr->GetRefPoint(); | |
18086258 | 99 | badpmt = -1; |
100 | // } | |
b0ab3f59 | 101 | AliT0CalibTimeEq *offline = new AliT0CalibTimeEq(); |
102 | Bool_t writeok = offline->ComputeOfflineParams(filePhysName.Data(), timecdb, cfdvalue, badpmt); | |
103 | AliCDBMetaData metaData; | |
104 | metaData.SetBeamPeriod(1); | |
105 | metaData.SetResponsible("Alla Maevskaya"); | |
106 | metaData.SetComment("Time equalizing result with slew"); | |
dd162229 | 107 | |
b0ab3f59 | 108 | if (writeok) { |
109 | AliCDBId* id1=NULL; | |
110 | id1=new AliCDBId("T0/Calib/TimeDelay", ustartRun, uendRun ); | |
111 | AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage); | |
112 | gStorage->Put(offline, (*id1), &metaData); | |
113 | } | |
114 | else { | |
115 | ||
116 | AliWarning(Form("writeok = %d data is not OK to be in OCDB",writeok)); | |
dd162229 | 117 | } |
b0ab3f59 | 118 | |
119 | delete offline; | |
120 | ||
dd162229 | 121 | } |
65521adf | 122 | //------------------------------------------------------------------------------------- |
123 | void AliT0PreprocessorOffline::CalibT0sPosition(TString filePhysName, Int_t ustartRun, Int_t uendRun, TString pocdbStorage) | |
124 | { | |
b0ab3f59 | 125 | Float_t zero_timecdb[4]={0}; |
126 | Float_t *timecdb = zero_timecdb; | |
127 | if (pocdbStorage.Length()>0) ocdbStorage=pocdbStorage; | |
128 | else | |
129 | ocdbStorage="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; | |
130 | AliCDBEntry *entryCalib = AliCDBManager::Instance()->Get("T0/Calib/TimeAdjust"); | |
131 | if(!entryCalib) { | |
132 | AliWarning(Form("Cannot find any AliCDBEntry for [Calib, TimeAdjust]!")); | |
133 | } | |
134 | else | |
65521adf | 135 | { |
b0ab3f59 | 136 | AliT0CalibSeasonTimeShift *clb = (AliT0CalibSeasonTimeShift*)entryCalib->GetObject(); |
137 | timecdb = clb->GetT0Means(); | |
138 | } | |
139 | ||
140 | AliT0CalibSeasonTimeShift *offline = new AliT0CalibSeasonTimeShift(); | |
141 | Bool_t writeok = offline->SetT0Par(filePhysName.Data(), timecdb); | |
142 | AliCDBMetaData metaData; | |
143 | metaData.SetBeamPeriod(1); | |
144 | metaData.SetResponsible("Alla Maevskaya"); | |
145 | metaData.SetComment("Time equalizing result with slew"); | |
146 | ||
147 | if (writeok) { | |
148 | AliCDBId* id1=NULL; | |
bb54f817 | 149 | id1=new AliCDBId("T0/Calib/TimeAdjust", ustartRun, uendRun); |
150 | AliCDBStorage* gStorage = AliCDBManager::Instance()->GetStorage(ocdbStorage); | |
151 | gStorage->Put(offline, (*id1), &metaData); | |
b0ab3f59 | 152 | } |
153 | ||
65521adf | 154 | } |