/////////////////////////////////////////////////////////////////////////////// // plain copy of TL2D bank /////////////////////////////////////////////////////////////////////////////// #ifndef STNTUPLE_OBJ_TTl2d_hh #define STNTUPLE_OBJ_TTl2d_hh #include "TObject.h" #include "TMath.h" #include "Stntuple/base/TStnArrayI.hh" #include "CalorGeometry/CalConstants.hh" #include "CalorGeometry/CalParameters.hh" //----------------------------------------------------------------------------- // L2 cluster as stored in TL2D //----------------------------------------------------------------------------- class TTl2dCluster { protected: Int_t fWord[2]; public: TTl2dCluster() {} ~TTl2dCluster(){} // ****** accessors (tbs) // Cluster Em transverse energy // (in units of 1/8 GeV) Int_t EtEm () const { return (fWord[0] & 0xfff ) ;} Int_t EtEmOverflow () { return (fWord[0] & 0x00001000) >> 12;} Float_t EtEmGeV () const { return EtEm()/8.; } // Cluster Had transverse energy Int_t EtHad () const { return (fWord[0] & 0x0fff0000) >> 16;} Int_t EtHadOverflow() { return (fWord[0] & 0x08000000) >> 28;} Float_t EtHadGeV () const { return EtHad()/8.; } // number of towers in the cluster Int_t NTowers () const { return (fWord[1] & 0x000003ff) ; } // iphi and ieta of the cluster seed Int_t IPhi () const { return (fWord[1] & 0x00007c00) >> 10; } Int_t IEta () const { return (fWord[1] & 0x000f8000) >> 15; } // calor type of the seed tower Int_t TowerType () const { return TOWER_TYPE[IEta()]; } Float_t DetEta () const; // trigger segmentation in phi is 24 Float_t Phi () const { return 2*TMath::Pi()*(IPhi()+0.5)/24.; } Int_t L2Buffer () const { return (fWord[1] & 0x00300000) >> 20; } // clustering pass: // 0: low E_T electrons, // 1: high E_T electrons // 2: jets Int_t Pass () const { return (fWord[1] & 0x00c00000) >> 22; } Int_t IsValid () const { return (fWord[1] & 0x80000000) >> 31; } Int_t EtTotal () const { return EtEm()+EtHad(); } Float_t EtTotalGeV () const { return EtTotal()/8.; } Float_t Et () const { return EtTotal()/8.; } Int_t IsCentral () const { return (IEta() >= 7) && (IEta() <=16);} // ClassDef(TTl2dCluster,0) }; //----------------------------------------------------------------------------- // L1 decision info as stored in TL2D //----------------------------------------------------------------------------- class TTl2dClusterIso { protected: Int_t fWord[4]; public: TTl2dClusterIso () {} ~TTl2dClusterIso() {} Int_t ClusteringPath() const { return (fWord[0] & 0x3 ) ;} Int_t Phi () const { return (fWord[0] & 0x0000007c) >> 2 ;} Int_t IsData () const { return (fWord[0] & 0x00000080) >> 7 ;} Int_t BufferNumber () const { return (fWord[0] & 0x00000300) >> 8 ;} Int_t Eta () const { return (fWord[0] & 0x00007c00) >> 10;} Int_t SumOverflow () const { return (fWord[0] & 0x001f0000) >> 16;} Int_t HiLow () const { return (fWord[0] & 0x00800000) >> 23;} // for now i=0 corresponds to Sum1 etc Int_t SumOverflow(Int_t i) { return (fWord[0] & 0x001f0000) >> (16+i);} Int_t Sum1() const { return (fWord[1] ) & 0xffff;} Int_t Sum2() const { return (fWord[1] & 0xffff0000) >> 16 ;} Int_t Sum3() const { return (fWord[2] ) & 0xffff;} Int_t Sum4() const { return (fWord[2] & 0xffff0000) >> 16 ;} Int_t Sum5() const { return (fWord[3] ) & 0xffff;} // ClassDef(TTl2dClusterIso,0) }; //----------------------------------------------------------------------------- // L1 decision info as stored in TL2D //----------------------------------------------------------------------------- class TTl2dL1Decision { protected: Int_t fWord[4]; public: TTl2dL1Decision () {} ~TTl2dL1Decision() {} Int_t L1DecisionBit(Int_t i) { if (i<32) return (fWord[1] >> i) & 0x1; else return (fWord[2] >> (i-32)) & 0x1; } Int_t Et() { return (fWord[3] ) & 0x7ff ; } Int_t Etx() { Int_t etx = (fWord[3] >> 11) & 0x2ff; if (etx > 511) etx = 512-etx; return etx; } Int_t Ety() { Int_t ety = (fWord[3] >> 21) & 0x2ff; if (ety > 511) ety = 512-ety; return ety; } // ClassDef( TTl2dL1Decision,0) }; //----------------------------------------------------------------------------- // XTRP track as stored in TL2D //----------------------------------------------------------------------------- class TTl2dXtrpTrack { protected: Int_t fWord[2]; public: TTl2dXtrpTrack () {} ~TTl2dXtrpTrack(){} // ****** accessors (tbs) // after talking to Evelyn and Nate // give the accessors the right names Int_t MiniPhi () const { return (fWord[0] ) & 0x7; } Int_t LinkerChip () const { return (fWord[0] >> 3) & 0x1ff; } Float_t Phi () const { return (LinkerChip()*8+MiniPhi())/288.*TMath::Pi()/4.; } Int_t PtBin () const { return (fWord[0] & 0x0007f000) >> 12; } Int_t IsolationBit () const { return (fWord[0] & 0x00080000) >> 19; } Int_t ShortBit () const { return (fWord[0] & 0x00100000) >> 20; } // need one more function // returning Pt - implement it as a // standalone function in TStntuple - // it is the same function for XTRP // and XFT tracks Int_t SpareBit () const { return (fWord[0] >> 21) & 0x1 ; } Int_t CmuPt () const { return (fWord[1] ) & 0xf; } Int_t CmxPt () const { return (fWord[1] & 0x000000f0 ) >> 4 ; } Int_t ImaPt () const { return (fWord[1] & 0x00000f00 ) >> 8 ; } Int_t ImbPt () const { return (fWord[1] & 0x0000f000 ) >> 12; } // add missing functions // ClassDef(TTl2dXtrpTrack,0) }; //----------------------------------------------------------------------------- // SVT track as stored in TL2D //----------------------------------------------------------------------------- class TTl2dSvtTrack { protected: Int_t fWord[2]; public: TTl2dSvtTrack (){} ~TTl2dSvtTrack(){} // ****** accessors (tbs) Int_t PhiBin () { return (fWord[0] & 0x00001fff) >> 0; } Int_t Zin () { return (fWord[0] & 0x0000e000) >> 13; } Int_t Zout () { return (fWord[0] & 0x00070000) >> 16; } Int_t D0Bin () { return (fWord[0] & 0x0ff80000) >> 19; } Int_t SignD0 () { return (fWord[0] & 0x10000000) >> 28; } Int_t C0Bin () { return (fWord[1] & 0x000000ff) >> 0; } Int_t SignC0 () { return (fWord[1] & 0x00000100) >> 8; } Int_t Chi2 () { return (fWord[1] & 0x000ffe00) >> 9; } Int_t XftLinkerID() { return (fWord[1] & 0x1ff00000) >> 20; } Int_t ErrorBit () { return (fWord[1] & 0x20000000) >> 29; } Float_t Phi () { return PhiBin()*(TMath::Pi()/4096.0); } Float_t D0 () { return D0Bin ()*0.001 *(SignD0()>0 ? -1. : 1.); } Float_t C0 () { return C0Bin ()*1.17e-5*(SignC0()>0 ? -1. : 1.); } Float_t Pt () { return (C0Bin()==0 ? 1e10 : 0.002116/TMath::Abs(C0()) ); } // ClassDef(TTl2dSvtTrack,0) }; //----------------------------------------------------------------------------- // description of L2 decision card //----------------------------------------------------------------------------- class TTl2dL2Decision { protected: // L2 decision block is of variable length // Word 0 - 3 - prescaled trigger bits // Word 4 - 7 - unprescaled trigger bits // (After Oct 2005 these are 0-5 and 6-11) // Then follows N(L2) trigger words // Actual format of L2 trigger word is uncpesified in // CDF note 4152 Int_t fWord[6]; public: TTl2dL2Decision (){} ~TTl2dL2Decision(){} Int_t PrescaledBit (Int_t i) { return ( fWord[i/32] >> (i - (i/32)*32) ) & 0x1; } // ClassDef( TTl2dL2Decision,0) }; //----------------------------------------------------------------------------- // description of L2 decision card, unprescaled piece //----------------------------------------------------------------------------- class TTl2dL2DecisionUnPrescaled { protected: // L2 decision block is of variable length // Word 0 - 3 - prescaled trigger bits // Word 4 - 7 - unprescaled trigger bits // (After Oct 2005 these are 0-5 and 6-11) // Then follows N(L2) trigger words // Actual format of L2 trigger word is uncpesified in // CDF note 4152 Int_t fWord[6]; public: TTl2dL2DecisionUnPrescaled (){} ~TTl2dL2DecisionUnPrescaled(){} Int_t UnprescaledBit(Int_t i) { return ( fWord[i/32] >> (i - (i/32)*32) ) & 0x1; } // ClassDef( TTl2dL2DecisionUnPrescaled,0) }; class TTl2d { //------------------------------------------------------------------------------ // data members - this is initial version, not bitmap for modules yet //------------------------------------------------------------------------------ protected: TStnArrayI fData; //------------------------------------------------------------------------------ // functions //------------------------------------------------------------------------------ public: // ****** constructors and destructor TTl2d (); ~TTl2d(); // ****** init methods Int_t Init(Int_t NWords); // ****** accessors TStnArrayI* Data () { return &fData; } Int_t NL1Words () const { return fData[ 2]-fData[ 1]; } Int_t NSL7Words () const { return fData[ 3]-fData[ 2]; } Int_t NMuonHeaderWords () const { return fData[ 4]-fData[ 3]; } Int_t NXtrpWords () const { return fData[ 5]-fData[ 4]; } Int_t NSvtWords () const { return fData[ 6]-fData[ 5]; } Int_t NClusterWords () const { return fData[ 7]-fData[ 6]; } Int_t NIsoClusterWords () const { return fData[ 8]-fData[ 7]; } Int_t NXcesWords () const { return fData[ 9]-fData[ 8]; } Int_t NMuonDecisionWords() const { return fData[10]-fData[ 9]; } Int_t NL2TriggerWords () const { return fData[11]-fData[10]; } Int_t NL2ScalerWords () const { return fData[12]-fData[11]; } Int_t NL2DiagnosticWords() const { return fData[13]-fData[12]; } // Number of L2 Clusters Int_t NL2Clusters() const { return (NClusterWords()-1)/2; } Int_t NL2IsoClusters() const { return (NIsoClusterWords()-1)/4; } Int_t NL2Triggers() const { return NL2TriggerWords()-9;} // for some reason length of track // blocks is even...Ask Stephen.. Int_t NXtrpTracks() const { return (NXtrpWords()-2)/2; } Int_t NSvtTracks () const { return (NSvtWords ()-2)/2; } // words used for L2 trigger bits (a subset of NL2TriggerWords) // before Oct 2005 it is 4, after it is 6 Int_t NL2TriggerBitWords() const { Int_t NL2Trig = fData[fData[10]]; return (NL2TriggerWords() - NL2Trig)/2; } // L2 Xtrp track has 2 words TTl2dXtrpTrack* XtrpTrack(Int_t I) const { return ((TTl2dXtrpTrack*) (fData.GetArray()+fData[4]+1+I*2)); } // L2 svt track has 2 words TTl2dSvtTrack* SvtTrack(Int_t I) const { return ((TTl2dSvtTrack*) (fData.GetArray()+fData[5]+1+I*2)); } // Return i-th cluster // Cluster size is 2 Words, may // change in the future TTl2dCluster* Cluster(Int_t I) const { return ((TTl2dCluster*) (fData.GetArray()+fData[6]+1+I*2)); } // ClusterIso is 4 words, may change TTl2dClusterIso* ClusterIso(Int_t I) const { return ((TTl2dClusterIso*) (fData.GetArray()+fData[7]+1+I*4)); } TTl2dL1Decision* L1Decision() const { return ((TTl2dL1Decision*) (fData.GetArray()+fData[1])); } TTl2dL2Decision* L2Decision() const { return ((TTl2dL2Decision*) (fData.GetArray()+fData[10]+1)); } TTl2dL2DecisionUnPrescaled* L2DecisionUnPrescaled() const { return ((TTl2dL2DecisionUnPrescaled*) (fData.GetArray()+fData[10]+1+NL2TriggerBitWords() )); } // Return L2 trigger word like // this for now Int_t L2TriggerWord(Int_t I) { return fData.At(fData[10]+9+I); } void Print(Option_t* opt = "") const ; ClassDef(TTl2d,0) }; #endif