if(!hotmapfile)
{
- printf(" NO HOTCHANNEL MAP FOUND (PMD_HOR.root) FILE IS FOUND \n");
+ printf(" NO HOTCHANNEL MAP FOUND (PMD_HOT.root) FILE IS FOUND \n");
fHotFlag[kDet][kMaxSMN][kMaxRow][kMaxCol] = 0.;
}
}
// ------------------------------------------------------------------------ //
-void AliPMDCalibGain::Analyse(TTree *gaintree)
+void AliPMDCalibGain::Analyse(TTree *gaintree, TTree *meantree)
{
// Calculates the mean
Int_t det, sm, row, col;
Float_t gain;
- Float_t modmean = 0.;
Float_t cellmean = 0.;
+ Float_t modmean[2][24];
+
+ for (Int_t idet=0; idet < 2; idet++)
+ {
+ for (Int_t ism = 0; ism < 24; ism++)
+ {
+ modmean[idet][ism] = 0.;
+ }
+ }
+
gaintree->Branch("det",&det,"det/I");
gaintree->Branch("sm",&sm,"sm/I");
gaintree->Branch("row",&row,"row/I");
for(Int_t ism = 0; ism < kMaxSMN; ism++)
{
if (fSMCount[idet][ism] > 0)
- modmean = fSMIso[idet][ism]/fSMCount[idet][ism];
+ modmean[idet][ism] = fSMIso[idet][ism]/fSMCount[idet][ism];
for(Int_t irow = 0; irow < kMaxRow; irow++)
{
for(Int_t icol = 0; icol < kMaxCol; icol++)
col = icol;
if (cellmean > 0.0 && fCellCount[idet][ism][irow][icol]>0.)
{
- gain = cellmean/modmean;
+ gain = cellmean/modmean[idet][ism];
}
else
{
}
}
}
+
+ Float_t smmean;
+
+ // Writing each module mean value
+ meantree->Branch("det",&det,"det/I");
+ meantree->Branch("sm",&sm,"sm/I");
+ meantree->Branch("smmean",&smmean,"row/F");
+ for(Int_t idet = 0; idet < kDet; idet++)
+ {
+ for (Int_t ism = 0; ism < kMaxSMN; ism++)
+ {
+ det = idet;
+ sm = ism;
+ smmean = modmean[idet][ism];
+ meantree->Fill();
+ }
+ }
+
}
// ------------------------------------------------------------------------ //
-void AliPMDCalibGain::AnalyseHotCell(TTree *hottree)
+void AliPMDCalibGain::FindHotCell(TTree *hottree, Float_t xvar)
{
// Calculates the mean
Int_t det, sm, row, col;
Float_t meannhit;
Float_t meanSqnhit;
Float_t sigmanhit,nhitcut;
-
+
+ //Float_t xvar = 5.;
+
hottree->Branch("det",&det,"det/I");
hottree->Branch("sm",&sm,"sm/I");
hottree->Branch("row",&row,"row/I");
meannhit = fTempnhit[idet][ism]/fCountSm[idet][ism];
meanSqnhit = fTempnhitSq[idet][ism]/fCountSm[idet][ism];
sigmanhit = sqrt(meanSqnhit-(meannhit*meannhit));
- nhitcut = meannhit + 6.*sigmanhit;
+ nhitcut = meannhit + xvar*sigmanhit;
for(Int_t irow = 0; irow < kMaxRow; irow++)
{
#include "event.h"
#include "monitor.h"
-//#include "daqDA.h"
#include <Riostream.h>
#include <stdio.h>
int status = 0;
- Int_t filestatus = -1, totevt = -1;
- Int_t maxevt = -1;
+ Int_t filestatus = -1, xvar = 5;
+ Int_t totevt = -1, maxevt = -1;
// Reads the pedestal file and keep the values in memory for subtraction
AliPMDCalibGain calibgain;
// Fetch the pedestal file - PMD_PED.root
+
status = daqDA_DB_getFile("PMD_PED.root","PMD_PED.root");
if(!status)
printf("*** Pedestal file NOT retrieved from DB *** \n");
return -1;
}
-
+
Int_t pstatus = calibgain.ExtractPedestal("PMD_PED.root");
if(pstatus == -3) return -3;
- TTree *ic = NULL;
+ TTree *ic = NULL;
+ TTree *meanc = NULL;
// Retrieve the PMD_GAIN_CONFIGFILE
status = daqDA_DB_getFile("PMD_GAIN_CONFIGFILE","PMD_GAIN_CONFIGFILE");
}
else
{
- fscanf(fp1,"%d %d %d\n",&filestatus, &totevt,&maxevt);
- //printf("%d %d %d\n",filestatus, totevt, maxevt);
+ fscanf(fp1,"%d %d %d %d\n",&filestatus, &xvar, &totevt, &maxevt);
+ //printf("%d %d %d %d\n",filestatus, xvar, totevt, maxevt);
}
fclose(fp1);
+
if (filestatus == 1)
{
{
printf("--- pmd_gain_tempfile.dat: not retrieved from DB ---\n");
}
+ // Retrieve the hot cell file from DB - PMD_HOT.root
+ status = daqDA_DB_getFile("PMD_HOT.root","PMD_HOT.root");
+ if(!status)
+ {
+ calibgain.ExtractHotChannel("PMD_HOT.root");
+ }
+ else
+ {
+ printf("--- pmd_gain_tempfile.dat: not retrieved from DB ---\n");
+ }
}
+
// decoding the events
/* exit when last event received, no need to wait for TERM signal */
- ic = new TTree("ic","PMD Gain tree");
+
+ ic = new TTree("ic","PMD Gain tree");
+ meanc = new TTree("meanc","PMD Module mean tree");
+
+ if (filestatus == 0)
+ {
+ TFile *hotRun = new TFile ("PMD_HOT.root","RECREATE");
+
+ TTree *hot = new TTree("hot","PMD Hot cell tree");
+
+ calibgain.FindHotCell(hot,xvar);
+
+ hot->Write();
+ hotRun->Close();
+
+ // store the hot cell root file in the DB
+
+ status = daqDA_DB_storeFile("PMD_HOT.root","PMD_HOT.root");
+ }
+
totevt += nevents_physics++;
status = daqDA_DB_storeFile("pmd_gain_tempfile.dat","pmd_gain_tempfile.dat");
filestatus = 1;
- fprintf(fp1,"%d %d %d\n",filestatus,totevt,maxevt);
+ fprintf(fp1,"%d %d %d %d\n",filestatus,xvar,totevt,maxevt);
+ fclose(fp1);
// Store the configfile in the DB
status = daqDA_DB_storeFile("PMD_GAIN_CONFIGFILE","PMD_GAIN_CONFIGFILE");
printf("*** Writing the PMDGAINS.root file ***\n");
printf("-----------------------------------------------\n");
- calibgain.Analyse(ic);
+ calibgain.Analyse(ic, meanc);
TFile * gainRun = new TFile ("PMDGAINS.root","RECREATE");
ic->Write();
gainRun->Close();
+ TFile * meanRun = new TFile ("PMD_MEAN_SM.root","RECREATE");
+ meanc->Write();
+ meanRun->Close();
+
+
filestatus = 0;
totevt = 0;
- fprintf(fp1,"%d %d %d\n",filestatus,totevt,maxevt);
+ fprintf(fp1,"%d %d %d %d\n",filestatus,xvar,totevt,maxevt);
+ fclose(fp1);
// Store the configfile in the DB
status = daqDA_DB_storeFile("PMD_GAIN_CONFIGFILE","PMD_GAIN_CONFIGFILE");
-
}
- fclose(fp1);
delete ic;
ic = 0;
+
+ delete meanc;
+ meanc = 0;
/* store the result file on FES */
if (filestatus == 0)
{
- printf("root file is created and getting exported\n");
+ printf("root file for cell gain is created and getting exported\n");
status = daqDA_FES_storeFile("PMDGAINS.root","PMDGAINS.root");
+ printf("root file for hot cell is created and getting exported\n");
+ status = daqDA_FES_storeFile("PMD_HOT.root","PMD_HOT.root");
+ printf("root file for normalised means of different modules\n");
+ status = daqDA_FES_storeFile("PMD_MEAN_SM.root","PMD_MEAN_SM.root");
}
-
+
if (status) {
status = -2;
}
+
return status;
}