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
22 changes: 16 additions & 6 deletions its/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,15 @@ Bool_t Detector::ProcessHits(FairVolume* vol)
mVolumeID = vol->getMCid();

// FIXME: Set a temporary value to mShunt for now, determine its use at a later stage
mShunt = 0;

Int_t trackStatus = 0;
if (gMC->IsTrackEntering()) trackStatus |= 1 << Point::kTrackEntering;
if (gMC->IsTrackInside()) trackStatus |= 1 << Point::kTrackInside;
if (gMC->IsTrackExiting()) trackStatus |= 1 << Point::kTrackExiting;
if (gMC->IsTrackOut()) trackStatus |= 1 << Point::kTrackOut;
if (gMC->IsTrackStop()) trackStatus |= 1 << Point::kTrackStopped;
if (gMC->IsTrackAlive()) trackStatus |= 1 << Point::kTrackAlive;
mStatus = trackStatus;

gMC->TrackPosition(mPosition);
gMC->TrackMomentum(mMomentum);

Expand All @@ -451,6 +458,7 @@ Bool_t Detector::ProcessHits(FairVolume* vol)
if (gMC->IsTrackEntering()) {
mEntrancePosition = mPosition;
mEntranceTime = mTime;
mStatus0 = mStatus;
return kFALSE; // don't save entering hit.
}

Expand All @@ -459,7 +467,7 @@ Bool_t Detector::ProcessHits(FairVolume* vol)
TVector3(mEntrancePosition.X(), mEntrancePosition.Y(), mEntrancePosition.Z()),
TVector3(mPosition.X(), mPosition.Y(), mPosition.Z()),
TVector3(mMomentum.Px(), mMomentum.Py(), mMomentum.Pz()), mEntranceTime, mTime, mLength,
mEnergyLoss, mShunt);
mEnergyLoss, mShunt, mStatus, mStatus0);

// Increment number of Detector det points in TParticle
AliceO2::Data::Stack* stack = (AliceO2::Data::Stack*)gMC->GetStack();
Expand All @@ -468,7 +476,8 @@ Bool_t Detector::ProcessHits(FairVolume* vol)
// Save old position for the next hit.
mEntrancePosition = mPosition;
mEntranceTime = mTime;

mStatus0 = mStatus;

return kTRUE;
}

Expand Down Expand Up @@ -1035,12 +1044,13 @@ void Detector::defineSensitiveVolumes()

Point* Detector::addHit(Int_t trackID, Int_t detID, TVector3 startPos, TVector3 pos,
TVector3 mom, Double_t startTime, Double_t time,
Double_t length, Double_t eLoss, Int_t shunt)
Double_t length, Double_t eLoss, Int_t shunt,
Int_t status, Int_t statusStart)
{
TClonesArray& clref = *mPointCollection;
Int_t size = clref.GetEntriesFast();
return new (clref[size])
Point(trackID, detID, startPos, pos, mom, startTime, time, length, eLoss, shunt);
Point(trackID, detID, startPos, pos, mom, startTime, time, length, eLoss, shunt, status, statusStart);
}

TParticle* Detector::GetParticle() const
Expand Down
3 changes: 2 additions & 1 deletion its/Detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class Detector : public AliceO2::Base::Detector {

/// This method is an example of how to add your own point of type Point to the clones array
Point* addHit(Int_t trackID, Int_t detID, TVector3 startPos, TVector3 pos, TVector3 mom, Double_t startTime,
Double_t time, Double_t length, Double_t eLoss, Int_t shunt);
Double_t time, Double_t length, Double_t eLoss, Int_t shunt, Int_t status, Int_t statusStart);

/// Book arrays for wrapper volumes
virtual void setNumberOfWrapperVolumes(Int_t n);
Expand Down Expand Up @@ -254,6 +254,7 @@ class Detector : public AliceO2::Base::Detector {
Int_t mTrackNumberID; //! track index
Int_t mVolumeID; //! volume id
Int_t mShunt; //! shunt
Int_t mTrkStatusFlag; //! track status flag
TLorentzVector mPosition; //! position
TLorentzVector mEntrancePosition; //! position at entrance
TLorentzVector mMomentum; //! momentum
Expand Down
19 changes: 16 additions & 3 deletions its/Point.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,26 @@ using std::cout;
using std::endl;
using namespace AliceO2::ITS;

Point::Point() : FairMCPoint()
Point::Point() : FairMCPoint(),
fTrackStatus(0),
fTrackStatusStart(0),
fShunt(0),
fStartX(0.),
fStartY(0.),
fStartZ(0.)
{
}

Point::Point(Int_t trackID, Int_t detID, TVector3 startPos, TVector3 pos, TVector3 mom,
Double_t startTime, Double_t time, Double_t length, Double_t eLoss, Int_t shunt)
: FairMCPoint(trackID, detID, pos, mom, time, length, eLoss)
Double_t startTime, Double_t time, Double_t length, Double_t eLoss, Int_t shunt, Int_t status, Int_t statusStart)
: FairMCPoint(trackID, detID, pos, mom, time, length, eLoss),
fTrackStatus(status),
fTrackStatusStart(statusStart),
fShunt(shunt),
fStartX(startPos.X()),
fStartY(startPos.Y()),
fStartZ(startPos.Z()),
fStartTime(startTime)
{
}

