Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions include/WCSimRootEvent.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ private:
Double_t fTime;
Int_t fId;
Int_t fParentId;
std::vector<std::vector<double>> boundaryPoints;
std::vector<double> boundaryKEs;
std::vector<int> boundaryTypes; // 1 = blacksheet, 2 = tyvek, 3 = cave

public:
WCSimRootTrack() {}
Expand All @@ -60,7 +63,10 @@ public:
Int_t parenttype,
Double_t time,
Int_t id,
Int_t idParent);
Int_t idParent,
std::vector<std::vector<double>> bPs,
std::vector<double> bKEs,
std::vector<int> bTypes);
virtual ~WCSimRootTrack() { }
bool CompareAllVariables(const WCSimRootTrack * c) const;

Expand All @@ -79,8 +85,11 @@ public:
Double_t GetTime() const { return fTime;}
Int_t GetId() const {return fId;}
Int_t GetParentId() const {return fParentId;}
std::vector<std::vector<double>> GetBoundaryPoints() {return boundaryPoints;}
std::vector<double> GetBoundaryKEs() {return boundaryKEs;}
std::vector<int> GetBoundaryTypes() {return boundaryTypes;}

ClassDef(WCSimRootTrack,3)
ClassDef(WCSimRootTrack,4)
};


Expand Down Expand Up @@ -447,7 +456,10 @@ public:
Int_t parenttype,
Double_t time,
Int_t id,
Int_t idParent);
Int_t idParent,
std::vector<std::vector<double>> bPs,
std::vector<double> bKEs,
std::vector<int> bTypes);

WCSimRootTrack * AddTrack (WCSimRootTrack * track);
WCSimRootTrack * RemoveTrack(WCSimRootTrack * track);
Expand Down Expand Up @@ -480,7 +492,7 @@ public:

TClonesArray *GetCaptures() const {return fCaptures;}

ClassDef(WCSimRootTrigger,4) //WCSimRootEvent structure
ClassDef(WCSimRootTrigger,5) //WCSimRootEvent structure
};


Expand Down
25 changes: 25 additions & 0 deletions include/WCSimTrajectory.hh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,26 @@ public: // with description
inline void SetStoppingVolume(G4VPhysicalVolume* currentVolume)
{ stoppingVolume = currentVolume;}

// Functions to Set/Get boundary points
inline void SetBoundaryPoints(std::vector<std::vector<G4double>> bPs,
std::vector<G4double> bKEs,
std::vector<G4int> bTypes)
{
boundaryPoints = bPs;
boundaryKEs = bKEs;
boundaryTypes = bTypes;
}
inline void AddBoundaryPoint(std::vector<G4double> bPs,
G4double bKEs,
G4int bTypes)
{
boundaryPoints.push_back(bPs);
boundaryKEs.push_back(bKEs);
boundaryTypes.push_back(bTypes);
}
inline std::vector<std::vector<G4double>> GetBoundaryPoints() {return boundaryPoints;}
inline std::vector<G4double> GetBoundaryKEs() {return boundaryKEs;}
inline std::vector<G4int> GetBoundaryTypes() {return boundaryTypes;}

// Other member functions
virtual void ShowTrajectory(std::ostream& os=G4cout) const;
Expand Down Expand Up @@ -107,6 +127,11 @@ public: // with description
G4bool SaveIt;
G4String creatorProcess;
G4double globalTime;

// Boundary points;
std::vector<std::vector<G4double>> boundaryPoints;
std::vector<G4double> boundaryKEs;
std::vector<G4int> boundaryTypes; // 1 = blacksheet, 2 = tyvek, 3 = cave
};

