Skip to content

Commit ed4ae8a

Browse files
committed
Fix for running without a file generator
1 parent f2c616d commit ed4ae8a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

include/A2CBOutput.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ protected:
8686
Float_t fepiz[MAXSIZE_PIZZA]; //hit sector energy deposits
8787
Float_t ftpiz[MAXSIZE_PIZZA]; //hit sector time
8888

89+
G4bool fIsGiBUU; // Is this a GiBUU file
8990
Float_t fweight; // event weight
9091

9192
TLorentzVector** fGenLorentzVec;

src/A2CBOutput.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ A2CBOutput::A2CBOutput(){
5454
ftofz=new Float_t[fToFTot];
5555
}
5656

57+
fIsGiBUU = false;
58+
if (fPGA->GetFileGen())
59+
fIsGiBUU = (fPGA->GetFileGen()->GetType() == A2FileGenerator::kGiBUU);
5760
fweight = 1;
5861
}
5962
A2CBOutput::~A2CBOutput(){
@@ -131,7 +134,7 @@ void A2CBOutput::SetBranches(){
131134
fTree->Branch("ipiz",fipiz,"fipiz[fnpiz]/I",basket);
132135
fTree->Branch("epiz",fepiz,"fepiz[fnpiz]/F",basket);
133136
fTree->Branch("tpiz",ftpiz,"ftpiz[fnpiz]/F",basket);
134-
if (fPGA->GetFileGen()->GetType() == A2FileGenerator::kGiBUU)
137+
if (fIsGiBUU)
135138
fTree->Branch("weight",&fweight,"fweight/F",basket);
136139
}
137140
void A2CBOutput::WriteHit(G4HCofThisEvent* HitsColl){
@@ -248,5 +251,5 @@ void A2CBOutput::WriteGenInput(){
248251
fplab[i]=fGenLorentzVec[i]->Rho()/GeV;
249252
fidpart[i]=fGenPartType[i];
250253
}
251-
fweight = fPGA->GetFileGen()->GetWeight();
254+
if (fIsGiBUU) fweight = fPGA->GetFileGen()->GetWeight();
252255
}

0 commit comments

Comments
 (0)