Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/advanced/underground_physics/src/DMXScintSD.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 // --------------------------------------------------------------
0028 //   GEANT 4 - Underground Dark Matter Detector Advanced Example
0029 //
0030 //      For information related to this code contact: Alex Howard
0031 //      e-mail: alexander.howard@cern.ch
0032 // --------------------------------------------------------------
0033 // Comments
0034 //
0035 //                  Underground Advanced
0036 //               by A. Howard and H. Araujo 
0037 //                    (27th November 2001)
0038 //
0039 // ScintSD (scintillator sensitive detector definition) program
0040 // --------------------------------------------------------------
0041 
0042 #include "DMXScintSD.hh"
0043 
0044 #include "DMXScintHit.hh"
0045 #include "DMXDetectorConstruction.hh"
0046 
0047 #include "G4VPhysicalVolume.hh"
0048 #include "G4HCofThisEvent.hh"
0049 #include "G4Step.hh"
0050 #include "G4SDManager.hh"
0051 #include "G4ParticleDefinition.hh"
0052 #include "G4ParticleTypes.hh"
0053 #include "G4Ions.hh"
0054 #include "G4ios.hh"
0055 
0056 #include "G4OpticalPhoton.hh"
0057 
0058 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0059 
0060 DMXScintSD::DMXScintSD(G4String name) 
0061   :G4VSensitiveDetector(name)
0062 {
0063   G4String HCname="scintillatorCollection";
0064   collectionName.insert(HCname);
0065 }
0066 
0067 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0068 
0069 DMXScintSD::~DMXScintSD(){ }
0070 
0071 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0072 
0073 void DMXScintSD::Initialize(G4HCofThisEvent*)
0074 {
0075   scintillatorCollection = new DMXScintHitsCollection
0076     (SensitiveDetectorName,collectionName[0]);
0077 
0078   HitID = -1;
0079 }
0080 
0081 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0082 
0083 G4bool DMXScintSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
0084 {
0085 
0086   //need to know if this is an optical photon and exclude it:
0087   if(aStep->GetTrack()->GetDefinition()
0088      == G4OpticalPhoton::OpticalPhotonDefinition()) return false;
0089 
0090   
0091   G4double edep = aStep->GetTotalEnergyDeposit();
0092   G4ParticleDefinition* particleType = aStep->GetTrack()->GetDefinition();
0093   G4String particleName = particleType->GetParticleName();
0094 
0095   G4double stepl = 0.;
0096   if (particleType->GetPDGCharge() != 0.)
0097     stepl = aStep->GetStepLength();
0098   
0099   if ((edep==0.)&&(stepl==0.)) return false;      
0100 
0101 
0102   // fill in hit
0103   DMXScintHit* newHit = new DMXScintHit();
0104   newHit->SetEdep(edep);
0105   newHit->SetPos(aStep->GetPostStepPoint()->GetPosition());
0106   newHit->SetTime(aStep->GetPreStepPoint()->GetGlobalTime());
0107   newHit->SetParticle(particleName);
0108   newHit->SetParticleEnergy(aStep->GetPreStepPoint()->GetKineticEnergy() );
0109 
0110   HitID = scintillatorCollection->insert(newHit);
0111   
0112   return true;
0113 }
0114 
0115 
0116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0117 
0118 void DMXScintSD::EndOfEvent(G4HCofThisEvent* HCE)
0119 {
0120 
0121   G4String HCname = collectionName[0];
0122   static G4int HCID = -1;
0123   if(HCID<0)
0124     HCID = G4SDManager::GetSDMpointer()->GetCollectionID(HCname);
0125   HCE->AddHitsCollection(HCID,scintillatorCollection);
0126 
0127   G4int nHits = scintillatorCollection->entries();
0128   if (verboseLevel>=1)
0129     G4cout << "     LXe collection: " <<  nHits << " hits" << G4endl;
0130   if (verboseLevel>=2)
0131     scintillatorCollection->PrintAllHits();
0132 
0133 }
0134 
0135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0136 
0137 void DMXScintSD::clear()
0138 {} 
0139 
0140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0141 
0142 void DMXScintSD::DrawAll()
0143 {} 
0144 
0145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0146 
0147 void DMXScintSD::PrintAll()
0148 {} 
0149 
0150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0151