// @(#)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 "TEveCalo.h"
#include "TEveCaloData.h"
#include "TEveProjections.h"
#include "TEveProjectionManager.h"
#include "TEveRGBAPalette.h"
#include "TEveText.h"
#include "TEveTrans.h"

#include "TClass.h"
#include "TMathBase.h"
#include "TMath.h"
#include "TAxis.h"

#include "TGLUtil.h"

#include <cassert>

//==============================================================================
// TEveCaloViz
//==============================================================================

//______________________________________________________________________________
//
// Base class for calorimeter data visualization.
// See TEveCalo2D and TEveCalo3D for concrete implementations.

ClassImp(TEveCaloViz);

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

   fData(0),
   fCellIdCacheOK(kFALSE),

   fEtaMin(-10),
   fEtaMax(10),

   fPhi(0.),
   fPhiOffset(TMath::Pi()),

   fAutoRange(kTRUE),

   fBarrelRadius(-1.f),
   fEndCapPosF(-1.f),
   fEndCapPosB(-1.f),

   fPlotEt(kTRUE),

   fMaxTowerH(100),
   fScaleAbs(kFALSE),
   fMaxValAbs(100),

   fValueIsColor(kFALSE),
   fPalette(0)
{
   // Constructor.

   fPickable = kTRUE;
   SetElementNameTitle(n, t);
   SetData(data);
}

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

   if (fPalette) fPalette->DecRefCount();
}

//______________________________________________________________________________
Float_t TEveCaloViz::GetDataSliceThreshold(Int_t slice) const
{
   // Get threshold for given slice.

   return fData->RefSliceInfo(slice).fThreshold;
}

//______________________________________________________________________________
TEveElement* TEveCaloViz::ForwardSelection()
{
   // Management of selection state and ownership of selected cell list
   // is done in TEveCaloData. This is a reason selection is forwared to it.

   return fData;
}

//______________________________________________________________________________
TEveElement* TEveCaloViz::ForwardEdit()
{
   // Management of selection state and ownership of selected cell list
   // is done in TEveCaloData. We still want GUI editor to disply
   // concrete calo-viz object.

   return this;
}

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

   fData->SetSliceThreshold(slice, val);
}

//______________________________________________________________________________
Color_t TEveCaloViz::GetDataSliceColor(Int_t slice) const
{
   // Get slice color from data.

   return fData->RefSliceInfo(slice).fColor;
}

//______________________________________________________________________________
void TEveCaloViz::SetDataSliceColor(Int_t slice, Color_t col)
{
   // Set slice color in data.

   fData->SetSliceColor(slice, col);
}

//______________________________________________________________________________
void TEveCaloViz::SetEta(Float_t l, Float_t u)
{
   // Set eta range.

   fEtaMin=l;
   fEtaMax=u;

   InvalidateCellIdCache();
}

//______________________________________________________________________________
void TEveCaloViz::SetPlotEt(Bool_t isEt)
{
   // Set E/Et plot.

   fPlotEt=isEt;
   if (fPalette)
      fPalette->SetLimits(0, TMath::CeilNint(GetMaxVal()));

   InvalidateCellIdCache();
}

//______________________________________________________________________________
Float_t TEveCaloViz::GetMaxVal() const
{

   // Get maximum plotted value.

   return fData->GetMaxVal(fPlotEt);

}

//______________________________________________________________________________
void TEveCaloViz::SetPhiWithRng(Float_t phi, Float_t rng)
{
   // Set phi range.

   using namespace TMath;

   fPhi = phi;
   fPhiOffset = rng;

   InvalidateCellIdCache();
}

//______________________________________________________________________________
Float_t TEveCaloViz::GetTransitionTheta() const
{
   // Get transition angle between barrel and end-cap cells, assuming fEndCapPosF = -fEndCapPosB.

   return TMath::ATan(fBarrelRadius/fEndCapPosF);
}

//______________________________________________________________________________
Float_t TEveCaloViz::GetTransitionEta() const
{
   // Get transition eta between barrel and end-cap cells, assuming fEndCapPosF = -fEndCapPosB.

   using namespace TMath;
   Float_t t = GetTransitionTheta()*0.5f;
   return -Log(Tan(t));
}

