#include "Stntuple/obj/TStnSiHit.hh" #include #include ClassImp(TStnSiHit) // For now, use the default streamer void TStnSiHit::Streamer(TBuffer &R__b) { UInt_t R__s, R__c; if (R__b.IsReading()) { Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { } TObject::Streamer(R__b); fGlobal.Streamer(R__b); R__b >> fStripNum; R__b >> fLocal; R__b >> fError; if (R__v==1) { // This will soon be just obsolete Int_t q; R__b >> q; fQtotal=q; } else { R__b >> fQtotal; } if (R__v>1) R__b >> fNoise; R__b >> fNstrip; if (R__v>4) { R__b >> fStatus; } else if (R__v==4) { bool stat; R__b >> stat; if (stat) fStatus=0; else fStatus=1; } fDigiCode.Streamer(R__b); R__b.CheckByteCount(R__s, R__c, TStnSiHit::IsA()); } else { R__c = R__b.WriteVersion(TStnSiHit::IsA(), kTRUE); TObject::Streamer(R__b); fGlobal.Streamer(R__b); R__b << fStripNum; R__b << fLocal; R__b << fError; R__b << fQtotal; R__b << fNoise; R__b << fNstrip; R__b << fStatus; fDigiCode.Streamer(R__b); R__b.SetByteCount(R__c, kTRUE); } } TStnSiHit::TStnSiHit() : fGlobal(0.0,0.0,0.0), fStripNum(0.0),fLocal(0.0),fError(-1.0), fQtotal(0.0),fNoise(0.0),fNstrip(0),fStatus(0),fDigiCode(0), fCdfSiHit(NULL) { SetUniqueID(UINT_MAX); } TStnSiHit::~TStnSiHit() {} // Pack the OBSP number into fUniqueID. Allow for up to 3 particles // contributing the same hit. Int_t TStnSiHit::NObsp() const{ if (GetUniqueID()==UINT_MAX) { return 0; } else if (GetUniqueID()>=0x200000) { return 3; } else if (GetUniqueID()>=0x800) { return 2; } else { return 1; } } Int_t TStnSiHit::Obsp(int i) const{ if (i>2) return -1; if (GetUniqueID()==UINT_MAX) return -1; int id = (GetUniqueID() >> i*11) & 0x7ff; if (id==0x7ff) id=-2; // Special treatment of noise hits return id; } void TStnSiHit::SetObsp(int i, int id) { if (i>2 || id >= 0x7ff) return; if (id==-2) id=0x7ff; // Special treatment of noise hits unsigned int uid=GetUniqueID(); if (uid==UINT_MAX) uid=0; // Initialize on first call uid |= (id & 0x7ff) << i*11; SetUniqueID(uid); } void TStnSiHit::Print(Option_t* opt) const { std::cout << "Global (" << fGlobal.X() << "," << fGlobal.Y() << "," << fGlobal.Z() << ")" << ", Strip# " << fStripNum << ", Local " << fLocal << ", Err " << fError << ", Q " << fQtotal << ", Noise " << fNoise << ", Nstrip " << fNstrip << ", Good " << Good() << ", Has bad neighbor " << HasBadNeighbor() << std::endl; fDigiCode.Print(opt); }