// @(#)root/eve:$Id$
// Author: Matevz Tadel 2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include "TEveCaloData.h"
#include "TEveCalo.h"

#include "TGLSelectRecord.h"

#include "TAxis.h"
#include "THStack.h"
#include "TH2.h"
#include "TMath.h"
#include "TList.h"

#include <cassert>
#include <algorithm>
#include <set>

//------------------------------------------------------------------------------
// TEveCaloData::CellGeom_t
//------------------------------------------------------------------------------


//______________________________________________________________________________
void TEveCaloData::CellGeom_t::Dump() const
{
   // Print member data.

   printf("%f, %f %f, %f \n", fEtaMin, fEtaMax, fPhiMin, fPhiMax);
}

//______________________________________________________________________________
void TEveCaloData::CellGeom_t::Configure(Float_t etaMin, Float_t etaMax, Float_t phiMin, Float_t phiMax)
{
   fEtaMin = etaMin;
   fEtaMax = etaMax;

   fPhiMin = phiMin;
   fPhiMax = phiMax;

   fThetaMin = EtaToTheta(fEtaMax);
   fThetaMax = EtaToTheta(fEtaMin);
}

//------------------------------------------------------------------------------
// TEveCaloData::CellData_t
//------------------------------------------------------------------------------

//______________________________________________________________________________
Float_t TEveCaloData::CellData_t::Value(Bool_t isEt) const
{
   // Return energy value associated with the cell, usually Et.
   // If isEt is false it is transformed into energy E.

   if (isEt)
      return fValue;
   else
      return TMath::Abs(fValue/TMath::Sin(Theta()));
}

//______________________________________________________________________________
void TEveCaloData::CellData_t::Dump() const
{
   // Print member data.

   printf("%f, %f %f, %f \n", fEtaMin, fEtaMax, fPhiMin, fPhiMax);
}

//______________________________________________________________________________
Float_t* TEveCaloData::RebinData_t::GetSliceVals(Int_t bin)
{

   //   printf("get val vec bin %d size %d\n", bin, fBinData.size());
   if (fBinData[bin] == -1)
   {
      fBinData[bin] = fSliceData.size();

      for (Int_t i=0; i<fNSlices; i++)
         fSliceData.push_back(0.f);
   }

   return &fSliceData[fBinData[bin]];
}

//==============================================================================
// TEveCaloData
//==============================================================================

//______________________________________________________________________________
//
//  A central manager for calorimeter event data. It provides a list of
//  cells within requested phi and eta range.
//

ClassImp(TEveCaloData);

//______________________________________________________________________________
TEveCaloData::TEveCaloData(const char* n, const char* t):
   TEveElement(),
   TNamed(n, t),

   fEtaAxis(0),
   fPhiAxis(0),

   fWrapTwoPi(kTRUE),

   fMaxValEt(0),
   fMaxValE(0),

   fEps(0)
{
   // Constructor.
}

//______________________________________________________________________________
void TEveCaloData::UnSelected()
{
   // Virtual method TEveElement::UnSelect.
   // Clear selected towers when deselected.

   fCellsSelected.clear();
}

//______________________________________________________________________________
void TEveCaloData::UnHighlighted()
{
   // Virtual method TEveElement::UnHighlighted.

   fCellsHighlighted.clear();
}

//______________________________________________________________________________
TString TEveCaloData::GetHighlightTooltip()
{
   if (fCellsHighlighted.empty()) return "";

   CellData_t cellData;

   Bool_t single = fCellsHighlighted.size() == 1;
   Float_t sum = 0;
   TString s;
   for (vCellId_i i = fCellsHighlighted.begin(); i!=fCellsHighlighted.end(); ++i)
   {
      GetCellData(*i, cellData);
      
      s += TString::Format("%s %.2f (%.3f, %.3f)", 
                           fSliceInfos[i->fSlice].fName.Data(), cellData.fValue,
                           cellData.Eta(), cellData.Phi());

      if (single) return s;
      s += "\n";
      sum += cellData.fValue;
   }
   s += TString::Format("Sum = %.2f", sum);
   return s;
}

//______________________________________________________________________________
void TEveCaloData::FillImpliedSelectedSet(Set_t& impSelSet)
{
   // Populate set impSelSet with derived / dependant elements.
   //

   for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
   {
      impSelSet.insert(*i);
   }
}

//______________________________________________________________________________
void TEveCaloData::PrintCellsSelected()
{
   // Print selected cells info.

   printf("%d Selected selected cells:\n", (Int_t)fCellsSelected.size());
   CellData_t cellData;

   for (vCellId_i i = fCellsSelected.begin(); i != fCellsSelected.end(); ++i)
   {
      GetCellData(*i, cellData);
      printf("Tower [%d] Slice [%d] Value [%.2f] ", i->fTower, i->fSlice, cellData.fValue);
      printf("Eta:(%f, %f) Phi(%f, %f)\n",  cellData.fEtaMin, cellData.fEtaMax, cellData.fPhiMin, cellData.fPhiMax);
   }
}

//______________________________________________________________________________
void TEveCaloData::ProcessSelection(vCellId_t& sel_cells, TGLSelectRecord& rec)
{
   // Process newly selected cells with given select-record.
   // Secondary-select status is set.
   // CellSelectionChanged() is called if needed.

   typedef std::set<CellId_t>           sCellId_t;
   typedef std::set<CellId_t>::iterator sCellId_i;

   struct helper
   {
      static void fill_cell_set(sCellId_t& cset, vCellId_t& cvec)
      {
         for (vCellId_i i = cvec.begin(); i != cvec.end(); ++i)
            cset.insert(*i);
      }
      static void fill_cell_vec(vCellId_t& cvec, sCellId_t& cset)
      {
         for (sCellId_i i = cset.begin(); i != cset.end(); ++i)
            cvec.push_back(*i);
      }
   };

   vCellId_t& cells = rec.GetHighlight() ? fCellsHighlighted : fCellsSelected;
 
   if (cells.empty())
   {
      if (!sel_cells.empty())
      {
         cells.swap(sel_cells);
         rec.SetSecSelResult(TGLSelectRecord::kEnteringSelection);
      }
   }
   else
   {
      if (!sel_cells.empty())
      {
         if (rec.GetMultiple())
         {
            sCellId_t cs;
            helper::fill_cell_set(cs, cells);
            for (vCellId_i i = sel_cells.begin(); i != sel_cells.end(); ++i)
            {
               std::set<CellId_t>::iterator csi = cs.find(*i);
               if (csi == cs.end())
                  cs.insert(*i);
               else
                  cs.erase(csi);
            }
            cells.clear();
            if (cs.empty())
            {
               rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
            }
            else
            {
               helper::fill_cell_vec(cells, cs);
               rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
            }
         }
         else
         {
            Bool_t differ = kFALSE;
            if (cells.size() == sel_cells.size())
            {
               sCellId_t cs;
               helper::fill_cell_set(cs, cells);
               for (vCellId_i i = sel_cells.begin(); i != sel_cells.end(); ++i)
               {
                  if (cs.find(*i) == cs.end())
                  {
                     differ = kTRUE;
                     break;
                  }
               }
            }
            else
            {
               differ = kTRUE;
            }
            if (differ)
            {
               cells.swap(sel_cells);
               rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
            }
         }
      }
      else
      {
         if (!rec.GetMultiple())
         {
            cells.clear();
            rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
         }
      }
   }

   if (rec.GetSecSelResult() != TGLSelectRecord::kNone)
   {
      CellSelectionChanged();
   }
}


//==============================================================================

//______________________________________________________________________________
void TEveCaloData::SetSliceThreshold(Int_t slice, Float_t val)
{
   // Set threshold for given slice.

   fSliceInfos[slice].fThreshold = val;
   InvalidateUsersCellIdCache();
}