//______________________________________________________________________________
Float_t TEveCaloViz::GetTransitionThetaForward() const
{
   // Get transition angle between barrel and forward end-cap cells.

   return TMath::ATan(fBarrelRadius/fEndCapPosF);
}

//______________________________________________________________________________
Float_t TEveCaloViz::GetTransitionEtaForward() const
{
   // Get transition eta between barrel and forward end-cap cells.

   using namespace TMath;
   Float_t t = GetTransitionThetaForward()*0.5f;
   return -Log(Tan(t));
}

//______________________________________________________________________________
Float_t TEveCaloViz::GetTransitionThetaBackward() const
{
   // Get transition angle between barrel and backward end-cap cells.

   return TMath::ATan(fBarrelRadius/fEndCapPosB);
}

//______________________________________________________________________________
Float_t TEveCaloViz::GetTransitionEtaBackward() const
{
   // Get transition eta between barrel and backward end-cap cells.

   using namespace TMath;
   Float_t t = GetTransitionThetaBackward()*0.5f;
   //negative theta means negative eta
   return Log(-Tan(t));
}


//______________________________________________________________________________
void TEveCaloViz::SetData(TEveCaloData* data)
{
   // Set calorimeter event data.


   if (data == fData) return;
   if (fData) fData->RemoveElement(this);
   fData = data;
   if (fData)
   {
      fData->AddElement(this);
      DataChanged();
   }
}

//______________________________________________________________________________
void TEveCaloViz::DataChanged()
{
   // Update setting and cache on data changed.
   // Called from TEvecaloData::BroadcastDataChange()

   Double_t min, max, delta;

   fData->GetEtaLimits(min, max);
   if (fAutoRange) {
      fEtaMin = min;
      fEtaMax = max;
   } else {
      if (fEtaMin < min) fEtaMin = min;
      if (fEtaMax > max) fEtaMax = max;
   }

   fData->GetPhiLimits(min, max);
   delta = 0.5*(max - min);
   if (fAutoRange || fPhi < min || fPhi > max) {
      fPhi       = 0.5*(max + min);
      fPhiOffset = delta;
   } else {
      if (fPhiOffset > delta) fPhiOffset = delta;
   }

   if (fPalette)
   {
      Int_t hlimit = TMath::CeilNint(GetMaxVal());
      fPalette->SetLimits(0, hlimit);
      fPalette->SetMin(0);
      fPalette->SetMax(hlimit);
   }

   InvalidateCellIdCache();
}

//______________________________________________________________________________
Bool_t TEveCaloViz::AssertCellIdCache() const
{
   // Assert cell id cache is ok.
   // Returns true if the cache has been updated.

   TEveCaloViz* cv = const_cast<TEveCaloViz*>(this);
   if (!fCellIdCacheOK) {
      cv->BuildCellIdCache();
      return kTRUE;
   } else {
      return kFALSE;
   }
}

//______________________________________________________________________________
Bool_t TEveCaloViz::CellInEtaPhiRng(TEveCaloData::CellData_t& cellData) const
{
   // Returns true if given cell is in the ceta phi range.

   if (cellData.EtaMin() >= fEtaMin && cellData.EtaMax() <= fEtaMax)
   {
      if (TEveUtil::IsU1IntervalContainedByMinMax
          (fPhi-fPhiOffset, fPhi+fPhiOffset, cellData.PhiMin(), cellData.PhiMax()))
         return kTRUE;
   }
   return kFALSE;
}

//______________________________________________________________________________
void TEveCaloViz::AssignCaloVizParameters(TEveCaloViz* m)
{
   // Assign paramteres from given model.

   SetData(m->fData);

   fEtaMin    = m->fEtaMin;
   fEtaMax    = m->fEtaMax;

   fPhi       = m->fPhi;
   fPhiOffset = m->fPhiOffset;

   fBarrelRadius = m->fBarrelRadius;
   fEndCapPosF    = m->fEndCapPosF;
   fEndCapPosB    = m->fEndCapPosB;

   if (m->fPalette)
   {
      TEveRGBAPalette& mp = * m->fPalette;
      if (fPalette) fPalette->DecRefCount();
      fPalette = new TEveRGBAPalette(mp.GetMinVal(), mp.GetMaxVal(), mp.GetInterpolate());
      fPalette->SetDefaultColor(mp.GetDefaultColor());
   }
}

