/* $Id$ */
+using std::ifstream;
ClassImp(AliITSPreprocessorSPD)
//______________________________________________________________________________________________
fIdList.Clear();
- UInt_t nrEqForScan = 0;
- // UInt_t nrEqForPhysN = 0;
- // UInt_t nrEqForPhysD = 0;
+
// ******************************************************************************************** //
// *** GET THE FILE IDs FOR DEBUGGING *** //
// ******************************************************************************************** //
// *** REFERENCE DATA *** //
- // Standalone runs:
+ // SCAN runs:
if (runType == "DAQ_MIN_TH_SCAN" ||
runType == "DAQ_MEAN_TH_SCAN" ||
runType == "DAQ_GEN_DAC_SCAN" ||
runType == "DAQ_UNIFORMITY_SCAN" ||
runType == "DAQ_NOISY_PIX_SCAN" ||
- runType == "DAQ_PIX_DELAY_SCAN" ||
- runType == "DAQ_FO_UNIF_SCAN") {
- // Store the scan container files as reference data (0 or 1 file for each equipment)
- for (UInt_t eq=0; eq<20; eq++) {
- TString id = Form("SPD_ref_scan_%d",eq);
- TList* list = GetFileSources(kDAQ,id.Data()); // (the id should be unique, so always 1 file)
- if (list) {
- TObjString* fileNameEntry = (TObjString*) list->First();
- if (fileNameEntry!=NULL) {
- nrEqForScan++;
- TString fileName = GetFile(kDAQ, id, fileNameEntry->GetString().Data());
- if (fileName.IsNull()) {
- Log(Form("GetFile failed to retrieve file %s.",fileNameEntry->GetString().Data()));
- return 1;
- }
- if (!RemoveIdFromList(id.Data())) {
- Log(Form("Warning: Retrieved file with id %s, that was not in the id list!",id.Data()));
- }
- TString refCAT = Form("SPD_ref_scan_eq_%d",eq);
- if (!StoreReferenceFile(fileName.Data(),refCAT.Data())) {
- Log(Form("Failed to store reference file %s.",fileName.Data()));
- return 1;
- }
- }
- }
- }
+ runType == "DAQ_PIX_DELAY_SCAN") {
+ // Store scan container files for all equipments used - as reference data
+ // ids from FXS follow ("SPD_ref_scan_%d",eq), while Alien follow ("SPD_ref_scan_eq_%d",eq)
+ // the first part of the id is passed as argument here:
+ if (!StoreRefForIdStartingWith("SPD_ref_scan")) return 1;
+ }
+
+ // FO runs:
+ else if (runType == "DAQ_FO_UNIF_SCAN") {
+ // Store fo container files for all equipments used - as reference data
+ // ids from FXS follow ("SPD_ref_fo_%d",eq), while Alien follow ("SPD_ref_fo_eq_%d",eq)
+ // the first part of the id is passed as argument here:
+ if (!StoreRefForIdStartingWith("SPD_ref_fo")) return 1;
}
// Physics runs (online monitoring):
- if (runType == "PHYSICS") {
- // Store the phys "per run" container files as reference data
+ else if (runType == "PHYSICS") {
+ // Store the phys "per run" container files - as reference data
if (!StoreRefFromTarForId("SPD_ref_phys")) return 1;
- // Store the phys "dead" container files as reference data
+ // Store the phys "dead" container files - as reference data
if (!StoreRefFromTarForId("SPD_ref_phys_dead")) return 1;
}
-// *** OLD CODE NOT TARED
-// for (UInt_t eq=0; eq<20; eq++) {
-// TString id = Form("SPD_ref_phys_%d",eq);
-// TList* list = GetFileSources(kDAQ,id.Data()); // (the id should be unique, so always 1 file)
-// if (list) {
-// TObjString* fileNameEntry = (TObjString*) list->First();
-// if (fileNameEntry!=NULL) {
-// nrEqForPhysN++;
-// TString fileName = GetFile(kDAQ, id, fileNameEntry->GetString().Data());
-// if (fileName.IsNull()) {
-// Log(Form("GetFile failed to retrieve file %s.",fileNameEntry->GetString().Data()));
-// return 1;
-// }
-// if (!RemoveIdFromList(id.Data())) {
-// Log(Form("Warning: Retrieved file with id %s, that was not in the id list!",id.Data()));
-// }
-// TString refCAT = Form("SPD_ref_phys_eq_%d",eq);
-// if (!StoreReferenceFile(fileName.Data(),refCAT.Data())) {
-// Log(Form("Failed to store reference file %s.",fileName.Data()));
-// return 1;
-// }
-// }
-// }
-// }
-// ***
-
-// *** OLD CODE NOT TARED
-// // Store the phys "dead" container files as reference data (0 or 1 file for each equipment)
-// for (UInt_t eq=0; eq<20; eq++) {
-// TString id = Form("SPD_ref_phys_dead_%d",eq);
-// TList* list = GetFileSources(kDAQ,id.Data()); // (the id should be unique, so always 1 file)
-// if (list) {
-// TObjString* fileNameEntry = (TObjString*) list->First();
-// if (fileNameEntry!=NULL) {
-// nrEqForPhysD++;
-// TString fileName = GetFile(kDAQ, id, fileNameEntry->GetString().Data());
-// if (fileName.IsNull()) {
-// Log(Form("GetFile failed to retrieve file %s.",fileNameEntry->GetString().Data()));
-// return 1;
-// }
-// if (!RemoveIdFromList(id.Data())) {
-// Log(Form("Warning: Retrieved file with id %s, that was not in the id list!",id.Data()));
-// }
-// TString refCAT = Form("SPD_ref_phys_dead_eq_%d",eq);
-// if (!StoreReferenceFile(fileName.Data(),refCAT.Data())) {
-// Log(Form("Failed to store reference file %s.",fileName.Data()));
-// return 1;
-// }
-// }
-// }
-// }
-// }
-// ***
// ******************************************************************************************** //
-
-
// *** NOISY AND DEAD DATA *** //
// Standalone runs:
handler->SetFileLocation(fileLoc.Data());
handler->ReadNoisyFromFiles();
for (Int_t module=0; module<240; module++) {
- ((AliITSCalibrationSPD*) spdEntryNoisy->At(module)) -> SetNrBad( handler->GetNrNoisy(module) );
+ ((AliITSCalibrationSPD*) spdEntryNoisy->At(module)) -> SetNrBadSingle( handler->GetNrNoisySingle(module) );
((AliITSCalibrationSPD*) spdEntryNoisy->At(module)) -> SetBadList( handler->GetNoisyArray(module) );
}
delete handler;
// If new noisy pixels were found: Update calibration objects
if (nrNewNoisy>0) {
for (Int_t module=0; module<240; module++) {
- ((AliITSCalibrationSPD*) spdEntryNoisy->At(module)) -> SetNrBad( handOld->GetNrNoisy(module) );
+ ((AliITSCalibrationSPD*) spdEntryNoisy->At(module)) -> SetNrBadSingle( handOld->GetNrNoisySingle(module) );
((AliITSCalibrationSPD*) spdEntryNoisy->At(module)) -> SetBadList( handOld->GetNoisyArray(module) );
}
// Store the new calibration objects in OCDB
}
// Add dead from the copied FXS files
handOld->SetFileLocation(".");
- handOld->ReadDeadFromFiles();
- for (Int_t module=0; module<240; module++) {
- ((AliITSCalibrationSPD*) spdEntryDead->At(module)) -> SetNrBad( handOld->GetNrDead(module) );
- ((AliITSCalibrationSPD*) spdEntryDead->At(module)) -> SetBadList( handOld->GetDeadArray(module) );
+ handOld->ReadSilentFromFiles();
+ for (UInt_t module=0; module<240; module++) {
+ AliITSCalibrationSPD* calibSPD = (AliITSCalibrationSPD*) spdEntryDead->At(module);
+ calibSPD->SetNrBadSingle( handOld->GetNrDeadSingle(module) );
+ calibSPD->SetBadList( handOld->GetDeadArray(module) );
+ for (UInt_t chipIndex=0; chipIndex<5; chipIndex++) {
+ UInt_t eq,hs,chip,col,row;
+ AliITSRawStreamSPD::OfflineToOnline(module, chipIndex*32, 0, eq, hs, chip, col, row);
+ if (handOld->IsSilentChip(eq,hs,chip)) {
+ calibSPD->SetChipBad(chipIndex);
+ }
+ else {
+ calibSPD->UnSetChipBad(chipIndex);
+ }
+ }
}
delete handOld;
// Store the new calibration objects in OCDB
}
+
+ // ******************************************************************************************** //
// check that there are no ids left in the list:
if (fIdList.First()!=NULL) {
TString logMessage = "";
Log(Form("Files with the following ids were never retrieved: %s.",logMessage.Data()));
return 1;
}
-
fIdList.Clear();
+
return 0; // 0 means success
}
return found;
}
//_________________________________________________________________________________________
+Bool_t AliITSPreprocessorSPD::StoreRefForIdStartingWith(const Char_t *idStart) {
+ // Store the standalone container files as reference data (0 or 1 file for each equipment)
+ // idStart is the first part of the id string (which also should contain the actual eq)
+ for (UInt_t eq=0; eq<20; eq++) {
+ TString id = Form("%s_%d",idStart,eq);
+ TList* list = GetFileSources(kDAQ,id.Data()); // (the id should be unique, so always 1 file)
+ if (list) {
+ TObjString* fileNameEntry = (TObjString*) list->First();
+ if (fileNameEntry!=NULL) {
+ TString fileName = GetFile(kDAQ, id, fileNameEntry->GetString().Data());
+ if (fileName.IsNull()) {
+ Log(Form("GetFile failed to retrieve file %s.",fileNameEntry->GetString().Data()));
+ return kFALSE;
+ }
+ if (!RemoveIdFromList(id.Data())) {
+ Log(Form("Warning: Retrieved file with id %s, that was not in the id list!",id.Data()));
+ }
+ TString refCAT = Form("%s_eq_%d",idStart,eq);
+ if (!StoreReferenceFile(fileName.Data(),refCAT.Data())) {
+ Log(Form("Failed to store reference file %s.",fileName.Data()));
+ return kFALSE;
+ }
+ }
+ }
+ }
+ return kTRUE;
+}
+//_________________________________________________________________________________________
Bool_t AliITSPreprocessorSPD::StoreRefFromTarForId(const Char_t *id) {
// store reference files from tar file for the id given (this is just to not duplicate code)
TList* list = GetFileSources(kDAQ,id);
// store each file
UInt_t index2 = 0;
while (fList.At(index2)!=NULL) {
- TString fileName = ((TObjString*)fList.At(index2))->GetString();
+ TString eqFileName = ((TObjString*)fList.At(index2))->GetString();
// get eq id
- TString eqStr = fileName.Data();
+ TString eqStr = eqFileName.Data();
UInt_t len = eqStr.Length();
eqStr.Replace(0,len-7,"",0);
eqStr.ReplaceAll("_",1,"",0);
Int_t eqId = eqStr.Atoi();
if (eqId>=0 && eqId<20) {
TString refCAT = Form("%s_eq_%d",id,eqId);
- if (!StoreReferenceFile(fileName.Data(),refCAT.Data())) {
- Log(Form("Failed to store reference file %s.",fileName.Data()));
+ if (!StoreReferenceFile(eqFileName.Data(),refCAT.Data())) {
+ Log(Form("Failed to store reference file %s.",eqFileName.Data()));
return kFALSE;
}
}
else {
- Log(Form("Eq ID %d out of bounds for file %s",eqId,fileName.Data()));
+ Log(Form("Eq ID %d out of bounds for file %s",eqId,eqFileName.Data()));
fList.Clear();
return kFALSE;
}