#include <TH1.h>
#include <TMath.h>
#include <TObjArray.h>
#include <TTimeStamp.h>
#include "AliCDBMetaData.h"
#include "AliLog.h"
#include "AliTOFPreprocessorFDR.h"
#include "AliTOFFormatDCS.h"
#include "AliDCSValue.h"
ClassImp(AliTOFPreprocessorFDR)
AliTOFPreprocessorFDR::AliTOFPreprocessorFDR(AliShuttleInterface* shuttle) :
AliPreprocessor("TOF", shuttle),
fStoreRefData(kTRUE)
{
AddRunType("PHYSICS");
}
AliTOFPreprocessorFDR::~AliTOFPreprocessorFDR()
{
}
void AliTOFPreprocessorFDR::Initialize(Int_t run, UInt_t startTime,
UInt_t endTime)
{
AliPreprocessor::Initialize(run, startTime, endTime);
Log(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
TTimeStamp(startTime).AsString(),
TTimeStamp(endTime).AsString()));
}
UInt_t AliTOFPreprocessorFDR::ProcessDCSDataPoints(TMap* aliasMap)
{
if (!aliasMap){
Log("No DCS map found: TOF exiting from Shuttle");
return 1;
}
else {
AliDCSValue* aValue;
AliDCSValue* aValue1;
Float_t timeMin = (Float_t)fStartTime;
Float_t timeMax = (Float_t)fEndTime;
Float_t val=0;
Float_t val1=0;
Float_t time=0;
Float_t delta[2];
Float_t timedelta[2];
TH1::AddDirectory(0);
Bool_t resultDCSMap=kFALSE;
Bool_t resultDCSStore=kFALSE;
TString aliasDP[4]={"tof_lv_i48_02","tof_lv_v48_02","tof_lv_i33_02","tof_lv_v33_02"};
TObjArray *array = new TObjArray(4);
array->SetOwner();
AliTOFFormatDCS *lvI4802 = new AliTOFFormatDCS();
AliTOFFormatDCS *lvV4802 = new AliTOFFormatDCS();
AliTOFFormatDCS *lvI3302 = new AliTOFFormatDCS();
AliTOFFormatDCS *lvV3302 = new AliTOFFormatDCS();
array->AddAt(lvI4802,0);
array->AddAt(lvV4802,1);
array->AddAt(lvI3302,2);
array->AddAt(lvV3302,3);
for (Int_t i=0;i<4;i++){
for (Int_t idelta =0;idelta<2;idelta++){
delta[idelta]=0;
timedelta[idelta]=0;
}
TObjArray *aliasArr = (TObjArray*) aliasMap->GetValue(aliasDP[i].Data());
if(!aliasArr){
Log(Form("Alias %s not found!", aliasDP[i].Data()));
return kFALSE;
}
if(aliasArr->GetEntries()<3){
Log(Form("Alias %s has just %d entries!",
aliasDP[i].Data(),aliasArr->GetEntries()));
continue;
}
TIter iterarray(aliasArr);
Int_t nentries = aliasArr->GetEntries();
Int_t deltaTimeStamp = (Int_t) nentries/3;
Int_t deltaTimeStamp1 = (Int_t) nentries/2;
Int_t index = 0;
for (Int_t k=0;k<3;k++){
index = deltaTimeStamp*k;
if (k==0) {
index=0;
}
else if (k==1) {
index=deltaTimeStamp1;
}
else if (k==2) {
index=nentries-1;
}
aValue = (AliDCSValue*) aliasArr->At(index);
val = aValue->GetFloat();
time = (Float_t) (aValue->GetTimeStamp());
if (i==0){
AliDebug(1,Form("tof_lv_i48_02: setting value %i to %f at %f",k,val,time));
lvI4802->SetFloat(k,val);
lvI4802->SetTimeStampFloat(k,time);
}
else if (i==1){
AliDebug(1,Form("tof_lv_v48_02: setting value %i to %f at %f",k,val,time));
lvV4802->SetFloat(k,val);
lvV4802->SetTimeStampFloat(k,time);
}
else if (i==2){
AliDebug(1,Form("tof_lv_i33_02: setting value %i to %f at %f",k,val,time));
lvI3302->SetFloat(k,val);
lvI3302->SetTimeStampFloat(k,time);
}
else if (i==3){
AliDebug(1,Form("tof_lv_v33_02: setting value %i to %f at %f",k,val,time));
lvV3302->SetFloat(k,val);
lvV3302->SetTimeStampFloat(k,time);
}
}
Int_t deltamin = (Int_t)(60/(timeMax-timeMin)*nentries);
Int_t klast = nentries-deltamin;
for (Int_t k=0;k<klast;k++){
aValue = (AliDCSValue*) aliasArr->At(k);
aValue1 = (AliDCSValue*) aliasArr->At(k+deltamin);
val = aValue->GetFloat();
val1 = aValue1->GetFloat();
if (delta[0]<=TMath::Abs(val1-val)) {
delta[0]=TMath::Abs(val1-val);
timedelta[0] = (Float_t)k;
}
if (delta[1]<=delta[0]) {
Float_t temp = delta[1];
Float_t timetemp = timedelta[1];
delta[1]=delta[0];
delta[0]=temp;
timedelta[1]=timedelta[0];
timedelta[0]=timetemp;
}
}
for (Int_t kk=0;kk<2;kk++){
if (i==0){
AliDebug(1,Form("tof_lv_i48: setting variation %i to %f at %f",kk,delta[kk],timedelta[kk]));
lvI4802->SetDelta(kk,delta[kk]);
lvI4802->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
}
else if (i==1){
AliDebug(1,Form("tof_lv_v48: setting variation %i to %f at %f",kk,delta[kk],timedelta[kk]));
lvV4802->SetDelta(kk,delta[kk]);
lvV4802->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
}
else if (i==2){
AliDebug(1,Form("tof_lv_i33: setting variation %i to %f at %f",kk,delta[kk],timedelta[kk]));
lvI3302->SetDelta(kk,delta[kk]);
lvI3302->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
}
else if (i==3){
AliDebug(1,Form("tof_lv_v33: setting variation %i to %f at %f",kk,delta[kk],timedelta[kk]));
lvV3302->SetDelta(kk,delta[kk]);
lvV3302->SetTimeStampDelta(kk,(Float_t)timedelta[kk]);
}
}
}
AliCDBMetaData metaDataDCS;
metaDataDCS.SetBeamPeriod(0);
metaDataDCS.SetResponsible("Chiara Zampolli");
metaDataDCS.SetComment("This preprocessor fills an AliTOFDataDCS object.");
Log("Storing DCS Data");
resultDCSStore = StoreReferenceData("Calib","DCSData",array, &metaDataDCS);
if (!resultDCSStore){
Log("Some problems occurred while storing DCS data results in Reference Data, TOF exiting from Shuttle");
return 2;
}
Log("Storing DCS Data in OCDB");
resultDCSMap = Store("Calib","DCSData",array, &metaDataDCS,0,kTRUE);
if (!resultDCSMap){
Log("Some problems occurred while storing DCS data results in OCDB, TOF exiting from Shuttle");
return 3;
}
delete array;
return 0;
}
}
UInt_t AliTOFPreprocessorFDR::Process(TMap* dcsAliasMap)
{
TH1::AddDirectory(0);
Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap);
if ((iresultDCS == 1) || (iresultDCS == 2) || (iresultDCS == 3)) return iresultDCS;
return 0;
}
AliTOFPreprocessorFDR.cxx:1 AliTOFPreprocessorFDR.cxx:2 AliTOFPreprocessorFDR.cxx:3 AliTOFPreprocessorFDR.cxx:4 AliTOFPreprocessorFDR.cxx:5 AliTOFPreprocessorFDR.cxx:6 AliTOFPreprocessorFDR.cxx:7 AliTOFPreprocessorFDR.cxx:8 AliTOFPreprocessorFDR.cxx:9 AliTOFPreprocessorFDR.cxx:10 AliTOFPreprocessorFDR.cxx:11 AliTOFPreprocessorFDR.cxx:12 AliTOFPreprocessorFDR.cxx:13 AliTOFPreprocessorFDR.cxx:14 AliTOFPreprocessorFDR.cxx:15 AliTOFPreprocessorFDR.cxx:16 AliTOFPreprocessorFDR.cxx:17 AliTOFPreprocessorFDR.cxx:18 AliTOFPreprocessorFDR.cxx:19 AliTOFPreprocessorFDR.cxx:20 AliTOFPreprocessorFDR.cxx:21 AliTOFPreprocessorFDR.cxx:22 AliTOFPreprocessorFDR.cxx:23 AliTOFPreprocessorFDR.cxx:24 AliTOFPreprocessorFDR.cxx:25 AliTOFPreprocessorFDR.cxx:26 AliTOFPreprocessorFDR.cxx:27 AliTOFPreprocessorFDR.cxx:28 AliTOFPreprocessorFDR.cxx:29 AliTOFPreprocessorFDR.cxx:30 AliTOFPreprocessorFDR.cxx:31 AliTOFPreprocessorFDR.cxx:32 AliTOFPreprocessorFDR.cxx:33 AliTOFPreprocessorFDR.cxx:34 AliTOFPreprocessorFDR.cxx:35 AliTOFPreprocessorFDR.cxx:36 AliTOFPreprocessorFDR.cxx:37 AliTOFPreprocessorFDR.cxx:38 AliTOFPreprocessorFDR.cxx:39 AliTOFPreprocessorFDR.cxx:40 AliTOFPreprocessorFDR.cxx:41 AliTOFPreprocessorFDR.cxx:42 AliTOFPreprocessorFDR.cxx:43 AliTOFPreprocessorFDR.cxx:44 AliTOFPreprocessorFDR.cxx:45 AliTOFPreprocessorFDR.cxx:46 AliTOFPreprocessorFDR.cxx:47 AliTOFPreprocessorFDR.cxx:48 AliTOFPreprocessorFDR.cxx:49 AliTOFPreprocessorFDR.cxx:50 AliTOFPreprocessorFDR.cxx:51 AliTOFPreprocessorFDR.cxx:52 AliTOFPreprocessorFDR.cxx:53 AliTOFPreprocessorFDR.cxx:54 AliTOFPreprocessorFDR.cxx:55 AliTOFPreprocessorFDR.cxx:56 AliTOFPreprocessorFDR.cxx:57 AliTOFPreprocessorFDR.cxx:58 AliTOFPreprocessorFDR.cxx:59 AliTOFPreprocessorFDR.cxx:60 AliTOFPreprocessorFDR.cxx:61 AliTOFPreprocessorFDR.cxx:62 AliTOFPreprocessorFDR.cxx:63 AliTOFPreprocessorFDR.cxx:64 AliTOFPreprocessorFDR.cxx:65 AliTOFPreprocessorFDR.cxx:66 AliTOFPreprocessorFDR.cxx:67 AliTOFPreprocessorFDR.cxx:68 AliTOFPreprocessorFDR.cxx:69 AliTOFPreprocessorFDR.cxx:70 AliTOFPreprocessorFDR.cxx:71 AliTOFPreprocessorFDR.cxx:72 AliTOFPreprocessorFDR.cxx:73 AliTOFPreprocessorFDR.cxx:74 AliTOFPreprocessorFDR.cxx:75 AliTOFPreprocessorFDR.cxx:76 AliTOFPreprocessorFDR.cxx:77 AliTOFPreprocessorFDR.cxx:78 AliTOFPreprocessorFDR.cxx:79 AliTOFPreprocessorFDR.cxx:80 AliTOFPreprocessorFDR.cxx:81 AliTOFPreprocessorFDR.cxx:82 AliTOFPreprocessorFDR.cxx:83 AliTOFPreprocessorFDR.cxx:84 AliTOFPreprocessorFDR.cxx:85 AliTOFPreprocessorFDR.cxx:86 AliTOFPreprocessorFDR.cxx:87 AliTOFPreprocessorFDR.cxx:88 AliTOFPreprocessorFDR.cxx:89 AliTOFPreprocessorFDR.cxx:90 AliTOFPreprocessorFDR.cxx:91 AliTOFPreprocessorFDR.cxx:92 AliTOFPreprocessorFDR.cxx:93 AliTOFPreprocessorFDR.cxx:94 AliTOFPreprocessorFDR.cxx:95 AliTOFPreprocessorFDR.cxx:96 AliTOFPreprocessorFDR.cxx:97 AliTOFPreprocessorFDR.cxx:98 AliTOFPreprocessorFDR.cxx:99 AliTOFPreprocessorFDR.cxx:100 AliTOFPreprocessorFDR.cxx:101 AliTOFPreprocessorFDR.cxx:102 AliTOFPreprocessorFDR.cxx:103 AliTOFPreprocessorFDR.cxx:104 AliTOFPreprocessorFDR.cxx:105 AliTOFPreprocessorFDR.cxx:106 AliTOFPreprocessorFDR.cxx:107 AliTOFPreprocessorFDR.cxx:108 AliTOFPreprocessorFDR.cxx:109 AliTOFPreprocessorFDR.cxx:110 AliTOFPreprocessorFDR.cxx:111 AliTOFPreprocessorFDR.cxx:112 AliTOFPreprocessorFDR.cxx:113 AliTOFPreprocessorFDR.cxx:114 AliTOFPreprocessorFDR.cxx:115 AliTOFPreprocessorFDR.cxx:116 AliTOFPreprocessorFDR.cxx:117 AliTOFPreprocessorFDR.cxx:118 AliTOFPreprocessorFDR.cxx:119 AliTOFPreprocessorFDR.cxx:120 AliTOFPreprocessorFDR.cxx:121 AliTOFPreprocessorFDR.cxx:122 AliTOFPreprocessorFDR.cxx:123 AliTOFPreprocessorFDR.cxx:124 AliTOFPreprocessorFDR.cxx:125 AliTOFPreprocessorFDR.cxx:126 AliTOFPreprocessorFDR.cxx:127 AliTOFPreprocessorFDR.cxx:128 AliTOFPreprocessorFDR.cxx:129 AliTOFPreprocessorFDR.cxx:130 AliTOFPreprocessorFDR.cxx:131 AliTOFPreprocessorFDR.cxx:132 AliTOFPreprocessorFDR.cxx:133 AliTOFPreprocessorFDR.cxx:134 AliTOFPreprocessorFDR.cxx:135 AliTOFPreprocessorFDR.cxx:136 AliTOFPreprocessorFDR.cxx:137 AliTOFPreprocessorFDR.cxx:138 AliTOFPreprocessorFDR.cxx:139 AliTOFPreprocessorFDR.cxx:140 AliTOFPreprocessorFDR.cxx:141 AliTOFPreprocessorFDR.cxx:142 AliTOFPreprocessorFDR.cxx:143 AliTOFPreprocessorFDR.cxx:144 AliTOFPreprocessorFDR.cxx:145 AliTOFPreprocessorFDR.cxx:146 AliTOFPreprocessorFDR.cxx:147 AliTOFPreprocessorFDR.cxx:148 AliTOFPreprocessorFDR.cxx:149 AliTOFPreprocessorFDR.cxx:150 AliTOFPreprocessorFDR.cxx:151 AliTOFPreprocessorFDR.cxx:152 AliTOFPreprocessorFDR.cxx:153 AliTOFPreprocessorFDR.cxx:154 AliTOFPreprocessorFDR.cxx:155 AliTOFPreprocessorFDR.cxx:156 AliTOFPreprocessorFDR.cxx:157 AliTOFPreprocessorFDR.cxx:158 AliTOFPreprocessorFDR.cxx:159 AliTOFPreprocessorFDR.cxx:160 AliTOFPreprocessorFDR.cxx:161 AliTOFPreprocessorFDR.cxx:162 AliTOFPreprocessorFDR.cxx:163 AliTOFPreprocessorFDR.cxx:164 AliTOFPreprocessorFDR.cxx:165 AliTOFPreprocessorFDR.cxx:166 AliTOFPreprocessorFDR.cxx:167 AliTOFPreprocessorFDR.cxx:168 AliTOFPreprocessorFDR.cxx:169 AliTOFPreprocessorFDR.cxx:170 AliTOFPreprocessorFDR.cxx:171 AliTOFPreprocessorFDR.cxx:172 AliTOFPreprocessorFDR.cxx:173 AliTOFPreprocessorFDR.cxx:174 AliTOFPreprocessorFDR.cxx:175 AliTOFPreprocessorFDR.cxx:176 AliTOFPreprocessorFDR.cxx:177 AliTOFPreprocessorFDR.cxx:178 AliTOFPreprocessorFDR.cxx:179 AliTOFPreprocessorFDR.cxx:180 AliTOFPreprocessorFDR.cxx:181 AliTOFPreprocessorFDR.cxx:182 AliTOFPreprocessorFDR.cxx:183 AliTOFPreprocessorFDR.cxx:184 AliTOFPreprocessorFDR.cxx:185 AliTOFPreprocessorFDR.cxx:186 AliTOFPreprocessorFDR.cxx:187 AliTOFPreprocessorFDR.cxx:188 AliTOFPreprocessorFDR.cxx:189 AliTOFPreprocessorFDR.cxx:190 AliTOFPreprocessorFDR.cxx:191 AliTOFPreprocessorFDR.cxx:192 AliTOFPreprocessorFDR.cxx:193 AliTOFPreprocessorFDR.cxx:194 AliTOFPreprocessorFDR.cxx:195 AliTOFPreprocessorFDR.cxx:196 AliTOFPreprocessorFDR.cxx:197 AliTOFPreprocessorFDR.cxx:198 AliTOFPreprocessorFDR.cxx:199 AliTOFPreprocessorFDR.cxx:200 AliTOFPreprocessorFDR.cxx:201 AliTOFPreprocessorFDR.cxx:202 AliTOFPreprocessorFDR.cxx:203 AliTOFPreprocessorFDR.cxx:204 AliTOFPreprocessorFDR.cxx:205 AliTOFPreprocessorFDR.cxx:206 AliTOFPreprocessorFDR.cxx:207 AliTOFPreprocessorFDR.cxx:208 AliTOFPreprocessorFDR.cxx:209 AliTOFPreprocessorFDR.cxx:210 AliTOFPreprocessorFDR.cxx:211 AliTOFPreprocessorFDR.cxx:212 AliTOFPreprocessorFDR.cxx:213 AliTOFPreprocessorFDR.cxx:214 AliTOFPreprocessorFDR.cxx:215 AliTOFPreprocessorFDR.cxx:216 AliTOFPreprocessorFDR.cxx:217 AliTOFPreprocessorFDR.cxx:218 AliTOFPreprocessorFDR.cxx:219 AliTOFPreprocessorFDR.cxx:220 AliTOFPreprocessorFDR.cxx:221 AliTOFPreprocessorFDR.cxx:222 AliTOFPreprocessorFDR.cxx:223 AliTOFPreprocessorFDR.cxx:224 AliTOFPreprocessorFDR.cxx:225 AliTOFPreprocessorFDR.cxx:226 AliTOFPreprocessorFDR.cxx:227 AliTOFPreprocessorFDR.cxx:228 AliTOFPreprocessorFDR.cxx:229 AliTOFPreprocessorFDR.cxx:230 AliTOFPreprocessorFDR.cxx:231 AliTOFPreprocessorFDR.cxx:232 AliTOFPreprocessorFDR.cxx:233 AliTOFPreprocessorFDR.cxx:234 AliTOFPreprocessorFDR.cxx:235 AliTOFPreprocessorFDR.cxx:236 AliTOFPreprocessorFDR.cxx:237 AliTOFPreprocessorFDR.cxx:238 AliTOFPreprocessorFDR.cxx:239 AliTOFPreprocessorFDR.cxx:240 AliTOFPreprocessorFDR.cxx:241 AliTOFPreprocessorFDR.cxx:242 AliTOFPreprocessorFDR.cxx:243 AliTOFPreprocessorFDR.cxx:244 AliTOFPreprocessorFDR.cxx:245 AliTOFPreprocessorFDR.cxx:246 AliTOFPreprocessorFDR.cxx:247 AliTOFPreprocessorFDR.cxx:248 AliTOFPreprocessorFDR.cxx:249 AliTOFPreprocessorFDR.cxx:250 AliTOFPreprocessorFDR.cxx:251 AliTOFPreprocessorFDR.cxx:252 AliTOFPreprocessorFDR.cxx:253 AliTOFPreprocessorFDR.cxx:254 AliTOFPreprocessorFDR.cxx:255 AliTOFPreprocessorFDR.cxx:256 AliTOFPreprocessorFDR.cxx:257 AliTOFPreprocessorFDR.cxx:258 AliTOFPreprocessorFDR.cxx:259 AliTOFPreprocessorFDR.cxx:260 AliTOFPreprocessorFDR.cxx:261 AliTOFPreprocessorFDR.cxx:262 AliTOFPreprocessorFDR.cxx:263 AliTOFPreprocessorFDR.cxx:264 AliTOFPreprocessorFDR.cxx:265 AliTOFPreprocessorFDR.cxx:266 AliTOFPreprocessorFDR.cxx:267 AliTOFPreprocessorFDR.cxx:268 AliTOFPreprocessorFDR.cxx:269 AliTOFPreprocessorFDR.cxx:270 AliTOFPreprocessorFDR.cxx:271 AliTOFPreprocessorFDR.cxx:272 AliTOFPreprocessorFDR.cxx:273 AliTOFPreprocessorFDR.cxx:274 AliTOFPreprocessorFDR.cxx:275 AliTOFPreprocessorFDR.cxx:276 AliTOFPreprocessorFDR.cxx:277 AliTOFPreprocessorFDR.cxx:278 AliTOFPreprocessorFDR.cxx:279 AliTOFPreprocessorFDR.cxx:280 AliTOFPreprocessorFDR.cxx:281 AliTOFPreprocessorFDR.cxx:282 AliTOFPreprocessorFDR.cxx:283 AliTOFPreprocessorFDR.cxx:284 AliTOFPreprocessorFDR.cxx:285 AliTOFPreprocessorFDR.cxx:286 AliTOFPreprocessorFDR.cxx:287 AliTOFPreprocessorFDR.cxx:288 AliTOFPreprocessorFDR.cxx:289 AliTOFPreprocessorFDR.cxx:290 AliTOFPreprocessorFDR.cxx:291 AliTOFPreprocessorFDR.cxx:292 AliTOFPreprocessorFDR.cxx:293 AliTOFPreprocessorFDR.cxx:294 AliTOFPreprocessorFDR.cxx:295 AliTOFPreprocessorFDR.cxx:296 AliTOFPreprocessorFDR.cxx:297 AliTOFPreprocessorFDR.cxx:298 AliTOFPreprocessorFDR.cxx:299 AliTOFPreprocessorFDR.cxx:300 AliTOFPreprocessorFDR.cxx:301