Message: Re: Hit Collection for multiple Sensitive Detectors Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Hit Collection for multiple Sensitive Detectors 

Keywords: hit collection, sensitive detector
Forum: Hits, Digitization and Pileup
Re: Question Hit Collection for multiple Sensitive Detectors (Matt Orr)
Date: 12 Jan, 2005
From: Jeremy McCormick <Jeremy McCormick>

Hi, Matt.

In fact, hits collections are not bound to have any
particlar name by the sensitive detector that writes
to them.

For your case, simply create hits collections based on
the unique name of your individual SDs.

PMTSD(G4String sdName)
  : G4VSensitiveDetector( sdName ),
    HCID( -1 )
  collectionNames.insert( sdName);

This will set the name of the hits collection to 
the name of your sensitive detector.

Set HCID to -1 in order to flag it as not setup.

Now create the collection for each event in Initialize().

void Initialize()
  hitsCollPtr = new PMTHitsCollection( GetName(), collectionName[0] );

  if ( HCID < 0) {
    HCID = GetCollectionID(0); 

  HCE->AddHitsCollection( HCID, hitsCollPtr );

The above assumes you have a member variable hitsCollPtr
which is of type PMTHitsCollection*.  PMTHitsCollection should
be your concrete hits collection class.

Then, just make sure to give the SDs unique names.

PMTSD* sd1 = new PMTSD("PMT1");
PMTSD* sd2 = new PMTSD("PMT2");

Your hits collections will then be called "PMT1", "PMT2", etc.

I am just writing code snippets here; please, email me
offline if you would like pointers to more complete codes.


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

 Add Message Add Message
to: "Re: Hit Collection for multiple Sensitive Detectors"

 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 ]