Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:19:38

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 ///////////////////////////////////////////////////////////////////////////////
0027 // File: CCaloSD.hh
0028 // Description: Stores hits of calorimetric type in appropriate container
0029 //
0030 // Use in your geometry routine: 
0031 //    CCaloSD* caloSD = new CCaloSD(SDname, new CalorimeterOrganization);
0032 //    G4SDManager::GetSDMpointer()->AddNewDetector(caloSD);
0033 //  and then for every Logical Volume to be declared as sensitive
0034 //    logVolume->SetSensitiveDetector(caloSD);
0035 //
0036 ///////////////////////////////////////////////////////////////////////////////
0037 
0038 #ifndef CCaloSD_h
0039 #define CCaloSD_h 1
0040 
0041 #include "CCalG4HitCollection.hh"
0042 #include "CCalG4Hit.hh"
0043 
0044 #include "G4VPhysicalVolume.hh"
0045 #include "G4LogicalVolume.hh"
0046 #include "G4Track.hh"
0047 #include "G4ParticleDefinition.hh"
0048 #include "G4Step.hh"
0049 #include "G4TransportationManager.hh"
0050 #include "G4VSensitiveDetector.hh"
0051 
0052 #include <iostream>
0053 #include <fstream>
0054 
0055 class CCalVOrganization;
0056 
0057 //#define debug
0058  
0059 class CCaloSD : public G4VSensitiveDetector
0060 {
0061 
0062 public:
0063 
0064   CCaloSD(G4String aSDname, CCalVOrganization* numberingScheme);
0065   virtual ~CCaloSD();
0066 
0067   void Initialize(G4HCofThisEvent*HCE);
0068   G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
0069   void EndOfEvent(G4HCofThisEvent*HCE);
0070   void clear();
0071   void DrawAll();
0072   void PrintAll();
0073 
0074 public:
0075   
0076   void SetPrimaryID(G4int i) {PrimaryID = i;}
0077   G4int  GetPrimaryID( )     {return PrimaryID;}
0078   void SetOrganization(CCalVOrganization* org);
0079 
0080 private:
0081 
0082   G4ThreeVector SetToLocal(const G4ThreeVector& globalPoint) const;
0083   void getStepInfo(const G4Step* aStep);
0084   G4bool hitExists();
0085   void createNewHit();
0086   void updateHit();
0087   void StoreHit(CCalG4Hit* ahit);
0088   void ResetForNewPrimary();
0089   void summarize();
0090   G4double curve_LY(const G4StepPoint* stepPoint);
0091         
0092   // Data relative to primary particle (the one which triggers a shower)
0093   // These data are common to all Hits of a given shower.
0094   // One shower is made of several hits which differ by the
0095   // unit ID (cristal/fiber/scintillator) and the Time slice ID.
0096 
0097   G4ThreeVector EntrancePoint;
0098   G4float IncidentEnergy;
0099   G4int PrimID  ; //@@ ID of the primary particle.
0100 
0101   G4int                HCID;
0102   G4String             SDname;
0103   CCalG4HitCollection* theHC; 
0104 
0105   G4int              TSID; 
0106   CCalG4Hit*         CurrentHit;
0107   const G4Track*     theTrack;
0108   G4VPhysicalVolume* CurrentPV;
0109   G4VPhysicalVolume* PreviousPV;
0110   unsigned int       UnitID, PreviousUnitID;
0111   G4int              PrimaryID, TSliceID;  
0112   G4double           TSlice;
0113 
0114   const G4StepPoint*   PreStepPoint; 
0115   const G4StepPoint*   PostStepPoint; 
0116   G4float          EdepositEM, EdepositEHAD;
0117   G4ThreeVector  HitPoint;
0118 
0119   CCalVOrganization* theDescription;
0120 
0121 };
0122 
0123 #endif