//______________________________________________________________________________
void TEveCaloViz::SetPalette(TEveRGBAPalette* p)
{
   // Set TEveRGBAPalette object pointer.

   if ( fPalette == p) return;
   if (fPalette) fPalette->DecRefCount();
   fPalette = p;
   if (fPalette) fPalette->IncRefCount();
}

//______________________________________________________________________________
Float_t TEveCaloViz::GetValToHeight() const
{
   // Get transformation factor from E/Et to height

   if (fScaleAbs)
   {
      return fMaxTowerH/fMaxValAbs;
   }
   else
   {
     if (fData->Empty())
       return 1;

      return fMaxTowerH/fData->GetMaxVal(fPlotEt);
   }
}

//______________________________________________________________________________
TEveRGBAPalette* TEveCaloViz::AssertPalette()
{
   // Make sure the TEveRGBAPalette pointer is not null.
   // If it is not set, a new one is instantiated and the range is set
   // to current min/max signal values.

   if (fPalette == 0) {
      fPalette = new TEveRGBAPalette;
      fPalette->SetDefaultColor((Color_t)4);

      Int_t hlimit = TMath::CeilNint(GetMaxVal());
      fPalette->SetLimits(0, hlimit);
      fPalette->SetMin(0);
      fPalette->SetMax(hlimit);

   }
   return fPalette;
}

//______________________________________________________________________________
void TEveCaloViz::Paint(Option_t* /*option*/)
{
   // Paint this object. Only direct rendering is supported.

   if (fData)
   {
      PaintStandard(this);
   }
}

//______________________________________________________________________________
TClass* TEveCaloViz::ProjectedClass(const TEveProjection*) const
{
   // Virtual from TEveProjectable, returns TEveCalo2D class.

   return TEveCalo2D::Class();
}

//______________________________________________________________________________
void TEveCaloViz::SetupColorHeight(Float_t value, Int_t slice, Float_t& outH) const
{
   // Set color and height for a given value and slice using slice color or TEveRGBAPalette.

   if (fValueIsColor)
   {
      outH = GetValToHeight()*fData->GetMaxVal(fPlotEt);
      UChar_t c[4];
      fPalette->ColorFromValue((Int_t)value, c);
      c[3] = fData->GetSliceTransparency(slice);
      TGLUtil::Color4ubv(c);
   }
   else
   {
      TGLUtil::ColorTransparency(fData->GetSliceColor(slice), fData->GetSliceTransparency(slice));
      outH = GetValToHeight()*value;
   }
}


//==============================================================================
// TEveCalo3D
//==============================================================================

//______________________________________________________________________________
//
// Visualization of a calorimeter event data in 3D.

ClassImp(TEveCalo3D);


TEveCalo3D::TEveCalo3D(TEveCaloData* d, const char* n, const char* t):
   TEveCaloViz(d, n, t),

   fRnrEndCapFrame    (kTRUE),
   fRnrBarrelFrame    (kTRUE),
   fFrameWidth        (0.5),
   fFrameColor        (kGray+1),
   fFrameTransparency (80)
{

   // Constructor.

   fCanEditMainColor        = kTRUE;
   fCanEditMainTransparency = kTRUE;
   fMainColorPtr = &fFrameColor;
}

//______________________________________________________________________________
void TEveCalo3D::BuildCellIdCache()
{
   // Build list of drawn cell IDs. See TEveCalo3DGL::DirectDraw().

   fCellList.clear();

   fData->GetCellList(GetEta(), GetEtaRng(), GetPhi(), GetPhiRng(), fCellList);
   fCellIdCacheOK = kTRUE;
}

//______________________________________________________________________________
void TEveCalo3D::ComputeBBox()
{
   // Fill bounding-box information of the base-class TAttBBox (virtual method).
   // If member 'TEveFrameBox* fFrame' is set, frame's corners are used as bbox.

   BBoxInit();

   Float_t th = (fData) ? GetValToHeight() * fData->GetMaxVal(fPlotEt) : 0;

   fBBox[0] = -fBarrelRadius - th;
   fBBox[1] =  fBarrelRadius + th;
   fBBox[2] =  fBBox[0];
   fBBox[3] =  fBBox[1];
   fBBox[4] =  fEndCapPosB - th;
   fBBox[5] =  fEndCapPosF + th;
}


