LCOV - code coverage report
Current view: top level - PMD/PMDrec - AliPMDCalibGain.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 268 0.4 %
Date: 2016-06-14 17:26:59 Functions: 1 16 6.2 %

          Line data    Source code
       1             : //////////////////////////////////////////////////////////////////////////////
       2             : //
       3             : // * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       4             : // *                                                                        *
       5             : // * Author: The ALICE Off-line Project.                                    *
       6             : // * Contributors are mentioned in the code where appropriate.              *
       7             : // *                                                                        *
       8             : // * Permission to use, copy, modify and distribute this software and its   *
       9             : // * documentation strictly for non-commercial purposes is hereby granted   *
      10             : // * without fee, provided that the above copyright notice appears in all   *
      11             : // * copies and that both the copyright notice and this permission notice   *
      12             : // * appear in the supporting documentation. The authors make no claims     *
      13             : // * about the suitability of this software for any purpose. It is          *
      14             : // * provided "as is" without express or implied warranty.                *
      15             : // **************************************************************************/
      16             : //
      17             : //////////////////////////////////////////////////////////////////////////////
      18             : 
      19             : #include "Riostream.h"
      20             : #include "TF1.h"
      21             : #include "TFile.h"
      22             : #include "TObjString.h"
      23             : #include "TROOT.h"
      24             : #include "TClonesArray.h"
      25             : #include "TH1F.h"
      26             : #include "TObjArray.h"
      27             : #include "TTree.h"
      28             : #include "TMath.h"
      29             : 
      30             : // --- Standard library ---
      31             : 
      32             : // --- AliRoot header files ---
      33             : #include "AliDAQ.h"
      34             : #include "AliLog.h"
      35             : #include "AliRawReader.h"
      36             : #include "AliPMDRawStream.h"
      37             : #include "AliPMDddldata.h"
      38             : #include "AliPMDCalibGain.h"
      39             : 
      40             : using std::ifstream;
      41          12 : ClassImp(AliPMDCalibGain)
      42             : 
      43             : AliPMDCalibGain::AliPMDCalibGain():
      44           0 :   TObject(),
      45           0 :   fpw(NULL)
      46           0 : {
      47             :   // Standard Constructor
      48           0 :   for(Int_t idet = 0; idet < kDet; idet++)
      49             :     {
      50           0 :       for(Int_t ismn = 0; ismn < kMaxSMN; ismn++)
      51             :         {
      52           0 :           fSMIso[idet][ismn]   = 0.;
      53           0 :           fSMCount[idet][ismn] = 0.;
      54           0 :           fCountSm[idet][ismn]=0.;
      55           0 :           fTempnhit[idet][ismn]=0.;
      56           0 :           fTempnhitSq[idet][ismn]=0.;
      57           0 :           for(Int_t jrow = 0; jrow < kMaxRow; jrow++)
      58             :             {
      59           0 :               for(Int_t kcol = 0; kcol < kMaxCol; kcol++)
      60             :                 {
      61           0 :                   fCellIso[idet][ismn][jrow][kcol]    = 0.;
      62           0 :                   fCellCount[idet][ismn][jrow][kcol]  = 0.;
      63           0 :                   fNhitCell[idet][ismn][jrow][kcol]   = 0.;
      64           0 :                   fPedMeanRMS[idet][ismn][jrow][kcol] = 0.;
      65           0 :                   fHotFlag[idet][ismn][jrow][kcol]    = 0.;
      66             :                   
      67             :                 }
      68             :             }
      69             :         }
      70             :     }
      71             :   
      72           0 : }
      73             : // ------------------------------------------------------------------------ //
      74             : AliPMDCalibGain::AliPMDCalibGain(const AliPMDCalibGain &pmdcalibgain):
      75           0 :   TObject(pmdcalibgain),
      76           0 :   fpw(NULL)
      77           0 : {
      78           0 :   for(Int_t idet = 0; idet < kDet; idet++)
      79             :     {
      80           0 :       for(Int_t ismn = 0; ismn < kMaxSMN; ismn++)
      81             :         {
      82           0 :           fSMIso[idet][ismn] = pmdcalibgain.fSMIso[idet][ismn] ;
      83           0 :           fSMCount[idet][ismn] = pmdcalibgain.fSMCount[idet][ismn] ;
      84           0 :           fCountSm[idet][ismn] = pmdcalibgain.fCountSm[idet][ismn];
      85           0 :           fTempnhit[idet][ismn] = pmdcalibgain.fTempnhit[idet][ismn];
      86           0 :           fTempnhitSq[idet][ismn] = pmdcalibgain.fTempnhitSq[idet][ismn];
      87           0 :           for(Int_t jrow = 0; jrow < kMaxRow; jrow++)
      88             :             {
      89           0 :               for(Int_t kcol = 0; kcol < kMaxCol; kcol++)
      90             :                 {
      91           0 :                   fCellIso[idet][ismn][jrow][kcol] = pmdcalibgain.fCellIso[idet][ismn][jrow][kcol];
      92           0 :                   fCellCount[idet][ismn][jrow][kcol] = pmdcalibgain.fCellCount[idet][ismn][jrow][kcol];
      93           0 :                   fNhitCell[idet][ismn][jrow][kcol] = pmdcalibgain.fNhitCell[idet][ismn][jrow][kcol];
      94           0 :                   fPedMeanRMS[idet][ismn][jrow][kcol] = pmdcalibgain.fPedMeanRMS[idet][ismn][jrow][kcol];
      95           0 :                   fHotFlag[idet][ismn][jrow][kcol] = pmdcalibgain.fHotFlag[idet][ismn][jrow][kcol];
      96             :                   
      97             :                 }
      98             :             }
      99             :         }
     100             :     }
     101             :   
     102           0 : }
     103             : // ------------------------------------------------------------------------ //
     104             : AliPMDCalibGain &AliPMDCalibGain::operator=(const AliPMDCalibGain &pmdcalibgain)
     105             : {
     106           0 :   if(this != &pmdcalibgain)
     107             :     {
     108           0 :       this->fpw = pmdcalibgain.fpw;
     109           0 :       for(Int_t idet = 0; idet < kDet; idet++)
     110             :         {
     111           0 :           for(Int_t ismn = 0; ismn < kMaxSMN; ismn++)
     112             :             {
     113           0 :               fSMIso[idet][ismn]      = pmdcalibgain.fSMIso[idet][ismn];
     114           0 :               fSMCount[idet][ismn]    = pmdcalibgain.fSMCount[idet][ismn];
     115           0 :               fCountSm[idet][ismn]    = pmdcalibgain.fCountSm[idet][ismn];
     116           0 :               fTempnhit[idet][ismn]   = pmdcalibgain.fTempnhit[idet][ismn];
     117           0 :               fTempnhitSq[idet][ismn] = pmdcalibgain.fTempnhitSq[idet][ismn];
     118           0 :               for(Int_t jrow = 0; jrow < kMaxRow;jrow++)
     119             :                 {
     120           0 :                   for(Int_t kcol = 0; kcol < kMaxCol; kcol++)
     121             :                     {
     122           0 :                       fCellIso[idet][ismn][jrow][kcol] = pmdcalibgain.fCellIso[idet][ismn][jrow][kcol];
     123           0 :                       fCellCount[idet][ismn][jrow][kcol] = pmdcalibgain.fCellCount[idet][ismn][jrow][kcol];
     124           0 :                       fNhitCell[idet][ismn][jrow][kcol] = pmdcalibgain.fNhitCell[idet][ismn][jrow][kcol]; //za 
     125           0 :                       fPedMeanRMS[idet][ismn][jrow][kcol] = pmdcalibgain.fPedMeanRMS[idet][ismn][jrow][kcol];
     126           0 :                       fHotFlag[idet][ismn][jrow][kcol] = pmdcalibgain.fHotFlag[idet][ismn][jrow][kcol];
     127             :                       
     128             :                     }
     129             :                 }
     130             :             }
     131             :         }
     132           0 :     }
     133           0 :   return *this;
     134             : }
     135             : // ------------------------------------------------------------------------ //
     136             : AliPMDCalibGain::~AliPMDCalibGain()
     137           0 : {
     138             :   // dtor
     139           0 : }
     140             : 
     141             : // ------------------------------------------------------------------------ //
     142             : 
     143             : Int_t AliPMDCalibGain::ExtractPedestal(const Char_t *rootFile)
     144             : {
     145             :   // Pedestal extraction from the PMD_PED.root file
     146             :   // To be called once at the beginning
     147             :   
     148           0 :   Int_t   det=0, sm=0, row=0, col=0;
     149           0 :   Float_t mean=0., rms=0.;
     150             :   
     151           0 :   TFile *pedfile = new TFile(rootFile);
     152             :   
     153           0 :   if(!pedfile)
     154             :     {
     155           0 :       printf("ERROR --- NO PEDESTAL (PMD_PED1.root) FILE IS FOUND --- STOP GAIN DA\n");
     156           0 :       return -3;
     157             :     }
     158             : 
     159             : 
     160           0 :   TTree *ped =(TTree*)pedfile->Get("ped");
     161             : 
     162           0 :   ped->SetBranchAddress("det",&det);
     163           0 :   ped->SetBranchAddress("sm",&sm);
     164           0 :   ped->SetBranchAddress("row",&row);
     165           0 :   ped->SetBranchAddress("col",&col);
     166           0 :   ped->SetBranchAddress("mean",&mean);
     167           0 :   ped->SetBranchAddress("rms",&rms);
     168             : 
     169           0 :   Int_t nentries = (Int_t)ped->GetEntries();
     170             : 
     171           0 :   for (Int_t ient = 0; ient < nentries; ient++)
     172             :     {
     173           0 :       ped->GetEntry(ient);
     174           0 :       fPedMeanRMS[det][sm][row][col] = mean + 3.*rms;
     175             :       //printf("Mean= %f, RMS= %f, PedMeanRMS=%f\n",mean,rms,fPedMeanRMS[det][sm][row][col]);
     176             : 
     177             :     }
     178             : 
     179           0 :   pedfile->Close();
     180           0 :   delete pedfile;
     181             :   pedfile = 0x0;
     182             : 
     183             :   return 1;
     184           0 : }
     185             : //------------------------------------------------------------------------------------------------
     186             : 
     187             : Int_t AliPMDCalibGain::ExtractHotChannel(const Char_t *rootFile)
     188             : {
     189             :   // HotChannel extraction from the PMD_HOT.root file
     190             :   // To be called once at the beginning
     191             : 
     192           0 :   Int_t   det=0, sm=0, row=0, col=0;
     193           0 :   Float_t flag=0.;
     194             : 
     195           0 :   TFile *hotmapfile = new TFile(rootFile);
     196             : 
     197           0 :   if(!hotmapfile)
     198             :     {
     199           0 :       printf(" NO HOTCHANNEL MAP (PMD_HOT.root) FILE IS FOUND \n");
     200             : 
     201           0 :       for (Int_t idet = 0; idet < kDet; idet++)
     202             :         {
     203           0 :           for (Int_t ismn = 0; ismn < kMaxSMN; ismn++)
     204             :             {
     205           0 :               for (Int_t irow = 0; irow < kMaxRow; irow++)
     206             :                 {
     207           0 :                   for (Int_t icol = 0; icol < kMaxCol; icol++)
     208             :                     {
     209           0 :                       fHotFlag[idet][ismn][irow][icol] = 0.;
     210             :                     }
     211             :                 }
     212             :             }
     213             :         }
     214           0 :     }
     215             : 
     216             : 
     217           0 :   TTree *hot =(TTree*)hotmapfile->Get("hot");
     218             :   
     219           0 :   hot->SetBranchAddress("det",&det);
     220           0 :   hot->SetBranchAddress("sm",&sm);
     221           0 :   hot->SetBranchAddress("row",&row);
     222           0 :   hot->SetBranchAddress("col",&col);
     223           0 :   hot->SetBranchAddress("flag",&flag);
     224             :   
     225           0 :   Int_t nentries = (Int_t)hot->GetEntries();
     226             :   
     227           0 :   for (Int_t ient = 0; ient < nentries; ient++)
     228             :     {
     229           0 :       hot->GetEntry(ient);
     230           0 :       fHotFlag[det][sm][row][col] = flag;
     231             : 
     232             :       //printf(" HotFlag=%f\n",fHotFlag[det][sm][row][col]);
     233             :     }
     234             : 
     235           0 :   hotmapfile->Close();
     236           0 :   delete hotmapfile;
     237             :   hotmapfile = 0x0;
     238             :   
     239           0 :   return 1;
     240           0 : }
     241             : 
     242             : 
     243             : // ------------------------------------------------------------------------ //
     244             : 
     245             : void AliPMDCalibGain::ReadTempFile(const Char_t *tempFile)
     246             : {
     247             :   // Read the variables from the file
     248             :   
     249           0 :   ifstream intmpfile;
     250           0 :   intmpfile.open(tempFile);
     251             : 
     252           0 :   Int_t iddet = 0, issm = 0, irrow = 0, iccol = 0;
     253           0 :   Float_t smcount = 0., smiso = 0.;
     254           0 :   Float_t cellcount = 0., celliso = 0.;
     255             : 
     256             : 
     257           0 :   for (Int_t idet = 0; idet < kDet; idet++)
     258             :     {
     259           0 :       for (Int_t ism = 0; ism < kMaxSMN; ism++)
     260             :         {
     261           0 :           intmpfile >> iddet >> issm >> smcount >> smiso;
     262           0 :           fSMCount[idet][ism] = smcount;
     263           0 :           fSMIso[idet][ism]   = smiso;
     264             :         }
     265             :     }
     266             : 
     267           0 :   for (Int_t idet = 0; idet < kDet; idet++)
     268             :     {
     269           0 :       for (Int_t ism = 0; ism < kMaxSMN; ism++)
     270             :         {
     271           0 :           for (Int_t irow = 0; irow < kMaxRow; irow++)
     272             :             {
     273           0 :               for (Int_t icol = 0; icol < kMaxCol; icol++)
     274             :                 {
     275           0 :                   intmpfile >> iddet >> issm >> irrow >> iccol
     276           0 :                             >> cellcount >> celliso;
     277           0 :                   fCellCount[idet][ism][irow][icol] = cellcount;
     278           0 :                   fCellIso[idet][ism][irow][icol]   = celliso;
     279             :                 }
     280             :             }
     281             :         }
     282             :     }
     283             :   
     284             : 
     285           0 :   intmpfile.close();
     286             : 
     287           0 : }
     288             : // ------------------------------------------------------------------------ //
     289             : void AliPMDCalibGain::WriteTempFile(const Char_t *tempFile)
     290             : {
     291             :   // Write the Temporary file if the required statics is not achieved
     292             : 
     293             : 
     294             :   /*
     295             :     Following variables to be written to a file
     296             :     fDetIso[idet] ;
     297             :     fSMIso[idet][ismn]; 
     298             :     fCellIso[idet][ismn][irow][icol]; 
     299             :     
     300             :     fDetCount[idet];
     301             :     fSMCount[idet][ismn];
     302             :     fCellCount[idet][ismn][irow][icol];
     303             :   */                              
     304             : 
     305             : 
     306           0 :   fpw = fopen(tempFile,"w+");
     307             :   
     308           0 :   for (Int_t idet = 0; idet < kDet; idet++)
     309             :     {
     310             :      // fprintf(fpw,"%d %f %f\n",idet,fDetCount[idet],fDetIso[idet]);
     311             :     }
     312             :   
     313           0 :   for (Int_t idet = 0; idet < kDet; idet++)
     314             :     {
     315           0 :       for (Int_t ism = 0; ism < kMaxSMN; ism++)
     316             :         {
     317           0 :           fprintf(fpw,"%d %d %f %f\n",idet,ism, fSMCount[idet][ism],fSMIso[idet][ism]);
     318             :         }
     319             :     }
     320             :   
     321           0 :   for (Int_t idet = 0; idet < kDet; idet++)
     322             :     {
     323           0 :       for (Int_t ism = 0; ism < kMaxSMN; ism++)
     324             :         {
     325           0 :           for (Int_t irow = 0; irow < kMaxRow; irow++)
     326             :             {
     327           0 :               for (Int_t icol = 0; icol < kMaxCol; icol++)
     328             :                 {
     329           0 :                   fprintf(fpw,"%d %d %d %d %f %f\n",idet,ism,irow,icol,
     330           0 :                           fCellCount[idet][ism][irow][icol],
     331           0 :                           fCellIso[idet][ism][irow][icol]);
     332             :                 }
     333             :             }
     334             :         }
     335             :     }
     336             :   
     337           0 :   fclose(fpw);
     338             :   
     339           0 : }
     340             : 
     341             : // ------------------------------------------------------------------------ //
     342             : 
     343             : Bool_t AliPMDCalibGain::ProcessEvent(AliRawReader *rawReader, TObjArray *pmdddlcont)
     344             : {
     345             :   // Calculates the ADC of isolated cell
     346             :   
     347           0 :   const Int_t kDDL           = AliDAQ::NumberOfDdls("PMD");
     348             :   const Int_t kCellNeighbour = 6;
     349           0 :   Int_t neibx[6] = {1,0,-1,-1,0,1};
     350           0 :   Int_t neiby[6] = {0,1,1,0,-1,-1};
     351             :   
     352             :   Int_t id1 = 0,jd1 = 0;  //neighbour row/col
     353             :   Int_t isocount = 0;     //number of neighbours with 0 signal
     354             : 
     355           0 :   Float_t d1[kDet][kMaxSMN][kMaxRow][kMaxCol];
     356             :   
     357           0 :   for(Int_t idet = 0; idet < kDet; idet++)
     358             :     {
     359           0 :       for(Int_t ismn = 0; ismn < kMaxSMN; ismn++)
     360             :         {
     361           0 :           for(Int_t irow = 0; irow < kMaxRow; irow++)
     362             :             {
     363           0 :               for(Int_t icol = 0; icol < kMaxCol; icol++)
     364             :                 {
     365           0 :                   d1[idet][ismn][irow][icol] = 0.;
     366             :                 }
     367             :             }
     368             :         }
     369             :     }
     370             :   
     371           0 :   AliPMDRawStream rawStream(rawReader);
     372             : 
     373             :   Int_t iddl = -1;
     374             :   
     375             :   Int_t numberofDDLs = 0;
     376             : 
     377           0 :   while ((iddl = rawStream.DdlData(pmdddlcont)) >=0) {
     378           0 :     numberofDDLs++;
     379             :     
     380           0 :     Int_t ientries = pmdddlcont->GetEntries();
     381             :     
     382           0 :     for (Int_t ient = 0; ient < ientries; ient++)
     383             :       {
     384           0 :         AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont->UncheckedAt(ient);
     385             :         
     386           0 :         Int_t idet = pmdddl->GetDetector();
     387           0 :         Int_t ismn = pmdddl->GetSMN();
     388           0 :         Int_t mcm = pmdddl->GetMCM();
     389             :         //Int_t ichno = pmdddl->GetChannel();
     390           0 :         Int_t irow = pmdddl->GetRow();
     391           0 :         Int_t icol = pmdddl->GetColumn();
     392           0 :         Int_t isig = pmdddl->GetSignal();
     393             :         
     394             :         // This is the protection not to crash the code 
     395             :         
     396           0 :         if(mcm == 0) continue;
     397           0 :         if (irow < 0 || icol < 0 || irow > 47 || icol > 95) continue;
     398             :         
     399             :         // Pedestal subtraction
     400           0 :         if(fHotFlag[idet][ismn][irow][icol] == 1.0) isig = 0;
     401             :         
     402           0 :         if (isig>0)
     403             :           {
     404           0 :             d1[idet][ismn][irow][icol] =
     405           0 :               (Float_t) isig - fPedMeanRMS[idet][ismn][irow][icol];
     406             :             
     407             :             //printf("Signal_ped_subtracted=%f, pedestal=%f\n",d1[idet][ismn][irow][icol]),fPedMeanRMS[idet][ismn][irow][icol];
     408             :             
     409           0 :             fNhitCell[idet][ismn][irow][icol]++;     //cell hit frequency
     410           0 :           }
     411             :         
     412             : 
     413           0 :       }
     414           0 :     pmdddlcont->Delete();
     415             :     }
     416             :   
     417           0 :   for(Int_t idet=0; idet < kDet; idet++)
     418             :     {
     419           0 :       for(Int_t ismn = 0; ismn < kMaxSMN; ismn++)
     420             :         {
     421           0 :           for(Int_t irow = 0; irow < kMaxRow; irow++)
     422             :             {
     423           0 :               for(Int_t icol = 0; icol < kMaxCol; icol++)
     424             :                 {
     425           0 :                   if(d1[idet][ismn][irow][icol] > 0)
     426             :                     {
     427             :                       isocount = 0;
     428           0 :                       for(Int_t ii = 0; ii < kCellNeighbour; ii++)
     429             :                         {
     430           0 :                           id1 = irow + neibx[ii];
     431           0 :                           jd1 = icol + neiby[ii];
     432           0 :                           if (id1 < 0) id1 = 0;
     433           0 :                           if (id1 > kMaxRow-1) id1 = kMaxRow - 1;
     434           0 :                           if (jd1 < 0) jd1 = 0;
     435           0 :                           if (jd1 > kMaxCol-1) jd1 = kMaxCol - 1;
     436           0 :                           if(d1[idet][ismn][id1][jd1] == 0)
     437             :                             {
     438           0 :                               isocount++;
     439           0 :                               if(isocount == kCellNeighbour)
     440             :                                 {
     441             :                                   //fDetIso[idet] += d1[idet][ismn][irow][icol];
     442           0 :                                   fSMIso[idet][ismn] += d1[idet][ismn][irow][icol];
     443           0 :                                   fCellIso[idet][ismn][irow][icol] += d1[idet][ismn][irow][icol];
     444             :                                   //fDetCount[idet]++;
     445           0 :                                   fSMCount[idet][ismn]++;
     446           0 :                                   fCellCount[idet][ismn][irow][icol]++;
     447             :                                   
     448           0 :                                 }
     449             :                             }
     450             :                         }  // neigh cell cond.
     451           0 :                     }     // d>0 cond.
     452             :                 }
     453             :             }
     454             :         }
     455             :     }
     456             :   
     457           0 :   for(Int_t idet=0; idet < kDet; idet++)
     458             :     {
     459           0 :       for(Int_t ismn = 0; ismn < kMaxSMN; ismn++)
     460             :         {
     461           0 :           for(Int_t irow = 0; irow < kMaxRow; irow++)
     462             :             {
     463           0 :               for(Int_t icol = 0; icol < kMaxCol; icol++)
     464             :                 {
     465           0 :                   if(fNhitCell[idet][ismn][irow][icol]>0)
     466             :                     {
     467           0 :                       fCountSm[idet][ismn]  += 1;
     468           0 :                       fTempnhit[idet][ismn] += fNhitCell[idet][ismn][irow][icol];
     469           0 :                       fTempnhitSq[idet][ismn] += fNhitCell[idet][ismn][irow][icol]
     470           0 :                         *fNhitCell[idet][ismn][irow][icol];
     471           0 :                     }
     472             :                 }
     473             :             }
     474             :         }
     475             :     }
     476             :   
     477           0 :   if (numberofDDLs < kDDL) return kFALSE;
     478           0 :   return kTRUE;
     479             :   
     480           0 : }
     481             : // ------------------------------------------------------------------------ //
     482             : void AliPMDCalibGain::Analyse(TTree *gaintree, TTree *meantree)
     483             : {
     484             :   // Calculates the mean
     485           0 :   Int_t   det = 0, sm = 0, row = 0, col = 0;
     486           0 :   Float_t gain = 0.;
     487             :   Float_t cellmean = 0.;
     488             : 
     489           0 :   Float_t modmean[2][24];
     490             : 
     491           0 :   for (Int_t idet=0; idet < 2; idet++)
     492             :     {
     493           0 :       for (Int_t ism = 0; ism < 24; ism++)
     494             :         {
     495           0 :           modmean[idet][ism] = 0.;
     496             :         }
     497             :     }
     498             : 
     499           0 :   gaintree->Branch("det",&det,"det/I");
     500           0 :   gaintree->Branch("sm",&sm,"sm/I");
     501           0 :   gaintree->Branch("row",&row,"row/I");
     502           0 :   gaintree->Branch("col",&col,"col/I");
     503           0 :   gaintree->Branch("gain",&gain,"gain/F");
     504             :   
     505           0 :   for(Int_t idet = 0; idet < kDet; idet++)
     506             :     {
     507           0 :       for(Int_t ism = 0; ism < kMaxSMN; ism++)
     508             :         {
     509           0 :           if (fSMCount[idet][ism] > 0)
     510           0 :             modmean[idet][ism] = fSMIso[idet][ism]/fSMCount[idet][ism];
     511           0 :           for(Int_t irow = 0; irow < kMaxRow; irow++)
     512             :             {
     513           0 :               for(Int_t icol = 0; icol < kMaxCol; icol++)
     514             :                 {
     515           0 :                   if (fCellCount[idet][ism][irow][icol] > 0.)
     516             :                     {
     517           0 :                       cellmean = fCellIso[idet][ism][irow][icol]/fCellCount[idet][ism][irow][icol];
     518           0 :                     }
     519           0 :                   det      = idet;
     520           0 :                   sm       = ism;
     521           0 :                   row      = irow;
     522           0 :                   col      = icol;
     523           0 :                   if (cellmean > 0.0 && fCellCount[idet][ism][irow][icol]>0.)
     524             :                     {
     525           0 :                       gain = cellmean/modmean[idet][ism];
     526           0 :                     }
     527             :                   else
     528             :                     {
     529           0 :                       gain = 0.;
     530             :                     }
     531             :                   //if(fCellCount[idet][ism][irow][icol]>0.) printf("CellCount =%f, gain= %f\n",fCellCount[idet][ism][irow][icol],gain);
     532           0 :                   gaintree->Fill();
     533             :                 }
     534             :             }
     535             :         }
     536             :     }
     537             : 
     538           0 :   Float_t smmean;
     539             : 
     540             :   // Writing each module mean value
     541           0 :   meantree->Branch("det",&det,"det/I");
     542           0 :   meantree->Branch("sm",&sm,"sm/I");
     543           0 :   meantree->Branch("smmean",&smmean,"row/F");
     544             :   
     545           0 :   for(Int_t idet = 0; idet < kDet; idet++)
     546             :     {
     547           0 :       for (Int_t ism = 0; ism < kMaxSMN; ism++)
     548             :         {
     549           0 :           det    = idet;
     550           0 :           sm     = ism;
     551           0 :           smmean = modmean[idet][ism];
     552           0 :           meantree->Fill();
     553             :         }
     554             :     }
     555             : 
     556           0 : }
     557             : // ------------------------------------------------------------------------ //
     558             : void AliPMDCalibGain::FindHotCell(TTree *hottree, Float_t xvar)
     559             : {
     560             :   // Calculates the mean
     561           0 :   Int_t   det = 0, sm = 0, row = 0, col = 0;
     562           0 :   Float_t flag = 0.;
     563             :   Float_t meannhit = 0.;
     564             :   Float_t meanSqnhit = 0.;
     565             :   Float_t sigmanhit = 0.,nhitcut = 0.;
     566             : 
     567             :   //Float_t xvar = 5.;
     568             : 
     569           0 :   hottree->Branch("det",&det,"det/I");
     570           0 :   hottree->Branch("sm",&sm,"sm/I");
     571           0 :   hottree->Branch("row",&row,"row/I");
     572           0 :   hottree->Branch("col",&col,"col/I");
     573           0 :   hottree->Branch("flag",&flag,"flag/F");
     574             :   
     575           0 :   for(Int_t idet = 0; idet < kDet; idet++)
     576             :     {
     577           0 :       for(Int_t ism = 0; ism < kMaxSMN; ism++)
     578             :         {
     579           0 :           if (fCountSm[idet][ism]> 0)
     580             :             {
     581           0 :               meannhit   = fTempnhit[idet][ism]/fCountSm[idet][ism];
     582           0 :               meanSqnhit = fTempnhitSq[idet][ism]/fCountSm[idet][ism];
     583           0 :               sigmanhit  = sqrt(meanSqnhit-(meannhit*meannhit));
     584           0 :               nhitcut    = meannhit + xvar*sigmanhit;
     585             : 
     586           0 :               for(Int_t irow = 0; irow < kMaxRow; irow++)
     587             :                 {
     588           0 :                   for(Int_t icol = 0; icol < kMaxCol; icol++)
     589             :                     {
     590           0 :                       det      = idet;
     591           0 :                       sm       = ism;
     592           0 :                       row      = irow;
     593           0 :                       col      = icol;
     594             :                       
     595           0 :                       if(fNhitCell[idet][ism][irow][icol] > nhitcut)
     596             :                         {
     597           0 :                           flag  = 1.0;
     598           0 :                         }
     599             :                       else
     600             :                         {
     601           0 :                           flag = 0.;
     602             :                         }
     603           0 :                       hottree->Fill();
     604             :                     }
     605             :                   
     606             :                 }
     607           0 :             }
     608             :         }
     609             :     }
     610           0 : }
     611             : 

Generated by: LCOV version 1.11