00001 #ifndef SimG4CMS_DreamSD_h
00002 #define SimG4CMS_DreamSD_h
00003
00004 #include "SimG4CMS/Calo/interface/CaloSD.h"
00005
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007
00008 #include "G4String.hh"
00009 #include "G4PhysicsOrderedFreeVector.hh"
00010
00011 #include <map>
00012
00013 const int MAXPHOTONS = 500;
00014
00015 class G4LogicalVolume;
00016
00017 class TTree;
00018
00019 class DreamSD : public CaloSD {
00020
00021 public:
00022
00023 DreamSD(G4String, const DDCompactView &, SensitiveDetectorCatalog &,
00024 edm::ParameterSet const &, const SimTrackManager*);
00025 virtual ~DreamSD() {}
00026 virtual bool ProcessHits(G4Step * step,G4TouchableHistory * tHistory);
00027 virtual uint32_t setDetUnitId(G4Step*);
00028
00029 protected:
00030
00031 virtual G4bool getStepInfo(G4Step* aStep);
00032 virtual void initRun();
00033
00034 private:
00035
00036 typedef std::pair<double,double> Doubles;
00037 typedef std::map<G4LogicalVolume*,Doubles> DimensionMap;
00038
00039 void initMap(G4String, const DDCompactView &);
00040 double curve_LY(G4Step*, int);
00041 const double crystalLength(G4LogicalVolume*) const;
00042 const double crystalWidth(G4LogicalVolume*) const;
00043
00045 double cherenkovDeposit_( G4Step* aStep );
00047 const double getAverageNumberOfPhotons_(const double charge,
00048 const double beta,
00049 const G4Material* aMaterial,
00050 const G4MaterialPropertyVector* rIndex ) const;
00052 const double getPhotonEnergyDeposit_( const G4ParticleMomentum& p, const G4ThreeVector& x,
00053 const G4Step* aStep );
00055 bool setPbWO2MaterialProperties_( G4Material* aMaterial );
00056
00057 bool useBirk, doCherenkov_, readBothSide_;
00058 double birk1, birk2, birk3;
00059 double slopeLY;
00060 DimensionMap xtalLMap;
00061
00062 int side;
00063
00065 std::auto_ptr<G4PhysicsOrderedFreeVector> chAngleIntegrals_;
00066 G4MaterialPropertiesTable* materialPropertiesTable;
00067
00068 TTree* ntuple_;
00069 int nphotons_;
00070 float px_[MAXPHOTONS],py_[MAXPHOTONS],pz_[MAXPHOTONS];
00071 float x_[MAXPHOTONS],y_[MAXPHOTONS],z_[MAXPHOTONS];
00072
00073 };
00074
00075 #endif // DreamSD_h