//==============================================================================
// TEveCalo2D
//==============================================================================

//______________________________________________________________________________
//
// Visualization of a calorimeter event data in 2D.

ClassImp(TEveCalo2D);

//______________________________________________________________________________
TEveCalo2D::TEveCalo2D(const char* n, const char* t):
   TEveCaloViz(0, n, t),
   TEveProjected(),
   fOldProjectionType(TEveProjection::kPT_Unknown),
   fMaxESumBin( 0),
   fMaxEtSumBin(0)
{
   // Constructor.
}

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

   TEveCaloData::vCellId_t* cids;
   UInt_t n;

   // clear selected cell ids
   n = fCellListsSelected.size();
   for(UInt_t i = 0; i < n; ++i) {
      cids = fCellListsSelected[i];
      if (cids) {
         cids->clear(); delete cids;
      }
   }
   fCellListsSelected.clear();

   // clear all cell dds
   n = fCellLists.size();
   for(UInt_t i = 0; i < n; ++i) {
      cids = fCellLists[i];
      if (cids) {
         cids->clear(); delete cids;
      }
   }
   fCellLists.clear();
}

//______________________________________________________________________________
void TEveCalo2D::UpdateProjection()
{
   // This is virtual method from base-class TEveProjected.

   if (fManager->GetProjection()->GetType() != fOldProjectionType)
   {
      fCellIdCacheOK=kFALSE;
      fOldProjectionType = fManager->GetProjection()->GetType();
   }
   ComputeBBox();
}

//______________________________________________________________________________
void TEveCalo2D::SetProjection(TEveProjectionManager* mng, TEveProjectable* model)
{
   // Set projection manager and model object.

   TEveProjected::SetProjection(mng, model);
   TEveCaloViz* viz = dynamic_cast<TEveCaloViz*>(model);
   AssignCaloVizParameters(viz);
}

//______________________________________________________________________________
void TEveCalo2D::BuildCellIdCache()
{
   // Build lists of drawn cell IDs. See TEveCalo2DGL::DirecDraw().

   // clear old cache
   for (vBinCells_i it = fCellLists.begin(); it != fCellLists.end(); it++)
   {
      if (*it)
      {
         (*it)->clear();
         delete *it;
      }
   }
   fCellLists.clear();
   fCellLists.push_back(0);

   TEveProjection::EPType_e pt = fManager->GetProjection()->GetType();
   TEveCaloData::vCellId_t* clv; // ids per phi bin in r-phi projection else ids per eta bins in rho-z projection

   Bool_t isRPhi = (pt == TEveProjection::kPT_RPhi);

   const TAxis* axis = isRPhi ? fData->GetPhiBins() :  fData->GetEtaBins();
   Int_t nBins = axis->GetNbins();

   Float_t min, max;
   if (isRPhi)
   {
      min = GetPhiMin() - fData->GetEps();
      max = GetPhiMax() + fData->GetEps();
      for (Int_t ibin = 1; ibin <= nBins; ++ibin) {
         clv = 0;
         if ( TEveUtil::IsU1IntervalOverlappingByMinMax
              (min, max, axis->GetBinLowEdge(ibin), axis->GetBinUpEdge(ibin)))
         {
            clv = new TEveCaloData::vCellId_t();
            fData->GetCellList(GetEta(), GetEtaRng(), axis->GetBinCenter(ibin), axis->GetBinWidth(ibin), *clv);
            if (!clv->size()) {
               delete clv; clv = 0;
            }
         }
         fCellLists.push_back(clv);
      }
   }
   else
   {
      min = GetEtaMin() - fData->GetEps();
      max = GetEtaMax() + fData->GetEps();
      for (Int_t ibin = 1; ibin <= nBins; ++ibin) {
         clv = 0;
         Float_t low = axis->GetBinLowEdge(ibin);
         Float_t up = axis->GetBinUpEdge(ibin) ;
         if (low >= min && up <= max)
         {
            clv = new TEveCaloData::vCellId_t();
            fData->GetCellList(axis->GetBinCenter(ibin), axis->GetBinWidth(ibin), fPhi, GetPhiRng(), *clv);
            if (!clv->size()) {
               delete clv; clv = 0;
            }
         }
         fCellLists.push_back(clv);
      }
   }

   // cache max bin sum for auto scale
   if (!fScaleAbs)
   {
      fMaxESumBin  = 0;
      fMaxEtSumBin = 0;
      Float_t sumE  = 0;
      Float_t sumEt = 0;
      TEveCaloData::CellData_t  cellData;
      for (Int_t ibin = 1; ibin <= nBins; ++ibin) {
         TEveCaloData::vCellId_t* cids = fCellLists[ibin];
         if (cids)
         {
            sumE = 0; sumEt = 0;
            for (TEveCaloData::vCellId_i it = cids->begin(); it != cids->end(); it++)
            {
               fData->GetCellData(*it, cellData);
               sumE  += cellData.Value(kFALSE);
               sumEt += cellData.Value(kTRUE);
            }
            fMaxESumBin  = TMath::Max(fMaxESumBin,  sumE);
            fMaxEtSumBin = TMath::Max(fMaxEtSumBin, sumEt);
         }
      }
      ComputeBBox();
   }

   fCellIdCacheOK= kTRUE;
}

