Message: Null pointer  Not Logged In (login) 
Hello,
I am simulating a planar NaI(Tl) scintillation detector with 25 pmt tubes coupled at the back before a gammaray source. I largely used example LXe code except that I defined all my detectors (including my pmts) inside the detectorConstruction class instead of creating a separate volume for them. My problem is that simulation is outputing (0,0,0) for all the (x,y,z) reconstructed positions from pmts. Other parts/classes of my code is almost the same as LXe example. Below is part of my code that show how I defined pmts are shown below: DetectorConstruction.hh
class CCDetectorConstruction : public G4VUserDetectorConstruction { public:
CCDetectorConstruction(); ~CCDetectorConstruction();
public:
G4VPhysicalVolume* Construct(); void PlacePMTs(G4LogicalVolume* pmt_log, G4RotationMatrix *rot, G4double dx, G4double dy, G4double xmin, G4double ymin, G4int nx, G4int ny, G4double &x1, G4double &y1, G4double z1, G4int &k,CCPMTSD* sd);
CCPMTSD* sd;
private: ........... ...........
//Sensitive detectors static CCScintSD* scint_SD; static CCPMTSD* pmt_SD;
G4int na, nb; G4double c, amin, bmin, da, db; };
DetectorConstruction.cc // // PMT //
G4double innerRadius_pmt = 0.*cm; G4double outerRadius_pmt = 1.*cm; //G4double diag_pmt = 2*outerRadius_pmt; G4double halfHeight_pmt = 2.*cm; G4double startAngle_pmt = 0.*deg; G4double spanningAngle_pmt = 360.*deg; pmt = new G4Tubs("pmt_tube",innerRadius_pmt,outerRadius_pmt, halfHeight_pmt,startAngle_pmt,spanningAngle_pmt);
//the "photocathode" is a metal slab at the back of the glass that //is only a very rough approximation of the real thing since it only //absorbs or detects the photons based on the efficiency set below photocath = new G4Tubs("photocath_tube",innerRadius_pmt,outerRadius_pmt, halfHeight_pmt/2,startAngle_pmt,spanningAngle_pmt);
pmt_log = new G4LogicalVolume(pmt,Glass, "pmt_log",0,0,0); photocath_log = new G4LogicalVolume(photocath, Al, "photocath_log",0,0,0);
photocath_phys = new G4PVPlacement(0,G4ThreeVector(0,0,halfHeight_pmt/2), photocath_log,"photocathode", pmt_log,false,0);
G4double da, db, amin, bmin, x1, y1; G4int na=0; G4int nb=0;
///////////////////////////////////////////////////////////////////////// // The PMT sensitive detector
//The sensitive detector is not actually on the photocathode. //processHits gets done manually by the stepping action. //It is used to detect when photons hit and get absorbed/detected at the //boundary to the photocathode (which doesnt get done by attaching it to a //logical volume. //It does however need to be attached to something or else it doesnt get //reset at the begining of events
pmt_SD = new CCPMTSD("pmt_SD");
SDman>AddNewDetector(pmt_SD); photocath_log>SetSensitiveDetector(pmt_SD);
pmt_SD>InitPMTs(na*nb); // let pmtSD know # of pmts
amin=bmin=6.*cm; da=db=2.*cm; na=nb=5; G4int k=0; c = (inter_Det_z + halfScint_z + halfHeight_pmt);
PlacePMTs(pmt_log,0,da,db,amin,bmin,na,nb,x1,y1,c,k,pmt_SD);
G4VisAttributes* pmtAttributes = new G4VisAttributes(G4Colour(0.0,0.0,1.0,0.0)); pmtAttributes>SetForceSolid(true); photocath_log>SetVisAttributes(pmtAttributes);
void CCDetectorConstruction::PlacePMTs(G4LogicalVolume* pmt_log, G4RotationMatrix *rot, G4double dx, G4double dy, G4double xmin, G4double ymin, G4int nx, G4int ny, G4double &x1, G4double &y1, G4double z1, G4int &k,CCPMTSD* sd){ /*PlacePMTs : a different way to parameterize placement that does not depend on calculating the position from the copy number
pmt_log = logical volume for pmts to be placed rot = rotation matrix to apply a,b = coordinates to vary(ie. if varying in the xy plane then pass x,y) da,db = value to increment a,b by amin,bmin = start values for a,b na,nb = number of repitions in a and b x,y,z = just pass x,y, and z by reference (the same ones passed for a,b) k = copy number to start with sd = sensitive detector for pmts*/
x1=xmin; for(G4int j=1;j<=nx;j++){ x1+=dx; y1=ymin; for(G4int i=1;i<=ny;i++){ y1+=dy; new G4PVPlacement(rot,G4ThreeVector(x1,y1,z1),pmt_log,"pmt", logicWorld,false,k); sd>SetPMTPos(k,x1,y1,z1); k++; } } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... I'm willing to provide more information in case I'm not clear enough. Please all kind suggestions are highly appreciated. Chibueze.

to: 