// $Header: SmearVolume.h $

#ifndef NLD_SMEARVOLUME_H
#define NLD_SMEARVOLUME_H
// This class only exists as a nested class of CalRecon
// It acts as a repository of detector-subvolume-specific information,
// such as geometry and materials properties.

#include "Rtypes.h"  // for Double_t, etc.
#include "TString.h"
#include "SmearFuzz.h"

enum VolumeType {
  VOL_EM = 1,
  VOL_HAD = 2,
  VOL_COIL = 3,
  VOL_AIR = 4,
  VOL_MUON = 5
};


class SmearVolume : public TObject {
public:
  SmearVolume() {} 
  TString      name;
  VolumeType   volKind;  // might need CalRecon::VolumeType here
  Double_t     innerR;   // inner radius
  Double_t     outerR;   // outer radius
  Double_t     innerZ;   // min z in the volume
  Double_t     outerZ;   // max z in the volume
  Bool_t       barrel;   // barrel or endcap-type volume?
  Double_t iLenPerCm;   // interaction lengths per cm
  Double_t radLenPerCm; // rad len per cm
  SmearFuzz*   pFuzz;   // parameters for smearing energy, position in volume
  Double_t field;       // average field in the volume
  Double_t emEff;       // unused for now 
  Double_t hadEff;      // unused for now
  TObject *pNextR;    // points to adjacent volume of larger R
  TObject *pPrevR;    // points to adjacent volume of smaller R
  TObject *pNextZ;    // points to adjacent volume of larger Z

  Bool_t isInside(Double_t x, Double_t y, Double_t z);

  // Note: need a special convention to properly interpret pPrevR.  In
  // some cases a volume may be adjacent to two volumes of smaller radius
  // In this case. pPrevR will point to the one of minimal z.  Code
  // following this pointer with regard to a particle at a known position
  // on the boundary will have to check if the new volume contains that
  // point.  If not, follow the pNextZ pointer and try again.
  ClassDef(SmearVolume,1) // Keep info of interest to clustering on each detector volume
};
#endif