//______________________________________________________________________________
Float_t TEveCaloData::GetSliceThreshold(Int_t slice) const
{
   // Get threshold for given slice.

   return fSliceInfos[slice].fThreshold;
}

//______________________________________________________________________________
void TEveCaloData::SetSliceColor(Int_t slice, Color_t col)
{
   // Set color for given slice.

   fSliceInfos[slice].fColor = col;
   for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
   {
      (*i)->AddStamp(TEveElement::kCBObjProps);
   }
}

//______________________________________________________________________________
Color_t TEveCaloData::GetSliceColor(Int_t slice) const
{
   // Get color for given slice.

   return fSliceInfos[slice].fColor;
}

//______________________________________________________________________________
void TEveCaloData::SetSliceTransparency(Int_t slice, Char_t t)
{
   // Set transparency for given slice.

   fSliceInfos[slice].fTransparency = t;
   for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
   {
      (*i)->AddStamp(TEveElement::kCBObjProps);
   }
}

//______________________________________________________________________________
Char_t TEveCaloData::GetSliceTransparency(Int_t slice) const
{
   // Get transparency for given slice.

   return fSliceInfos[slice].fTransparency;
}

//______________________________________________________________________________
void TEveCaloData::InvalidateUsersCellIdCache()
{
   // Invalidate cell ids cache on back ptr references.

   TEveCaloViz* calo;
   for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
   {
      calo = dynamic_cast<TEveCaloViz*>(*i);
      calo->InvalidateCellIdCache();
      calo->StampObjProps();
   }
}

//______________________________________________________________________________
void TEveCaloData::DataChanged()
{
   // Tell users (TEveCaloViz instances using this data) that data
   // has changed and they should update the limits/scales etc.
   // This is done by calling TEveCaloViz::DataChanged().

   TEveCaloViz* calo;
   for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
   {
      calo = dynamic_cast<TEveCaloViz*>(*i);
      calo->DataChanged();
      calo->StampObjProps();
   }
}

//______________________________________________________________________________
void TEveCaloData::CellSelectionChanged()
{
   // Tell users (TEveCaloViz instances using this data) that cell selection
   // has changed and they should update selection cache if necessary. 
   // This is done by calling TEveCaloViz::CellSelectionChanged().

   TEveCaloViz* calo;
   for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
   {
      calo = dynamic_cast<TEveCaloViz*>(*i);
      calo->CellSelectionChanged();
      calo->StampColorSelection();
   }
}

//______________________________________________________________________________
Float_t TEveCaloData::EtaToTheta(Float_t eta)
{
   using namespace TMath;

   if (eta < 0)
      return Pi() - 2*ATan(Exp(- Abs(eta)));
   else
      return 2*ATan(Exp(- Abs(eta)));
}


//==============================================================================
// TEveCaloDataVec
//==============================================================================

//______________________________________________________________________________
//
// Calo data for universal cell geometry.

ClassImp(TEveCaloDataVec);

//______________________________________________________________________________
TEveCaloDataVec::TEveCaloDataVec(Int_t nslices):
   TEveCaloData(),

   fTower(0),
   fEtaMin( 1e3),
   fEtaMax(-1e3),
   fPhiMin( 1e3),
   fPhiMax(-1e3)
{
   // Constructor.

   fSliceInfos.assign(nslices, SliceInfo_t());

   fSliceVec.assign(nslices, std::vector<Float_t> ());
}

//______________________________________________________________________________
TEveCaloDataVec::~TEveCaloDataVec()
{
   // Destructor.

   if (fEtaAxis) delete fEtaAxis;
   if (fPhiAxis) delete fPhiAxis;
}

//______________________________________________________________________________
Int_t TEveCaloDataVec::AddSlice()
{
  // Add new slice.
  
  fSliceInfos.push_back(SliceInfo_t());
  fSliceVec.push_back(std::vector<Float_t> ()); 
  fSliceVec.back().resize(fGeomVec.size(), 0.f);

  return fSliceInfos.size() - 1;
}
  
//______________________________________________________________________________
Int_t TEveCaloDataVec::AddTower(Float_t etaMin, Float_t etaMax, Float_t phiMin, Float_t phiMax)
{
   // Add tower within eta/phi range.

   assert (etaMin < etaMax);
   assert (phiMin < phiMax);

   fGeomVec.push_back(CellGeom_t(etaMin, etaMax, phiMin, phiMax));

   for (vvFloat_i it=fSliceVec.begin(); it!=fSliceVec.end(); ++it)
      (*it).push_back(0);

   if (etaMin < fEtaMin) fEtaMin = etaMin;
   if (etaMax > fEtaMax) fEtaMax = etaMax;

   if (phiMin < fPhiMin) fPhiMin = phiMin;
   if (phiMax > fPhiMax) fPhiMax = phiMax;
  
   fTower = fGeomVec.size() - 1;
   return fTower;
}

//______________________________________________________________________________
void TEveCaloDataVec::FillSlice(Int_t slice, Float_t val)
{
   // Fill given slice in the current tower.

   fSliceVec[slice][fTower] = val;
}

//______________________________________________________________________________
void TEveCaloDataVec::FillSlice(Int_t slice, Int_t tower, Float_t val)
{
   // Fill given slice in a given tower.

   fSliceVec[slice][tower] = val;
}


//______________________________________________________________________________
void TEveCaloDataVec::GetCellList(Float_t eta, Float_t etaD,
                                  Float_t phi, Float_t phiD,
                                  TEveCaloData::vCellId_t &out) const
{
   // Get list of cell-ids for given eta/phi range.

   using namespace TMath;

   Float_t etaMin = eta - etaD*0.5;
   Float_t etaMax = eta + etaD*0.5;

   Float_t phiMin = phi - phiD*0.5;
   Float_t phiMax = phi + phiD*0.5;

   Int_t nS = fSliceVec.size();

   Int_t tower = 0;
   Float_t fracx=0, fracy=0, frac;
   Float_t minQ, maxQ;

   for(vCellGeom_ci i=fGeomVec.begin(); i!=fGeomVec.end(); i++)
   {
      const CellGeom_t &cg = *i;
      fracx = TEveUtil::GetFraction(etaMin, etaMax, cg.fEtaMin, cg.fEtaMax);
      if (fracx > 1e-3)
      {
         minQ = cg.fPhiMin;
         maxQ = cg.fPhiMax;

         if (fWrapTwoPi)
         {
            if (maxQ < phiMin)
            {
               minQ += TwoPi(); maxQ += TwoPi();
            }
            else if (minQ > phiMax)
            {
               minQ -= TwoPi(); maxQ -= TwoPi();
            }
         }

         if (maxQ >= phiMin && minQ <= phiMax)
         {
            fracy = TEveUtil::GetFraction(phiMin, phiMax, minQ, maxQ);
            if (fracy > 1e-3)
            {
               frac = fracx*fracy;
               for (Int_t s=0; s<nS; s++)
               {
                  if (fSliceVec[s][tower] > fSliceInfos[s].fThreshold)
                     out.push_back(CellId_t(tower, s, frac));
               }
            }
         }
      }
      tower++;
   }
}

