00001 #ifndef SimG4CMS_HCalSD_h
00002 #define SimG4CMS_HCalSD_h
00003
00004
00005
00006
00007
00009
00010 #include "SimG4CMS/Calo/interface/CaloSD.h"
00011 #include "SimG4CMS/Calo/interface/HFShower.h"
00012 #include "SimG4CMS/Calo/interface/HFShowerLibrary.h"
00013 #include "SimG4CMS/Calo/interface/HFShowerParam.h"
00014 #include "SimG4CMS/Calo/interface/HFShowerPMT.h"
00015 #include "SimG4CMS/Calo/interface/HFShowerFibreBundle.h"
00016 #include "SimG4CMS/Calo/interface/HcalNumberingScheme.h"
00017 #include "SimG4CMS/Calo/interface/HEDarkening.h"
00018 #include "SimG4CMS/Calo/interface/HFDarkening.h"
00019 #include "DetectorDescription/Core/interface/DDsvalues.h"
00020 #include "Geometry/HcalCommonData/interface/HcalNumberingFromDDD.h"
00021
00022 #include "G4String.hh"
00023 #include <map>
00024 #include <string>
00025 #include <TH1F.h>
00026
00027 class DDCompactView;
00028 class DDFilteredView;
00029 class G4LogicalVolume;
00030 class G4Material;
00031 class G4Step;
00032
00033 class HCalSD : public CaloSD {
00034
00035 public:
00036
00037 HCalSD(G4String , const DDCompactView &, SensitiveDetectorCatalog &,
00038 edm::ParameterSet const &, const SimTrackManager*);
00039 virtual ~HCalSD();
00040 virtual bool ProcessHits(G4Step * , G4TouchableHistory * );
00041 virtual double getEnergyDeposit(G4Step* );
00042 virtual uint32_t setDetUnitId(G4Step* step);
00043 void setNumberingScheme(HcalNumberingScheme* );
00044
00045 protected:
00046
00047 virtual void initRun();
00048 virtual bool filterHit(CaloG4Hit*, double);
00049
00050 private:
00051
00052 uint32_t setDetUnitId(int, G4ThreeVector, int, int);
00053 std::vector<double> getDDDArray(const std::string&,
00054 const DDsvalues_type&);
00055 std::vector<G4String> getNames(DDFilteredView&);
00056 bool isItHF(G4Step *);
00057 bool isItHF(G4String);
00058 bool isItFibre(G4LogicalVolume*);
00059 bool isItFibre(G4String);
00060 bool isItPMT(G4LogicalVolume*);
00061 bool isItStraightBundle(G4LogicalVolume*);
00062 bool isItConicalBundle(G4LogicalVolume*);
00063 bool isItScintillator(G4Material*);
00064 bool isItinFidVolume (G4ThreeVector&);
00065 void getFromLibrary(G4Step * step, double weight);
00066 void hitForFibre(G4Step * step, double weight);
00067 void getFromParam(G4Step * step, double weight);
00068 void getHitPMT(G4Step * step);
00069 void getHitFibreBundle(G4Step * step, bool type);
00070 int setTrackID(G4Step * step);
00071 void readWeightFromFile(std::string);
00072 double layerWeight(int, G4ThreeVector, int, int);
00073 void plotProfile(G4Step* step, G4ThreeVector pos,
00074 double edep, double time, int id);
00075 void plotHF(G4ThreeVector& pos, bool emType);
00076
00077 HcalNumberingFromDDD* numberingFromDDD;
00078 HcalNumberingScheme* numberingScheme;
00079 HFShowerLibrary * showerLibrary;
00080 HFShower * hfshower;
00081 HFShowerParam * showerParam;
00082 HFShowerPMT * showerPMT;
00083 HFShowerFibreBundle * showerBundle;
00084 HEDarkening * m_HEDarkening;
00085 HFDarkening * m_HFDarkening;
00086 bool useBirk, useLayerWt, useFibreBundle, usePMTHit;
00087 double birk1, birk2, birk3, betaThr;
00088 bool useHF, useShowerLibrary, useParam, applyFidCut;
00089 double eminHitHB, eminHitHE, eminHitHO, eminHitHF;
00090 double deliveredLumi;
00091 G4int mumPDG, mupPDG;
00092 std::vector<double> layer0wt, gpar;
00093 std::vector<int> hfLevels;
00094 std::vector<G4String> hfNames, fibreNames, matNames;
00095 std::vector<G4Material*> materials;
00096 std::vector<G4LogicalVolume*> hfLV, fibreLV, pmtLV, fibre1LV, fibre2LV;
00097 std::map<uint32_t,double> layerWeights;
00098 TH1F *hit_[9], *time_[9], *dist_[9], *hzvem, *hzvhad;
00099
00100 };
00101
00102 #endif // HCalSD_h