From b401648b811345ed2f029a26f8da8bd468641b89 Mon Sep 17 00:00:00 2001 From: marian Date: Thu, 7 Feb 2008 14:01:20 +0000 Subject: [PATCH] For test purposes check the presence of the configuration data in the $DAQDA_TEST_DIR as first Only if not existing - get the data from DAQdb Adding protection for corrupted data - check the pad and row number if reasonable Disabling Altro warnings - Not working yet (Marian) --- TPC/AliTPCCalibCE.cxx | 4 +++ TPC/AliTPCCalibPedestal.cxx | 5 +++- TPC/AliTPCCalibPulser.cxx | 4 +++ TPC/TPCCEda.cxx | 45 ++++++++++++++++++++-------- TPC/TPCPEDESTALda.cxx | 60 ++++++++++++++++++++++++------------- TPC/TPCPULSERda.cxx | 48 +++++++++++++++++++---------- 6 files changed, 117 insertions(+), 49 deletions(-) diff --git a/TPC/AliTPCCalibCE.cxx b/TPC/AliTPCCalibCE.cxx index 61b250a5672..d4e425457bf 100644 --- a/TPC/AliTPCCalibCE.cxx +++ b/TPC/AliTPCCalibCE.cxx @@ -560,6 +560,10 @@ Int_t AliTPCCalibCE::Update(const Int_t icsector, // no extra analysis necessary. Assumes knowledge of the signal shape! // assumes that it is looped over consecutive time bins of one pad // + + if (icRow<0) return 0; + if (icPad<0) return 0; + if (icTimeBin<0) return 0; if ( (icTimeBin>fLastTimeBin) || (icTimeBinGetRowIndexes(icsector)[icRow]+icPad; // global pad position in sector diff --git a/TPC/AliTPCCalibPedestal.cxx b/TPC/AliTPCCalibPedestal.cxx index 802b427c356..39d73f233c1 100644 --- a/TPC/AliTPCCalibPedestal.cxx +++ b/TPC/AliTPCCalibPedestal.cxx @@ -336,7 +336,10 @@ Int_t AliTPCCalibPedestal::Update(const Int_t icsector, /*FOLD00*/ // // Signal filling method // - + if (icRow<0) return 0; + if (icPad<0) return 0; + if (icTimeBin<0) return 0; + // Time dependent pedestals if ( fTimeAnalysis ) { if ( icsector < 36 ) // IROC diff --git a/TPC/AliTPCCalibPulser.cxx b/TPC/AliTPCCalibPulser.cxx index 958b2c23b8c..75fa252a2c8 100644 --- a/TPC/AliTPCCalibPulser.cxx +++ b/TPC/AliTPCCalibPulser.cxx @@ -394,6 +394,10 @@ Int_t AliTPCCalibPulser::Update(const Int_t icsector, // no extra analysis necessary. Assumes knowledge of the signal shape! // assumes that it is looped over consecutive time bins of one pad // + + if (icRow<0) return 0; + if (icPad<0) return 0; + if (icTimeBin<0) return 0; if ( (icTimeBin>fLastTimeBin) || (icTimeBinGetenv("DAQDA_TEST_DIR")){ + printf("Test setup\tGetting data from local storage\n"); + char localname[1000]; + sprintf(localname,"%s/%s",gSystem->Getenv("DAQDA_TEST_DIR"),MAPPING_FILE); + TFile *fileMapping = new TFile(localname,"read"); + mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping"); + delete fileMapping; + } + + if (!mapping){ + /* copy locally the mapping file from daq detector config db */ + status = daqDA_DB_getFile(MAPPING_FILE,"./tpcMapping.root"); + if (status) { + printf("Failed to get mapping file (%s) from DAQdetDB, status=%d\n", MAPPING_FILE, status); + printf("Continue anyway ... maybe it works?\n"); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + return -1; // temporarily uncommented for testing on pcald47 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + } - /* copy locally the mapping file from daq detector config db */ - status = daqDA_DB_getFile(MAPPING_FILE,"./tpcMapping.root"); - if (status) { - printf("Failed to get mapping file (%s) from DAQdetDB, status=%d\n", MAPPING_FILE, status); - printf("Continue anyway ... maybe it works?\n"); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - //return -1; // temporarily uncommented for testing on pcald47 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + /* open the mapping file and retrieve mapping object */ + TFile *fileMapping = new TFile(MAPPING_FILE, "read"); + mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping"); + delete fileMapping; } - /* open the mapping file and retrieve mapping object */ - AliTPCmapper *mapping = 0; // The TPC mapping - TFile *fileMapping = new TFile(MAPPING_FILE, "read"); - mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping"); if (mapping == 0) { - printf("Failed to get mapping object from %s. Exiting ...\n", MAPPING_FILE); - delete fileMapping; - return -1; + printf("Failed to get mapping object from %s. ...\n", MAPPING_FILE); + //return -1; } else { printf("Got mapping object from %s\n", MAPPING_FILE); } diff --git a/TPC/TPCPEDESTALda.cxx b/TPC/TPCPEDESTALda.cxx index dba4c0072dc..6baa6481c3a 100644 --- a/TPC/TPCPEDESTALda.cxx +++ b/TPC/TPCPEDESTALda.cxx @@ -32,7 +32,7 @@ and save results in a file (named from RESULT_FILE define - see below). #define RESULT_FILE "tpcPedestal.root" #define MAPPING_FILE "tpcMapping.root" - +#define AliDebugLevel() -1 extern "C" { #include @@ -64,6 +64,8 @@ extern "C" { #include "AliTPCCalPad.h" #include "AliMathBase.h" #include "TTreeStream.h" +#include "AliLog.h" +#include "TSystem.h" // // TPC calibration algorithm includes @@ -80,6 +82,12 @@ int main(int argc, char **argv) { // Main for TPC pedestal detector algorithm // + AliLog::SetClassDebugLevel("AliTPCRawStream",AliLog::kFatal); + AliLog::SetClassDebugLevel("AliRawReaderDate",AliLog::kFatal); + AliLog::SetClassDebugLevel("AliTPCAltroMapping",AliLog::kFatal); + AliLog::SetModuleDebugLevel("TPC",AliLog::kFatal); + AliLog::SetModuleDebugLevel("RAW",AliLog::kFatal); + Bool_t timeAnalysis = kTRUE; if (argc<2) { @@ -105,22 +113,35 @@ int main(int argc, char **argv) { return -1; } - /* copy locally the mapping file from daq detector config db */ - status = daqDA_DB_getFile(MAPPING_FILE,"./tpcMapping.root"); - if (status) { - printf("Failed to get mapping file (%s) from DAQdetDB, status=%d\n", MAPPING_FILE, status); - printf("Continue anyway ... maybe it works?\n"); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - //return -1; // temporarily uncommented for testing on pcald47 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + AliTPCmapper *mapping = 0; // The TPC mapping + // if test setup get parameters from $DAQDA_TEST_DIR + if (gSystem->Getenv("DAQDA_TEST_DIR")){ + printf("Test setup\tGetting data from local storage\n"); + char localname[1000]; + sprintf(localname,"%s/%s",gSystem->Getenv("DAQDA_TEST_DIR"),MAPPING_FILE); + TFile *fileMapping = new TFile(localname,"read"); + mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping"); + delete fileMapping; } + + if (!mapping){ + /* copy locally the mapping file from daq detector config db */ + status = daqDA_DB_getFile(MAPPING_FILE,"./tpcMapping.root"); + if (status) { + printf("Failed to get mapping file (%s) from DAQdetDB, status=%d\n", MAPPING_FILE, status); + printf("Continue anyway ... maybe it works?\n"); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + return -1; // temporarily uncommented for testing on pcald47 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + } - /* open the mapping file and retrieve mapping object */ - AliTPCmapper *mapping = 0; // The TPC mapping - TFile *fileMapping = new TFile(MAPPING_FILE, "read"); - mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping"); - if (mapping == 0) { - printf("Failed to get mapping object from %s. Exiting ...\n", MAPPING_FILE); + /* open the mapping file and retrieve mapping object */ + TFile *fileMapping = new TFile(MAPPING_FILE, "read"); + mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping"); delete fileMapping; - return -1; + } + + if (mapping == 0) { + printf("Failed to get mapping object from %s. ...\n", MAPPING_FILE); + //return -1; } else { printf("Got mapping object from %s\n", MAPPING_FILE); } @@ -128,8 +149,9 @@ int main(int argc, char **argv) { AliTPCCalibPedestal calibPedestal; // pedestal and noise calibration calibPedestal.SetRangeTime(60,940); // set time bin range calibPedestal.SetTimeAnalysis(timeAnalysis); // pedestal(t) calibration - calibPedestal.SetAltroMapping(mapping->GetAltroMapping()); // Use altro mapping we got from daqDetDb - + if (mapping){ + calibPedestal.SetAltroMapping(mapping->GetAltroMapping()); // Use altro mapping we got from daqDetDb + } /* loop over RAW data files */ int nevents=0; for ( i=1; i @@ -55,7 +56,8 @@ and save results in a file (named from RESULT_FILE define - see below). #include "AliTPCCalPad.h" #include "AliMathBase.h" #include "TTreeStream.h" -#include "TTreeStream.h" +#include "AliLog.h" +#include "TSystem.h" // // TPC calibration algorithm includes @@ -69,6 +71,11 @@ and save results in a file (named from RESULT_FILE define - see below). Arguments: list of DATE raw data files */ int main(int argc, char **argv) { + AliLog::SetClassDebugLevel("AliTPCRawStream",AliLog::kFatal); + AliLog::SetClassDebugLevel("AliRawReaderDate",AliLog::kFatal); + AliLog::SetClassDebugLevel("AliTPCAltroMapping",AliLog::kFatal); + AliLog::SetModuleDebugLevel("TPC",AliLog::kFatal); + AliLog::SetModuleDebugLevel("RAW",AliLog::kFatal); gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo", "*", @@ -78,29 +85,40 @@ int main(int argc, char **argv) { int i,status; + AliTPCmapper *mapping = 0; // The TPC mapping + // if test setup get parameters from $DAQDA_TEST_DIR + if (gSystem->Getenv("DAQDA_TEST_DIR")){ + printf("Test setup\tGetting data from local storage\n"); + char localname[1000]; + sprintf(localname,"%s/%s",gSystem->Getenv("DAQDA_TEST_DIR"),MAPPING_FILE); + TFile *fileMapping = new TFile(localname,"read"); + mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping"); + delete fileMapping; + } + + if (!mapping){ + /* copy locally the mapping file from daq detector config db */ + status = daqDA_DB_getFile(MAPPING_FILE,"./tpcMapping.root"); + if (status) { + printf("Failed to get mapping file (%s) from DAQdetDB, status=%d\n", MAPPING_FILE, status); + printf("Continue anyway ... maybe it works?\n"); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + return -1; // temporarily uncommented for testing on pcald47 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + } - /* copy locally the mapping file from daq detector config db */ - status = daqDA_DB_getFile(MAPPING_FILE,"./tpcMapping.root"); - if (status) { - printf("Failed to get mapping file (%s) from DAQdetDB, status=%d\n", MAPPING_FILE, status); - printf("Continue anyway ... maybe it works?\n"); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - //return -1; // temporarily uncommented for testing on pcald47 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + /* open the mapping file and retrieve mapping object */ + TFile *fileMapping = new TFile(MAPPING_FILE, "read"); + mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping"); + delete fileMapping; } - /* open the mapping file and retrieve mapping object */ - AliTPCmapper *mapping = 0; // The TPC mapping - TFile *fileMapping = new TFile(MAPPING_FILE, "read"); - mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping"); if (mapping == 0) { - printf("Failed to get mapping object from %s. Exiting ...\n", MAPPING_FILE); - delete fileMapping; - return -1; + printf("Failed to get mapping object from %s. ...\n", MAPPING_FILE); + //return -1; } else { printf("Got mapping object from %s\n", MAPPING_FILE); } - AliTPCCalibPulser calibPulser; // pedestal and noise calibration if (argc<2) { -- 2.39.3