Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class Detector : public o2::base::DetImpl<Detector>

// Simulation
std::vector<Hit>* mHits = nullptr; //! Collection of CPV hits
int mTrackRefLastTrackID = -1; //! last track that received a TrackReference in the current event

template <typename Det>
friend class o2::base::DetImpl;
Expand Down
8 changes: 8 additions & 0 deletions Detectors/CPV/simulation/src/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ void Detector::Reset()
if (!o2::utils::ShmManager::Instance().isOperational()) {
mHits->clear();
}
mTrackRefLastTrackID = -1;
}

void Detector::Register() { FairRootManager::Instance()->RegisterAny(addNameTo("Hit").data(), mHits, kTRUE); }
Expand All @@ -123,6 +124,13 @@ Bool_t Detector::ProcessHits(FairVolume* v)
// ported from AliRoot 2019
// ------------------------------------------------------------------------

if (fMC->IsTrackEntering() && !fMC->IsNewTrack() && fMC->TrackCharge() != 0) { // one reference per charged particle, first entry from outside
auto o2stack = static_cast<o2::data::Stack*>(fMC->GetStack());
if (o2stack->GetCurrentTrackNumber() != mTrackRefLastTrackID) {
mTrackRefLastTrackID = o2stack->GetCurrentTrackNumber();
o2stack->addTrackReference(o2::TrackReference(*fMC, GetDetId()));
}
}
// analyze only charged
if (fMC->TrackCharge() == 0) {
fMC->SetMaxStep(1.e10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class Detector : public o2::base::DetImpl<Detector>

/// Container for data points
std::vector<o2::fdd::Hit>* mHits = nullptr;
int mTrackRefLastTrackID = -1; //! last track that received a TrackReference in the current event

Detector& operator=(const Detector&);

Expand Down
8 changes: 8 additions & 0 deletions Detectors/FIT/FDD/simulation/src/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ void Detector::InitializeO2Detector()
Bool_t Detector::ProcessHits(FairVolume* vol)
{
// This is step manager
if (fMC->IsTrackEntering() && !fMC->IsNewTrack() && fMC->TrackCharge() != 0) { // one reference per charged particle, first entry from outside
auto o2stack = static_cast<o2::data::Stack*>(fMC->GetStack());
if (o2stack->GetCurrentTrackNumber() != mTrackRefLastTrackID) {
mTrackRefLastTrackID = o2stack->GetCurrentTrackNumber();
o2stack->addTrackReference(o2::TrackReference(*fMC, GetDetId()));
}
}
// do not track neutral particles
if (!(fMC->TrackCharge())) {
return kFALSE;
Expand Down Expand Up @@ -373,4 +380,5 @@ void Detector::Reset()
if (!o2::utils::ShmManager::Instance().isOperational()) {
mHits->clear();
}
mTrackRefLastTrackID = -1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ class Detector : public o2::base::DetImpl<Detector>

/// Container for data points
std::vector<o2::ft0::HitType>* mHits = nullptr;
int mTrackRefLastTrackID = -1; //! last track that received a TrackReference in the current event

// Define volume IDs
int mREGVolID = -1;
Expand Down
8 changes: 8 additions & 0 deletions Detectors/FIT/FT0/simulation/src/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,13 @@ Bool_t Detector::ProcessHits(FairVolume* v)

Int_t copy;
Int_t volID = fMC->CurrentVolID(copy);
if (fMC->IsTrackEntering() && !fMC->IsNewTrack() && fMC->TrackCharge() != 0 && volID == mTOPVolID) { // one reference per charged particle, first entry from outside
auto o2stack = static_cast<o2::data::Stack*>(fMC->GetStack());
if (o2stack->GetCurrentTrackNumber() != mTrackRefLastTrackID) {
mTrackRefLastTrackID = o2stack->GetCurrentTrackNumber();
o2stack->addTrackReference(o2::TrackReference(*fMC, GetDetId()));
}
}

TVirtualMCStack* stack = fMC->GetStack();
Int_t quadrant, mcp;
Expand Down Expand Up @@ -1203,6 +1210,7 @@ void Detector::Reset()
if (!o2::utils::ShmManager::Instance().isOperational()) {
mHits->clear();
}
mTrackRefLastTrackID = -1;
}

void Detector::CreateMaterials()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class Detector : public o2::base::DetImpl<Detector>
private:
/// Container for hits
std::vector<o2::fv0::Hit>* mHits = nullptr;
int mTrackRefLastTrackID = -1; //! last track that received a TrackReference in the current event

/// Geometry pointer
Geometry* mGeometry = nullptr; //!
Expand Down
8 changes: 8 additions & 0 deletions Detectors/FIT/FV0/simulation/src/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ Bool_t Detector::ProcessHits(FairVolume* v)
{
// This method is called from the MC stepping

if (fMC->IsTrackEntering() && !fMC->IsNewTrack() && fMC->TrackCharge() != 0) { // one reference per charged particle, first entry from outside
auto o2stack = static_cast<o2::data::Stack*>(fMC->GetStack());
if (o2stack->GetCurrentTrackNumber() != mTrackRefLastTrackID) {
mTrackRefLastTrackID = o2stack->GetCurrentTrackNumber();
o2stack->addTrackReference(o2::TrackReference(*fMC, GetDetId()));
}
}
// Track only charged particles and photons
bool isPhotonTrack = false;
Int_t particlePdg = fMC->TrackPid();
Expand Down Expand Up @@ -150,6 +157,7 @@ void Detector::Reset()
if (!o2::utils::ShmManager::Instance().isOperational()) {
mHits->clear();
}
mTrackRefLastTrackID = -1;
}

void Detector::EndOfEvent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class Detector : public o2::base::DetImpl<Detector>
private:
/// Container for hit data
std::vector<o2::itsmft::Hit>* mHits;
int mTrackRefLastTrackID = -1; //! last track that received a TrackReference in the current event

Detector(const Detector&);
Detector& operator=(const Detector&);
Expand Down
8 changes: 8 additions & 0 deletions Detectors/ITSMFT/MFT/simulation/src/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ Bool_t Detector::ProcessHits(FairVolume* vol)
{
// This method is called from the MC stepping

if (fMC->IsTrackEntering() && !fMC->IsNewTrack() && fMC->TrackCharge() != 0) { // one reference per charged particle, first entry from outside
auto o2stack = static_cast<o2::data::Stack*>(fMC->GetStack());
if (o2stack->GetCurrentTrackNumber() != mTrackRefLastTrackID) {
mTrackRefLastTrackID = o2stack->GetCurrentTrackNumber();
o2stack->addTrackReference(o2::TrackReference(*fMC, GetDetId()));
}
}
// do not track neutral particles
if (!(fMC->TrackCharge())) {
return kFALSE;
Expand Down Expand Up @@ -744,4 +751,5 @@ void Detector::Reset()
if (!o2::utils::ShmManager::Instance().isOperational()) {
mHits->clear();
}
mTrackRefLastTrackID = -1;
}
1 change: 1 addition & 0 deletions Detectors/PHOS/simulation/src/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ Bool_t Detector::ProcessHits(FairVolume* v)

if (isNewPartile) { // mark track to be kept by stack
stack->addHit(GetDetId());
stack->addTrackReference(o2::TrackReference(*fMC, GetDetId())); // PHOS entry (new superparent)
}

Double_t lostenergy = fMC->Edep();
Expand Down
5 changes: 3 additions & 2 deletions Detectors/TOF/simulation/include/TOFSimulation/Detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ class Detector : public o2::base::DetImpl<Detector>

Int_t mEventNr; // event count
Int_t mTOFSectors[o2::tof::Geo::NSECTORS];
Bool_t mTOFHoles; // flag to allow for holes in front of the PHOS
Int_t mLastChannelID = -1; ///< Last channel seen by the hit
Bool_t mTOFHoles; // flag to allow for holes in front of the PHOS
Int_t mLastChannelID = -1; ///< Last channel seen by the hit
Int_t mTrackRefLastTrackID = -1; //! last track that received a TrackReference in the current event

/// container for data points
std::vector<HitType>* mHits; //!
Expand Down
8 changes: 8 additions & 0 deletions Detectors/TOF/simulation/src/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ void Detector::InitializeO2Detector()
Bool_t Detector::ProcessHits(FairVolume* v)
{
// This method is called from the MC stepping for the sensitive volume only
if (fMC->IsTrackEntering() && !fMC->IsNewTrack() && fMC->TrackCharge() != 0) { // one reference per charged particle, first entry from outside
auto o2stack = static_cast<o2::data::Stack*>(fMC->GetStack());
if (o2stack->GetCurrentTrackNumber() != mTrackRefLastTrackID) {
mTrackRefLastTrackID = o2stack->GetCurrentTrackNumber();
o2stack->addTrackReference(o2::TrackReference(*fMC, GetDetId()));
}
}
if (static_cast<int>(fMC->TrackCharge()) == 0) {
// set a very large step size for neutral particles
return kFALSE; // take only charged particles
Expand Down Expand Up @@ -130,6 +137,7 @@ void Detector::Reset()
mHits->clear();
}
mLastChannelID = -1;
mTrackRefLastTrackID = -1;
}

void Detector::CreateMaterials()
Expand Down
Loading