//______________________________________________________________________________
void TEveCaloDataVec::Rebin(TAxis* ax, TAxis* ay, vCellId_t &ids, Bool_t et, RebinData_t& rdata) const
{
   // Rebin cells.

   rdata.fNSlices = GetNSlices();
   rdata.fBinData.assign((ax->GetNbins()+2)*(ay->GetNbins()+2), -1);

   CellData_t cd;
   for (vCellId_i it = ids.begin(); it != ids.end(); ++it)
   {
      GetCellData(*it, cd);
      Int_t iMin = ax->FindBin(cd.EtaMin());
      Int_t iMax = ax->FindBin(cd.EtaMax());
      Int_t jMin = ay->FindBin(cd.PhiMin());
      Int_t jMax = ay->FindBin(cd.PhiMax());
      for (Int_t i = iMin; i <= iMax; ++i)
      {
         if (i < 0 || i > ax->GetNbins()) continue;
         for (Int_t j = jMin; j <= jMax; ++j)
         {
            if (j < 0 || j > ay->GetNbins()) continue;

            Double_t ratio = TEveUtil::GetFraction(ax->GetBinLowEdge(i), ax->GetBinUpEdge(i), cd.EtaMin(), cd.EtaMax())
                           * TEveUtil::GetFraction(ay->GetBinLowEdge(j), ay->GetBinUpEdge(j), cd.PhiMin(), cd.PhiMax());
            
            if (ratio > 1e-6f)
            {
               Float_t* slices = rdata.GetSliceVals(i + j*(ax->GetNbins()+2));
               slices[(*it).fSlice] += ratio * cd.Value(et);
            }
         }
      }
   }
}

//______________________________________________________________________________
void TEveCaloDataVec::GetCellData(const TEveCaloData::CellId_t &id,
                                  TEveCaloData::CellData_t& cellData) const
{
   // Get cell geometry and value from cell ID.

   cellData.CellGeom_t::operator=( fGeomVec[id.fTower] );
   cellData.fValue = fSliceVec[id.fSlice][id.fTower];
}

//______________________________________________________________________________
void TEveCaloDataVec::DataChanged()
{
   // Update limits and notify data users.

   using namespace TMath;

   // update max E/Et values

   fMaxValE = 0;
   fMaxValEt = 0;
   Float_t sum=0;
   //   printf("geom vec %d slices %d\n",fGeomVec.size(), fSliceVec.size() );

   for (UInt_t tw=0; tw<fGeomVec.size(); tw++)
   {
      sum=0;
      for (vvFloat_i it=fSliceVec.begin(); it!=fSliceVec.end(); ++it)
         sum += (*it)[tw];

      if (sum > fMaxValEt ) fMaxValEt=sum;

      sum /= Abs(Sin(EtaToTheta(fGeomVec[tw].Eta())));

      if (sum > fMaxValE) fMaxValE=sum;
   }

   TEveCaloData::DataChanged();
}


//______________________________________________________________________________
void  TEveCaloDataVec::SetAxisFromBins(Double_t epsX, Double_t epsY)
{
   // Set XY axis from cells geometry.

   std::vector<Double_t> binX;
   std::vector<Double_t> binY;

   for(vCellGeom_ci i=fGeomVec.begin(); i!=fGeomVec.end(); i++)
   {
      const CellGeom_t &ch = *i;

      binX.push_back(ch.EtaMin());
      binX.push_back(ch.EtaMax());
      binY.push_back(ch.PhiMin());
      binY.push_back(ch.PhiMax());
   }

   std::sort(binX.begin(), binX.end());
   std::sort(binY.begin(), binY.end());

   Int_t cnt = 0;
   Double_t sum = 0;
   Double_t val;

   // X axis
   Double_t dx = binX.back() - binX.front();
   epsX *= dx;
   std::vector<Double_t> newX;
   newX.push_back(binX.front()); // underflow
   Int_t nX = binX.size()-1;
   for(Int_t i=0; i<nX; i++)
   {
      val = (sum +binX[i])/(cnt+1);
      if (binX[i+1] -val > epsX)
      {
         newX.push_back(val);
         cnt = 0;
         sum = 0;
      }
      else
      {
         sum += binX[i];
         cnt++;
      }
   }
   newX.push_back(binX.back()); // overflow

   // Y axis
   cnt = 0;
   sum = 0;
   std::vector<Double_t> newY;
   Double_t dy = binY.back() - binY.front();
   epsY *= dy;
   newY.push_back(binY.front());// underflow
   Int_t nY = binY.size()-1;
   for(Int_t i=0 ; i<nY; i++)
   {
      val = (sum +binY[i])/(cnt+1);
      if (binY[i+1] -val > epsY )
      {
         newY.push_back(val);
         cnt = 0;
         sum = 0;
      }
      else
      {
         sum += binY[i];
         cnt++;
      }

   }
   newY.push_back(binY.back()); // overflow

   if (fEtaAxis) delete fEtaAxis;
   if (fPhiAxis) delete fPhiAxis;

   fEtaAxis = new TAxis(newX.size()-1, &newX[0]);
   fPhiAxis = new TAxis(newY.size()-1, &newY[0]);
   fEtaAxis->SetNdivisions(510);
   fPhiAxis->SetNdivisions(510);
}

//==============================================================================
// TEveCaloDataHist
//==============================================================================

//______________________________________________________________________________
//
// A central manager for calorimeter data of an event written in TH2F.
// X axis is used for eta and Y axis for phi.
//

ClassImp(TEveCaloDataHist);

//______________________________________________________________________________
TEveCaloDataHist::TEveCaloDataHist():
   TEveCaloData(),

   fHStack(0)
{
   // Constructor.

   fHStack = new THStack();
   fEps    = 1e-5;
}

//______________________________________________________________________________
TEveCaloDataHist::~TEveCaloDataHist()
{
   // Destructor.

   delete fHStack;
}

//______________________________________________________________________________
void TEveCaloDataHist::DataChanged()
{
   // Update limits and notify data users.

   using namespace TMath;

   // update max E/Et values
   fMaxValE  = 0;
   fMaxValEt = 0;

   if (GetNSlices() < 1) return;

   TH2* hist = GetHist(0);
   fEtaAxis  = hist->GetXaxis();
   fPhiAxis  = hist->GetYaxis();
   for (Int_t ieta = 1; ieta <= fEtaAxis->GetNbins(); ++ieta)
   {
      Double_t eta = fEtaAxis->GetBinCenter(ieta); // conversion E/Et
      for (Int_t iphi = 1; iphi <= fPhiAxis->GetNbins(); ++iphi)
      {
         Double_t value = 0;
         for (Int_t i = 0; i < GetNSlices(); ++i)
         {
            hist = GetHist(i);
            Int_t bin = hist->GetBin(ieta, iphi);
            value += hist->GetBinContent(bin);
         }

         if (value > fMaxValEt ) fMaxValEt = value;

         value /= Abs(Sin(EtaToTheta(eta)));

         if (value > fMaxValE) fMaxValE = value;
      }
   }
   TEveCaloData::DataChanged();
}

//______________________________________________________________________________
void TEveCaloDataHist::GetCellList(Float_t eta, Float_t etaD,
                                   Float_t phi, Float_t phiD,
                                   TEveCaloData::vCellId_t &out) const
{
   // Get list of cell IDs in given eta and phi range.

   using namespace TMath;

   Float_t etaMin = eta - etaD*0.5 -fEps;
   Float_t etaMax = eta + etaD*0.5 +fEps;

   Float_t phiMin = phi - phiD*0.5 -fEps;
   Float_t phiMax = phi + phiD*0.5 +fEps;

   Int_t nEta = fEtaAxis->GetNbins();
   Int_t nPhi = fPhiAxis->GetNbins();
   Int_t nSlices = GetNSlices();

   Int_t bin  = 0;

   Bool_t accept;
   for (Int_t ieta = 1; ieta <= nEta; ++ieta)
   {
      if (fEtaAxis->GetBinLowEdge(ieta) >= etaMin && fEtaAxis->GetBinUpEdge(ieta) <= etaMax)
      {
         for (Int_t iphi = 1; iphi <= nPhi; ++iphi)
         {
            if (fWrapTwoPi )
            {
               accept = TEveUtil::IsU1IntervalContainedByMinMax
                  (phiMin, phiMax, fPhiAxis->GetBinLowEdge(iphi), fPhiAxis->GetBinUpEdge(iphi));
            }
            else
            {
               accept = fPhiAxis->GetBinLowEdge(iphi) >= phiMin &&  fPhiAxis->GetBinUpEdge(iphi) <= phiMax &&
                  fPhiAxis->GetBinLowEdge(iphi) >= phiMin &&  fPhiAxis->GetBinUpEdge(iphi) <= phiMax;
            }

            if (accept)
            {
               for (Int_t s = 0; s < nSlices; ++s)
               {
                  TH2F *hist = GetHist(s);
                  bin = hist->GetBin(ieta, iphi);
                  if (hist->GetBinContent(bin) > fSliceInfos[s].fThreshold)
                     out.push_back(TEveCaloData::CellId_t(bin, s));
               } // hist slices
            }
         } // phi bins
      }
   } // eta bins
}


