44 CurrentHit(0), theTrack(0), CurrentPV(0), PreviousPV(0), UnitID(0),
45 PreviousUnitID(0), PreStepPoint(0), PostStepPoint(0),
46 theDescription(numberingScheme) {
50 G4cout <<
"*******************************************************" <<
G4endl;
52 G4cout <<
"* Constructing a CCaloSD with name " << name <<
G4endl;
54 G4cout <<
"*******************************************************" <<
G4endl;
63 delete theDescription;
70 G4cout <<
"CCaloSD : Initialize called for " << SDname <<
G4endl;
88 if (aStep == NULL)
return true;
91 if (hitExists() ==
false && EdepositEM+EdepositEHAD>0.)
98 void CCaloSD::getStepInfo(
G4Step* aStep) {
112 weight = curve_LY(PreStepPoint);
116 if (particleType ==
"e-" ||
117 particleType ==
"e+" ||
118 particleType ==
"gamma" ){
128 if ( TSlice > 1.0E9 ) TSliceID = 999999999;
129 else TSliceID = (
int) TSlice;
131 if (theDescription!=0)
132 UnitID = theDescription->
GetUnitID(aStep);
139 G4bool CCaloSD::hitExists() {
142 G4cerr <<
"***** CCaloSD error: PrimaryID = " << PrimaryID
143 <<
" Maybe detector name changed"
148 if ( CurrentPV==PreviousPV && PrimaryID == PrimID && TSliceID == TSID &&
149 UnitID==PreviousUnitID) {
155 if (PrimaryID != PrimID)
156 ResetForNewPrimary();
165 if (aPreviousHit->
getTrackID() == PrimaryID &&
168 CurrentHit = aPreviousHit;
182 void CCaloSD::ResetForNewPrimary() {
184 EntrancePoint = SetToLocal(HitPoint);
192 if (PrimID<0)
return;
194 G4cout <<
"CCaloSD: hit to be stored is NULL !!" <<
G4endl;
202 void CCaloSD::createNewHit() {
205 G4int currentCopyNo = -999;
206 G4int motherCopyNo = -999;
209 if ( theTouchable ) {
215 G4cout <<
"CCaloSD createNewHit for"
216 <<
" PV " << CurrentPV->
GetName()
217 <<
" PVid = " << currentCopyNo
218 <<
" MVid = " << motherCopyNo
219 <<
" Unit " << UnitID <<
G4endl;
220 G4cout <<
" primary " << PrimaryID
221 <<
" time slice " << TSliceID
231 G4cout <<
" and created by " ;
244 CurrentHit->
setEntry(EntrancePoint);
248 StoreHit(CurrentHit);
253 void CCaloSD::updateHit() {
254 if (EdepositEM+EdepositEHAD != 0) {
257 G4cout <<
"Energy deposit in Unit " << UnitID <<
" em " << EdepositEM/
MeV
258 <<
" hadronic " << EdepositEHAD/
MeV <<
" MeV" <<
G4endl;
265 PreviousPV = CurrentPV;
266 PreviousUnitID = UnitID;
286 void CCaloSD::summarize() {
306 if (theDescription!=0)
307 delete theDescription;
308 theDescription = org;
317 G4double dapd = 0.5 * crlength - localPoint.
z();
318 if (dapd >= -0.1 || dapd <= crlength+0.1) {
320 weight = 1.05 - dapd * 0.0005;
322 G4cout <<
"CCaloSD, light coll curve : wrong distance to APD " << dapd
323 <<
" crlength = " << crlength
324 <<
" z of localPoint = " << localPoint.
z()
325 <<
" take weight = " << weight <<
G4endl;
328 G4cout <<
"CCaloSD, light coll curve : " << dapd
329 <<
" crlength = " << crlength
330 <<
" z of localPoint = " << localPoint.
z()
331 <<
" take weight = " << weight <<
G4endl;
G4ParticleDefinition * GetDefinition() const
G4int GetParentID() const
G4int GetCollectionID(G4String colName)
G4int GetHistoryDepth() const
G4THitsCollection< CCalG4Hit > CCalG4HitCollection
static CCalSDList * getInstance()
void setIncidentEnergy(double e)
virtual void PrintAllHits()
void SetOrganization(CCalVOrganization *org)
virtual const G4NavigationHistory * GetHistory() const
void setEntry(CLHEP::Hep3Vector xyz)
const G4VTouchable * GetTouchable() const
static constexpr double nanosecond
const G4String & GetParticleName() const
CCaloSD(G4String aSDname, CCalVOrganization *numberingScheme)
G4StepPoint * GetPreStepPoint() const
void EndOfEvent(G4HCofThisEvent *HCE)
const G4VProcess * GetCreatorProcess() const
G4GLOB_DLL std::ostream G4cout
void insert(G4String str)
G4VPhysicalVolume * GetPhysicalVolume() const
G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)
const G4String & GetName() const
const G4ThreeVector & GetPosition() const
void addCalo(nameType name)
G4int GetReplicaNumber(G4int depth=0) const
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
virtual unsigned int GetUnitID(const G4Step *aStep) const =0
void setTimeSlice(double d)
const G4String & GetProcessName() const
G4double GetTotalEnergyDeposit() const
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
const G4VTouchable * GetTouchable() const
G4StepPoint * GetPostStepPoint() const
static G4SDManager * GetSDMpointer()
G4double GetTotalEnergy() const
unsigned int getUnitID() const
void setUnitID(unsigned int i)
G4double GetGlobalTime() const
static constexpr double MeV
const G4AffineTransform & GetTopTransform() const
void addEnergyDeposit(const CCalG4Hit &aHit)
G4CollectionNameVector collectionName
G4double GetKineticEnergy() const
G4Track * GetTrack() const
void Initialize(G4HCofThisEvent *HCE)
int getTimeSliceID() const
G4GLOB_DLL std::ostream G4cerr