Message: access to a Hit Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None access to a Hit 

Forum: Hits, Digitization and Pileup
Date: 06 Feb, 2003
From: Jerome Roccaz <roccaz@csnsm.in2p3.fr>

Hi everyone,

Let's first have a look at these code lines :

G4HCofThisEvent* HCE=evt->GetHCofThisEvent();
  SimpleGeHitsCollection* CHC=0;
  G4int n_hit=0;
  G4double totEAbs=0, EHit1=0;
  G4double dumb=0;
  G4ThreeVector Hit1, Hit2;

  if(HCE) CHC=(SimpleGeHitsCollection*)(HCE->GetHC(simpleGeCollID));
  if(CHC){
    n_hit=CHC->entries();
    //dumb=(*CHC)[0]->GetG();
    //if(dumb==0){
    //Hit1=(*CHC)[0]->GetPos();
    //Hit2=(*CHC)[1]->GetPos();
    EHit1=(*CHC)[1]->GetEdep();
      //geRun->fillEn(EHit1);
      //geRun->fillLong(Hit1, Hit2);
    //}

    for(G4int i=0;i<n_hit;i++) {totEAbs+=(*CHC)[i]->GetEdepAbs();EHit1=(*CHC)[i]->GetEdep();};
    geRun->fillNabs(totEAbs);
    geRun->fillNdet(totEAbs);
    geRun->fillHist(totEAbs);
  }

When the line : EHit1=(*CHC)[1]->GetEdep(); is in comment, i have no problem executing my program. But when it is not, I obtain a "bus error" when i start a run. as you can see, I've also placed this line in the for loop, and no problem with it.

I don't have any error during compilation. I'd like to understand what can happen, and of course find a solution.

Thanks

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

 Add Message Add Message
to: "access to a Hit"

 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 ]