return NULL;
}
TMap* mapLHC = new TMap();
- // mapLHC->SetOwner(1);
+ mapLHC->SetOwnerKeyValue();
TString strLine;
Int_t lhcEntries;
Int_t nBlocks = 0;
- // TObjArray** array;
Int_t nline =0;
while(strLine.ReadLine(*file)){
nline++;
}
if (ntokens == 1 && !(((TObjString*)tokens->At(0))->String()).CompareTo("END_OF_DATA")){
AliDebug(2,"End of file reached");
+ delete tokens;
break;
}
if (ntokens < 4){
// requiring the the type and the number of elements for each measurement
AliError(Form("The format does not match the expected one, skipping the current line for DP = %s", lhcDPtype.Data()));
delete typeTokens;
+ delete tokens;
continue;
}
TString type = ((TObjString*)typeTokens->At(0))->String();
if (mapLHC->GetValue(lhcDPname)==0x0){
array = new TObjArray();
array->SetOwner(1);
+ mapLHC->Add(new TObjString(lhcDPname->String()),array);
}
else{
- TPair* p = mapLHC->RemoveEntry(lhcDPname);
- array = (TObjArray*)p->Value();
+ array = (TObjArray*)mapLHC->GetValue(lhcDPname);
AliDebug(2,Form("entry found! --> %p",array));
}
for (Int_t ientry=0; ientry< nentries; ientry ++){
Int_t indextime = nfixed+nValuesPerEntry*ientry+nelements;
TString strTimestamp = ((TObjString*)tokens->At(indextime))->String();
- // TObjArray* timeTokens = strTimestamp.Tokenize(".");
- //if (timeTokens->GetEntriesFast() < 2 ){
- // // requiring both the seconds and the nseconds for the timestamp
- // AliError(Form("The timestamp format does not match the expected one, skipping entry %d for DP = %s", ientry, lhcDPtype.Data()));
- // continue;
- //}
- //time_t seconds = time_t((((TObjString*)timeTokens->At(0))->String()).Atoi());
- //Int_t nseconds = Int_t((((TObjString*)timeTokens->At(1))->String()).Atoi());
- //TTimeStamp* timestamp = new TTimeStamp(seconds, (Int_t)(nseconds*1E8));
Double_t timestamp = strTimestamp.Atof();
AliDebug(2,Form("Timestamp in unix time = %f (s)",timestamp));
if (fStartTime!=0 && fEndTime!=0 && (fStartTime > timestamp || fEndTime < timestamp)){
}
AliDCSArray* dcs = new AliDCSArray(nelements,value,timestamp);
array->Add(dcs);
+ delete[] value;
}
else if (type == "b"){
Bool_t* value = new Bool_t[nelements];
}
AliDCSArray* dcs = new AliDCSArray(nelements,value,timestamp);
array->Add(dcs);
+ delete[] value;
}
else if (type == "f"){ // the floats should be considered as doubles
Double_t* value = new Double_t[nelements];
}
AliDCSArray* dcs = new AliDCSArray(nelements,value,timestamp);
array->Add(dcs);
+ delete[] value;
}
else if (type == "s"){
TObjArray* value = new TObjArray();
+ value->SetOwner(1);
for (Int_t ielement=0; ielement<nelements; ielement++){
- TObjString* strobj = ((TObjString*)tokens->At(nfixed+ielement+ientry*nValuesPerEntry));
+ TObjString* strobj = (new TObjString(((TObjString*)tokens->At(nfixed+ielement+ientry*nValuesPerEntry))->String()));
AliDebug(2,Form("Value at index %d = %s",nfixed+ielement+ientry*nValuesPerEntry,(strobj->String()).Data()));
value->Add(strobj);
}
AliDCSArray* dcs = new AliDCSArray(nelements,value,timestamp);
array->Add(dcs);
+ delete value;
}
else{
AliError(Form("Non-expected type %s",type.Data()));
+ delete typeTokens;
+ delete tokens;
+ file->close();
+ delete file;
return NULL;
}
}
- mapLHC->Add(lhcDPname,array);
+ delete typeTokens;
+ delete tokens;
}
- //mapLHC->Print();
+ file->close();
+ delete file;
return mapLHC;
}