void JetInfo::SetDelphesTags(::delphes::Jet const &jet) { DEBUG0; SetBTag(jet.BTag); SetTauTag(jet.TauTag); SetCharge(jet.Charge); }
flag CReport::DoExcelReports() { ASSERT(gs_pPrj); CSVColArray c; char Buff[8192]; const int ReportKeyLen = strlen(ReportKey); int i,j,Pos1; char* p; DWORD dwSize = 0; void* pData = NULL; char* pDat; i = 0; flag found = 0; flag DoMore = 1; flag FoundOne = 0; flag DoReportErr = 1; int jStart = 0; CDdeReportInfo& d = gs_pPrj->ReportInfo; while (DoMore && i<d.iVSearchLen) { sprintf(Buff, "R%dC1:R%dC%d", i+1, i+1, d.iHSearchLen+1); pConv->Request(Buff, &pData, &dwSize); //request for a row if (dwSize) {//got row... pDat = (char*)pData; int nToks = ParseTokens(pDat, c, '\t'); XStrRTrim(c[nToks-1], "\r\t\n "); found = False; j = jStart; while (!found && j<nToks) { if (_strnicmp(c[j], ReportKey, ReportKeyLen)==0) { if (ParseFn(c[j])) found = (bAll || sReportName==sName); else { DoReportErr = 0; ReportError(13L, "Illegal syntax for %s....) R%dC%d", ReportKey, i+1, j+1); found = False; } } j++; } delete pData; jStart = 0; if (found) {//found, now get tags... iStartRow = i+1; iStartCol = j; //get the primary tags... if (bVert) sprintf(Buff, "R%dC%d:R%dC%d", iStartRow+1, iStartCol, iStartRow+lALen, iStartCol); else sprintf(Buff, "R%dC%d:R%dC%d", iStartRow, iStartCol+1, iStartRow, iStartCol+lALen); char c = (bVert ? '\r' : '\t'); pConv->Request(Buff, &pData, &dwSize); if (dwSize) { pDat = (char*)pData; Pos1 = 0; int index = 0; p = strchr(pDat, c); while (p) { p[0] = 0; SetATag(index, &pDat[Pos1]); Pos1 = p - pDat + 1; if (bVert) Pos1++; index++; p = strchr(&pDat[Pos1], c); } if (index<lALen) SetATag(index, &pDat[Pos1]); delete pData; } else { pConv->Release(); // and it should get deleted ReportError(14L, "Unable to get primary tags %s from excel", Buff); return False; } //get the secondary tags... if (bVert) sprintf(Buff, "R%dC%d:R%dC%d", iStartRow, iStartCol+1, iStartRow, iStartCol+lBLen); else sprintf(Buff, "R%dC%d:R%dC%d", iStartRow+1, iStartCol, iStartRow+lBLen, iStartCol); c = (bVert ? '\t' : '\r'); pConv->Request(Buff, &pData, &dwSize); if (dwSize) { pDat = (char*)pData; Pos1 = 0; int index = 0; p = strchr(pDat, c); while (p) { p[0] = 0; SetBTag(index, &pDat[Pos1]); Pos1 = p - pDat + 1; if (!bVert) Pos1++; index++; p = strchr(&pDat[Pos1], c); } if (index<lBLen) SetBTag(index, &pDat[Pos1]); delete pData; } else { pConv->Release(); // and it should get deleted ReportError(15L, "Unable to get secondary tags %s from excel", Buff); return False; } //have the primary and secondry tags, do the report... DoReport(); FoundOne = 1; DoMore = bAll; i--; jStart = j; } } else { pConv->Release(); // and it should get deleted ReportError(11L, "Unable to get request %s from excel", Buff); return False; } i++; } if (!FoundOne) { pConv->Release(); // and it should get deleted if (DoReportErr) ReportError(12L, "Unable to find %s....)", ReportKey); return False; } return True; }