CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/SimG4CMS/Forward/interface/BscSD.h

Go to the documentation of this file.
00001 //
00002 #ifndef Bsc_BscSD_h
00003 #define Bsc_BscSD_h
00004 //
00005 
00006 #include "SimG4Core/Notification/interface/Observer.h"
00007 #include "SimG4Core/SensitiveDetector/interface/SensitiveTkDetector.h"
00008 
00009 #include "SimG4Core/Notification/interface/BeginOfRun.h"
00010 #include "SimG4Core/Notification/interface/BeginOfEvent.h"
00011 #include "SimG4Core/Notification/interface/EndOfEvent.h"
00012 
00013 // last
00014 //#include "SimG4Core/Application/interface/SimTrackManager.h"
00015 //#include "SimG4CMS/Calo/interface/CaloSD.h"
00016 
00017 
00018 //#include "SimG4Core/Notification/interface/TrackWithHistory.h"
00019 //#include "SimG4Core/Notification/interface/TrackContainer.h"
00020 
00021 #include "SimG4CMS/Forward/interface/BscG4Hit.h"
00022 #include "SimG4CMS/Forward/interface/BscG4HitCollection.h"
00023 #include "SimG4CMS/Forward/interface/BscNumberingScheme.h"
00024 
00025   
00026 #include "G4Step.hh"
00027 #include "G4StepPoint.hh"
00028 #include "G4Track.hh"
00029 #include "G4VPhysicalVolume.hh"
00030 
00031 //#include <CLHEP/Vector/ThreeVector.h>
00032 //#include <iostream>
00033 //#include <fstream>
00034 //#include <vector>
00035 //#include <map>
00036 #include <string>
00037  
00038 
00039 
00040 class TrackingSlaveSD;
00041 //AZ:
00042 class BscSD;
00043 
00044 class TrackInformation;
00045 class SimTrackManager;
00046 class TrackingSlaveSD;
00047 class UpdatablePSimHit;
00048 class G4ProcessTypeEnumerator;
00049 class G4TrackToParticleID;
00050 
00051 
00052 //-------------------------------------------------------------------
00053 
00054 class BscSD : public SensitiveTkDetector,
00055               public Observer<const BeginOfRun *>,
00056               public Observer<const BeginOfEvent*>,
00057               public Observer<const EndOfEvent*> {
00058 
00059 public:
00060   
00061   BscSD(std::string, const DDCompactView &, SensitiveDetectorCatalog &, 
00062           edm::ParameterSet const &, const SimTrackManager* );
00063 
00064 
00065   virtual ~BscSD();
00066   
00067   virtual bool ProcessHits(G4Step *,G4TouchableHistory *);
00068   virtual uint32_t  setDetUnitId(G4Step*);
00069 
00070   virtual void Initialize(G4HCofThisEvent * HCE);
00071   virtual void EndOfEvent(G4HCofThisEvent * eventHC);
00072   virtual void clear();
00073   virtual void DrawAll();
00074   virtual void PrintAll();
00075 
00076   virtual double getEnergyDeposit(G4Step* step);
00077   //protected:
00078   //    Collection       hits_;
00079     void fillHits(edm::PSimHitContainer&, std::string use);
00080   
00081   std::vector<std::string> getNames();
00082   
00083  private:
00084   void           update(const BeginOfRun *);
00085   void           update(const BeginOfEvent *);
00086   void           update(const ::EndOfEvent *);
00087   virtual void   clearHits();
00088   
00089   //void SetNumberingScheme(BscNumberingScheme* scheme);
00090   
00091   
00092   
00093   //  int eventno;
00094  private:
00095   
00096   G4ThreeVector SetToLocal(G4ThreeVector global);
00097   G4ThreeVector SetToLocalExit(G4ThreeVector globalPoint);
00098   void          GetStepInfo(G4Step* aStep);
00099   G4bool        HitExists();
00100   void          CreateNewHit();
00101   void          UpdateHit();
00102   void          StoreHit(BscG4Hit*);
00103   void          ResetForNewPrimary();
00104   void          Summarize();
00105   
00106   
00107  private:
00108   
00109   //AZ:
00110   TrackingSlaveSD* slave;
00111   BscNumberingScheme * numberingScheme;
00112   
00113   G4ThreeVector entrancePoint, exitPoint;
00114   G4ThreeVector theEntryPoint ;
00115   G4ThreeVector theExitPoint  ;
00116   
00117   float                incidentEnergy;
00118   G4int                primID  ; 
00119   
00120   //  G4String             name;
00121   std::string             name;
00122   G4int                    hcID;
00123   BscG4HitCollection*       theHC; 
00124   const SimTrackManager*      theManager;
00125  
00126   G4int                    tsID; 
00127   BscG4Hit*               currentHit;
00128   G4Track*                 theTrack;
00129   G4VPhysicalVolume*         currentPV;
00130   // unsigned int         unitID, previousUnitID;
00131   uint32_t             unitID, previousUnitID;
00132   G4int                primaryID, tSliceID;  
00133   G4double             tSlice;
00134   
00135   G4StepPoint*         preStepPoint; 
00136   G4StepPoint*         postStepPoint; 
00137   float                edeposit;
00138   
00139   G4ThreeVector        hitPoint;
00140   //  G4ThreeVector    Position;
00141   G4ThreeVector        hitPointExit;
00142   G4ThreeVector        hitPointLocal;
00143   G4ThreeVector        hitPointLocalExit;
00144   float Pabs;
00145   float Tof;
00146   float Eloss;  
00147   short ParticleType; 
00148   
00149   float ThetaAtEntry;
00150   float PhiAtEntry;
00151   
00152   int ParentId;
00153   float Vx,Vy,Vz;
00154   float X,Y,Z;
00155   
00156   
00157   //
00158   // Hist
00159   //
00160   int eventno;
00161   
00162  protected:
00163   
00164   float                edepositEM, edepositHAD;
00165   G4int emPDG;
00166   G4int epPDG;
00167   G4int gammaPDG;
00168 };
00169 
00170 #endif // BscSD_h
00171 
00172 
00173 
00174