//______________________________________________________________________________
void TEveCalo2D::CellSelectionChanged()
{
   // Sort slected cells in eta or phi bins for selection and highlight.

   CellSelectionChangedInternal(fData->GetCellsSelected(), fCellListsSelected);
   CellSelectionChangedInternal(fData->GetCellsHighlighted(), fCellListsHighlighted);
}

//______________________________________________________________________________
void TEveCalo2D::CellSelectionChangedInternal(TEveCaloData::vCellId_t& inputCells, std::vector<TEveCaloData::vCellId_t*>& outputCellLists)
{
   // Sort slected cells in eta or phi bins.

   Bool_t isRPhi = (fManager->GetProjection()->GetType() == TEveProjection::kPT_RPhi);
   const TAxis* axis = isRPhi ? fData->GetPhiBins() :  fData->GetEtaBins();

   // clear old cache
   for (vBinCells_i it = outputCellLists.begin(); it != outputCellLists.end(); it++)
   {
      if (*it)
      {
         (*it)->clear();
         delete *it;
      }
   }
   outputCellLists.clear();
   UInt_t nBins = axis->GetNbins();
   outputCellLists.resize(nBins+1);
   for (UInt_t b = 0; b <= nBins; ++b)
      outputCellLists[b] = 0;

   for(UInt_t bin = 1; bin <= nBins; ++bin)
   {
      TEveCaloData::vCellId_t* idsInBin = fCellLists[bin];
      if (!idsInBin)
         continue;

      for (TEveCaloData::vCellId_i i = idsInBin->begin(); i != idsInBin->end(); i++)
      {
         for (TEveCaloData::vCellId_i j = inputCells.begin(); j != inputCells.end(); j++)
         {
            if( (*i).fTower == (*j).fTower && (*i).fSlice == (*j).fSlice)
            {
               if (!outputCellLists[bin])
                  outputCellLists[bin] = new TEveCaloData::vCellId_t();

               outputCellLists[bin]->push_back(TEveCaloData::CellId_t((*i).fTower, (*i).fSlice, (*i).fFraction));
            }
         }
      }
   }
}

//______________________________________________________________________________
void TEveCalo2D::SetScaleAbs(Bool_t sa)
{
   // Set absolute scale in projected calorimeter.

   TEveCaloViz::SetScaleAbs(sa);
   BuildCellIdCache();
}

//______________________________________________________________________________
Float_t TEveCalo2D::GetValToHeight() const
{
   // Virtual function of TEveCaloViz.
   // Get transformation factor from E/Et to height.

   AssertCellIdCache();

   if (fScaleAbs)
   {
      return fMaxTowerH/fMaxValAbs;
   }
   else
   {
      if (fData->Empty())
         return 1;

      if (fPlotEt)
         return fMaxTowerH/fMaxEtSumBin;
      else
         return fMaxTowerH/fMaxESumBin;
   }
}