//______________________________________________________________________________
void TEveCaloDataHist::Rebin(TAxis* ax, TAxis* ay, TEveCaloData::vCellId_t &ids, Bool_t et, RebinData_t &rdata) const
{
   rdata.fNSlices = GetNSlices();
   rdata.fBinData.assign((ax->GetNbins()+2)*(ay->GetNbins()+2), -1);
   TEveCaloData::CellData_t cd;
   Float_t *val;
   Int_t i, j, w;
   Int_t binx, biny;
   Int_t bin;

   for (vCellId_i it=ids.begin(); it!=ids.end(); ++it)
   {
      GetCellData(*it, cd);
      GetHist(it->fSlice)->GetBinXYZ((*it).fTower, i, j, w);
      binx = ax->FindBin(fEtaAxis->GetBinCenter(i));
      biny = ay->FindBin(fPhiAxis->GetBinCenter(j));
      bin = biny*(ax->GetNbins()+2)+binx;
      val = rdata.GetSliceVals(bin);
      Double_t ratio = TEveUtil::GetFraction(ax->GetBinLowEdge(binx), ax->GetBinUpEdge(binx), cd.EtaMin(), cd.EtaMax())
                     * TEveUtil::GetFraction(ay->GetBinLowEdge(biny), ay->GetBinUpEdge(biny), cd.PhiMin(), cd.PhiMax());
      
      val[(*it).fSlice] += cd.Value(et)*ratio;
   }
}

//______________________________________________________________________________
void TEveCaloDataHist::GetCellData(const TEveCaloData::CellId_t &id,
                                   TEveCaloData::CellData_t& cellData) const
{
   // Get cell geometry and value from cell ID.

   TH2F* hist = GetHist(id.fSlice);

   Int_t x, y, z;
   hist->GetBinXYZ(id.fTower, x, y, z);

   cellData.fValue =  hist->GetBinContent(id.fTower);
   cellData.Configure(hist->GetXaxis()->GetBinLowEdge(x),
                      hist->GetXaxis()->GetBinUpEdge(x),
                      hist->GetYaxis()->GetBinLowEdge(y),
                      hist->GetYaxis()->GetBinUpEdge(y));
}


//______________________________________________________________________________
Int_t TEveCaloDataHist::AddHistogram(TH2F* hist)
{
   // Add new slice to calo tower. Updates cached variables fMaxValE
   // and fMaxValEt
   // Return last index in the vector of slice infos.

   fHStack->Add(hist);
   fSliceInfos.push_back(SliceInfo_t());
   fSliceInfos.back().fName  = hist->GetName();
   fSliceInfos.back().fColor = hist->GetLineColor();
   
   DataChanged();
   
   return fSliceInfos.size() - 1;
}

//______________________________________________________________________________
TH2F* TEveCaloDataHist::GetHist(Int_t slice) const
{
   // Get histogram in given slice.

   assert(slice >= 0 && slice < fHStack->GetHists()->GetSize());
   return (TH2F*) fHStack->GetHists()->At(slice);
}
   
//______________________________________________________________________________
void TEveCaloDataHist::GetEtaLimits(Double_t &min, Double_t &max) const
{
   // Get eta limits.

   min = fEtaAxis->GetXmin();
   max = fEtaAxis->GetXmax();
}

