+/*
+Contact: annalisa.mastroserio@cern.ch
+Link: tydes.home.cern.ch/tydes/doc/CalibrationOverview/CalibrationAlgorithms/
+Run Type: DAQ_FO_UNIF_SCAN
+DA Type: LDC
+Number of events needed: Depending on scan type
+Input Files: spd_focalib_params, raw data
+Output Files: ./calibResults/ScanDCSconfigToFXS/*
+Trigger types used: PHYSICS
+*/
+
////////////////////////////////////////////////////////////////////////////////
// This program can be compiled in two modes. //
// //
#include <TString.h>
#include <TFitter.h>
#include <TFile.h>
+#include <cstdlib>
int main(int argc, char **argv) {
if (argc<2) {
timer.Start();
// directory structure, hard coded
- char *saveDirNoisyToFXS = "./calibResults/ScanNoisyToFXS"; // may delete content
char *saveDirDCSconfigToFXS= "./calibResults/ScanDCSconfigToFXS"; // may delete content
char *configFilesDir = "./configFiles"; // may delete content
char *saveDirIdsToFXS = "./calibResults/IdsToFXS";
+
+ // make sure the directory structure is correct:
+ system("mkdir ./calibResults >& /dev/null");
+ system("mkdir ./calibResults/ScanDCSconfigToFXS >& /dev/null");
+ system("mkdir ./calibResults/IdsToFXS >& /dev/null");
+ system("mkdir ./configFiles >& /dev/null");
+
+
// parameters config files
TString thresholdsFileName = Form("%s/focalib_params.txt",configFilesDir);
"TStreamerInfo()");
// turn off annoying warning messages
- new AliLog;
- AliLog::Instance()->SetGlobalDebugLevel(-20);
-
-
-
+ // NB: Should not be handled here
+ AliLog* logger = AliLog::GetRootLogger();
+ logger->SetGlobalDebugLevel(-20);
// ********* STEP 0: Get configuration files from db (if there are any) , then read parameters*********
Int_t evType =-1;
AliITSOnlineSPDfoInfo *info[20]; Int_t ntriggers[20]; Int_t vDB[20]; Bool_t iseq[20];
- Bool_t infodacs[6] = {kFALSE, kFALSE, kFALSE, kFALSE, kFALSE,kFALSE}; // num of DAC params
AliITSOnlineSPDfo *fomanager[20];
TString s = "focalib";
Int_t eventType;
UInt_t eventNr=0;
- Int_t entry=0;
+
// main loop (infinite)
for(;;) {
if(!fomanager[eqId]->GetNdacs()) fomanager[eqId]->SetNdacs(str->GetFOHnumDacs());
TArrayS dacvalues(str->GetFOHnumDacs());
- for(Int_t n = 0; n<str->GetFOHnumDacs(); n++) dacvalues.AddAt(str->GetFOHdacValue(n),n);
+ for(Int_t n = 0; n<(Int_t)str->GetFOHnumDacs(); n++) dacvalues.AddAt(str->GetFOHdacValue(n),n);
TArrayS dacs = fomanager[eqId]->CreateDACArray(dacvalues, info[eqId]->GetDACIndexArray());
for(Int_t ihs =0; ihs < 6; ihs++) { // needed in the header to access the HS and ChipId info (in data it is different)
for(Int_t ich =0; ich < 10; ich++){
if(!str->GetFOHchipPresent(ihs, ich)) continue;
+ info[eqId]->SetActiveChipsAndHS(ihs,ich);
Short_t measure[4] = {str->GetFOHMatrixID(),str->GetFOHpixelRow(), str->GetFOHpixelCol(), str->GetFOHchipCount(ihs,ich)};
fomanager[eqId]->AddMeasurement(dacs,measure,ihs,ich);
} // chip loop
if(dacs.GetSize() == 0) continue;
for(Int_t idac =0; idac < dacs.GetSize() - 1; idac++) { // -1 (the last one is the quality flag)
if(dacs.At(idac) >=0 ) {
+
dcsfile << ((analyzer->GetFOHandler())->GetFOscanInfo())->GetDACindex(idac) << ",";
dcsfile << iff << ",";
dcsfile << hs << ",";
// send a tared file of all the dcsConfig text files
TString command = Form("cd %s; tar -cf dcsConfig.tar *",saveDirDCSconfigToFXS);
//printf("\n\n%s\n\n",command.Data());
- //system(command.Data());
+ system(command.Data());
TString fileName = Form("%s/dcsConfig.tar",saveDirDCSconfigToFXS);
TString iddcs = "SPD_dcsConfig";
if(!iseq[eqId]) continue;
//printf("Preparing reference data for eq %d\n",eqId);
- TString idf = Form("SPD_fo_scan_%d",eqId);
+ TString idf = Form("SPD_ref_fo_%d",eqId);
#ifndef SPD_DA_OFF
status = daqDA_FES_storeFile(files[eqId].Data(),idf.Data());
if (status!=0) {
idsFXSfile << Form("%s\n",idf.Data());
}
+
+
+ printf("Preparing id list file\n");
+ idsFXSfile.close();
+ TString idlist = "SPD_id_list";
+#ifndef SPD_DA_OFF
+ status = daqDA_FES_storeFile(idsFXSFileName.Data(),idlist.Data());
+ if (status!=0) {
+ printf("Failed to export file %s , status %d\n",idsFXSFileName.Data(),status);
+ return -1;
+ }
+#endif
+
+
+
timer.Stop();
timer.Print();
printf("DA finished.\n");