// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // /// \file B2/src/B2CellSD.cc /// \brief Implementation of the B2CellSD class // #include "B2CellSD.hh" #include "B2CellHit.hh" #include "G4VPhysicalVolume.hh" #include "G4LogicalVolume.hh" #include "G4Track.hh" #include "G4Step.hh" #include "G4ParticleDefinition.hh" #include "G4VTouchable.hh" #include "G4TouchableHistory.hh" #include "G4SystemOfUnits.hh" #include "G4ios.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... B2CellSD::B2CellSD(G4String name) :G4VSensitiveDetector(name), fNumberOfCellsInZ(10),fNumberOfCellsInPhi(20) { G4String HCname; collectionName.insert(HCname="cellHitsCollection"); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... B2CellSD::~B2CellSD() {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void B2CellSD::Initialize(G4HCofThisEvent*) { G4cout<<"B2CellSD-----------------------collectionName[0] ="<GetTotalEnergyDeposit(); if(verboseLevel>1) G4cout << "Next step edep(MeV) = " << edep/MeV << G4endl; if(edep==0.) return false; const G4VTouchable* touchable = aStep->GetPreStepPoint()->GetTouchable(); G4int copyIDinZ = touchable->GetReplicaNumber(0); G4int copyIDinPhi = touchable->GetReplicaNumber(1); //seems no difference b/w replica no and copy no //G4int copyNoZ = touchable->GetCopyNumber(); //G4int copyNoPhi = touchable->GetCopyNumber(1); // G4ThreeVector worldPosition = aStep->GetPreStepPoint()->GetPosition(); G4ThreeVector localPosition = touchable->GetHistory()-> GetTopTransform().TransformPoint(worldPosition); //G4ThreeVector momentum = aStep->GetPreStepPoint()->GetMomentum(); //calculate eta and phi G4double theta = std::acos(worldPosition[2]/sqrt(std::pow(worldPosition[0],2) + pow(worldPosition[1],2) + pow(worldPosition[2],2)))/deg; G4double eta = - std::log(tan((theta/2)*deg)); G4double phi = std::atan2(worldPosition[1],worldPosition[0])/deg; //G4cout << " theta ="<GetVolume()->GetLogicalVolume()="<GetVolume()->GetLogicalVolume()<< // "icell ="<0) { G4cout << " New Cell Hit on fCellID " << copyIDinZ << " " <GetCellPhi()<<" "<AddEdep(edep); if(verboseLevel>0) { G4cout << " Energy added to fCellID " << copyIDinZ << " " << copyIDinPhi <<" "<GetReplicaNumber(1) << ", CopyNo " <GetCopyNumber(1) <<", HistoryDepth "<GetHistoryDepth()<< G4endl; } } return true; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void B2CellSD::EndOfEvent(G4HCofThisEvent*HCE) { G4cout<<"check-2-------------------------"<AddHitsCollection( HCID, fCalCollection ); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void B2CellSD::clear() {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void B2CellSD::DrawAll() {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void B2CellSD::PrintAll() {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......