//______________________________________________________________________________
void TEveCaloDataHist::GetPhiLimits(Double_t &min, Double_t &max) const
{
   // Get phi limits.

   min = fPhiAxis->GetXmin();
   max = fPhiAxis->GetXmax();
}
 TEveCaloData.cxx:1
 TEveCaloData.cxx:2
 TEveCaloData.cxx:3
 TEveCaloData.cxx:4
 TEveCaloData.cxx:5
 TEveCaloData.cxx:6
 TEveCaloData.cxx:7
 TEveCaloData.cxx:8
 TEveCaloData.cxx:9
 TEveCaloData.cxx:10
 TEveCaloData.cxx:11
 TEveCaloData.cxx:12
 TEveCaloData.cxx:13
 TEveCaloData.cxx:14
 TEveCaloData.cxx:15
 TEveCaloData.cxx:16
 TEveCaloData.cxx:17
 TEveCaloData.cxx:18
 TEveCaloData.cxx:19
 TEveCaloData.cxx:20
 TEveCaloData.cxx:21
 TEveCaloData.cxx:22
 TEveCaloData.cxx:23
 TEveCaloData.cxx:24
 TEveCaloData.cxx:25
 TEveCaloData.cxx:26
 TEveCaloData.cxx:27
 TEveCaloData.cxx:28
 TEveCaloData.cxx:29
 TEveCaloData.cxx:30
 TEveCaloData.cxx:31
 TEveCaloData.cxx:32
 TEveCaloData.cxx:33
 TEveCaloData.cxx:34
 TEveCaloData.cxx:35
 TEveCaloData.cxx:36
 TEveCaloData.cxx:37
 TEveCaloData.cxx:38
 TEveCaloData.cxx:39
 TEveCaloData.cxx:40
 TEveCaloData.cxx:41
 TEveCaloData.cxx:42
 TEveCaloData.cxx:43
 TEveCaloData.cxx:44
 TEveCaloData.cxx:45
 TEveCaloData.cxx:46
 TEveCaloData.cxx:47
 TEveCaloData.cxx:48
 TEveCaloData.cxx:49
 TEveCaloData.cxx:50
 TEveCaloData.cxx:51
 TEveCaloData.cxx:52
 TEveCaloData.cxx:53
 TEveCaloData.cxx:54
 TEveCaloData.cxx:55
 TEveCaloData.cxx:56
 TEveCaloData.cxx:57
 TEveCaloData.cxx:58
 TEveCaloData.cxx:59
 TEveCaloData.cxx:60
 TEveCaloData.cxx:61
 TEveCaloData.cxx:62
 TEveCaloData.cxx:63
 TEveCaloData.cxx:64
 TEveCaloData.cxx:65
 TEveCaloData.cxx:66
 TEveCaloData.cxx:67
 TEveCaloData.cxx:68
 TEveCaloData.cxx:69
 TEveCaloData.cxx:70
 TEveCaloData.cxx:71
 TEveCaloData.cxx:72
 TEveCaloData.cxx:73
 TEveCaloData.cxx:74
 TEveCaloData.cxx:75
 TEveCaloData.cxx:76
 TEveCaloData.cxx:77
 TEveCaloData.cxx:78
 TEveCaloData.cxx:79
 TEveCaloData.cxx:80
 TEveCaloData.cxx:81
 TEveCaloData.cxx:82
 TEveCaloData.cxx:83
 TEveCaloData.cxx:84
 TEveCaloData.cxx:85
 TEveCaloData.cxx:86
 TEveCaloData.cxx:87
 TEveCaloData.cxx:88
 TEveCaloData.cxx:89
 TEveCaloData.cxx:90
 TEveCaloData.cxx:91
 TEveCaloData.cxx:92
 TEveCaloData.cxx:93
 TEveCaloData.cxx:94
 TEveCaloData.cxx:95
 TEveCaloData.cxx:96
 TEveCaloData.cxx:97
 TEveCaloData.cxx:98
 TEveCaloData.cxx:99
 TEveCaloData.cxx:100
 TEveCaloData.cxx:101
 TEveCaloData.cxx:102
 TEveCaloData.cxx:103
 TEveCaloData.cxx:104
 TEveCaloData.cxx:105
 TEveCaloData.cxx:106
 TEveCaloData.cxx:107
 TEveCaloData.cxx:108
 TEveCaloData.cxx:109
 TEveCaloData.cxx:110
 TEveCaloData.cxx:111
 TEveCaloData.cxx:112
 TEveCaloData.cxx:113
 TEveCaloData.cxx:114
 TEveCaloData.cxx:115
 TEveCaloData.cxx:116
 TEveCaloData.cxx:117
 TEveCaloData.cxx:118
 TEveCaloData.cxx:119
 TEveCaloData.cxx:120
 TEveCaloData.cxx:121
 TEveCaloData.cxx:122
 TEveCaloData.cxx:123
 TEveCaloData.cxx:124
 TEveCaloData.cxx:125
 TEveCaloData.cxx:126
 TEveCaloData.cxx:127
 TEveCaloData.cxx:128
 TEveCaloData.cxx:129
 TEveCaloData.cxx:130
 TEveCaloData.cxx:131
 TEveCaloData.cxx:132
 TEveCaloData.cxx:133
 TEveCaloData.cxx:134
 TEveCaloData.cxx:135
 TEveCaloData.cxx:136
 TEveCaloData.cxx:137
 TEveCaloData.cxx:138
 TEveCaloData.cxx:139
 TEveCaloData.cxx:140
 TEveCaloData.cxx:141
 TEveCaloData.cxx:142
 TEveCaloData.cxx:143
 TEveCaloData.cxx:144
 TEveCaloData.cxx:145
 TEveCaloData.cxx:146
 TEveCaloData.cxx:147
 TEveCaloData.cxx:148
 TEveCaloData.cxx:149
 TEveCaloData.cxx:150
 TEveCaloData.cxx:151
 TEveCaloData.cxx:152
 TEveCaloData.cxx:153
 TEveCaloData.cxx:154
 TEveCaloData.cxx:155
 TEveCaloData.cxx:156
 TEveCaloData.cxx:157
 TEveCaloData.cxx:158
 TEveCaloData.cxx:159
 TEveCaloData.cxx:160
 TEveCaloData.cxx:161
 TEveCaloData.cxx:162
 TEveCaloData.cxx:163
 TEveCaloData.cxx:164
 TEveCaloData.cxx:165
 TEveCaloData.cxx:166
 TEveCaloData.cxx:167
 TEveCaloData.cxx:168
 TEveCaloData.cxx:169
 TEveCaloData.cxx:170
 TEveCaloData.cxx:171
 TEveCaloData.cxx:172
 TEveCaloData.cxx:173
 TEveCaloData.cxx:174
 TEveCaloData.cxx:175
 TEveCaloData.cxx:176
 TEveCaloData.cxx:177
 TEveCaloData.cxx:178
 TEveCaloData.cxx:179
 TEveCaloData.cxx:180
 TEveCaloData.cxx:181
 TEveCaloData.cxx:182
 TEveCaloData.cxx:183
 TEveCaloData.cxx:184
 TEveCaloData.cxx:185
 TEveCaloData.cxx:186
 TEveCaloData.cxx:187
 TEveCaloData.cxx:188
 TEveCaloData.cxx:189
 TEveCaloData.cxx:190
 TEveCaloData.cxx:191
 TEveCaloData.cxx:192
 TEveCaloData.cxx:193
 TEveCaloData.cxx:194
 TEveCaloData.cxx:195
 TEveCaloData.cxx:196
 TEveCaloData.cxx:197
 TEveCaloData.cxx:198
 TEveCaloData.cxx:199
 TEveCaloData.cxx:200
 TEveCaloData.cxx:201
 TEveCaloData.cxx:202
 TEveCaloData.cxx:203
 TEveCaloData.cxx:204
 TEveCaloData.cxx:205
 TEveCaloData.cxx:206
 TEveCaloData.cxx:207
 TEveCaloData.cxx:208
 TEveCaloData.cxx:209
 TEveCaloData.cxx:210
 TEveCaloData.cxx:211
 TEveCaloData.cxx:212
 TEveCaloData.cxx:213
 TEveCaloData.cxx:214
 TEveCaloData.cxx:215
 TEveCaloData.cxx:216
 TEveCaloData.cxx:217
 TEveCaloData.cxx:218
 TEveCaloData.cxx:219
 TEveCaloData.cxx:220
 TEveCaloData.cxx:221
 TEveCaloData.cxx:222
 TEveCaloData.cxx:223
 TEveCaloData.cxx:224
 TEveCaloData.cxx:225
 TEveCaloData.cxx:226
 TEveCaloData.cxx:227
 TEveCaloData.cxx:228
 TEveCaloData.cxx:229
 TEveCaloData.cxx:230
 TEveCaloData.cxx:231
 TEveCaloData.cxx:232
 TEveCaloData.cxx:233
 TEveCaloData.cxx:234
 TEveCaloData.cxx:235
 TEveCaloData.cxx:236
 TEveCaloData.cxx:237
 TEveCaloData.cxx:238
 TEveCaloData.cxx:239
 TEveCaloData.cxx:240
 TEveCaloData.cxx:241
 TEveCaloData.cxx:242
 TEveCaloData.cxx:243
 TEveCaloData.cxx:244
 TEveCaloData.cxx:245
 TEveCaloData.cxx:246
 TEveCaloData.cxx:247
 TEveCaloData.cxx:248
 TEveCaloData.cxx:249
 TEveCaloData.cxx:250
 TEveCaloData.cxx:251
 TEveCaloData.cxx:252
 TEveCaloData.cxx:253
 TEveCaloData.cxx:254
 TEveCaloData.cxx:255
 TEveCaloData.cxx:256
 TEveCaloData.cxx:257
 TEveCaloData.cxx:258
 TEveCaloData.cxx:259
 TEveCaloData.cxx:260
 TEveCaloData.cxx:261
 TEveCaloData.cxx:262
 TEveCaloData.cxx:263
 TEveCaloData.cxx:264
 TEveCaloData.cxx:265
 TEveCaloData.cxx:266
 TEveCaloData.cxx:267
 TEveCaloData.cxx:268
 TEveCaloData.cxx:269
 TEveCaloData.cxx:270
 TEveCaloData.cxx:271
 TEveCaloData.cxx:272
 TEveCaloData.cxx:273
 TEveCaloData.cxx:274
 TEveCaloData.cxx:275
 TEveCaloData.cxx:276
 TEveCaloData.cxx:277
 TEveCaloData.cxx:278
 TEveCaloData.cxx:279
 TEveCaloData.cxx:280
 TEveCaloData.cxx:281
 TEveCaloData.cxx:282
 TEveCaloData.cxx:283
 TEveCaloData.cxx:284
 TEveCaloData.cxx:285
 TEveCaloData.cxx:286
 TEveCaloData.cxx:287
 TEveCaloData.cxx:288
 TEveCaloData.cxx:289
 TEveCaloData.cxx:290
 TEveCaloData.cxx:291
 TEveCaloData.cxx:292
 TEveCaloData.cxx:293
 TEveCaloData.cxx:294
 TEveCaloData.cxx:295
 TEveCaloData.cxx:296
 TEveCaloData.cxx:297
 TEveCaloData.cxx:298
 TEveCaloData.cxx:299
 TEveCaloData.cxx:300
 TEveCaloData.cxx:301
 TEveCaloData.cxx:302
 TEveCaloData.cxx:303
 TEveCaloData.cxx:304
 TEveCaloData.cxx:305
 TEveCaloData.cxx:306
 TEveCaloData.cxx:307
 TEveCaloData.cxx:308
 TEveCaloData.cxx:309
 TEveCaloData.cxx:310
 TEveCaloData.cxx:311
 TEveCaloData.cxx:312
 TEveCaloData.cxx:313
 TEveCaloData.cxx:314
 TEveCaloData.cxx:315
 TEveCaloData.cxx:316
 TEveCaloData.cxx:317
 TEveCaloData.cxx:318
 TEveCaloData.cxx:319
 TEveCaloData.cxx:320
 TEveCaloData.cxx:321
 TEveCaloData.cxx:322
 TEveCaloData.cxx:323
 TEveCaloData.cxx:324
 TEveCaloData.cxx:325
 TEveCaloData.cxx:326
 TEveCaloData.cxx:327
 TEveCaloData.cxx:328
 TEveCaloData.cxx:329
 TEveCaloData.cxx:330
 TEveCaloData.cxx:331
 TEveCaloData.cxx:332
 TEveCaloData.cxx:333
 TEveCaloData.cxx:334
 TEveCaloData.cxx:335
 TEveCaloData.cxx:336
 TEveCaloData.cxx:337
 TEveCaloData.cxx:338
 TEveCaloData.cxx:339
 TEveCaloData.cxx:340
 TEveCaloData.cxx:341
 TEveCaloData.cxx:342
 TEveCaloData.cxx:343
 TEveCaloData.cxx:344
 TEveCaloData.cxx:345
 TEveCaloData.cxx:346
 TEveCaloData.cxx:347
 TEveCaloData.cxx:348
 TEveCaloData.cxx:349
 TEveCaloData.cxx:350
 TEveCaloData.cxx:351
 TEveCaloData.cxx:352
 TEveCaloData.cxx:353
 TEveCaloData.cxx:354
 TEveCaloData.cxx:355
 TEveCaloData.cxx:356
 TEveCaloData.cxx:357
 TEveCaloData.cxx:358
 TEveCaloData.cxx:359
 TEveCaloData.cxx:360
 TEveCaloData.cxx:361
 TEveCaloData.cxx:362
 TEveCaloData.cxx:363
 TEveCaloData.cxx:364
 TEveCaloData.cxx:365
 TEveCaloData.cxx:366
 TEveCaloData.cxx:367
 TEveCaloData.cxx:368
 TEveCaloData.cxx:369
 TEveCaloData.cxx:370
 TEveCaloData.cxx:371
 TEveCaloData.cxx:372
 TEveCaloData.cxx:373
 TEveCaloData.cxx:374
 TEveCaloData.cxx:375
 TEveCaloData.cxx:376
 TEveCaloData.cxx:377
 TEveCaloData.cxx:378
 TEveCaloData.cxx:379
 TEveCaloData.cxx:380
 TEveCaloData.cxx:381
 TEveCaloData.cxx:382
 TEveCaloData.cxx:383
 TEveCaloData.cxx:384
 TEveCaloData.cxx:385
 TEveCaloData.cxx:386
 TEveCaloData.cxx:387
 TEveCaloData.cxx:388
 TEveCaloData.cxx:389
 TEveCaloData.cxx:390
 TEveCaloData.cxx:391
 TEveCaloData.cxx:392
 TEveCaloData.cxx:393
 TEveCaloData.cxx:394
 TEveCaloData.cxx:395
 TEveCaloData.cxx:396
 TEveCaloData.cxx:397
 TEveCaloData.cxx:398
 TEveCaloData.cxx:399
 TEveCaloData.cxx:400
 TEveCaloData.cxx:401
 TEveCaloData.cxx:402
 TEveCaloData.cxx:403
 TEveCaloData.cxx:404
 TEveCaloData.cxx:405
 TEveCaloData.cxx:406
 TEveCaloData.cxx:407
 TEveCaloData.cxx:408
 TEveCaloData.cxx:409
 TEveCaloData.cxx:410
 TEveCaloData.cxx:411
 TEveCaloData.cxx:412
 TEveCaloData.cxx:413
 TEveCaloData.cxx:414
 TEveCaloData.cxx:415
 TEveCaloData.cxx:416
 TEveCaloData.cxx:417
 TEveCaloData.cxx:418
 TEveCaloData.cxx:419
 TEveCaloData.cxx:420
 TEveCaloData.cxx:421
 TEveCaloData.cxx:422
 TEveCaloData.cxx:423
 TEveCaloData.cxx:424
 TEveCaloData.cxx:425
 TEveCaloData.cxx:426
 TEveCaloData.cxx:427
 TEveCaloData.cxx:428
 TEveCaloData.cxx:429
 TEveCaloData.cxx:430
 TEveCaloData.cxx:431
 TEveCaloData.cxx:432
 TEveCaloData.cxx:433
 TEveCaloData.cxx:434
 TEveCaloData.cxx:435
 TEveCaloData.cxx:436
 TEveCaloData.cxx:437
 TEveCaloData.cxx:438
 TEveCaloData.cxx:439
 TEveCaloData.cxx:440
 TEveCaloData.cxx:441
 TEveCaloData.cxx:442
 TEveCaloData.cxx:443
 TEveCaloData.cxx:444
 TEveCaloData.cxx:445
 TEveCaloData.cxx:446
 TEveCaloData.cxx:447
 TEveCaloData.cxx:448
 TEveCaloData.cxx:449
 TEveCaloData.cxx:450
 TEveCaloData.cxx:451
 TEveCaloData.cxx:452
 TEveCaloData.cxx:453
 TEveCaloData.cxx:454
 TEveCaloData.cxx:455
 TEveCaloData.cxx:456
 TEveCaloData.cxx:457
 TEveCaloData.cxx:458
 TEveCaloData.cxx:459
 TEveCaloData.cxx:460
 TEveCaloData.cxx:461
 TEveCaloData.cxx:462
 TEveCaloData.cxx:463
 TEveCaloData.cxx:464
 TEveCaloData.cxx:465
 TEveCaloData.cxx:466
 TEveCaloData.cxx:467
 TEveCaloData.cxx:468
 TEveCaloData.cxx:469
 TEveCaloData.cxx:470
 TEveCaloData.cxx:471
 TEveCaloData.cxx:472
 TEveCaloData.cxx:473
 TEveCaloData.cxx:474
 TEveCaloData.cxx:475
 TEveCaloData.cxx:476
 TEveCaloData.cxx:477
 TEveCaloData.cxx:478
 TEveCaloData.cxx:479
 TEveCaloData.cxx:480
 TEveCaloData.cxx:481
 TEveCaloData.cxx:482
 TEveCaloData.cxx:483
 TEveCaloData.cxx:484
 TEveCaloData.cxx:485
 TEveCaloData.cxx:486
 TEveCaloData.cxx:487
 TEveCaloData.cxx:488
 TEveCaloData.cxx:489
 TEveCaloData.cxx:490
 TEveCaloData.cxx:491
 TEveCaloData.cxx:492
 TEveCaloData.cxx:493
 TEveCaloData.cxx:494
 TEveCaloData.cxx:495
 TEveCaloData.cxx:496
 TEveCaloData.cxx:497
 TEveCaloData.cxx:498
 TEveCaloData.cxx:499
 TEveCaloData.cxx:500
 TEveCaloData.cxx:501
 TEveCaloData.cxx:502
 TEveCaloData.cxx:503
 TEveCaloData.cxx:504
 TEveCaloData.cxx:505
 TEveCaloData.cxx:506
 TEveCaloData.cxx:507
 TEveCaloData.cxx:508
 TEveCaloData.cxx:509
 TEveCaloData.cxx:510
 TEveCaloData.cxx:511
 TEveCaloData.cxx:512
 TEveCaloData.cxx:513
 TEveCaloData.cxx:514
 TEveCaloData.cxx:515
 TEveCaloData.cxx:516
 TEveCaloData.cxx:517
 TEveCaloData.cxx:518
 TEveCaloData.cxx:519
 TEveCaloData.cxx:520
 TEveCaloData.cxx:521
 TEveCaloData.cxx:522
 TEveCaloData.cxx:523
 TEveCaloData.cxx:524
 TEveCaloData.cxx:525
 TEveCaloData.cxx:526
 TEveCaloData.cxx:527
 TEveCaloData.cxx:528
 TEveCaloData.cxx:529
 TEveCaloData.cxx:530
 TEveCaloData.cxx:531
 TEveCaloData.cxx:532
 TEveCaloData.cxx:533
 TEveCaloData.cxx:534
 TEveCaloData.cxx:535
 TEveCaloData.cxx:536
 TEveCaloData.cxx:537
 TEveCaloData.cxx:538
 TEveCaloData.cxx:539
 TEveCaloData.cxx:540
 TEveCaloData.cxx:541
 TEveCaloData.cxx:542
 TEveCaloData.cxx:543
 TEveCaloData.cxx:544
 TEveCaloData.cxx:545
 TEveCaloData.cxx:546
 TEveCaloData.cxx:547
 TEveCaloData.cxx:548
 TEveCaloData.cxx:549
 TEveCaloData.cxx:550
 TEveCaloData.cxx:551
 TEveCaloData.cxx:552
 TEveCaloData.cxx:553
 TEveCaloData.cxx:554
 TEveCaloData.cxx:555
 TEveCaloData.cxx:556
 TEveCaloData.cxx:557
 TEveCaloData.cxx:558
 TEveCaloData.cxx:559
 TEveCaloData.cxx:560
 TEveCaloData.cxx:561
 TEveCaloData.cxx:562
 TEveCaloData.cxx:563
 TEveCaloData.cxx:564
 TEveCaloData.cxx:565
 TEveCaloData.cxx:566
 TEveCaloData.cxx:567
 TEveCaloData.cxx:568
 TEveCaloData.cxx:569
 TEveCaloData.cxx:570
 TEveCaloData.cxx:571
 TEveCaloData.cxx:572
 TEveCaloData.cxx:573
 TEveCaloData.cxx:574
 TEveCaloData.cxx:575
 TEveCaloData.cxx:576
 TEveCaloData.cxx:577
 TEveCaloData.cxx:578
 TEveCaloData.cxx:579
 TEveCaloData.cxx:580
 TEveCaloData.cxx:581
 TEveCaloData.cxx:582
 TEveCaloData.cxx:583
 TEveCaloData.cxx:584
 TEveCaloData.cxx:585
 TEveCaloData.cxx:586
 TEveCaloData.cxx:587
 TEveCaloData.cxx:588
 TEveCaloData.cxx:589
 TEveCaloData.cxx:590
 TEveCaloData.cxx:591
 TEveCaloData.cxx:592
 TEveCaloData.cxx:593
 TEveCaloData.cxx:594
 TEveCaloData.cxx:595
 TEveCaloData.cxx:596
 TEveCaloData.cxx:597
 TEveCaloData.cxx:598
 TEveCaloData.cxx:599
 TEveCaloData.cxx:600
 TEveCaloData.cxx:601
 TEveCaloData.cxx:602
 TEveCaloData.cxx:603
 TEveCaloData.cxx:604
 TEveCaloData.cxx:605
 TEveCaloData.cxx:606
 TEveCaloData.cxx:607
 TEveCaloData.cxx:608
 TEveCaloData.cxx:609
 TEveCaloData.cxx:610
 TEveCaloData.cxx:611
 TEveCaloData.cxx:612
 TEveCaloData.cxx:613
 TEveCaloData.cxx:614
 TEveCaloData.cxx:615
 TEveCaloData.cxx:616
 TEveCaloData.cxx:617
 TEveCaloData.cxx:618
 TEveCaloData.cxx:619
 TEveCaloData.cxx:620
 TEveCaloData.cxx:621
 TEveCaloData.cxx:622
 TEveCaloData.cxx:623
 TEveCaloData.cxx:624
 TEveCaloData.cxx:625
 TEveCaloData.cxx:626
 TEveCaloData.cxx:627
 TEveCaloData.cxx:628
 TEveCaloData.cxx:629
 TEveCaloData.cxx:630
 TEveCaloData.cxx:631
 TEveCaloData.cxx:632
 TEveCaloData.cxx:633
 TEveCaloData.cxx:634
 TEveCaloData.cxx:635
 TEveCaloData.cxx:636
 TEveCaloData.cxx:637
 TEveCaloData.cxx:638
 TEveCaloData.cxx:639
 TEveCaloData.cxx:640
 TEveCaloData.cxx:641
 TEveCaloData.cxx:642
 TEveCaloData.cxx:643
 TEveCaloData.cxx:644
 TEveCaloData.cxx:645
 TEveCaloData.cxx:646
 TEveCaloData.cxx:647
 TEveCaloData.cxx:648
 TEveCaloData.cxx:649
 TEveCaloData.cxx:650
 TEveCaloData.cxx:651
 TEveCaloData.cxx:652
 TEveCaloData.cxx:653
 TEveCaloData.cxx:654
 TEveCaloData.cxx:655
 TEveCaloData.cxx:656
 TEveCaloData.cxx:657
 TEveCaloData.cxx:658
 TEveCaloData.cxx:659
 TEveCaloData.cxx:660
 TEveCaloData.cxx:661
 TEveCaloData.cxx:662
 TEveCaloData.cxx:663
 TEveCaloData.cxx:664
 TEveCaloData.cxx:665
 TEveCaloData.cxx:666
 TEveCaloData.cxx:667
 TEveCaloData.cxx:668
 TEveCaloData.cxx:669
 TEveCaloData.cxx:670
 TEveCaloData.cxx:671
 TEveCaloData.cxx:672
 TEveCaloData.cxx:673
 TEveCaloData.cxx:674
 TEveCaloData.cxx:675
 TEveCaloData.cxx:676
 TEveCaloData.cxx:677
 TEveCaloData.cxx:678
 TEveCaloData.cxx:679
 TEveCaloData.cxx:680
 TEveCaloData.cxx:681
 TEveCaloData.cxx:682
 TEveCaloData.cxx:683
 TEveCaloData.cxx:684
 TEveCaloData.cxx:685
 TEveCaloData.cxx:686
 TEveCaloData.cxx:687
 TEveCaloData.cxx:688
 TEveCaloData.cxx:689
 TEveCaloData.cxx:690
 TEveCaloData.cxx:691
 TEveCaloData.cxx:692
 TEveCaloData.cxx:693
 TEveCaloData.cxx:694
 TEveCaloData.cxx:695
 TEveCaloData.cxx:696
 TEveCaloData.cxx:697
 TEveCaloData.cxx:698
 TEveCaloData.cxx:699
 TEveCaloData.cxx:700
 TEveCaloData.cxx:701
 TEveCaloData.cxx:702
 TEveCaloData.cxx:703
 TEveCaloData.cxx:704
 TEveCaloData.cxx:705
 TEveCaloData.cxx:706
 TEveCaloData.cxx:707
 TEveCaloData.cxx:708
 TEveCaloData.cxx:709
 TEveCaloData.cxx:710
 TEveCaloData.cxx:711
 TEveCaloData.cxx:712
 TEveCaloData.cxx:713
 TEveCaloData.cxx:714
 TEveCaloData.cxx:715
 TEveCaloData.cxx:716
 TEveCaloData.cxx:717
 TEveCaloData.cxx:718
 TEveCaloData.cxx:719
 TEveCaloData.cxx:720
 TEveCaloData.cxx:721
 TEveCaloData.cxx:722
 TEveCaloData.cxx:723
 TEveCaloData.cxx:724
 TEveCaloData.cxx:725
 TEveCaloData.cxx:726
 TEveCaloData.cxx:727
 TEveCaloData.cxx:728
 TEveCaloData.cxx:729
 TEveCaloData.cxx:730
 TEveCaloData.cxx:731
 TEveCaloData.cxx:732
 TEveCaloData.cxx:733
 TEveCaloData.cxx:734
 TEveCaloData.cxx:735
 TEveCaloData.cxx:736
 TEveCaloData.cxx:737
 TEveCaloData.cxx:738
 TEveCaloData.cxx:739
 TEveCaloData.cxx:740
 TEveCaloData.cxx:741
 TEveCaloData.cxx:742
 TEveCaloData.cxx:743
 TEveCaloData.cxx:744
 TEveCaloData.cxx:745
 TEveCaloData.cxx:746
 TEveCaloData.cxx:747
 TEveCaloData.cxx:748
 TEveCaloData.cxx:749
 TEveCaloData.cxx:750
 TEveCaloData.cxx:751
 TEveCaloData.cxx:752
 TEveCaloData.cxx:753
 TEveCaloData.cxx:754
 TEveCaloData.cxx:755
 TEveCaloData.cxx:756
 TEveCaloData.cxx:757
 TEveCaloData.cxx:758
 TEveCaloData.cxx:759
 TEveCaloData.cxx:760
 TEveCaloData.cxx:761
 TEveCaloData.cxx:762
 TEveCaloData.cxx:763
 TEveCaloData.cxx:764
 TEveCaloData.cxx:765
 TEveCaloData.cxx:766
 TEveCaloData.cxx:767
 TEveCaloData.cxx:768
 TEveCaloData.cxx:769
 TEveCaloData.cxx:770
 TEveCaloData.cxx:771
 TEveCaloData.cxx:772
 TEveCaloData.cxx:773
 TEveCaloData.cxx:774
 TEveCaloData.cxx:775
 TEveCaloData.cxx:776
 TEveCaloData.cxx:777
 TEveCaloData.cxx:778
 TEveCaloData.cxx:779
 TEveCaloData.cxx:780
 TEveCaloData.cxx:781
 TEveCaloData.cxx:782
 TEveCaloData.cxx:783
 TEveCaloData.cxx:784
 TEveCaloData.cxx:785
 TEveCaloData.cxx:786
 TEveCaloData.cxx:787
 TEveCaloData.cxx:788
 TEveCaloData.cxx:789
 TEveCaloData.cxx:790
 TEveCaloData.cxx:791
 TEveCaloData.cxx:792
 TEveCaloData.cxx:793
 TEveCaloData.cxx:794
 TEveCaloData.cxx:795
 TEveCaloData.cxx:796
 TEveCaloData.cxx:797
 TEveCaloData.cxx:798
 TEveCaloData.cxx:799
 TEveCaloData.cxx:800
 TEveCaloData.cxx:801
 TEveCaloData.cxx:802
 TEveCaloData.cxx:803
 TEveCaloData.cxx:804
 TEveCaloData.cxx:805
 TEveCaloData.cxx:806
 TEveCaloData.cxx:807
 TEveCaloData.cxx:808
 TEveCaloData.cxx:809
 TEveCaloData.cxx:810
 TEveCaloData.cxx:811
 TEveCaloData.cxx:812
 TEveCaloData.cxx:813
 TEveCaloData.cxx:814
 TEveCaloData.cxx:815
 TEveCaloData.cxx:816
 TEveCaloData.cxx:817
 TEveCaloData.cxx:818
 TEveCaloData.cxx:819
 TEveCaloData.cxx:820
 TEveCaloData.cxx:821
 TEveCaloData.cxx:822
 TEveCaloData.cxx:823
 TEveCaloData.cxx:824
 TEveCaloData.cxx:825
 TEveCaloData.cxx:826
 TEveCaloData.cxx:827
 TEveCaloData.cxx:828
 TEveCaloData.cxx:829
 TEveCaloData.cxx:830
 TEveCaloData.cxx:831
 TEveCaloData.cxx:832
 TEveCaloData.cxx:833
 TEveCaloData.cxx:834
 TEveCaloData.cxx:835
 TEveCaloData.cxx:836
 TEveCaloData.cxx:837
 TEveCaloData.cxx:838
 TEveCaloData.cxx:839
 TEveCaloData.cxx:840
 TEveCaloData.cxx:841
 TEveCaloData.cxx:842
 TEveCaloData.cxx:843
 TEveCaloData.cxx:844
 TEveCaloData.cxx:845
 TEveCaloData.cxx:846
 TEveCaloData.cxx:847
 TEveCaloData.cxx:848
 TEveCaloData.cxx:849
 TEveCaloData.cxx:850
 TEveCaloData.cxx:851
 TEveCaloData.cxx:852
 TEveCaloData.cxx:853
 TEveCaloData.cxx:854
 TEveCaloData.cxx:855
 TEveCaloData.cxx:856
 TEveCaloData.cxx:857
 TEveCaloData.cxx:858
 TEveCaloData.cxx:859
 TEveCaloData.cxx:860
 TEveCaloData.cxx:861
 TEveCaloData.cxx:862
 TEveCaloData.cxx:863
 TEveCaloData.cxx:864
 TEveCaloData.cxx:865
 TEveCaloData.cxx:866
 TEveCaloData.cxx:867
 TEveCaloData.cxx:868
 TEveCaloData.cxx:869
 TEveCaloData.cxx:870
 TEveCaloData.cxx:871
 TEveCaloData.cxx:872
 TEveCaloData.cxx:873
 TEveCaloData.cxx:874
 TEveCaloData.cxx:875
 TEveCaloData.cxx:876
 TEveCaloData.cxx:877
 TEveCaloData.cxx:878
 TEveCaloData.cxx:879
 TEveCaloData.cxx:880
 TEveCaloData.cxx:881
 TEveCaloData.cxx:882
 TEveCaloData.cxx:883
 TEveCaloData.cxx:884
 TEveCaloData.cxx:885
 TEveCaloData.cxx:886
 TEveCaloData.cxx:887
 TEveCaloData.cxx:888
 TEveCaloData.cxx:889
 TEveCaloData.cxx:890
 TEveCaloData.cxx:891
 TEveCaloData.cxx:892
 TEveCaloData.cxx:893
 TEveCaloData.cxx:894
 TEveCaloData.cxx:895
 TEveCaloData.cxx:896
 TEveCaloData.cxx:897
 TEveCaloData.cxx:898
 TEveCaloData.cxx:899
 TEveCaloData.cxx:900
 TEveCaloData.cxx:901
 TEveCaloData.cxx:902
 TEveCaloData.cxx:903
 TEveCaloData.cxx:904
 TEveCaloData.cxx:905
 TEveCaloData.cxx:906
 TEveCaloData.cxx:907
 TEveCaloData.cxx:908
 TEveCaloData.cxx:909
 TEveCaloData.cxx:910
 TEveCaloData.cxx:911
 TEveCaloData.cxx:912
 TEveCaloData.cxx:913
 TEveCaloData.cxx:914
 TEveCaloData.cxx:915
 TEveCaloData.cxx:916
 TEveCaloData.cxx:917
 TEveCaloData.cxx:918
 TEveCaloData.cxx:919
 TEveCaloData.cxx:920
 TEveCaloData.cxx:921
 TEveCaloData.cxx:922
 TEveCaloData.cxx:923
 TEveCaloData.cxx:924
 TEveCaloData.cxx:925
 TEveCaloData.cxx:926
 TEveCaloData.cxx:927
 TEveCaloData.cxx:928
 TEveCaloData.cxx:929
 TEveCaloData.cxx:930
 TEveCaloData.cxx:931
 TEveCaloData.cxx:932
 TEveCaloData.cxx:933
 TEveCaloData.cxx:934
 TEveCaloData.cxx:935
 TEveCaloData.cxx:936
 TEveCaloData.cxx:937