]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALRecPointsQaESDSelector.cxx
Histogram ranges changed to cut off saturation peak and noise
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALRecPointsQaESDSelector.cxx
index 7881e07e3f4c7471aa4661c2d4b5fb5a7a5aa7d9..0edc8f803be4b07fea9006bece59674a2097cb07 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
+/* History of cvs commits:
+ *
+* $Log$
+* Revision 1.6  2007/10/16 14:36:39  pavlinov
+* fixed code violation (almost)
+*
+* Revision 1.5  2007/10/15 18:04:07  pavlinov
+* quick fix
+*
+* Revision 1.4  2007/10/15 15:50:58  pavlinov
+* fixed code violation
+*
+* Revision 1.3  2007/10/09 08:46:10  hristov
+* The data members fEMCALClusterCluster and fPHOSCluster are removed from AliESDCaloCluster, the fClusterType is used to select PHOS or EMCAL clusters. Changes, needed to use correctly the new AliESDCaloCluster. (Christian)
+*
+* Revision 1.2  2007/09/11 19:38:15  pavlinov
+* added pi0 calibration, linearity, shower profile
+* co: warning: ` $Log' is obsolescent; use ` * $Log'.
+* Revision 1.1  2007/08/08 15:58:01  hristov
+* New calibration classes. (Aleksei)
+ */
 
-/* $Log$co: warning: `/* $Log' is obsolescent; use ` * $Log'.
- * Revision 1.1  2007/08/08 15:58:01  hristov
- * New calibration classes. (Aleksei)
- * */
 //_________________________________________________________________________
 // This is selector for making a set of histogramms from ESD for rec.points
-//*--  Authors: Aleksei Pavlinov (WSU) 
-//*--  Feb 17, 2007 - Sep 11, 2007
-//*--  Pi0 calibration
-//*--  Recalibration, linearity, shower profile 
+//--  Authors: Aleksei Pavlinov (WSU) 
+//--  Feb 17, 2007 - Sep 11, 2007
+//--  Pi0 calibration
+//--  Recalibration, linearity, shower profile 
 //_________________________________________________________________________
 
 #include "AliEMCALRecPointsQaESDSelector.h"
@@ -78,25 +95,18 @@ using namespace std;
 
 typedef  AliEMCALHistoUtilities u;
 
-Double_t AliEMCALRecPointsQaESDSelector::fDistEff = 3.;
-Double_t AliEMCALRecPointsQaESDSelector::fW0      = 4.5;
-Double_t AliEMCALRecPointsQaESDSelector::fSlopePhiShift = 0.01; // ?? just guess
+AliEMCALGeometry* AliEMCALRecPointsQaESDSelector::fgEmcalGeo=0;
+Int_t             AliEMCALRecPointsQaESDSelector::fgNmaxCell = 4*12*24*11;
 
-AliEMCALFolder* AliEMCALRecPointsQaESDSelector::fEMCAL = 0;
-AliEMCALFolder* AliEMCALRecPointsQaESDSelector::fEMCALOld = 0;
+Double_t AliEMCALRecPointsQaESDSelector::fgDistEff = 3.;
+Double_t AliEMCALRecPointsQaESDSelector::fgW0      = 4.5;
+Double_t AliEMCALRecPointsQaESDSelector::fgSlopePhiShift = 0.01; // ?? just guess
 
-AliEMCALGeometry *geo=0;
+AliEMCALFolder* AliEMCALRecPointsQaESDSelector::fgEMCAL = 0;
+AliEMCALFolder* AliEMCALRecPointsQaESDSelector::fgEMCALOld = 0;
 
-char *anaOpt[]={
-  "CORR1",   // GetCorrectedEnergyForGamma_1(Double_t eRec);
-  "RECALIB",
-  "IDEAL",
-  "PI0",
-  "GAMMA",
-  "KINE",   // reading kine file
-  "PROF",   // Shower profile: phi direction now
-  "FIT"     // define parameters : deff, w0 and phislope
-};
+Char_t **AliEMCALRecPointsQaESDSelector::fgAnaOpt=0;
+Int_t AliEMCALRecPointsQaESDSelector::fgNanaOpt = 0; 
 enum keyOpt{
   kCORR1,
   kRECALIB,
@@ -109,8 +119,7 @@ enum keyOpt{
  //-- 
   kEND
 };
-        
-int  nAnaOpt = sizeof(anaOpt) / sizeof(char*); 
+
 // Enumeration variables
 // enum {kUndefined=-1, kLed=0, kBeam=1};
 // enum {kPatchResponse=0, kClusterResponse=1};
@@ -118,8 +127,6 @@ int  nAnaOpt = sizeof(anaOpt) / sizeof(char*);
 
 ClassImp(AliEMCALRecPointsQaESDSelector)
 
-Int_t  nmaxCell = 4*12*24*11;
-
 AliEMCALRecPointsQaESDSelector::AliEMCALRecPointsQaESDSelector() :
   AliSelector(),
   fPmom(0),
@@ -137,6 +144,20 @@ AliEMCALRecPointsQaESDSelector::AliEMCALRecPointsQaESDSelector() :
   //
   // Constructor. Initialization of pointers
   //
+  Char_t *anaOpt[]={
+  "CORR1",   // GetCorrectedEnergyForGamma1(Double_t eRec);
+  "RECALIB",
+  "IDEAL",
+  "PI0",
+  "GAMMA",
+  "KINE",   // reading kine file
+  "PROF",   // Shower profile: phi direction now
+  "FIT"     // define parameters : deff, w0 and phislope
+  };
+  
+  fgNanaOpt = sizeof(anaOpt) / sizeof(Char_t*); 
+  fgAnaOpt = new Char_t*[fgNanaOpt];
+  for(int i=0; i<fgNanaOpt; i++) fgAnaOpt[i] = anaOpt[i];
 }
 
 AliEMCALRecPointsQaESDSelector::~AliEMCALRecPointsQaESDSelector()
