/////////////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////////// #include "Stntuple/data/TTl2d.hh" #include "Stntuple/data/TXftTrack.hh" #include "iostream" ClassImp(TTl2d) //ClassImp(TTl2dCluster) //ClassImp(TTl2dXtrpTrack) //ClassImp(TTl2dSvtTrack) //ClassImp(TTl2dClusterIso) //ClassImp(TTl2dL1Decision) //ClassImp(TTl2dL2Decision) namespace { float TriggerTowerEta [25] = { -3.500, -2.611, -2.331, -2.112, -1.777, -1.523, -1.317, -1.100, -0.916, -0.723, -0.503, -0.260, 0.000, 0.260, 0.503, 0.723, 0.916, 1.100, 1.317, 1.523, 1.777, 2.112, 2.331, 2.611, 3.500 }; } //______________________________________________________________________________ void TTl2d::ReadV1(TBuffer &R__b) { // Stream an object of class TTl2d - do it by hand Version_t R__v = R__b.ReadVersion(); if (R__v) { } fData.Streamer(R__b); } //______________________________________________________________________________ void TTl2d::Streamer(TBuffer &R__b) { // Stream an object of class TTl2d - do it by hand // current version : 2 if (R__b.IsReading()) { Version_t R__v = R__b.ReadVersion(); if (R__v) { } fVersion = -1; if (R__v > 0) { // in v0 vesion has not been written out R__b << fVersion; } fData.Streamer(R__b); if ((fVersion == -1) && (fData.NDataWords() > 0)) { //----------------------------------------------------------------------------- // version of TL2D has not been written out. decide on it // for TTl2D ROOT version 1 version of the data can be either 0 or 1 // we need to keep track of the following: TL2D version, // number of L2 trigger words //----------------------------------------------------------------------------- if (NL2TriggerWords() > 13) fVersion = 0; else fVersion = 1; } //----------------------------------------------------------------------------- // need to define corectly number of words per cluster and number of L2 trigger // bit words // words used for L2 trigger bits (a subset of NL2TriggerWords) // before Oct 2005 it is 4, after it is 6 //----------------------------------------------------------------------------- if (fVersion == 0) { fL2ClusterSize = 2; fNL2TriggerBitWords = NL2TriggerWords() - fData[fData[10]]; } else if (fVersion == 1) { fNL2TriggerBitWords = 6; fL2ClusterSize = 3; } } else { R__b.WriteVersion(TTl2d::IsA()); R__b << fVersion; fData.Streamer(R__b); } } //_____________________________________________________________________________ TTl2d::TTl2d() { } //_____________________________________________________________________________ Int_t TTl2d::Init(Int_t NWords) { fData.Clear(); fData.Reserve(NWords); return 0; } //_____________________________________________________________________________ TTl2d::~TTl2d() { } //----------------------------------------------------------------------------- TTl2dCluster* TTl2d::Cluster(Int_t I) const { if (fVersion == 0) { return ((TTl2dCluster*) (fData.GetArray()+fData[6]+1+I*fL2ClusterSize)); } else if (fVersion == 1) { int nclus(0), iclus(0), ia1, ia2, n; ia1 = fData[6]+3; // 0=METX, 1=METY, 2=MET ia2 = ia1; while (ia1 < fData[7]) { n = (fData[ia1] & 0x03ffffff); if ((I+1) <= (n+nclus)) { ia2 = ia1+(I-nclus)*fL2ClusterSize+1; break; } nclus += n; ia1 += n*fL2ClusterSize+1; } return ((TTl2dCluster*) (fData.GetArray()+ia2)); } else { //----------------------------------------------------------------------------- // this should not be happening //----------------------------------------------------------------------------- return 0; } } //_____________________________________________________________________________ Int_t TTl2d::NL2Clusters() const { if (fVersion == 0) { return (NClusterWords()-1)/2; } else if (fVersion == 1) { int nclus(0), n, ia, ib; ia = fData[6]+3; // 0=METX, 1=METY, 2=MET ib = fData[ 7]; while (ia < ib) { n = (fData[ia] & 0x03ffffff); nclus += n; ia += n*fL2ClusterSize + 1; } return nclus ; } else { //----------------------------------------------------------------------------- // this should not be happening //----------------------------------------------------------------------------- return -1; } } //----------------------------------------------------------------------------- void TTl2d::Print(Option_t* opt) const { if (strcmp(opt,"") == 0 || strcmp(opt,"hex") != 0) { //----------------------------------------------------------------------------- // HEX format //----------------------------------------------------------------------------- std::cout << "\n" ; std::cout << "TL2D Bank: as unsigned int (4-byte words)\n" ; printf(" Index 0 1 2 3 4"); printf(" 5 6 7 8 9\n"); printf("---------- -------- --------- --------- --------- ---------- "); printf("---------- -------- --------- --------- ---------\n"); Int_t nwords = fData.GetSize(); for (int index = 0; index < nwords ; ++index) { // set first column as index if (index%10 == 0) printf(" %9i:",index); printf(" %8x ",fData.At(index)); if (index% 10 == 9) printf("\n"); if (index%100 == 99) printf("\n"); } printf("\n") ; } if (strstr(opt,"structure") != 0) { printf("%3i ncards %2i NL2Clust\n",fData[0],NL2Clusters()); printf("ptr size \n",fData[0]); printf("%3i %4i L1trig \n",fData[ 1],fData[ 2]-fData[ 1]); printf("%3i %4i L1scal \n",fData[ 2],fData[ 3]-fData[ 2]); printf("%3i %4i muon \n",fData[ 3],fData[ 4]-fData[ 3]); printf("%3i %4i XTRP \n",fData[ 4],fData[ 5]-fData[ 4]); printf("%3i %4i SVT \n",fData[ 5],fData[ 6]-fData[ 5]); printf("%3i %4i CLIST \n",fData[ 6],fData[ 7]-fData[ 6]); printf("%3i %4i ISOLIST\n",fData[ 7],fData[ 8]-fData[ 7]); printf("%3i %4i XCES \n",fData[ 8],fData[ 9]-fData[ 8]); printf("%3i %4i MUON D \n",fData[ 9],fData[10]-fData[ 9]); printf("%3i %4i L2trig \n",fData[10],fData[11]-fData[10]); printf("%3i %4i L2Scal \n",fData[11],fData[12]-fData[11]); printf("%3i %4i Diag \n",fData[12],fData[13]-fData[12]); printf("%3i version\n",Version()); printf("%3i NClust\n",NL2Clusters()); printf("%3i NIsoClust\n",NL2IsoClusters()); printf("%3i NL2Trig\n",NL2Triggers()); printf("%3i NL2TrigBitWord\n",NL2TriggerBitWords()); printf("%3i NXtrp\n",NXtrpTracks()); printf("%3i NSvt\n",NSvtTracks()); } if (strstr(opt,"xtrp") != 0) { printf(" ------------------------------- XTRP tracks -----------------------\n"); printf(" i PtBin Pt Chip MiniPhi Phi Phi0 IsoBit ShortBit\n"); int nt = NXtrpTracks(); for (int i=0; iPtBin ()); printf(" %10.3f",TXftTrack::TrackPt(trk->PtBin(), trk->IsolationBit(), trk->ShortBit())); printf(" %3i" ,trk->LinkerChip ()); printf(" %3i" ,trk->MiniPhi ()); printf(" %9.4f" ,trk->Phi ()); printf(" %9.4f" ,trk->Phi()+TXftTrack::TrackDPhi0(trk->PtBin())); printf(" %6i" ,trk->IsolationBit()); printf(" %6i" ,trk->ShortBit ()); printf("\n"); } } //----------------------------------------------------------------------------- // L2 clusters //----------------------------------------------------------------------------- if (strstr(opt,"clus") != 0) { printf(" ------------------------------- L2 clusters ---------------------------\n"); printf(" i pass ieta iphi DetEta Phi EtTotGeV EtEmGeV "); printf("EtHadGeV NTowers Central L2Buf"); if(Version()>=1) printf(" IsoGeV "); printf("\n"); int ncl = NL2Clusters(); for (int i=0; iPass (fVersion)); printf(" %4i" ,cl->IEta ()); printf(" %3i" ,cl->IPhi ()); printf(" %10.3f",cl->DetEta ()); printf(" %8.3f",cl->Phi ()); printf(" %10.3f",cl->EtTotalGeV()); printf(" %10.3f",cl->EtEmGeV ()); printf(" %10.3f",cl->EtHadGeV ()); printf(" %6i" ,cl->NTowers ()); printf(" %6i" ,cl->IsCentral ()); printf(" %6i" ,cl->L2Buffer ()); if(Version()>=1) { printf(" %10.3f" ,cl->SmallestIsoGeV(Version())); } printf("\n"); } } if (strstr(opt,"iso") != 0) { printf(" ------------------------------- L2 cluster iso -------------------------\n"); printf(" i pass ieta iphi IsoMin Iso0 Iso1 Iso1 Iso3 Iso4\n"); int ncl = NL2IsoClusters(); for (int i=0; iSum1(); if(cl->Sum2()Sum2(); if(cl->Sum3()Sum3(); if(cl->Sum4()Sum4(); if(cl->Sum5()Sum5(); printf(" %3i" ,i); printf(" %4i" ,cl->ClusteringPath()); printf(" %4i" ,cl->Eta()); printf(" %3i" ,cl->Phi()); printf(" %8.3f",m/8.0); printf(" %8.3f",cl->Sum1()/8.0); printf(" %8.3f",cl->Sum2()/8.0); printf(" %8.3f",cl->Sum3()/8.0); printf(" %8.3f",cl->Sum4()/8.0); printf(" %8.3f",cl->Sum5()/8.0); printf("\n"); } } } //_____________________________________________________________________________ Float_t TTl2dCluster::DetEta() const { int ieta = IEta(); return (TriggerTowerEta[ieta] + TriggerTowerEta[ieta+1])/2.; }