//______________________________________________________________________________
void TEveCalo2D::ComputeBBox()
{
   // Fill bounding-box information of the base-class TAttBBox (virtual method).
   // If member 'TEveFrameBox* fFrame' is set, frame's corners are used as bbox.

   BBoxZero();

   Float_t x, y, z;
   Float_t th = fMaxTowerH                                           ;
   Float_t r  = fBarrelRadius + th;

   x = r,  y = 0, z = 0;
   fManager->GetProjection()->ProjectPoint(x, y, z, fDepth);
   BBoxCheckPoint(x, y, z);
   x = -r, y = 0, z = 0;
   fManager->GetProjection()->ProjectPoint(x, y, z, fDepth);
   BBoxCheckPoint(x, y, z);

   x = 0, y = 0, z = fEndCapPosF + th;
   fManager->GetProjection()->ProjectPoint(x, y, z, fDepth);
   BBoxCheckPoint(x, y, z);
   x = 0, y = 0, z = fEndCapPosB - th;
   fManager->GetProjection()->ProjectPoint(x, y, z, fDepth);
   BBoxCheckPoint(x, y, z);

   x = 0, y = r,  z = 0;
   fManager->GetProjection()->ProjectPoint(x, y, z, fDepth);
   BBoxCheckPoint(x, y, z);
   x = 0, y = -r, z = 0;
   fManager->GetProjection()->ProjectPoint(x, y, z, fDepth);
   BBoxCheckPoint(x, y, z);
}


//==============================================================================
// TEveCaloLego
//==============================================================================

//______________________________________________________________________________
//
// Visualization of calorimeter data as eta/phi histogram.

ClassImp(TEveCaloLego);

//______________________________________________________________________________
TEveCaloLego::TEveCaloLego(TEveCaloData* d, const char* n, const char* t):
   TEveCaloViz(d, n, t),

   fFontColor(-1),
   fGridColor(-1),
   fPlaneColor(kRed-5),
   fPlaneTransparency(60),

   fNZSteps(6),
   fZAxisStep(0.f),

   fAutoRebin(kTRUE),

   fPixelsPerBin(12),
   fNormalizeRebin(kFALSE),

   fProjection(kAuto),
   f2DMode(kValSize),
   fBoxMode(kBack),

   fDrawHPlane(kFALSE),
   fHPlaneVal(0),

   fHasFixedHeightIn2DMode(kFALSE),
   fFixedHeightValIn2DMode(0.f),

   fDrawNumberCellPixels(18), // draw numbers on cell above 30 pixels
   fCellPixelFontSize(12) // size of cell fonts in pixels
{
   // Constructor.

   fMaxTowerH = 1;
   SetElementNameTitle("TEveCaloLego", "TEveCaloLego");
}

//______________________________________________________________________________
void TEveCaloLego::SetData(TEveCaloData* data)
{
   TEveCaloViz::SetData(data);
}

//______________________________________________________________________________
void TEveCaloLego::BuildCellIdCache()
{
   // Build list of drawn cell IDs. For more information see TEveCaloLegoGL:DirectDraw().

   fCellList.clear();

   fData->GetCellList(GetEta(), GetEtaRng(), GetPhi(), GetPhiRng(), fCellList);
   fCellIdCacheOK = kTRUE;
}

//______________________________________________________________________________
void TEveCaloLego::ComputeBBox()
{
   // Fill bounding-box information of the base-class TAttBBox (virtual method).
   // If member 'TEveFrameBox* fFrame' is set, frame's corners are used as bbox.


   // fBBox = Float_t[6] X(min,max), Y(min,max), Z(min,max)

   BBoxZero();

   Float_t ex = 1.2; // 20% offset for axis labels

   Float_t a = 0.5*ex;

   fBBox[0] = -a;
   fBBox[1] =  a;
   fBBox[2] = -a;
   fBBox[3] =  a;

   // scaling is relative to shortest XY axis
   Double_t em, eM, pm, pM;
   fData->GetEtaLimits(em, eM);
   fData->GetPhiLimits(pm, pM);
   Double_t r = (eM-em)/(pM-pm);
   if (r<1)
   {
      fBBox[2] /= r;
      fBBox[3] /= r;
   }
   else
   {
      fBBox[0] *= r;
      fBBox[1] *= r;
   }

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