//* $Id: */ // ------------------------------------------------------------------------- // ----- PndGemDigi header file ----- // ----- Created 28/08/06 by V. Friese ----- // ------------------------------------------------------------------------- /** PndGemDigi.h **@author V.Friese **@since 28.08.06 **@version 1.0 ** ** Data class for digital STS information ** Data level: RAW ** ** The detector ID consists of: ** system ID (0-31, kSTS=2), bits 0-4, see base class ** station number (0-255), bits 5-12 ** sector number (0-32767), bits 13-27 ** side (0=front side, 1=back side, bit 28, always 0 for pixel sectors). ** ** The index of the (first) MCPoint having activated this channel ** is accessible via GetMcPointIndex(). **/ #ifndef PNDGEMDIGI_H #define PNDGEMDIGI_H 1 #include #include "FairTimeStamp.h" #include "PndDetectorList.h" #include "TObject.h" class PndGemDigi : public FairTimeStamp { friend std::ostream& operator<< (std::ostream& out, PndGemDigi& digi){ out << "PndGemDigi in: " << digi.GetDetectorId() << "( system = " << digi.GetSystemId() << ", station = " << digi.GetStationNr() << ", sensor = " << digi.GetSensorNr() << ", side = " << digi.GetSide() << "), channelNr = " << digi.GetChannelNr() << ", charge = " << digi.GetCharge() << ", cor = " << digi.GetCor() << ", timestamp "<< digi.GetTimeStamp() << ", from Point(s) "; std::vectorindices = digi.GetIndices(); for (unsigned int i = 0; i < indices.size(); i++){ out << indices[i] << " "; } out << std::endl; return out; } public: /** Default constructor **/ PndGemDigi(); /** Constructor from station number, sector number, ** front/back side and channel number **@param iStation station number (0-255) **@param iSector sector number (0-32767) **@param iSide 0=front side; 1=back side **@param iChannel channel number **/ PndGemDigi(Int_t iDetectorId, Double_t iChannel, Int_t index); PndGemDigi(Int_t iDetectorId, Double_t iChannel, Int_t index, Double_t signal, Double_t time); /** Destructor **/ virtual ~PndGemDigi(); void SetCharge(Double_t iCharge) { fDigiCharge = iCharge; } void SetCor(Double_t iCor) { fDigiCor = iCor; } void AddCharge(Double_t iCharge) { fDigiCharge+= iCharge; } /** Accessors **/ Int_t GetDetectorId() const { return fDetectorId; } Double_t GetChannelNr() const { return fChannelNr; } Int_t GetSystemId() const { return ( ( fDetectorId & ( 31<<27) ) >> 27); } Int_t GetStationNr() const { return ( ( fDetectorId & (8191<< 8) ) >> 8 ); } Int_t GetSensorNr() const { // sensor number within station return ( ( fDetectorId & ( 3<< 6) ) >> 6 ); } Int_t GetSide() const { return ( ( fDetectorId & ( 1<< 5) ) >> 5 ); } // 0=front, 1=back Double_t GetCharge() const { return fDigiCharge; } Double_t GetCor() const { return fDigiCor; } std::vector GetIndices() const { std::vector result; std::set myLinks = GetLinks(); for (std::set::iterator it = myLinks.begin(); it != myLinks.end(); it++){ result.push_back(it->GetIndex()); } return result; } Int_t GetNIndices() {return GetNLinks();} Int_t GetIndex(int i = 0) const{ return GetLink(i).GetIndex();} void AddIndex(int index){ AddLink(FairLink("GEMPoint", index)); } void AddIndex(std::vector index){ SetLinks(FairMultiLinkedData("GEMPoint", index)); } virtual bool equal(FairTimeStamp* data) const{ PndGemDigi* myDigi = dynamic_cast (data); if (myDigi != 0){ if (fDetectorId == myDigi->GetDetectorId() ) return kTRUE; } return false; } virtual bool operator<(const PndGemDigi& myDigi) const{ if (fDetectorId < myDigi.GetDetectorId()) return true; else if (fDetectorId > myDigi.GetDetectorId()) return false; if (fChannelNr < myDigi.GetChannelNr ()) return true; else if (fChannelNr > myDigi.GetChannelNr ()) return false; return false; } virtual bool operator>(const PndGemDigi& myDigi) const{ if (fDetectorId > myDigi.GetDetectorId()) return true; else if (fDetectorId < myDigi.GetDetectorId()) return false; if (fChannelNr > myDigi.GetChannelNr ()) return true; else if (fChannelNr < myDigi.GetChannelNr ()) return false; return false; } virtual bool operator==(const PndGemDigi& myDigi) const{ if (fDetectorId == myDigi.GetDetectorId()) if (fChannelNr == myDigi.GetChannelNr ()) return true; return false; } private: Int_t fDetectorId; // detectorId * 256 + stationId * 16 + sensorId Double_t fChannelNr; // channel number Double_t fDigiCharge; // charge in the digi Double_t fDigiCor; // correlation between digis ClassDef(PndGemDigi,2); }; #endif