Expand Down
63 changes: 54 additions & 9 deletions its/Point.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ namespace ITS {
class Point : public FairMCPoint {

public:
enum PointStatus_t{
kTrackEntering = 0,
kTrackInside,
kTrackExiting,
kTrackOut,
kTrackStopped,
kTrackAlive
};
/// Default constructor
Point();

Expand All @@ -32,26 +40,63 @@ class Point : public FairMCPoint {
/// \param eLoss Energy deposit [GeV]
/// \param shunt Shunt value
Point(Int_t trackID, Int_t detID, TVector3 startPos, TVector3 pos, TVector3 mom, Double_t startTime, Double_t time,
Double_t length, Double_t eLoss, Int_t shunt);
Double_t length, Double_t eLoss, Int_t shunt, Int_t status, Int_t statusStart);

// Default Destructor
virtual ~Point();

Double_t GetStartX() const { return fStartX; }
Double_t GetStartY() const { return fStartY; }
Double_t GetStartZ() const { return fStartZ; }

/// Get Position at the start of the hit
void GetStartPosition(Double_t &x, Double_t &y, Double_t &z) const {
x = fStartX;
y = fStartY;
z = fStartZ;
}
Double_t GetStartTime() const { return fStartTime; }

Int_t GetShunt() const { return fShunt; }
Int_t GetStatus() const { return fTrackStatus; }
Int_t GetStatusStart() const { return fTrackStatusStart; }
Bool_t IsEntering() const { return fTrackStatus & (1 << kTrackEntering); }
Bool_t IsInsideDetector() const { return fTrackStatus & (1 << kTrackInside); }
Bool_t IsExiting() const { return fTrackStatus & (1 << kTrackExiting); }
Bool_t IsOut() const {return fTrackStatus & (1 << kTrackOut); }
Bool_t IsStopped() const { return fTrackStatus & (1 << kTrackStopped); }
Bool_t IsAlive() const { return fTrackStatus & (1 << kTrackAlive); }
Bool_t IsEnteringStart() const { return fTrackStatusStart & (1 << kTrackEntering); }
Bool_t IsInsideDetectorStart() const { return fTrackStatusStart & (1 << kTrackInside); }
Bool_t IsExitingStart() const { return fTrackStatusStart & (1 << kTrackExiting); }
Bool_t IsOutStart() const {return fTrackStatusStart & (1 << kTrackOut); }
Bool_t IsStoppedStart() const { return fTrackStatusStart & (1 << kTrackStopped); }
Bool_t IsAliveStart() const { return fTrackStatusStart & (1 << kTrackAlive); }



/// Output to screen
virtual void Print(const Option_t* opt) const;
friend std::ostream &operator<<(std::ostream &of, const Point &point){
of << "-I- Point: O2its point for track " << point.fTrackID << " in detector " << point.fDetectorID << std::endl;
of << " Position (" << point.fX << ", " << point.fY << ", " << point.fZ << ") cm" << std::endl;
of << " Momentum (" << point.fPx << ", " << point.fPy << ", " << point.fPz << ") GeV" << std::endl;
of << " Time " << point.fTime << " ns, Length " << point.fLength << " cm, Energy loss "
<< point.fELoss * 1.0e06 << " keV" << std::endl;
return of;
}
friend std::ostream &operator<<(std::ostream &of, const Point &point){
of << "-I- Point: O2its point for track " << point.fTrackID << " in detector " << point.fDetectorID << std::endl;
of << " Position (" << point.fX << ", " << point.fY << ", " << point.fZ << ") cm" << std::endl;
of << " Momentum (" << point.fPx << ", " << point.fPy << ", " << point.fPz << ") GeV" << std::endl;
of << " Time " << point.fTime << " ns, Length " << point.fLength << " cm, Energy loss "
<< point.fELoss * 1.0e06 << " keV" << std::endl;
return of;
}


private:
/// Copy constructor
Point(const Point& point);
Point operator=(const Point& point);

Int_t fTrackStatus; ///< MC status flag at hit
Int_t fTrackStatusStart; ///< MC status at starting point
Int_t fShunt; ///< Shunt
Double32_t fStartX, fStartY, fStartZ; ///< Position at the entrance of the active volume
Double32_t fStartTime; ///< Time at the entrance of the active volume

ClassDef(Point, 1)
};
Expand Down