CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/SimG4CMS/Forward/interface/TotemSD.h

Go to the documentation of this file.
00001 #ifndef Forward_TotemSD_h
00002 #define Forward_TotemSD_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Forward
00006 // Class  :     TotemSD
00007 //
00016 //
00017 // Original Author: 
00018 //         Created:  Tue May 16 10:14:34 CEST 2006
00019 // $Id: TotemSD.h,v 1.2 2007/05/08 21:27:29 sunanda Exp $
00020 //
00021  
00022 // system include files
00023 
00024 // user include files
00025 
00026 #include "SimG4Core/Notification/interface/Observer.h"
00027 #include "SimG4Core/SensitiveDetector/interface/SensitiveTkDetector.h"
00028 #include "SimG4Core/Notification/interface/BeginOfEvent.h"
00029 #include "SimG4Core/Notification/interface/EndOfEvent.h"
00030 
00031 #include "SimG4CMS/Forward/interface/TotemG4Hit.h"
00032 #include "SimG4CMS/Forward/interface/TotemG4HitCollection.h"
00033 #include "SimG4CMS/Forward/interface/TotemVDetectorOrganization.h"
00034  
00035 #include "G4Step.hh"
00036 #include "G4StepPoint.hh"
00037 #include "G4Track.hh"
00038  
00039 #include <string>
00040 
00041 class TrackingSlaveSD;
00042 
00043 class TotemSD : public SensitiveTkDetector,
00044                 public Observer<const BeginOfEvent*>,
00045                 public Observer<const EndOfEvent*> {
00046 
00047 public:
00048 
00049   TotemSD(std::string, const DDCompactView &, SensitiveDetectorCatalog &, 
00050           edm::ParameterSet const &, const SimTrackManager*);
00051   virtual ~TotemSD();
00052 
00053   virtual bool   ProcessHits(G4Step *,G4TouchableHistory *);
00054   virtual uint32_t setDetUnitId(G4Step*);
00055 
00056   virtual void   Initialize(G4HCofThisEvent * HCE);
00057   virtual void   EndOfEvent(G4HCofThisEvent * eventHC);
00058   virtual void   clear();
00059   virtual void   DrawAll();
00060   virtual void   PrintAll();
00061 
00062   void fillHits(edm::PSimHitContainer&, std::string use);
00063 
00064 private:
00065 
00066   void           update(const BeginOfEvent *);
00067   void           update(const ::EndOfEvent *);
00068   virtual void   clearHits();
00069 
00070 private:
00071 
00072   G4ThreeVector  SetToLocal(G4ThreeVector globalPoint);
00073   void           GetStepInfo(G4Step* aStep);
00074   bool           HitExists();
00075   void           CreateNewHit();
00076   void           CreateNewHitEvo();
00077   G4ThreeVector  PosizioEvo(G4ThreeVector,double ,double ,double, double,int&);
00078   void           UpdateHit();
00079   void           StoreHit(TotemG4Hit*);
00080   void           ResetForNewPrimary();
00081   void           Summarize();
00082 
00083 private:
00084 
00085   TrackingSlaveSD*            slave;
00086   TotemVDetectorOrganization* numberingScheme;
00087 
00088   // Data relative to primary particle (the one which triggers a shower)
00089   // These data are common to all Hits of a given shower.
00090   // One shower is made of several hits which differ by the
00091   // unit ID (cristal/fiber/scintillator) and the Time slice ID.
00092 
00093   G4ThreeVector               entrancePoint;
00094   float                       incidentEnergy;
00095   G4int                       primID  ; //@@ ID of the primary particle.
00096 
00097   std::string                 name;
00098   G4int                       hcID;
00099   TotemG4HitCollection*       theHC; 
00100   const SimTrackManager*      theManager;
00101 
00102   int                         tsID; 
00103   TotemG4Hit*                 currentHit;
00104   G4Track*                    theTrack;
00105   G4VPhysicalVolume*          currentPV;
00106   uint32_t                    unitID, previousUnitID;
00107   int                         primaryID, tSliceID;  
00108   double                      tSlice;
00109 
00110   G4StepPoint*                preStepPoint; 
00111   G4StepPoint*                postStepPoint; 
00112   float                       edeposit;
00113   G4ThreeVector               hitPoint;
00114 
00115   G4ThreeVector               Posizio;
00116   float                       Pabs;
00117   float                       Tof;
00118   float                       Eloss;    
00119   short                       ParticleType; 
00120 
00121   float                       ThetaAtEntry;
00122   float                       PhiAtEntry;
00123 
00124   int                         ParentId;
00125   float                       Vx,Vy,Vz;
00126 
00127   int                         eventno;
00128 };
00129 
00130 #endif