CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/SimG4CMS/FP420/interface/FP420SD.h

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