Skip to content

Commit bdf73d9

Browse files
committed
make it compile
1 parent f8186c6 commit bdf73d9

6 files changed

+404
-170
lines changed

Diff for: include/WCSimPrimaryGeneratorAction.hh

+24-17
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include "G4VUserPrimaryGeneratorAction.hh"
55
#include "G4ThreeVector.hh"
66
#include "globals.hh"
7+
#include "jhfNtuple.h"
8+
#include <vector>
79

810
#include <fstream>
911

@@ -14,6 +16,7 @@ class G4ParticleGun;
1416
class G4GeneralParticleSource;
1517
class G4Event;
1618
class WCSimPrimaryGeneratorMessenger;
19+
class G4Generator;
1720

1821
class WCSimPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
1922
{
@@ -25,23 +28,26 @@ public:
2528
void GeneratePrimaries(G4Event* anEvent);
2629

2730
// Gun, laser & gps setting calls these functions to fill jhfNtuple and Root tree
28-
void SetVtx(G4ThreeVector i) { vtx = i; };
29-
void SetBeamEnergy(G4double i) { beamenergy = i; };
30-
void SetBeamDir(G4ThreeVector i) { beamdir = i; };
31-
void SetBeamPDG(G4int i) { beampdg = i; };
31+
void SetVtx(G4ThreeVector i) { vtxs[0] = i; nvtxs = 1; };
32+
void SetBeamEnergy(G4double i, G4int n = 0) { beamenergies[n] = i;};
33+
void SetBeamDir(G4ThreeVector i, G4int n = 0) { beamdirs[n] = i;};
34+
void SetBeamPDG(G4int i, G4int n = 0) { beampdgs[n] = i;};
35+
void SetNvtxs(G4int i) { nvtxs = i; };
36+
void SetVtxs(G4int i, G4ThreeVector v) { vtxs[i] = v; };
3237

3338
// These go with jhfNtuple
3439
G4int GetVecRecNumber(){return vecRecNumber;}
3540
G4int GetMode() {return mode;};
36-
G4int GetVtxVol() {return vtxvol;};
37-
G4ThreeVector GetVtx() {return vtx;}
41+
G4int GetNvtxs() {return nvtxs;};
42+
G4int GetVtxVol(G4int n = 0) {return vtxsvol[n];};
43+
G4ThreeVector GetVtx(G4int n = 0) {return vtxs[n];}
3844
G4int GetNpar() {return npar;};
39-
G4int GetBeamPDG() {return beampdg;};
40-
G4double GetBeamEnergy() {return beamenergy;};
41-
G4ThreeVector GetBeamDir() {return beamdir;};
42-
G4int GetTargetPDG() {return targetpdg;};
43-
G4double GetTargetEnergy() {return targetenergy;};
44-
G4ThreeVector GetTargetDir() {return targetdir;};
45+
G4int GetBeamPDG(G4int n = 0) {return beampdgs[n];};
46+
G4double GetBeamEnergy(G4int n = 0) {return beamenergies[n];};
47+
G4ThreeVector GetBeamDir(G4int n = 0) {return beamdirs[n];};
48+
G4int GetTargetPDG(G4int n = 0) {return targetpdgs[n];};
49+
G4double GetTargetEnergy(G4int n = 0) {return targetenergies[n];};
50+
G4ThreeVector GetTargetDir(G4int n = 0) {return targetdirs[n];};
4551

4652
// older ...
4753
G4double GetNuEnergy() {return nuEnergy;};
@@ -74,12 +80,13 @@ private:
7480

7581
// These go with jhfNtuple
7682
G4int mode;
77-
G4int vtxvol;
78-
G4ThreeVector vtx;
83+
G4int nvtxs;
84+
G4int vtxsvol[MAX_N_PRIMARIES];
85+
G4ThreeVector vtxs[MAX_N_PRIMARIES];
7986
G4int npar;
80-
G4int beampdg, targetpdg;
81-
G4ThreeVector beamdir, targetdir;
82-
G4double beamenergy, targetenergy;
87+
G4int beampdgs[MAX_N_PRIMARIES], targetpdgs[MAX_N_PRIMARIES];
88+
G4ThreeVector beamdirs[MAX_N_PRIMARIES], targetdirs[MAX_N_PRIMARIES];
89+
G4double beamenergies[MAX_N_PRIMARIES], targetenergies[MAX_N_PRIMARIES];
8390
G4int vecRecNumber;
8491

8592
G4double nuEnergy;

Diff for: include/WCSimRootEvent.hh

+15-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include "TClonesArray.h"
1212
#include <string>
1313
#include <vector>
14+
#include <iostream>
15+
#include "jhfNtuple.h"
1416
//#include <map>
1517
//#include "G4Transform3D.hh"
1618

@@ -207,8 +209,9 @@ private:
207209
WCSimRootEventHeader fEvtHdr; // The header
208210
// See jhfNtuple.h for the meaning of these data members:
209211
Int_t fMode;
210-
Int_t fVtxvol;
211-
Float_t fVtx[3];
212+
Int_t fNvtxs;
213+
Int_t fVtxsvol[MAX_N_PRIMARIES];
214+
Float_t fVtxs[MAX_N_PRIMARIES][3];
212215
Int_t fVecRecNumber; // "info event" number in inputvectorfile
213216
Int_t fJmu;
214217
Int_t fJp;
@@ -251,8 +254,11 @@ public:
251254
void SetTriggerInfo(TriggerType_t trigger_type, std::vector<Float_t> trigger_info);
252255
bool IsASubEvent() { return (fEvtHdr.GetSubEvtNumber()>=1); }
253256
void SetMode(Int_t i) {fMode = i;}
254-
void SetVtxvol(Int_t i) {fVtxvol = i;}
255-
void SetVtx(Int_t i, Float_t f) {fVtx[i]= ( (i<3) ? f : 0);}
257+
void SetNvtxs(Int_t i) {fNvtxs = i;}
258+
void SetVtxvol(Int_t i) {fVtxsvol[0] = i;}
259+
void SetVtxsvol(Int_t i, Int_t v) {fVtxsvol[i] = v;}
260+
void SetVtx(Int_t i, Float_t f) {fNvtxs=1; fVtxs[0][i] = ( (i<3) ? f : 0);}
261+
void SetVtxs(Int_t n, Int_t i, Float_t f) {fVtxs[n][i]= ( (i<3) ? f : 0);}
256262
void SetVecRecNumber(Int_t i) {fVecRecNumber = i;}
257263
void SetJmu(Int_t i) {fJmu = i;}
258264
void SetJp(Int_t i) {fJp = i;}
@@ -269,8 +275,11 @@ public:
269275
WCSimRootEventHeader *GetHeader() {return &fEvtHdr; }
270276
WCSimRootPi0 *GetPi0Info() {return &fPi0; }
271277
Int_t GetMode() const {return fMode;}
272-
Int_t GetVtxvol() const {return fVtxvol;}
273-
Float_t GetVtx(Int_t i=0) {return (i<3) ? fVtx[i]: 0;}
278+
Int_t GetVtxvol() const {return fVtxsvol[0];}
279+
Float_t GetVtx(Int_t i=0) {return (i<3) ? fVtxs[0][i]: 0;}
280+
Int_t GetNvtxs() const {return fNvtxs;}
281+
Int_t GetVtxsvol(Int_t i) const {return fVtxsvol[i];}
282+
Float_t GetVtxs(Int_t n, Int_t i=0) {return (i<3) ? fVtxs[n][i]: 0;}
274283
Int_t GetVecRecNumber() const {return fVecRecNumber;}
275284
Int_t GetJmu() const {return fJmu;}
276285
Int_t GetJp() const {return fJp;}

Diff for: include/jhfNtuple.h

+42-34
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,67 @@
1+
#ifndef JHFNTUPLE_H
2+
#define JHFNTUPLE_H
3+
static const int MAX_N_PRIMARIES = 900;
4+
static const int MAX_N_ACTIVE_TUBES = 2000;
5+
static const int MAX_N_HITS_PER_TUBE = 90;
16
struct ntupleStruct
27
{
38
int mode; // interaction mode
4-
int vtxvol; // volume of vertex
5-
float vtx[3]; // interaction vertex
9+
int nvtxs; // number of vertices
10+
int vtxsvol[MAX_N_PRIMARIES]; // volume of vertices
11+
float vtxs[MAX_N_PRIMARIES][3]; // interaction vertices
612
int vecRecNumber; // info event number in inputvetcotfile
713
int jmu; // index to muon
814
int jp; // index to proton
915
int npar; // number of final state particles
10-
int ipnu[50]; // id of ith final state particle
11-
int flag[50]; // flag: -1 = incoming neutrino
16+
int ipnu[MAX_N_PRIMARIES]; // id of ith final state particle
17+
int flag[MAX_N_PRIMARIES]; // flag: -1 = incoming neutrino
1218
// -2 = target
1319
// 1 = outgoing lepton
1420
// 2 = most energetic outgoing nucleon
15-
float m[50]; // mass of ith final state particle
16-
float p[50]; // momentum of ith final state particle
17-
float E[50]; // energy of ith final state particle
18-
int startvol[50]; // starting volume of ith final state particle
19-
int stopvol[50]; // stopping volume of ith final state particle
20-
float dir[50][3]; // direction of ith final state particle
21-
float pdir[50][3]; // momentum-vector of ith final state particle
22-
float stop[50][3]; // stopping point of ith final state particle
23-
float start[50][3]; // starting point of ith final state particle
24-
int parent[50]; // ID of parent of ith particle (0 if primary)
25-
float time[50]; // creation time of the ith particle
21+
float m[MAX_N_PRIMARIES]; // mass of ith final state particle
22+
float p[MAX_N_PRIMARIES]; // momentum of ith final state particle
23+
float E[MAX_N_PRIMARIES]; // energy of ith final state particle
24+
int startvol[MAX_N_PRIMARIES]; // starting volume of ith final state particle
25+
int stopvol[MAX_N_PRIMARIES]; // stopping volume of ith final state particle
26+
float dir[MAX_N_PRIMARIES][3]; // direction of ith final state particle
27+
float pdir[MAX_N_PRIMARIES][3]; // momentum-vector of ith final state particle
28+
float stop[MAX_N_PRIMARIES][3]; // stopping point of ith final state particle
29+
float start[MAX_N_PRIMARIES][3]; // starting point of ith final state particle
30+
int parent[MAX_N_PRIMARIES]; // ID of parent of ith particle (0 if primary)
31+
float time[MAX_N_PRIMARIES]; // creation time of the ith particle
2632

2733
int numTubesHit; // Total number of tubes with hits
28-
int totalPe[500]; // The totalPE recorded at each tube
29-
float truetime[500][90]; // The true time of each hit
34+
int totalPe[MAX_N_ACTIVE_TUBES]; // The totalPE recorded at each tube
35+
float truetime[MAX_N_ACTIVE_TUBES][MAX_N_HITS_PER_TUBE]; // The true time of each hit
3036

3137
int numDigitizedTubes; // Number of PMTs with digitized hits
32-
float q[500]; // The readout digitized pe
33-
float t[500]; // The readout digitized time
34-
int tubeid[500]; // The readout tube ID
38+
float q[MAX_N_ACTIVE_TUBES]; // The readout digitized pe
39+
float t[MAX_N_ACTIVE_TUBES]; // The readout digitized time
40+
int tubeid[MAX_N_ACTIVE_TUBES]; // The readout tube ID
3541
float sumq; // sum of q(readout digitized pe) in event
3642

3743
int fvnumTubesHit; // Total number of inner tubes with hits
38-
int fvtotalPe[500]; // The totalPE recorded at each innertube
39-
float fvtruetime[500][90]; // The true time of each inner hit
44+
int fvtotalPe[MAX_N_ACTIVE_TUBES]; // The totalPE recorded at each innertube
45+
float fvtruetime[MAX_N_ACTIVE_TUBES][MAX_N_HITS_PER_TUBE]; // The true time of each inner hit
4046

4147
int fvnumDigitizedTubes; // Number of PMTs with digitized hits
42-
float fvq[500]; // The readout digitized pe
43-
float fvt[500]; // The readout digitized time
44-
int fvtubeid[500]; // The readout tube ID
48+
float fvq[MAX_N_ACTIVE_TUBES]; // The readout digitized pe
49+
float fvt[MAX_N_ACTIVE_TUBES]; // The readout digitized time
50+
int fvtubeid[MAX_N_ACTIVE_TUBES]; // The readout tube ID
4551
float fvsumq; // sum of q(readout digitized pe) in event
4652
};
4753

4854
extern struct ntupleStruct jhfNtuple;
4955

5056
static const char* ntDesc =
5157
"mode:I,"
52-
"vtxvol:I,"
53-
"vtx(3):R,"
58+
"nvtxs[0,MAX_N_PRIMARIES]:I,"
59+
"vtxsvol(npar):I,"
60+
"vtxs(3,npar):R,"
5461
"vecRecNumber:I,"
5562
"jmu:I,"
5663
"jp:I,"
57-
"npar[0,50]:I,"
64+
"npar[0,MAX_N_PRIMARIES]:I,"
5865
"ipnu(npar):I,"
5966
"flag(npar):I,"
6067
"m(npar):R,"
@@ -68,19 +75,20 @@ static const char* ntDesc =
6875
"startpos(3,npar):R,"
6976
"parent(npar):I,"
7077
"time(npar):R,"
71-
"numTubesHit[0,500]:I,"
78+
"numTubesHit[0,MAX_N_ACTIVE_TUBES]:I,"
7279
"totalPe(numTubesHit):I,"
73-
"truetime(90,numTubesHit):R,"
74-
"numDigTubes[0,500]:I,"
80+
"truetime(MAX_N_HITS_PER_TUBE,numTubesHit):R,"
81+
"numDigTubes[0,MAX_N_ACTIVE_TUBES]:I,"
7582
"q(numDigTubes):R,"
7683
"t(numDigTubes):R,"
7784
"tubeid(numDigTubes):I"
78-
"fvnumTubesHit[0,500]:I,"
85+
"fvnumTubesHit[0,MAX_N_ACTIVE_TUBES]:I,"
7986
"fvtotalPe(fvnumTubesHit):I,"
80-
"fvtruetime(90,fvnumTubesHit):R,"
81-
"fvnumDigTubes[0,500]:I,"
87+
"fvtruetime(MAX_N_HITS_PER_TUBE,fvnumTubesHit):R,"
88+
"fvnumDigTubes[0,MAX_N_ACTIVE_TUBES]:I,"
8289
"fvq(fvnumDigTubes):R,"
8390
"fvt(fvnumDigTubes):R,"
8491
"fvtubeid(fvnumDigTubes):I";
92+
#endif
8593

8694

0 commit comments

Comments
 (0)