Message: Re: Memory Leak/Implementation of THitsCollection Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

More Re: Memory Leak/Implementation of THitsCollection 

Forum: Hits, Digitization and Pileup
Re: Sad Memory Leak/Implementation of THitsCollection (Nicole Ackerman)
Re: None Re: Memory Leak/Implementation of THitsCollection (Tsukasa Aso)
Date: 14 May, 2012
From: Nicole Ackerman <Nicole Ackerman>

Hi Tsukasa,

Thank you for the reply. Here is the relevant code from my SD class.

NucSD::NucSD(G4String name)
  :G4VSensitiveDetector(name)
{
  G4String HCname;
  HCname = name;
  HCname += "_collection";
  collectionName.insert(HCname);

  G4cout << "SD Made with name " << HCname  << G4endl;

  recorder = NULL;
}

void NucSD::Initialize(G4HCofThisEvent* HCE) {

  //##############################
  //Initialize Hits Collections
  //##############################  

  G4cout << "@@@   NucSD: tracker SD Name: " << SensitiveDetectorName << " and CN: " << collectionName[0] <<  G4endl; 

  trackerCollection = new NucHitsCollection
                          (SensitiveDetectorName,collectionName[0]); 

  G4cout << "     trackerC: " << trackerCollection << G4endl;

  static G4int HCID = -1;
  if(HCID<0)
  { HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
  HCE->AddHitsCollection( HCID, trackerCollection ); 

}

 Note that in my DetectorConstruction class I create two instances of my SD via:
  NucSD* cellDet = new NucSD(myname="cellDet");
  NucSD* nucDet = new NucSD(myname="nucDet");

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Ok: Re: Memory Leak/Implementation of THitsCollection   (Nicole Ackerman - 15 May, 2012)
 Add Message Add Message
to: "Re: Memory Leak/Implementation of THitsCollection"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]