Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:59

0001 #ifndef Forward_TotemSD_h
0002 #define Forward_TotemSD_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Forward
0006 // Class  :     TotemSD
0007 //
0008 /**\class TotemSD TotemSD.h SimG4CMS/Forward/interface/TotemSD.h
0009  
0010  Description: Stores hits of Totem in appropriate  container
0011  
0012  Usage:
0013     Used in sensitive detector builder 
0014  
0015 */
0016 //
0017 // Original Author:
0018 //         Created:  Tue May 16 10:14:34 CEST 2006
0019 //
0020 
0021 // system include files
0022 
0023 // user include files
0024 
0025 #include "SimG4Core/Notification/interface/Observer.h"
0026 #include "SimG4Core/SensitiveDetector/interface/SensitiveTkDetector.h"
0027 #include "SimG4Core/Notification/interface/BeginOfEvent.h"
0028 #include "SimG4Core/Notification/interface/EndOfEvent.h"
0029 
0030 #include "SimG4CMS/Forward/interface/TotemG4Hit.h"
0031 #include "SimG4CMS/Forward/interface/TotemG4HitCollection.h"
0032 #include "SimG4CMS/Forward/interface/TotemVDetectorOrganization.h"
0033 
0034 #include "FWCore/Framework/interface/Frameworkfwd.h"
0035 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0036 
0037 #include "G4Step.hh"
0038 #include "G4StepPoint.hh"
0039 #include "G4Track.hh"
0040 
0041 #include <string>
0042 
0043 class TrackingSlaveSD;
0044 class SimTrackManager;
0045 
0046 class TotemSD : public SensitiveTkDetector, public Observer<const BeginOfEvent*> {
0047 public:
0048   TotemSD(const std::string&, const SensitiveDetectorCatalog&, edm::ParameterSet const&, const SimTrackManager*);
0049   ~TotemSD() override;
0050 
0051   bool ProcessHits(G4Step*, G4TouchableHistory*) override;
0052   uint32_t setDetUnitId(const G4Step*) override;
0053 
0054   void Initialize(G4HCofThisEvent* HCE) override;
0055   void EndOfEvent(G4HCofThisEvent* eventHC) override;
0056   void PrintAll() override;
0057 
0058   void fillHits(edm::PSimHitContainer&, const std::string&) override;
0059   void clearHits() override;
0060 
0061 protected:
0062   void update(const BeginOfEvent*) override;
0063 
0064 private:
0065   G4ThreeVector setToLocal(const G4ThreeVector& globalPoint);
0066   void getStepInfo(const G4Step* aStep);
0067   bool hitExists();
0068   void createNewHit();
0069   void createNewHitEvo();
0070   G4ThreeVector posizioEvo(const G4ThreeVector&, double, double, double, double, int&);
0071   void updateHit();
0072   void storeHit(TotemG4Hit*);
0073   void resetForNewPrimary();
0074 
0075 private:
0076   TrackingSlaveSD* slave;
0077   TotemVDetectorOrganization* numberingScheme;
0078 
0079   // Data relative to primary particle (the one which triggers a shower)
0080   // These data are common to all Hits of a given shower.
0081   // One shower is made of several hits which differ by the
0082   // unit ID (cristal/fiber/scintillator) and the Time slice ID.
0083 
0084   G4ThreeVector entrancePoint;
0085   float incidentEnergy;
0086   G4int primID;  //@@ ID of the primary particle.
0087 
0088   G4int hcID;
0089   TotemG4HitCollection* theHC;
0090   const SimTrackManager* theManager;
0091 
0092   int tsID;
0093   TotemG4Hit* currentHit;
0094   G4Track* theTrack;
0095   G4VPhysicalVolume* currentPV;
0096   uint32_t unitID, previousUnitID;
0097   int primaryID, tSliceID;
0098   double tSlice;
0099 
0100   const G4StepPoint* preStepPoint;
0101   const G4StepPoint* postStepPoint;
0102   float edeposit;
0103   G4ThreeVector hitPoint;
0104 
0105   G4ThreeVector Posizio;
0106   float Pabs;
0107   float Tof;
0108   float Eloss;
0109   short ParticleType;
0110 
0111   float ThetaAtEntry;
0112   float PhiAtEntry;
0113 
0114   int ParentId;
0115   float Vx, Vy, Vz;
0116 };
0117 
0118 #endif