/*** TEMP : M FECHNER ***********
Expand Down
20 changes: 16 additions & 4 deletions src/WCSimEventAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,10 @@ void WCSimEventAction::FillRootEvent(G4int event_id,
injhfNtuple.parent[k],
injhfNtuple.time[k],
0,
0);
0,
std::vector<std::vector<double>>(),
std::vector<double>(),
std::vector<int>());
}

// the rest of the tracks come from WCSimTrajectory
Expand Down Expand Up @@ -1350,7 +1353,10 @@ void WCSimEventAction::FillRootEvent(G4int event_id,
parentType,
ttime,
id,
idPrnt);
idPrnt,
trj->GetBoundaryPoints(),
trj->GetBoundaryKEs(),
trj->GetBoundaryTypes());
}


Expand Down Expand Up @@ -1742,7 +1748,10 @@ void WCSimEventAction::FillRootEventHybrid(G4int event_id,
injhfNtuple.parent[k],
injhfNtuple.time[k],
0,
0);
0,
std::vector<std::vector<double>>(),
std::vector<double>(),
std::vector<int>());
}

// the rest of the tracks come from WCSimTrajectory
Expand Down Expand Up @@ -1878,7 +1887,10 @@ void WCSimEventAction::FillRootEventHybrid(G4int event_id,
parentType,
ttime,
id,
idPrnt);
idPrnt,
trj->GetBoundaryPoints(),
trj->GetBoundaryKEs(),
trj->GetBoundaryTypes());
}


Expand Down
23 changes: 19 additions & 4 deletions src/WCSimRootEvent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,10 @@ WCSimRootTrack *WCSimRootTrigger::AddTrack(Int_t ipnu,
Int_t parenttype,
Double_t time,
Int_t id,
Int_t idParent)
Int_t idParent,
std::vector<std::vector<double>> bPs,
std::vector<double> bKEs,
std::vector<int> bTypes)
{
// Add a new WCSimRootTrack to the list of tracks for this event.
// To avoid calling the very time consuming operator new for each track,
Expand All @@ -428,7 +431,10 @@ WCSimRootTrack *WCSimRootTrigger::AddTrack(Int_t ipnu,
parenttype,
time,
id,
idParent);
idParent,
bPs,
bKEs,
bTypes);
fNtrack++;
return track;
}
Expand Down Expand Up @@ -466,7 +472,10 @@ WCSimRootTrack *WCSimRootTrigger::AddTrack(WCSimRootTrack * track)
track->GetParenttype(),
track->GetTime(),
track->GetId(),
track->GetParentId());
track->GetParentId(),
track->GetBoundaryPoints(),
track->GetBoundaryKEs(),
track->GetBoundaryTypes());
fNtrack++;
return track_out;
}
Expand Down Expand Up @@ -497,7 +506,10 @@ WCSimRootTrack::WCSimRootTrack(Int_t ipnu,
Int_t parenttype,
Double_t time,
Int_t id,
Int_t idParent)
Int_t idParent,
std::vector<std::vector<double>> bPs,
std::vector<double> bKEs,
std::vector<int> bTypes)
{

// Create a WCSimRootTrack object and fill it with stuff
Expand All @@ -521,6 +533,9 @@ WCSimRootTrack::WCSimRootTrack(Int_t ipnu,
fTime = time;
fId = id;
fParentId = idParent;
boundaryPoints = bPs;
boundaryKEs = bKEs;
boundaryTypes = bTypes;
}

//_____________________________________________________________________________
Expand Down
50 changes: 49 additions & 1 deletion src/WCSimTrajectory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ WCSimTrajectory::WCSimTrajectory()
PDGEncoding( 0 ), PDGCharge(0.0), ParticleName(""),
initialMomentum( G4ThreeVector() ),SaveIt(false),creatorProcess(""),
globalTime(0.0)
{;}
{
boundaryPoints.clear();
boundaryKEs.clear();
boundaryTypes.clear();
}

WCSimTrajectory::WCSimTrajectory(const G4Track* aTrack)
{
Expand Down Expand Up @@ -49,6 +53,10 @@ WCSimTrajectory::WCSimTrajectory(const G4Track* aTrack)
}
else
creatorProcess = "";

boundaryPoints.clear();
boundaryKEs.clear();
boundaryTypes.clear();
}

WCSimTrajectory::WCSimTrajectory(WCSimTrajectory & right):G4VTrajectory()
Expand All @@ -72,6 +80,10 @@ WCSimTrajectory::WCSimTrajectory(WCSimTrajectory & right):G4VTrajectory()
positionRecord->push_back(new G4TrajectoryPoint(*rightPoint));
}
globalTime = right.globalTime;

boundaryPoints = right.boundaryPoints;
boundaryKEs = right.boundaryKEs;
boundaryTypes = right.boundaryTypes;
}

WCSimTrajectory::~WCSimTrajectory()
Expand All @@ -84,6 +96,10 @@ WCSimTrajectory::~WCSimTrajectory()
positionRecord->clear();

delete positionRecord;

boundaryPoints.clear();
boundaryKEs.clear();
boundaryTypes.clear();
}

void WCSimTrajectory::ShowTrajectory(std::ostream& os) const
Expand Down Expand Up @@ -174,6 +190,32 @@ void WCSimTrajectory::AppendStep(const G4Step* aStep)
{
positionRecord->push_back( new G4TrajectoryPoint(aStep->GetPostStepPoint()->
GetPosition() ));

// Save boundary points
G4StepPoint* thePrePoint = aStep->GetPreStepPoint();
G4VPhysicalVolume* thePrePV = thePrePoint->GetPhysicalVolume();

G4StepPoint* thePostPoint = aStep->GetPostStepPoint();
G4VPhysicalVolume* thePostPV = thePostPoint->GetPhysicalVolume();

if (thePrePV && thePostPV && thePrePV->GetName()!=thePostPV->GetName())
{
G4String thePrePVName = thePrePV->GetName();
G4String thePostPVName = thePostPV->GetName();
G4int ty = 0;
if (thePrePVName.contains("BlackSheet") || thePostPVName.contains("BlackSheet")) ty = 1;
else if (thePrePVName.contains("Cave") || thePostPVName.contains("Cave")) ty = 3;
else if (thePrePVName.contains("Tyvek") || thePostPVName.contains("Tyvek")) ty = 2;
if (ty>0)
{
const G4Track* track = aStep->GetTrack();
std::vector<G4double> bPs(3);
bPs[0] = track->GetPosition().x(); bPs[1] = track->GetPosition().y(); bPs[2] = track->GetPosition().z();
AddBoundaryPoint(bPs, track->GetKineticEnergy(), ty);
// G4cout<<"Step point "<<track->GetCurrentStepNumber () <<" "<<track->GetPosition().x()<<" "<<track->GetPosition().y()<<" "<<track->GetPosition().z()<<
// " "<<track->GetKineticEnergy()<<" "<<thePrePV->GetName()<<" "<<thePostPV->GetName()<<G4endl;
}
}
}

G4ParticleDefinition* WCSimTrajectory::GetParticleDefinition()
Expand All @@ -198,6 +240,12 @@ void WCSimTrajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
}
delete (*seco->positionRecord)[0];
seco->positionRecord->clear();

ent = (seco->GetBoundaryPoints()).size();
for (G4int i=0;i<ent;i++)
{
AddBoundaryPoint((seco->GetBoundaryPoints()).at(i),(seco->GetBoundaryKEs()).at(i),(seco->GetBoundaryTypes()).at(i));
}
}