+/*
+TPC DA for online calibration
+
+Contact: Haavard.Helstrup@cern.ch
+Link:
+Run Type: PEDESTAL
+DA Type: LDC
+Number of events needed: 100
+Input Files:
+Output Files: tpcPedestal.root, to be exported to the DAQ FXS
+fileId: pedestals
+Trigger types used: CALIBRATION_EVENT
+
+*/
+
/*
TPCda_pedestal.cxx - calibration algorithm for TPC pedestal runs
*/
#define RESULT_FILE "tpcPedestal.root"
+#define FILE_ID "pedestals"
#define MAPPING_FILE "tpcMapping.root"
-
+#define AliDebugLevel() -1
extern "C" {
#include <daqDA.h>
#include "AliTPCCalPad.h"
#include "AliMathBase.h"
#include "TTreeStream.h"
+#include "AliLog.h"
+#include "TSystem.h"
//
// TPC calibration algorithm includes
// Main for TPC pedestal detector algorithm
//
+ AliLog::SetClassDebugLevel("AliTPCRawStream",-5);
+ AliLog::SetClassDebugLevel("AliRawReaderDate",-5);
+ AliLog::SetClassDebugLevel("AliTPCAltroMapping",-5);
+ AliLog::SetModuleDebugLevel("RAW",-5);
+
Bool_t timeAnalysis = kTRUE;
if (argc<2) {
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 (!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 */
+ 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);
}
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<argc; i++ ) {
status=monitorSetDataSource( argv[i] );
if (status!=0) {
printf("monitorSetDataSource() failed. Error=%s. Exiting ...\n", monitorDecodeError(status));
- delete fileMapping;
return -1;
}
// Pedestal calibration
AliRawReader *rawReader = new AliRawReaderDate((void*)event);
- //calibPedestal.ProcessEvent(rawReader);
- calibPedestal.ProcessEventFast(rawReader); // fast data reader
+ calibPedestal.ProcessEvent(rawReader);
+ //calibPedestal.ProcessEventFast(rawReader); // fast data reader
delete rawReader;
/* free resources */
printf ("%d physics/calibration events processed.\n",nevents);
TFile *fileTPC = new TFile(RESULT_FILE, "recreate");
- calibPedestal.Write("calibPedestal");
+ calibPedestal.Write("tpcCalibPedestal");
delete fileTPC;
printf("Wrote %s.\n",RESULT_FILE);
+ /* store the result file on FES */
+
+ status=daqDA_FES_storeFile(RESULT_FILE,FILE_ID);
+ if (status) {
+ status = -2;
+ }
+
+
//
// Now prepare ASCII files for local ALTRO configuration through DDL.
//
pedmemfile.close();
printf("Wrote ASCII files.\n");
- delete fileMapping;
return status;
}