Message: multiple sensitive detectors conflicting with each other Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None multiple sensitive detectors conflicting with each other 

Forum: Hits, Digitization and Pileup
Date: 18 Mar, 2008
From: David Oxley <David Oxley>

Dear all,

I appreciate there are many posts around this topic but I can't find one that answers my question. Any thoughts would be much appreciated:

I have adapted exampleN05 to simulate two seperate sensitive detectors and hope to create two hit collections. I find I can only run the simulation with either one or the other. Comment one out, and the other works...and vice versa.

If they are both in , only the first ever has hits although the visualisation shows interactions in the second.

I attach the sections of my code I have changed and that I believe are relevant. I have been comparing my code with example N05 for some time now and just can't see where I am going wrong. I hope someone with more C++ experience will be able to point me in the right direction.

Thanks for any help,


  G4SDManager* SDman  = G4SDManager::GetSDMpointer();
  G4String SmartPET1 = "ExN01/SmartPET1";
  ExN01TrackerSD* aSenDet1 = new ExN01TrackerSD(SmartPET1, "SmartPET1");
  geStrip_log ->SetSensitiveDetector(aSenDet1);

  G4String SmartPET2 = "ExN01/SmartPET2";
  ExN01TrackerSD* aSenDet2 = new ExN01TrackerSD(SmartPET2, "SmartPET2");
  geStrip_log2 ->SetSensitiveDetector(aSenDet2);

00000000000000-============================0000000000000000 My file:

ExN01TrackerSD :: ExN01TrackerSD(G4String name, G4String trackName)
{ G4String HCname; collectionName.insert(HCname=trackName); }

ExN01TrackerSD:: ~ExN01TrackerSD(){}


void ExN01TrackerSD::Initialize(G4HCofThisEvent* HCE)
trackerCollection = new ExN01TrackerHitsCollection
static G4int HCID = -1;
  { HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
    HCE->AddHitsCollection( HCID, trackerCollection ); 

00000000000000000===========================0000000000000000000000 My event action: void ExN01EventAction::EndOfEventAction(const G4Event* evt ) {

  G4SDManager * SDman = G4SDManager::GetSDMpointer();
  G4String detName;
  SP1CollID    = SDman->GetCollectionID(detName="SmartPET1");

  SP2CollID    = SDman->GetCollectionID(detName="SmartPET2");

   G4cout << ">>> Event " << evt->GetEventID() << G4endl;

  G4HCofThisEvent * HCE = evt->GetHCofThisEvent();

  ExN01TrackerHitsCollection* SP1_HC    = 0;
  ExN01TrackerHitsCollection* SP2_HC = 0;

	SP1_HC  = (ExN01TrackerHitsCollection*) (HCE ->GetHC(SP1CollID));
	SP2_HC  = (ExN01TrackerHitsCollection*) (HCE ->GetHC(SP2CollID));
    //  CaloHC    = (ExN05CalorimeterHitsCollection*)(HCE->GetHC(calorimeterCollID));
    //  HadCaloHC = (ExN05CalorimeterHitsCollection*)(HCE->GetHC(hadCalorimeterCollID));
  G4int NbHits =0;
G4double jim =0; G4double track =0;
	NbHits = SP1_HC->entries();
	cout << NbHits << "JACK" <<endl;	

		for (G4int i =0; i<NbHits; i++)
		jim += (*SP1_HC)[i]->GetEdep();
		track = (*SP1_HC)[i]->GetTrackID();

G4double SP2double =0;
G4int NbHits2 = 0;
	NbHits2 = SP2_HC->entries();

	NbHits2 = SP2_HC->entries();
	cout <<NbHits2 << "Jill"<<endl;
	cout << "In here"<<endl;

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

1 None: Re: multiple sensitive detectors conflicting with each other   (Bethany - 24 Jul, 2012)
2 None: Re: multiple sensitive detectors conflicting with each other   (Makoto Asai - 24 Jul, 2012)
 Add Message Add Message
to: "multiple sensitive detectors conflicting with each other"

 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 ]