+// $Id$
+
/**************************************************************************
* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
* *
#include "AliHLTPHOSRcuHistogramProducer.h"
#include <iostream>
-#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
+//#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
#include "TFile.h"
#include "unistd.h"
#include <time.h>
+#include "AliHLTPHOSUtilities.h"
#define THRESHOLD 30
**************************************************************************/
-AliHLTPHOSRcuHistogramProducer:: AliHLTPHOSRcuHistogramProducer(): AliHLTPHOSBase(), fModuleID(0), fRcuX(0), fRcuZ(0)
-
-//AliHLTPHOSRcuHistogramProducer:: AliHLTPHOSRcuHistogramProducer(): AliHLTPHOSRcuProcessor(), fModuleID(0), fRcuX(0), fRcuZ(0)
+AliHLTPHOSRcuHistogramProducer:: AliHLTPHOSRcuHistogramProducer(): // AliHLTPHOSBase(),
+ // AliHLTPHOSRcuProcessor(),
+ fCellAccEnergy(),
+ fModuleID(0),
+ fRcuX(0),
+ fRcuZ(0),
+ fUtilitiesPtr(0)
{
+ fUtilitiesPtr = new AliHLTPHOSUtilities;
+
//Default constructor
- cout << "WARNING: You cannot invoke the AliHLTPHOSRcuHistogramProducer without arguments" << endl;
- cout << "Usage AliHLTPHOSRcuHistogramProducer(ModuleID, X. Z)" << endl;
+ // cout << "WARNING: You cannot invoke the AliHLTPHOSRcuHistogramProducer without arguments" << endl;
+ // cout << "Usage AliHLTPHOSRcuHistogramProducer(ModuleID, X. Z)" << endl;
}
-//AliHLTPHOSRcuHistogramProducer::AliHLTPHOSRcuHistogramProducer(AliHLTUInt8_t moduleID, AliHLTUInt8_t rcuX, AliHLTUInt8_t rcuZ)
-AliHLTPHOSRcuHistogramProducer::AliHLTPHOSRcuHistogramProducer(AliHLTUInt8_t moduleID, AliHLTUInt8_t rcuX, AliHLTUInt8_t rcuZ)
+
+AliHLTPHOSRcuHistogramProducer::AliHLTPHOSRcuHistogramProducer(AliHLTUInt8_t moduleID, AliHLTUInt8_t rcuX, AliHLTUInt8_t rcuZ): //AliHLTPHOSBase(),
+ // AliHLTPHOSRcuProcessor(),
+ fCellAccEnergy(),
+ fModuleID(moduleID),
+ fRcuX(rcuX),
+ fRcuZ(rcuZ),
+ fUtilitiesPtr(0)
{
+
//Se header file for documentation
- // char *tmp = getenv("ALIHLT_BASEDIR");
- char *tmp = getenv("HOME");
+ fUtilitiesPtr = new AliHLTPHOSUtilities();
+ char *tmp = getenv("HOME");
if(tmp == 0)
{
- cout << "ERROR, environment vriable HOME is not set" << endl;
-
+ // cout << "ERROR, environment vriable HOME is not set" << endl;
}
-
else
{
// sprintf(fHistoOutDir,"%s/rundir/output/histograms",tmp);
sprintf(fHistoOutDir,"%s/rundir/output/histograms/",tmp);
}
-
-
- SetModuleID(moduleID);
- SetRcuX(rcuX);
- SetRcuZ(rcuZ);
Init();
}
-AliHLTPHOSRcuHistogramProducer::~ AliHLTPHOSRcuHistogramProducer()
+
+AliHLTPHOSRcuHistogramProducer::~AliHLTPHOSRcuHistogramProducer()
{
//Destructor
}
if(fp == 0)
{
- cout << "ERROR, directory =" << fHistoOutDir << " Doesnt exist, or you don have write permissions to the directory" << endl;
- cout << "WARNING: Histograms will not bew written to files at end of run unless a valid directory is set" << endl;
- cout << "INFO, You must either" << endl;
- cout << "1) Create the directory " << fHistoOutDir << "Manually" <<endl;
- cout << "OR "<< endl;
- cout << "2) Se a valid output directory with the function AliHLTPHOSRcuHistogramProducer::SetHistoOutDir(*char outdir) "<< endl;
+// cout << "ERROR, directory =" << fHistoOutDir << " Doesnt exist, or you don have write permissions to the directory" << endl;
+// cout << "WARNING: Histograms will not bew written to files at end of run unless a valid directory is set" << endl;
+// cout << "INFO, You must either" << endl;
+// cout << "1) Create the directory " << fHistoOutDir << "Manually" <<endl;
+// cout << "OR "<< endl;
+// cout << "2) Se a valid output directory with the function AliHLTPHOSRcuHistogramProducer::SetHistoOutDir(*char outdir) "<< endl;
}
else
{
- cout << "INFO: Output ddirectory for Histograms was set tot" << fHistoOutDir << endl;
- cout << "INFO: if you want another output directory use the AliHLTPHOSRcuHistogramProducer::SetHistoOutDir(*char outdir)" << endl;
+ // cout << "INFO: Output ddirectory for Histograms was set tot" << fHistoOutDir << endl;
+ // cout << "INFO: if you want another output directory use the AliHLTPHOSRcuHistogramProducer::SetHistoOutDir(*char outdir)" << endl;
}
}
char tmpHistoName[256];
int geomx;
int geomz;
-
- for(int gain=0; gain< N_GAINS; gain++)
+ for(int gain=0; gain< NGAINS; gain++)
{
sprintf(tmpHistoName, "DeadChanneMap_Module%d_rcuz%d_rcux%d_gain%d",(int)fModuleID, fRcuZ, fRcuX, gain);
- // fDeadChannelMapHistogramPtrs[gain] = new TH2D( tmpHistoName, tmpHistoName, N_BINS, XBIN_LOW, XBIN_UP);
-
-
+ // fDeadChannelMapHistogramPtrs[gain] = new TH2D( tmpHistoName, tmpHistoName, NBINS, XBINLOW, XBINUP);
fDeadChannelMapHistogramPtrs[gain] = new TH2D(tmpHistoName, tmpHistoName,
- N_XCOLUMNS_RCU , 0, N_XCOLUMNS_RCU ,
- N_ZROWS_RCU, 0, N_ZROWS_RCU);
+ NXCOLUMNSRCU , 0, NXCOLUMNSRCU ,
+ NZROWSRCU, 0, NZROWSRCU);
fDeadChannelMapHistogramPtrs[gain]->Reset();
// fgCalibHistPtr[gain]->GetXaxis()->SetRange(128, 128 + 64);
-
-
}
-
-
- for(int x = 0; x < N_XCOLUMNS_RCU; x ++)
+ for(int x = 0; x < NXCOLUMNSRCU; x ++)
{
- for(int z = 0; z < N_ZROWS_RCU; z ++)
+ for(int z = 0; z < NZROWSRCU; z ++)
{
- for(int gain = 0; gain < N_GAINS; gain ++)
+ for(int gain = 0; gain < NGAINS; gain ++)
{
- geomx = x + N_XCOLUMNS_RCU*fRcuX;
- geomz = z + N_ZROWS_RCU*fRcuZ;
-
+ geomx = x + NXCOLUMNSRCU*fRcuX;
+ geomz = z + NZROWSRCU*fRcuZ;
fEnergyAverageValues[x][z][gain] = 0;
fAccumulatedValues[x][z][gain] = 0;
fTimingAverageValues[x][z][gain] = 0;
fHits[x][z][gain] = 0;
fDeadChannelMap[x][z][gain] = 0;
-
sprintf(tmpHistoName, "Edistribution_%d_%d_%d_%d",(int)fModuleID, geomx, geomz, gain);
// fEnergyHistogramPtrs[x][z][gain] = 0;
- fEnergyHistogramPtrs[x][z][gain] = new TH1F( tmpHistoName, tmpHistoName, N_BINS, XBIN_LOW, XBIN_UP);
+ fEnergyHistogramPtrs[x][z][gain] = new TH1F( tmpHistoName, tmpHistoName, NBINS, XBINLOW, XBINUP);
sprintf(tmpHistoName, "TOFdistribution_module%d_x%d_z%d_gain%d", (int)fModuleID, geomx, geomz, gain);
// fTimingHistogramPtrs[x][z][gain] = 0;
// fDeadChannelMapHistogramPtrs[x][z][gain] = new TH1D( tmpHistoName, tmpHistoName, N_BINS, XBIN_LOW, XBIN_UP);
- fTimingHistogramPtrs[x][z][gain] = new TH1F(tmpHistoName , tmpHistoName, N_BINS, XBIN_LOW, XBIN_UP);
+ fTimingHistogramPtrs[x][z][gain] = new TH1F(tmpHistoName , tmpHistoName, NBINS, XBINLOW, XBINUP);
fCellAccEnergy.fAccumulatedEnergies[x][z][gain] = 0;
fCellAccEnergy.fHits[x][z][gain] = 0;
fCellAccEnergy.fDeadChannelMap[x][z][gain] = 0;
-void
-AliHLTPHOSRcuHistogramProducer::SetRcuX(AliHLTUInt8_t X)
-{
- //See header file for documentation
- fRcuX = X;
- fCellAccEnergy.fRcuX = X;
-}
-
-
-
-void
-AliHLTPHOSRcuHistogramProducer::SetRcuZ(AliHLTUInt8_t Z)
-{
- //See header file for documentation
- fRcuZ = Z;
- fCellAccEnergy.fRcuZ = Z;
-}
-
-
-
-
-void
-AliHLTPHOSRcuHistogramProducer::SetModuleID(AliHLTUInt8_t moduleID)
-{
- //See header file for documentation
- fModuleID = moduleID;
-}
-
-
void
AliHLTPHOSRcuHistogramProducer::FillEnergy(AliHLTUInt8_t x, AliHLTUInt8_t z, AliHLTUInt8_t gain, float energy)
{
AliHLTPHOSRcuHistogramProducer::FillLiveChannelHistograms()
{
//comment
- for(int x = 0; x < N_XCOLUMNS_RCU; x ++)
+ for(int x = 0; x < NXCOLUMNSRCU; x ++)
{
- for(int z = 0; z < N_ZROWS_RCU; z ++)
+ for(int z = 0; z < NZROWSRCU; z ++)
{
- for(int gain = 0; gain < N_GAINS; gain ++)
+ for(int gain = 0; gain < NGAINS; gain ++)
{
fDeadChannelMapHistogramPtrs[gain]->SetBinContent(x ,z , fCellAccEnergy.fDeadChannelMap[x][z][gain]);
}
}
+
void
AliHLTPHOSRcuHistogramProducer::Reset()
{
//See header file for documentation
- for(int x = 0; x < N_XCOLUMNS_RCU; x ++)
+ for(int x = 0; x < NXCOLUMNSRCU; x ++)
{
- for(int z = 0; z < N_ZROWS_RCU; z ++)
+ for(int z = 0; z < NZROWSRCU; z ++)
{
- for(int gain = 0; gain < N_GAINS; gain ++)
+ for(int gain = 0; gain < NGAINS; gain ++)
{
fEnergyAverageValues[x][z][gain] = 0;
fAccumulatedValues[x][z][gain] = 0;
}
}
- for(int i = 0; i <ALTRO_MAX_SAMPLES; i++)
+ for(int i = 0; i <ALTROMAXSAMPLES; i++)
{
fTmpChannelData[i] = 0;
}
char runNumberFile[256];
char timeString[256];
- ResetArray(runNumberFile, 256);
- ResetArray(tmpEFileName, 256);
- ResetArray(timeString, 256);
+ fUtilitiesPtr->ResetArray(runNumberFile, 256);
+ fUtilitiesPtr->ResetArray(tmpEFileName, 256);
+ fUtilitiesPtr->ResetArray(timeString, 256);
sprintf(runNumberFile, "%s/rundir/runNumber.txt", getenv("HOME"));
FILE *fp = fopen(runNumberFile, "r");
+
+ Int_t res = 0; //OD to get rid of warnings
if(fp == 0)
{
ScanTimeString(timeString);
- cout << "WARNING, could not find file "<< runNumberFile <<endl;
- cout <<"Filename will be stamped with data and time instead " << endl;
+ // cout << "WARNING, could not find file "<< runNumberFile <<endl;
+ // cout <<"Filename will be stamped with data and time instead " << endl;
sprintf(tmpEFileName, "%s/Energy/EnergyHistograms_%s_mod%d_rcuZ%d_rcuX%d.root", fHistoOutDir, timeString, (int)fModuleID, (int)fRcuZ, (int)fRcuZ);
sprintf(tmpDeadFileName_gain0, "%s/DeadMap/DeadChannelHistograms_%s_mod%d_rcuZ%d_rcuX%d_LG.root", fHistoOutDir, timeString, (int)fModuleID, (int)fRcuZ, (int)fRcuZ);
sprintf(tmpDeadFileName_gain1, "%s/DeadMap/DeadChannelHistograms_%s_mod%d_rcuZ%d_rcuX%d_HG.root", fHistoOutDir, timeString, (int)fModuleID, (int)fRcuZ, (int)fRcuZ);
}
else
{
- fscanf(fp, "%d", &runNumber);
+ res = fscanf(fp, "%d", &runNumber);
sprintf(tmpEFileName, "%s/Energy/EnergyHisttograms_run%d_mod%d_rcuZ%d_rcuX%d.root", fHistoOutDir, runNumber, (int)fModuleID, (int)fRcuZ, (int)fRcuX);
sprintf(tmpDeadFileName_gain0, "%s/DeadMap/DeadChannleHistograms_run%d_mod%d_rcuZ%d_rcuX%d_LG.root", fHistoOutDir, runNumber, (int)fModuleID, (int)fRcuZ, (int)fRcuX);
sprintf(tmpDeadFileName_gain1, "%s/DeadMap/DeadChannleHistograms_run%d_mod%d_rcuZ%d_rcuX%d_HG.root", fHistoOutDir, runNumber, (int)fModuleID, (int)fRcuZ, (int)fRcuX);
fclose(fp);
}
- // cout << "tmpEFileName = "<< tmpEFileName <<endl;
- // cout << "tmpDeadFileName_gain0 (low gain) = " << tmpDeadFileName_gain0 <<endl;
- // cout << "tmpDeadFileName_gain1 (high gain) = " << tmpDeadFileName_gain1 <<endl;
-
- // sprintf(tmpEFileName,"/home/aliphoshlt/rundir/outdata/calibHisto_%d_%d_%d.root", (int)fModuleID, (int)fRcuX, (int)fRcuZ);
-
-
- // TFile *energyHistoFile = new TFile(tmpEFileName,"update");
- // TFile *energyHistoFile = new TFile(tmpEFileName,"recreate");
- // TFile *energyHistoFile = new TFile(tmpEFileName,"recreate");
-
- cout << "tmpEFileName = "<< tmpEFileName << endl;
+ // cout << "tmpEFileName = "<< tmpEFileName << endl;
TFile *energyHistoFile = new TFile(tmpEFileName, opt);
if(!energyHistoFile) return;
if(!energyHistoFile->IsOpen()) return;
- cout <<"printing histograms"<< endl;
+ // cout <<"printing histograms"<< endl;
- for(int x = 0; x < N_XCOLUMNS_RCU; x ++)
+ for(int x = 0; x < NXCOLUMNSRCU; x ++)
{
- for(int z = 0; z < N_ZROWS_RCU; z ++)
+ for(int z = 0; z < NZROWSRCU; z ++)
{
- for(int gain = 0; gain < N_GAINS; gain ++)
+ for(int gain = 0; gain < NGAINS; gain ++)
{
// cout << "the number of entries is " <<fEnergyHistogramPtrs[x][z][gain]->GetEntries()<< endl;
fEnergyHistogramPtrs[x][z][gain]->Write();
deadHistoFile_gain0->Close();
deadHistoFile_gain1->Close();
-
- cout << "printing histograms, finished"<< endl;
+
+ // cout << "printing histograms, finished"<< endl;
}
void
//comment
time_t timePtr;
tm *tmPtr;
- // char *timeString;
time(&timePtr);
tmPtr=localtime(&timePtr);
timeString=asctime(tmPtr);
- // char tShort [strlen(timeString)+1];
char day[10];
char month[10];
int date;
int min;
int sec;
int year;
- char sDate[5];
- char sHour[5];
- char sMin[5];
- char sSec[5];
- char sYear[10];
sscanf(timeString, "%s %s %d %d:%d:%d %d\n", day, month, &date, &hour, &min, &sec, &year);
}