#ifndef STNTUPLE_TSvxDataBlock #define STNTUPLE_TSvxDataBlock //----------------------------------------------------------------------------- // This is a pared down version of SiHitSet. It is just a // TClonesArray of TStnSiHit objects and some information about what // version of the silicon geometry was used. // // If you want to know which hits were used in which TStnTrack's, you // should use the correspondance object TStnTrackLink. // // Author: Aaron Dominguez (CDF/LBNL) // Date: Apr 17 2001 //----------------------------------------------------------------------------- #include "Stntuple/obj/TStnDataBlock.hh" #include "Stntuple/obj/TStnSiHit.hh" #include "Stntuple/obj/TStnSiDigiCode.hh" #include "TClonesArray.h" #include "TArrayI.h" #include "Stntuple/obj/TStnLinkBlock.hh" // Forward decls for lookup table. class SiHitLookup; class TSvxDataBlock: public TStnDataBlock { friend Int_t StntupleInitSvxDataBlock(TStnDataBlock*, AbsEvent*, int); friend Int_t StntupleTrackLinkBlockLinks(TStnDataBlock*, AbsEvent*, int); friend Int_t StntupleSvxDataBlockLinks(TStnDataBlock*, AbsEvent*, int); public: //------------------------------------------------------------------------------ // data members //------------------------------------------------------------------------------ Int_t fNSiHits; // Total number of hits. TClonesArray* fSiHitList; // Flat array of hits. Int_t* fIndexFirstHit; //! Used for looping over Int_t* fIndexLastHit; //! hits in one halfladder. UInt_t fMaxDigiCode; //! Array size for Indexes. TArrayI fDigiCodes; // List of all detector // elements with hits. // These three arrays are TArrayI fDigiCodeFirstHit; // used to puff up the TArrayI fDigiCodeLastHit; // look-up tables. TStnLinkBlock fSiStripLinkHit; // (Optional) Links to strips used in hit //----------------------------------------------------------------------------- // functions //----------------------------------------------------------------------------- public: // ****** constructors and destructor TSvxDataBlock(); virtual ~TSvxDataBlock(); // ****** init methods Int_t InitEvent(Int_t flag=0); // ****** accessors Int_t NSiHits () const { return fNSiHits; } TClonesArray* SiHitList() const { return fSiHitList; } TStnSiHit* SiHit(int i) const { return (TStnSiHit*) fSiHitList->UncheckedAt(i); } // Get indexes to first and last hit on detector element if you // already know the digicode Int_t IndexFirstHit(unsigned int digiCode) const { return (digiCode<=fMaxDigiCode ? fIndexFirstHit[digiCode] : -1);} Int_t IndexLastHit(unsigned int digiCode) const { return (digiCode<=fMaxDigiCode ? fIndexLastHit[digiCode] : -2);} // Same as above, but if you only know barrel, layer, phi, etc Int_t IndexFirstHit(int barrel, int ladderSeg, int phiWedge, int layer, int side) const { TStnSiDigiCode code(barrel, ladderSeg, phiWedge, layer, side); return (code.fDigiCode<=fMaxDigiCode ? fIndexFirstHit[code.fDigiCode] : -1); } Int_t IndexLastHit(int barrel, int ladderSeg, int phiWedge, int layer, int side) const { TStnSiDigiCode code(barrel, ladderSeg, phiWedge, layer, side); return (code.fDigiCode<=fMaxDigiCode ? fIndexLastHit[code.fDigiCode] : -1); } // ****** modifiers TStnSiHit* NewSiHit() { return new ((*fSiHitList)[fNSiHits++]) TStnSiHit(); } TStnLinkBlock* SiStripLinkHit() {return &fSiStripLinkHit;} // ****** overloaded methods of // TObject void Clear(Option_t* opt=""); #ifndef NO_ROOT_CONST void Print(Option_t* opt="")const ; #else void Print(Option_t* opt=""); #endif private: // Lookup table (which is not streamed out) to cross reference our // SiHit's with Rick's SiHit's. Supposed to be direct lookup and fast. // 2002.12.24 P.M.: in normal life fId is SiHitLookup TObject *fId; //! ClassDef(TSvxDataBlock,4) }; #endif