// ------------------------------------------------------------------------- // ----- FairStack source file ----- // ----- Created 10/08/04 by D. Bertini / V. Friese ----- // ------------------------------------------------------------------------- #include "FairStack.h" #include "FairMCTrack.h" #include "FairRootManager.h" #include "TParticle.h" #include "TClonesArray.h" #include using std::pair; // ----- Default constructor ------------------------------------------- FairStack::FairStack(Int_t size) : FairGenericStack(size) { fTracks = new TClonesArray("FairMCTrack", size); } // ------------------------------------------------------------------------- // ----- Destructor ---------------------------------------------------- FairStack::~FairStack() { } // ------------------------------------------------------------------------- // ----- Public method FillTrackArray ---------------------------------- void FairStack::FillTrackArray() { FairMCTrack a; FairGenericStack::FillTrackArray(kREF, kSTOPHERE, a); } // ------------------------------------------------------------------------- // ----- Public method UpdateTrackIndex -------------------------------- void FairStack::UpdateTrackIndex(TRefArray* detList) { FairMCTrack a; FairGenericStack::UpdateTrackIndex(detList, a); } // ------------------------------------------------------------------------- // ----- Public method Register ---------------------------------------- void FairStack::Register() { FairRootManager::Instance()->Register("MCTrack", "Stack", fTracks,kTRUE); } // ------------------------------------------------------------------------- // ----- Public method Print -------------------------------------------- void FairStack::Print(Int_t iVerbose) const { FairMCTrack a; FairGenericStack::Print(iVerbose, a); } // ------------------------------------------------------------------------- // ----- Public method AddPoint (for current track) -------------------- void FairStack::AddPoint(DetectorId detId) { Int_t iDet = detId; LOG(DEBUG2) << "Add point for Detektor" << iDet << FairLogger::endl; pair a(fCurrentTrack, iDet); if ( fPointsMap.find(a) == fPointsMap.end() ) { fPointsMap[a] = 1; } else { fPointsMap[a]++; } } // ------------------------------------------------------------------------- // ----- Public method AddPoint (for arbitrary track) ------------------- void FairStack::AddPoint(DetectorId detId, Int_t iTrack) { if ( iTrack < 0 ) { return; } Int_t iDet = detId; pair a(iTrack, iDet); if ( fPointsMap.find(a) == fPointsMap.end() ) { fPointsMap[a] = 1; } else { fPointsMap[a]++; } } // ------------------------------------------------------------------------- ClassImp(FairStack)