//
//////////////////////////////////////////////////////////////////////////////
+#include "Riostream.h"
#include "TF1.h"
#include "TFile.h"
#include "TObjString.h"
// Pedestal extraction from the PMD_PED.root file
// To be called once at the beginning
- Int_t det, sm, row, col;
- Float_t mean, rms;
+ Int_t det=0, sm=0, row=0, col=0;
+ Float_t mean=0., rms=0.;
TFile *pedfile = new TFile(rootFile);
// HotChannel extraction from the PMD_HOT.root file
// To be called once at the beginning
- Int_t det, sm, row, col;
- Float_t flag;
+ Int_t det=0, sm=0, row=0, col=0;
+ Float_t flag=0.;
TFile *hotmapfile = new TFile(rootFile);
if(!hotmapfile)
{
- printf(" NO HOTCHANNEL MAP FOUND (PMD_HOR.root) FILE IS FOUND \n");
- fHotFlag[kDet][kMaxSMN][kMaxRow][kMaxCol] = 0.;
+ printf(" NO HOTCHANNEL MAP (PMD_HOT.root) FILE IS FOUND \n");
+
+ for (Int_t idet = 0; idet < kDet; idet++)
+ {
+ for (Int_t ismn = 0; ismn < kMaxSMN; ismn++)
+ {
+ for (Int_t irow = 0; irow < kMaxRow; irow++)
+ {
+ for (Int_t icol = 0; icol < kMaxCol; icol++)
+ {
+ fHotFlag[idet][ismn][irow][icol] = 0.;
+ }
+ }
+ }
+ }
}
{
// Read the variables from the file
- fpw = fopen(tempFile,"r");
-
- Float_t smcount, smiso;
- Float_t cellcount, celliso;
+ ifstream intmpfile;
+ intmpfile.open(tempFile);
+
+ Int_t iddet = 0, issm = 0, irrow = 0, iccol = 0;
+ Float_t smcount = 0., smiso = 0.;
+ Float_t cellcount = 0., celliso = 0.;
for (Int_t idet = 0; idet < kDet; idet++)
{
for (Int_t ism = 0; ism < kMaxSMN; ism++)
{
- fscanf(fpw,"%d %d %f %f",&idet,&ism,&smcount,&smiso);
-
+ intmpfile >> iddet >> issm >> smcount >> smiso;
fSMCount[idet][ism] = smcount;
fSMIso[idet][ism] = smiso;
}
{
for (Int_t icol = 0; icol < kMaxCol; icol++)
{
- fscanf(fpw,"%d %d %d %d %f %f",&idet,&ism,&irow,&icol,
- &cellcount,&celliso);
-
+ intmpfile >> iddet >> issm >> irrow >> iccol
+ >> cellcount >> celliso;
fCellCount[idet][ism][irow][icol] = cellcount;
fCellIso[idet][ism][irow][icol] = celliso;
}
}
}
- fclose(fpw);
+
+ intmpfile.close();
}
// ------------------------------------------------------------------------ //
Int_t neibx[6] = {1,0,-1,-1,0,1};
Int_t neiby[6] = {0,1,1,0,-1,-1};
- Int_t id1,jd1; //neighbour row/col
- Int_t isocount; //number of neighbours with 0 signal
+ Int_t id1 = 0,jd1 = 0; //neighbour row/col
+ Int_t isocount = 0; //number of neighbours with 0 signal
Float_t d1[kDet][kMaxSMN][kMaxRow][kMaxCol];
{
id1 = irow + neibx[ii];
jd1 = icol + neiby[ii];
+ if (id1 < 0) id1 = 0;
+ if (id1 > kMaxRow-1) id1 = kMaxRow - 1;
+ if (jd1 < 0) jd1 = 0;
+ if (jd1 > kMaxCol-1) jd1 = kMaxCol - 1;
if(d1[idet][ismn][id1][jd1] == 0)
{
isocount++;
}
// ------------------------------------------------------------------------ //
-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.;
+ Int_t det = 0, sm = 0, row = 0, col = 0;
+ Float_t gain = 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 flag;
- Float_t meannhit;
- Float_t meanSqnhit;
- Float_t sigmanhit,nhitcut;
-
+ Int_t det = 0, sm = 0, row = 0, col = 0;
+ Float_t flag = 0.;
+ Float_t meannhit = 0.;
+ Float_t meanSqnhit = 0.;
+ Float_t sigmanhit = 0.,nhitcut = 0.;
+
+ //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++)
{