@@ -187,8 +208,11 @@ Bool_t AliEMCALRecPointsQaESDSelector::Notify()
 
 void AliEMCALRecPointsQaESDSelector::InitStructure(Int_t it)
 {
-  geo = AliEMCALGeometry::GetInstance("SHISH_TRD1_CURRENT_2X2"); // initialize geometry just once
-  fCellsInfo = AliEMCALCellInfo::GetTableForGeometry(geo);
+  //
+  // Initialize the common structure of selector
+  //
+  fgEmcalGeo = AliEMCALGeometry::GetInstance("SHISH_TRD1_CURRENT_2X2"); // initialize geometry just once
+  fCellsInfo = AliEMCALCellInfo::GetTableForGeometry(fgEmcalGeo);
 
   if(fRunOpts.Length()>0) CheckRunOpts();
 
@@ -199,8 +223,8 @@ void AliEMCALRecPointsQaESDSelector::InitStructure(Int_t it)
 
   fEmcalPool = new TFolder("PoolOfEMCAL","");
   if(it <= 1) {
-    fEMCAL     = new AliEMCALFolder(it); // folder for first itteration   
-    fEmcalPool->Add(fEMCAL);
+    fgEMCAL     = new AliEMCALFolder(it); // folder for first itteration   
+    fEmcalPool->Add(fgEMCAL);
   }
   //if(it<=0) SetName("GammaSel"); // For convinience
   //else      SetName("Pi0Sel");
@@ -210,14 +234,15 @@ void AliEMCALRecPointsQaESDSelector::InitStructure(Int_t it)
 
 void AliEMCALRecPointsQaESDSelector::CheckRunOpts()
 {
+  // Check run options
   fRunOpts.ToUpper();
   int nopt = u::ParseString(fRunOpts, fArrOpts);
-  printf("<I> AliEMCALRecPointsQaESDSelector::CheckRunOpts() analyze %i(%i) options : nAnaOpt %i\n", 
-         nopt, fArrOpts.GetEntries(), nAnaOpt);  
+  printf("<I> AliEMCALRecPointsQaESDSelector::CheckRunOpts() analyze %i(%i) options : fgNanaOpt %i\n", 
+         nopt, fArrOpts.GetEntries(), fgNanaOpt);  
   if(nopt <=0) return;
 
-  fKeyOpts = new TArrayI(nAnaOpt);
-  for(Int_t i=0; i<nAnaOpt; i++) (*fKeyOpts)[i] = 0;
+  fKeyOpts = new TArrayI(fgNanaOpt);
+  for(Int_t i=0; i<fgNanaOpt; i++) (*fKeyOpts)[i] = 0;
 
   for(Int_t i=0; i<fArrOpts.GetEntries(); i++ ) {
     TObjString *o = (TObjString*)fArrOpts.At(i); 
@@ -225,8 +250,8 @@ void AliEMCALRecPointsQaESDSelector::CheckRunOpts()
     TString runOpt = o->String();
     Int_t indj=-1;
 
-    for(Int_t j=0; j<nAnaOpt; j++) {
-      TString opt = anaOpt[j];
+    for(Int_t j=0; j<fgNanaOpt; j++) {
+      TString opt = fgAnaOpt[j];
       if(runOpt.Contains(opt,TString::kIgnoreCase)) {
        indj = j;
         break;
@@ -239,19 +264,20 @@ void AliEMCALRecPointsQaESDSelector::CheckRunOpts()
     } else {
       (*fKeyOpts)[indj] = 1;
       printf("<I> option |%s| is valid : number %i : |%s| \n", 
-            runOpt.Data(), indj, anaOpt[indj]);
+            runOpt.Data(), indj, fgAnaOpt[indj]);
     }
   }
 }
 
 Int_t AliEMCALRecPointsQaESDSelector::GetKeyOptsValue(Int_t key)
 {
+  // Oct 14, 2007
   static Int_t val=0;
   val = 0;
   if(fKeyOpts && key>=0 && key<fKeyOpts->GetSize()) {
     val = fKeyOpts->At(key);
   }
-  // printf(" key %i : val %i : opt %s \n", key, val, anaOpt[key]);
+  // printf(" key %i : val %i : opt %s \n", key, val, fgAnaOpt[key]);
   return val;
 }
 
@@ -290,14 +316,14 @@ Bool_t AliEMCALRecPointsQaESDSelector::Process(Long64_t entry)
     return kFALSE;
   }
   
-  static pi0SelectionParam* rPar = GetEmcalFolder()->GetPi0SelectionParRow(0);
+  static AliEMCALPi0SelectionParRec* rPar = GetEmcalFolder()->GetPi0SelectionParRow(0);
 
   static Int_t nEmcalClusters, indOfFirstEmcalRP, nEmcalRP,nEmcalPseudoClusters;
   nEmcalClusters    = fESD->GetNumberOfEMCALClusters();
   indOfFirstEmcalRP = fESD->GetFirstEMCALCluster();
   u::FillH1(fLofHistsRP, 1, double(indOfFirstEmcalRP));
 
-  static AliRunLoader* RL = 0;
+  static AliRunLoader* rl = 0;
   static Int_t nev = 0; // Temporary - 0nly for reading one file now !!
   
   static AliESDCaloCluster *cl = 0; 
@@ -313,27 +339,27 @@ Bool_t AliEMCALRecPointsQaESDSelector::Process(Long64_t entry)
   static Double_t erec=0., ecorr=0.0;
   for(int i=indOfFirstEmcalRP; i<indOfFirstEmcalRP+nEmcalClusters; i++) {
     cl = fESD->GetCaloCluster(i);
-    if(cl->GetClusterType() == AliESDCaloCluster::kPseudoCluster) {
+    if(cl->GetClusterType() == AliESDCaloCluster::kEMCALPseudoCluster) {
       nEmcalPseudoClusters++;
       l = fLofHistsPC;
-    } else if(cl->GetClusterType() == AliESDCaloCluster::kClusterv1){
+    } else if(cl->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1){
       nEmcalRP++;
-      if(fEMCAL->GetIterationNumber()>1||GetKeyOptsValue(kIDEAL)||GetKeyOptsValue(kRECALIB)||GetKeyOptsValue(kFIT)) {
+      if(fgEMCAL->GetIterationNumber()>1||GetKeyOptsValue(kIDEAL)||GetKeyOptsValue(kRECALIB)||GetKeyOptsValue(kFIT)) {
         AliEMCALRecPoint *rp=0;
-        if(GetKeyOptsValue(kFIT) == kFALSE) fDistEff = -1.; // No fitting ; Sep 4, 2007
+        if(GetKeyOptsValue(kFIT) == kFALSE) fgDistEff = -1.; // No fitting ; Sep 4, 2007
         if(GetKeyOptsValue(kIDEAL)) {
-          rp = AliEMCALFolder::GetRecPoint(cl, fEMCAL->GetCCFirst(), 0, fLofHistsRP, fDistEff, fW0, fSlopePhiShift);
+          rp = AliEMCALFolder::GetRecPoint(cl, fgEMCAL->GetCCFirst(), 0, fLofHistsRP, fgDistEff, fgW0, fgSlopePhiShift);
        } else {
-          rp = AliEMCALFolder::GetRecPoint(cl, fEMCAL->GetCCFirst(), fEMCAL->GetCCIn(), fLofHistsRP, fDistEff, fW0, fSlopePhiShift);
+          rp = AliEMCALFolder::GetRecPoint(cl, fgEMCAL->GetCCFirst(), fgEMCAL->GetCCIn(), fLofHistsRP, fgDistEff, fgW0, fgSlopePhiShift);
        }
         if(GetKeyOptsValue(kPROF)) {
           FillHistsForShowerProfile( GetListShowerProfile(), rp, GetCellsInfo());
        }
-       //if(rp->GetPointEnergy()>=rPar->eOfRpMin && u::GetLorentzVectorFromRecPoint(v, rp)) {
+       //if(rp->GetPointEnergy()>=rPar->fEOfRpMin && u::GetLorentzVectorFromRecPoint(v, rp)) {
         if(u::GetLorentzVectorFromRecPoint(v, rp)) { // comparing with RP
           if(GetKeyOptsValue(kCORR1)) {
            erec  = v.Rho();
-            ecorr = u::GetCorrectedEnergyForGamma_1(erec);
+            ecorr = u::GetCorrectedEnergyForGamma1(erec);
             v.SetRho(ecorr);
             v.SetE(ecorr); // This is gamma
            //printf("<1> erec %f | ecorr %f \n", erec, ecorr);
@@ -354,12 +380,12 @@ Bool_t AliEMCALRecPointsQaESDSelector::Process(Long64_t entry)
         }
         if(rp) delete rp;
       } else { // first iteration
-       //        if(cl->E()>=rPar->eOfRpMin && u::GetLorentzVectorFromESDCluster(v, cl)) {
+       //        if(cl->E()>=rPar->fEOfRpMin && u::GetLorentzVectorFromESDCluster(v, cl)) {
         if(u::GetLorentzVectorFromESDCluster(v, cl)) { // comparing with RP
        // cut 0.4 GeV may be high ! 
           if(GetKeyOptsValue(kCORR1)) {
            erec  = v.Rho();
-            ecorr = u::GetCorrectedEnergyForGamma_1(erec);
+            ecorr = u::GetCorrectedEnergyForGamma1(erec);
             v.SetRho(ecorr);
             v.SetE(ecorr); // This is gamma now
             // printf("<2> erec %f | ecorr %f \n", erec, ecorr);
@@ -387,15 +413,15 @@ Bool_t AliEMCALRecPointsQaESDSelector::Process(Long64_t entry)
     for(int id=0; id<cl->GetNumberOfDigits(); id++) {
       eDigi = double(digiAmpl[id]) / 500.; // See AliEMCALClusterizerv1
       //      if(eDigi <= 0.0) { // sometimes it is happen
-      //if(eDigi > 10.0 && cl->GetClusterType() == AliESDCaloCluster::kClusterv1) {
+      //if(eDigi > 10.0 && cl->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1) {
       // printf(" %i digiAmpl %i : %f \n", id, int(digiAmpl[id]), eDigi);
       //}
       u::FillH1(l, 5, eDigi);
       u::FillH1(l, 6, double(digiTime[id]));
       u::FillH1(l, 7, double(digiAbsId[id]));
-      if(int(digiAbsId[id]) >= nmaxCell) {
+      if(int(digiAbsId[id]) >= fgNmaxCell) {
         printf(" id %i :  digiAbsId[id] %i (%i) : %s \n", 
-              id, int(digiAbsId[id]), nmaxCell, l->GetName());
+              id, int(digiAbsId[id]), fgNmaxCell, l->GetName());
       }
     }
   }
@@ -421,10 +447,10 @@ Bool_t AliEMCALRecPointsQaESDSelector::Process(Long64_t entry)
         pgg = lgg.P();  // momentum
         u::FillH1(fLofHistsRP, 8, mgg);
  
-       if((mgg>=rPar->massGGMin && mgg<=rPar->massGGMax)) {// pi0 candidates
-         if((pgg>=rPar->momPi0Min && pgg>=rPar->momPi0Min)) {
-            if(fEMCAL && fEMCAL->GetIterationNumber()>=1) {
-              fEMCAL->FillPi0Candidate(mgg,fESD->GetCaloCluster(indLv[i1]),fESD->GetCaloCluster(indLv[i2]));
+       if((mgg>=rPar->fMassGGMin && mgg<=rPar->fMassGGMax)) {// pi0 candidates
+         if((pgg>=rPar->fMomPi0Min && pgg>=rPar->fMomPi0Min)) {
+            if(fgEMCAL && fgEMCAL->GetIterationNumber()>=1) {
+              fgEMCAL->FillPi0Candidate(mgg,fESD->GetCaloCluster(indLv[i1]),fESD->GetCaloCluster(indLv[i2]));
               u::FillH1(fLofHistsRP, 9, pgg); 
               u::FillH1(fLofHistsRP,10, lv1->P());
               u::FillH1(fLofHistsRP,10, lv2->P());
@@ -445,9 +471,9 @@ Bool_t AliEMCALRecPointsQaESDSelector::Process(Long64_t entry)
       curFileName = fChain->GetCurrentFile()->GetName();
       curFileName.ReplaceAll("AliESDs.","galice."); 
     }
-    RL = u::InitKinematics(nev, curFileName.Data());
+    rl = u::InitKinematics(nev, curFileName.Data());
   // Compare kineamtics vs EMCal clusters
-    FillHistsOfKineVsRP(fLKineVsRP, RL, lvM1);
+    FillHistsOfKineVsRP(fLKineVsRP, rl, lvM1);
   }
 
   lvM1.Delete();
@@ -492,8 +518,11 @@ void AliEMCALRecPointsQaESDSelector::Terminate()
 //
 TList *AliEMCALRecPointsQaESDSelector::DefineHistsOfRP(const char *name,Double_t p,Int_t keyOpt)
 {
+  //
+  // Define histogramms of rec.points
+  //
   printf("<I> DefineHistsOfRP :%s : p %f : keyOpt %i \n", name, p, keyOpt);
-  Double_t ADCchannelEC = 0.0153; // ~15mev per adc count
+  Double_t adcChannelEC = 0.0153; // ~15mev per adc count
   Double_t xma = p*1.4, xmi=0.0, step=0.0, xmic=xmi, xmac = xma;
   if(xma<0) xma = 20.;
   Int_t nmax=1000, scale=4, nmaxc = nmax;
@@ -516,18 +545,18 @@ TList *AliEMCALRecPointsQaESDSelector::DefineHistsOfRP(const char *name,Double_t
   }
 
   if(step < 0.0153) {
-    nmax = int((xma-xmi) / ADCchannelEC)+1;
-    xma =  xmi + ADCchannelEC*nmax;
+    nmax = int((xma-xmi) / adcChannelEC)+1;
+    xma =  xmi + adcChannelEC*nmax;
   } 
   new TH1F("04_EnergyOf", "energy of ", nmax, xmi, xma);
   nmaxc = nmax; xmic=xmi; xmac = xma;
 
   nmax = 10000;
-  xmi  = ADCchannelEC/2.; xma = xmi + ADCchannelEC*nmax;
+  xmi  = adcChannelEC/2.; xma = xmi + adcChannelEC*nmax;
   // All energy(momentum) unit is GeV if don't notice
   new TH1F("05_DigitEnergyIn", "digit energy in ", nmaxc, xmic, xmac);
   new TH1F("06_DigitTimeIn", "digit time in 10ps(0.01ns) ", 1000, 0.0, 3.e+3); // ns/100 = 10 ps
-  new TH1F("07_DigitAbsIdIn", "digit abs id in ", nmaxCell, -0.5, double(nmaxCell)-0.5);
+  new TH1F("07_DigitAbsIdIn", "digit abs id in ", fgNmaxCell, -0.5, double(fgNmaxCell)-0.5);
   new TH1F("08_EffMass", "effective mass of #gamma,#gamma(m_{#pi^{0}}=134.9766 MeV)", 100, 0.0, 0.5);
   new TH1F("09_MomOfPi0Candidate", "momentum of #pi^{0} candidates (0.085 <mgg<0.185)", 600, 0.0, 30.0);
   new TH1F("10_MomOfRpPi0Candidate", "momentum of RP for #pi^{0} candidates (0.085 <mgg<0.185)", 600, 0.0, 30.0);
@@ -543,7 +572,7 @@ TList *AliEMCALRecPointsQaESDSelector::DefineHistsOfRP(const char *name,Double_t
   // Digi
   new TH1F("14_EDigiRecalib", "energy of digits after recalibration", 2000, 0.0, 20.);
   //  AliEMCALGeometry* g = AliEMCALGeometry::GetInstance();
-  new TH1F("15_AbsIdRecalib", "abs Id of digits after recalibration", geo->GetNCells(),-0.5,Double_t(geo->GetNCells())-0.5);
+  new TH1F("15_AbsIdRecalib", "abs Id of digits after recalibration", fgEmcalGeo->GetNCells(),-0.5,Double_t(fgEmcalGeo->GetNCells())-0.5);
   new TH1F("16_EnergyOfRecalibRp_", "energy of recalibrated rec.points", nmaxc, xmic, xmac); // Jul 12, 2007
   new TH2F("17_ShiftRecalib_", "E(clESD) - E(recalib)", 110,0.0, pmax, 50,0.0,dpmax); // Jul 13, 2007
   
@@ -562,7 +591,10 @@ TList *AliEMCALRecPointsQaESDSelector::DefineHistsOfRP(const char *name,Double_t
 
 TList* AliEMCALRecPointsQaESDSelector::DefineHistsOfKineVsRP(const char *name,  Double_t p, Int_t keyOpt)
 {
-  printf("<I>  DefineHistsOfKineVsRP :%s : p %f : keyOpt %i \n", name, p, keyOpt);
+  //
+  // Define histogramms for comparing a initial kinematics with rec.points
+  //
+ printf("<I>  DefineHistsOfKineVsRP :%s : p %f : keyOpt %i \n", name, p, keyOpt);
 
   gROOT->cd();
   TH1::AddDirectory(1);
@@ -570,7 +602,7 @@ TList* AliEMCALRecPointsQaESDSelector::DefineHistsOfKineVsRP(const char *name,
   new TH1F("01_hVy",Form("Vy of primary vertex"), 100, -5., +5.);   // 01
   new TH1F("02_hVz",Form("Vz of primary vertex"), 100, -50., +50.); // 02
 
-  //  Double_t ADCchannelEC = 0.0153; // ~15mev per adc count
+  //  Double_t adcChannelEC = 0.0153; // ~15mev per adc count
   Double_t xma = p*1.4, xmi=0.0, sig=0.15*TMath::Sqrt(p);
   //  Double_t step=0.0, xmic=xmi, xmac = xma;
   if(xma<0) xma = 20.;
@@ -640,13 +672,13 @@ TList *AliEMCALRecPointsQaESDSelector::DefineHistsForShowerProfile(const char *n
   return l;
 }
 
-void AliEMCALRecPointsQaESDSelector::FillHistsOfKineVsRP(TList *l, AliRunLoader* RL,  TClonesArray &lvM)
+void AliEMCALRecPointsQaESDSelector::FillHistsOfKineVsRP(TList *l, AliRunLoader* rl,  TClonesArray &lvM)
 {
   //
   // lvM - array of TLorentzVector's which was cretaef from AliESDCaloCluster's
   //
 
-  if(l==0 || RL==0) return;
+  if(l==0 || rl==0) return;
 
   // TNtuple for qucik analysis
   static TNtuple *nt=0;
@@ -662,7 +694,7 @@ void AliEMCALRecPointsQaESDSelector::FillHistsOfKineVsRP(TList *l, AliRunLoader*
   static Int_t gid=0, ic=0, pdg=0, i=0;
   gid = ic = pdg = 0;
 
-  st = RL->Stack();
+  st = rl->Stack();
   if(st == 0) return;
   // first primary particle
   p = st->Particle(0);
@@ -742,7 +774,7 @@ void AliEMCALRecPointsQaESDSelector::FillHistsForShowerProfile
   if(l==0 || rp==0 || t==0) return;
   // --
   static Double_t xmean=0., xlog=0.;
-  static cellInfo rMax;
+  static AliEMCALCellIndexes rMax;
   static Int_t phiSize;
 
   if(rp->GetPointEnergy() < 1.0) return;
@@ -752,16 +784,16 @@ void AliEMCALRecPointsQaESDSelector::FillHistsForShowerProfile
   if(phiSize == 0) return; // just one row in cell directions
 
   EvalLocalPhiPosition(5.5, rp, t, xlog, phiSize, rMax);
-  if(rMax.iPhi>1.5&&rMax.iPhi<21.5 && rMax.iEta>1.5&&rMax.iEta<46.5) { 
+  if(rMax.fIPhi>1.5&&rMax.fIPhi<21.5 && rMax.fIEta>1.5&&rMax.fIEta<46.5) { 
     u::FillH1(l, 0, xmean); 
     u::FillH1(l, 1, xlog); 
     u::FillH2(l, 2, xlog, xmean);
     // Select two central modules
-    if((rMax.iPhim==5 || rMax.iPhim==6)){
+    if((rMax.fIPhim==5 || rMax.fIPhim==6)){
     // Transition to system of cell with max energy
-      xmean -= (double(rMax.iPhi)+0.5);  
-      xlog  -= (double(rMax.iPhi)+0.5);  
-      if(rMax.iEtam>=2 && rMax.iEtam<=12){ // approximatively first half on eta 
+      xmean -= (double(rMax.fIPhi)+0.5);  
+      xlog  -= (double(rMax.fIPhi)+0.5);  
+      if(rMax.fIEtam>=2 && rMax.fIEtam<=12){ // approximatively first half on eta 
         u::FillH2(l, 3, xlog, xmean);
       } else {// approximatively second half on eta 
         u::FillH2(l, 4, xlog, xmean);
@@ -770,7 +802,7 @@ void AliEMCALRecPointsQaESDSelector::FillHistsForShowerProfile
   }
 }
 
-void   AliEMCALRecPointsQaESDSelector::EvalLocalPhiPosition(const Double_t wlog, const AliEMCALRecPoint *rp, const AliEMCALCellInfo* t, Double_t &xcog, Int_t &phiSize, cellInfo &rMax)
+void   AliEMCALRecPointsQaESDSelector::EvalLocalPhiPosition(const Double_t wlog, const AliEMCALRecPoint *rp, const AliEMCALCellInfo* t, Double_t &xcog, Int_t &phiSize, AliEMCALCellIndexes &rMax)
 {
   // wlog = 1 - usual center of gravity; >1 - with logarithmic weight.
   // digits - array of digits
@@ -782,7 +814,7 @@ void   AliEMCALRecPointsQaESDSelector::EvalLocalPhiPosition(const Double_t wlog,
 
   static Double_t wtot=0., w=0., edigi=0., e=0., edigiMax=0.;
   static Int_t absid = 0, phiMin=0, phiMax=0;
-  static cellInfo* r=0;
+  static AliEMCALCellIndexes* r=0;
 
   e = rp->GetPointEnergy();
   wtot = 0.0;
@@ -796,14 +828,14 @@ void   AliEMCALRecPointsQaESDSelector::EvalLocalPhiPosition(const Double_t wlog,
     else            w = edigi; // just energy
 
     r     = t->GetTable(absid);
-    xcog += w*(Double_t(r->iPhi) + 0.5);
+    xcog += w*(Double_t(r->fIPhi) + 0.5);
     wtot += w;
     if(edigi > edigiMax) {
       edigiMax = edigi;
       rMax = (*r);
     }
-    if(phiMin > r->iPhi) phiMin = r->iPhi; 
-    if(phiMax < r->iPhi) phiMax = r->iPhi; 
+    if(phiMin > r->fIPhi) phiMin = r->fIPhi; 
+    if(phiMax < r->fIPhi) phiMax = r->fIPhi; 
   }
   xcog /= wtot;
   phiSize = phiMax - phiMin;
@@ -838,8 +870,8 @@ void AliEMCALRecPointsQaESDSelector::PrintInfo()
 {
   // Service routine
   printf("\n %i Entrie(s) | Option(s) |%s| \n", GetOptsArray().GetEntries(), fRunOpts.Data());  
-  for(int i=0; i<nAnaOpt; i++) {
-    if(GetKeyOptsValue(i)) printf(" %i |%s| \n", i, anaOpt[i]);
+  for(int i=0; i<fgNanaOpt; i++) {
+    if(GetKeyOptsValue(i)) printf(" %i |%s| \n", i, fgAnaOpt[i]);
   }
 
   TList *l[2] = {fLofHistsPC, fLofHistsRP};
@@ -848,7 +880,7 @@ void AliEMCALRecPointsQaESDSelector::PrintInfo()
     TH1F *h = (TH1F*)l[i]->At(2);
     printf(" %s \t: %i \n", h->GetTitle(), int(h->GetEntries()));
   }
-  printf(" fDistEff %f fW0 %f fSlopePhiShift %f \n", fDistEff, fW0, fSlopePhiShift);
+  printf(" fgDistEff %f fgW0 %f fgSlopePhiShift %f \n", fgDistEff, fgW0, fgSlopePhiShift);
 }
 
 void  AliEMCALRecPointsQaESDSelector::SetMomentum(Double_t p) 
@@ -860,22 +892,26 @@ void  AliEMCALRecPointsQaESDSelector::SetMomentum(Double_t p)
 
 AliEMCALFolder*  AliEMCALRecPointsQaESDSelector::CreateEmcalFolder(const Int_t it)
 {
+  //
+  // Create emcal folder for iteration number it
+  //
   AliEMCALFolder* newFolder = new AliEMCALFolder(it); // folder for iteration #it   
   if(it>1) {
-    fEMCALOld = fEMCAL; 
-    AliEMCALCalibCoefs* tabOldOut = fEMCALOld->GetCCOut();
+    fgEMCALOld = fgEMCAL; 
+    AliEMCALCalibCoefs* tabOldOut = fgEMCALOld->GetCCOut();
     AliEMCALCalibCoefs* tabNewIn = new AliEMCALCalibCoefs(*tabOldOut);
-    tabNewIn->SetName(AliEMCALFolder::fgkCCinName.Data());
+    tabNewIn->SetName(AliEMCALFolder::GetCCinName().Data());
     newFolder->Add(tabNewIn);
   } 
   fEmcalPool->Add(newFolder);
-  fEMCAL = newFolder;
+  fgEMCAL = newFolder;
 
-  return fEMCAL;
+  return fgEMCAL;
 }
 
 AliEMCALFolder* AliEMCALRecPointsQaESDSelector::GetEmcalOldFolder(const Int_t nsm)
 {
+  // Return emcal folder with number nsm
   AliEMCALFolder* folder=0;
   if(fEmcalPool) folder =  (AliEMCALFolder*)fEmcalPool->FindObject(Form("EMCAL_%2.2i",nsm));
   return folder;
@@ -884,22 +920,23 @@ AliEMCALFolder* AliEMCALRecPointsQaESDSelector::GetEmcalOldFolder(const Int_t ns
 
 void AliEMCALRecPointsQaESDSelector::SetEmcalFolder(AliEMCALFolder* folder)
 {
-  fEMCAL = folder;
-  fEmcalPool->Add(fEMCAL);
+  fgEMCAL = folder;
+  fEmcalPool->Add(fgEMCAL);
 }
 
 void AliEMCALRecPointsQaESDSelector::SetEmcalOldFolder(AliEMCALFolder* folder)
 {
-  fEMCALOld = folder;
-  fEmcalPool->Add(fEMCALOld);
+  fgEMCALOld = folder;
+  fEmcalPool->Add(fgEMCALOld);
 }
 
 void AliEMCALRecPointsQaESDSelector::Browse(TBrowser* b)
 {
+  // What we see at browser
   if(fESD)        b->Add(fESD);
   if(fChain)      b->Add(fChain);
   if(fEmcalPool)  b->Add(fEmcalPool);
-  if(geo)         b->Add(geo);
+  if(fgEmcalGeo) b->Add(fgEmcalGeo);
   if(fCellsInfo)  b->Add(fCellsInfo);
   //
   if(fLofHistsPC) b->Add(fLofHistsPC);
@@ -916,7 +953,9 @@ Bool_t AliEMCALRecPointsQaESDSelector::IsFolder() const
 }
 
 void AliEMCALRecPointsQaESDSelector::Save(Int_t ver, const char *optIO)
-{ // Aug 3, 2007
+{ 
+  // Aug 3, 2007
+  // Save selector to file
   TString dir("/home/pavlinov/ALICE/SHISHKEBAB/RF/CALIB/"); // Root directory for saving
   TString nf=dir;
   if(GetKeyOptsValue(kPROF)) {
@@ -938,6 +977,7 @@ void AliEMCALRecPointsQaESDSelector::Save(Int_t ver, const char *optIO)
 
 AliEMCALRecPointsQaESDSelector* AliEMCALRecPointsQaESDSelector::ReadSelector(const char* nf)
 {
+  // Read selector to file
   AliEMCALRecPointsQaESDSelector* selector=0;
 
   TH1::AddDirectory(0);
@@ -946,16 +986,18 @@ AliEMCALRecPointsQaESDSelector* AliEMCALRecPointsQaESDSelector::ReadSelector(con
     TObject *o = f.Get("AliEMCALRecPointsQaESDSelector");
     if(o) selector = dynamic_cast<AliEMCALRecPointsQaESDSelector *>(o);
   }
-  printf("<I> read selector %p : file |%s| \n", selector, nf);
+  // printf("<I> read selector %p : file |%s| \n", selector, nf);
   return selector;
 }
 
 void AliEMCALRecPointsQaESDSelector::ReadAllEmcalFolders()
 {
+  // Oct 14, 2007
   if(fEmcalPool==0) {
     fEmcalPool = new TFolder("PoolOfEMCAL","");
     for(Int_t it=1; it<=10; it++){
-      AliEMCALFolder* fold = AliEMCALFolder::Read(Form("EMCALFOLDER_It%i_fit.root",it), "READ");
+      AliEMCALFolder* fold = AliEMCALFolder::ReadFolder(Form("EMCALFOLDER_It%i_fit.root",it), "READ");
+      //      AliEMCALFolder* fold = AliEMCALFolder::Read(Form("EMCALFOLDER_It%i_fit.root",it), "READ");
       if(fold) fEmcalPool->Add(fold);
     }
   }
@@ -1023,10 +1065,11 @@ void AliEMCALRecPointsQaESDSelector::PictVsIterNumber(const Int_t ind, const Int
 
 TH1F* AliEMCALRecPointsQaESDSelector::FitHistOfRecPointEnergy(const char *opt)
 {
+  // Fit hist of rec.point energy
   TH1::AddDirectory(0);
 
-  TString OPT(opt);
-  OPT.ToUpper();
+  TString sopt(opt);
+  sopt.ToUpper();
 
   Int_t ind = 4, ind2 = 16;
   if(GetKeyOptsValue(kIDEAL)) {
@@ -1040,7 +1083,7 @@ TH1F* AliEMCALRecPointsQaESDSelector::FitHistOfRecPointEnergy(const char *opt)
   if(hold == 0) return 0;
   if(hold->GetEntries() <10.) return hold;
 
-  if(OPT.Contains("CLONE")) {
+  if(sopt.Contains("CLONE")) {
     TString newName(Form("C_%s",hold->GetName()));
     h = (TH1F*)hold->Clone(newName.Data());
     printf(" Clone hist %s -> |%s|%s| \n",hold->GetName(),h->GetName(),h->GetTitle()); 
@@ -1067,7 +1110,9 @@ TH1F* AliEMCALRecPointsQaESDSelector::FitHistOfRecPointEnergy(const char *opt)
 }
 
 TCanvas *AliEMCALRecPointsQaESDSelector::Linearity(TList *l, int ifun)
-{ //Jul 10, 2007
+{ 
+  // Jul 10, 2007
+  // Draw picture of EMCal linearity 
   if(l==0) {
     printf("<E> AliEMCALRecPointsQaESDSelector::Linearity :TList is zero ! Bye ! \n");
     return 0;
@@ -1162,7 +1207,7 @@ TCanvas *AliEMCALRecPointsQaESDSelector::Linearity(TList *l, int ifun)
     gr->GetHistogram()->SetMinimum(xmi);
     gr->GetHistogram()->SetTitleOffset(1.4,"y");
     if(ifun==0) {
-      f = new TF1("fres", "AliEMCALHistoUtilities::EnergyCorrectionForGamma_1(x)", 0., 101.); 
+      f = new TF1("fres", "AliEMCALHistoUtilities::EnergyCorrectionForGamma1(x)", 0., 101.); 
       f->Draw("same");
     }
   }
@@ -1172,7 +1217,7 @@ TCanvas *AliEMCALRecPointsQaESDSelector::Linearity(TList *l, int ifun)
   if(0) {
     c->Clear();
     for(int i=0; i<9; i++) {
-      residual[i] =  100.*(invRat[i] - u::GetCorrectionCoefficientForGamma_1(erec[i])); // in percent
+      residual[i] =  100.*(invRat[i] - u::GetCorrectionCoefficientForGamma1(erec[i])); // in percent
       printf(" erec %f : residual %5.3f \n", erec[i], residual[i]);
     }
     markerColor = 2;
@@ -1230,7 +1275,8 @@ TCanvas *AliEMCALRecPointsQaESDSelector::Linearity(TList *l, int ifun)
 }
 
 TCanvas *AliEMCALRecPointsQaESDSelector::DrawKineVsRP(TList *l)
-{ //Jul 25, 2007
+{ 
+  //Jul 25, 2007
   if(l==0) {
     printf("<W> AliEMCALRecPointsQaESDSelector::DrawKineVsRP : TList is zero ! \n");
     return 0;
@@ -1316,12 +1362,12 @@ TCanvas* AliEMCALRecPointsQaESDSelector::DrawPhiEtaAnglesDistribution(const char
   TCanvas *c = new TCanvas("Geometry","Geometry", 20,20, 700, 500);
   c->Divide(2,2);
 
-  if(geo==0) geo = AliEMCALGeometry::GetInstance(gn);
+  if(fgEmcalGeo==0) fgEmcalGeo = AliEMCALGeometry::GetInstance(gn);
 
   gROOT->cd();
   TH1::AddDirectory(1);
   TH1F *hDtheta  = new TH1F("hDtheta","#Delta#theta in one SM", 60, -2.0, +1.0); // in degree
-  TH2F *hDtheta2 = new TH2F("hDtheta2","#Delta#theta vs iEta of cell", 48, -0.5, 47.5, 60,-2.0,+1.0);
+  TH2F *hDtheta2 = new TH2F("hDtheta2","#Delta#theta vs fIEta of cell", 48, -0.5, 47.5, 60,-2.0,+1.0);
 
   TH1F *hDphi  = new TH1F("hDphi","#Delta#ph in one SM", 2000, -10.0, +10.0); // in degree
 
@@ -1331,13 +1377,13 @@ TCanvas* AliEMCALRecPointsQaESDSelector::DrawPhiEtaAnglesDistribution(const char
   Double_t phiCell=0., dphi=0.;
 
   for(int absid=0; absid<12*24*4; absid++){
-    cellInfo *r = t->GetTable(absid);
-    geo->GetGlobal(absid, vg3);
+    AliEMCALCellIndexes *r = t->GetTable(absid);
+    fgEmcalGeo->GetGlobal(absid, vg3);
 
     thetaCell   = vg3.Theta()*TMath::RadToDeg();
-    thetaModule = 90. - 1.5*r->iEtam;
+    thetaModule = 90. - 1.5*r->fIEtam;
     hDtheta->Fill(thetaCell - thetaModule);
-    hDtheta2->Fill(double(r->iEta), thetaCell - thetaModule);
+    hDtheta2->Fill(double(r->fIEta), thetaCell - thetaModule);
 
     phiCell   = vg3.Phi()*TMath::RadToDeg();
     dphi      = phiCell - 90.;
@@ -1402,7 +1448,7 @@ TCanvas* AliEMCALRecPointsQaESDSelector::DrawDeffVsEnergy2(const char *opt)
   Double_t ep[]={0., 0., 0., 0., 0., 0., 0., 0., 0.};
   // 2 pars
   Double_t deff[9], edeff[9], w0[9], ew0[9]; // max size now 
-  TString OPT(opt);
+  TString sopt(opt);
 
   int np = sizeof(p)/sizeof(Double_t);
   printf("<I> AliEMCALRecPointsQaESDSelector::DrawDeffVsEnergy2() | np %i \n", np);
@@ -1413,7 +1459,7 @@ TCanvas* AliEMCALRecPointsQaESDSelector::DrawDeffVsEnergy2(const char *opt)
 
   TF1 *fdeff = 0, *fw0 = 0;
   TString optFit(""), funName("");
-  if(OPT.Contains("fit1")) {
+  if(sopt.Contains("fit1")) {
     fdeff= new TF1("fdeff","[0]+[1]*log(x)",0.1, 101.);
     fdeff->SetLineColor(kRed);
     fdeff->SetLineWidth(1);
@@ -1475,6 +1521,7 @@ TCanvas* AliEMCALRecPointsQaESDSelector::DrawDeffVsEnergy2(const char *opt)
 void AliEMCALRecPointsQaESDSelector::ReadParsDeffAndW0
 (const char *dirName, double *deff, double *edeff, double *w0, double *ew0, const Int_t pri)
 {
+  // read pars and W0
   int strategy = 0, itmp=0;
   char line[100];
   for(int var=11; var<=19; var++){
@@ -1514,15 +1561,15 @@ TCanvas* AliEMCALRecPointsQaESDSelector::DrawSpaceResolution()
 
   Double_t* eSpAng    = new Double_t[np];
   Double_t* eSpAngOpt = new Double_t[np];
-  Double_t C=TMath::Sqrt(8000.), C2 = 1000.*TMath::DegToRad();
+  Double_t cc=TMath::Sqrt(8000.), cc2 = 1000.*TMath::DegToRad();
   for(int i=0; i<np; i++){
-    spAng[i]       *= C2;
-    rmsSpAng[i]    *= C2;
-    spAngOpt[i]    *= C2;
-    rmsSpAngOpt[i] *= C2;
+    spAng[i]       *= cc2;
+    rmsSpAng[i]    *= cc2;
+    spAngOpt[i]    *= cc2;
+    rmsSpAngOpt[i] *= cc2;
 
-    eSpAng[i]    = spAng[i]/C;
-    eSpAngOpt[i] = spAngOpt[i]/C;
+    eSpAng[i]    = spAng[i]/cc;
+    eSpAngOpt[i] = spAngOpt[i]/cc;
   }
 
   TCanvas *c = new TCanvas("Deff","Deff", 20,20, 700, 500);
@@ -1566,6 +1613,7 @@ TCanvas* AliEMCALRecPointsQaESDSelector::DrawSpaceResolution()
 
 void AliEMCALRecPointsQaESDSelector::ResetAllListOfHists()
 {
+  // Reset all list of hits
   u::ResetListOfHists(fLofHistsPC);
   u::ResetListOfHists(fLofHistsRP);
   u::ResetListOfHists(fLKineVsRP);
@@ -1573,7 +1621,8 @@ void AliEMCALRecPointsQaESDSelector::ResetAllListOfHists()
 }
 
 void AliEMCALRecPointsQaESDSelector::ReloadChain(Long64_t entry)
-{ // unused now
+{ 
+  // Oct 14, 2007 - unused now
   if(fChain) {
     fChain->LoadTree(entry);
   }