void MakeNsignalEff_pt15(){ setTDRStyle(); gStyle->SetPalette(1); TH1* medium = makehist("PreSelection_medium_pt15"); TH1* tight = makehist("PreSelection_tight_pt15"); TH1* tight_dxy10= makehist("PreSelection_iso_10_10_pt15"); TH1* tight_anal = makehist("PreSelection_pt15"); TLegend* legendH = new TLegend(0.6, 0.7, 0.9, 0.9); legendH->SetFillColor(kWhite); legendH->SetTextSize(0.03); medium->GetXaxis()->SetTitle("m_{N} GeV"); medium->GetYaxis()->SetTitle("ID efficiency"); medium->SetMarkerColor(kRed); tight->SetMarkerColor(kRed); tight_dxy10->SetMarkerColor(kRed); tight_anal->SetMarkerColor(kRed); medium->SetMarkerStyle(20.); tight->SetMarkerStyle(21.); tight_dxy10->SetMarkerStyle(22.); tight_anal->SetMarkerStyle(23.); legendH->AddEntry(medium, "medium ID", "p"); legendH->AddEntry(tight, "tight ID", "p"); legendH->AddEntry(tight_dxy10, "tight+ dxy ", "p"); legendH->AddEntry(tight_anal, "tight+ dxy+ iso ", "p"); medium->Draw("p"); tight->Draw("psame"); tight_dxy10->Draw("psame"); tight_anal->Draw("psame"); legendH->Draw(); TGraphAsymmErrors * g = new TGraphAsymmErrors(heff); g->SetLineWidth(2.0); g->SetMarkerSize(2.); // g->Draw( "9pXsame" ); CMS_lumi( c1, 2, 11 ); c1->Update(); c1->RedrawAxis(); c1->SaveAs(("/home/jalmond/WebPlots/PreApproval/SignalPlots/SignalEff_presel_med_tight_pt15.pdf" )); }
void MakeNPunziLowMass_lowmasscuts(){ setTDRStyle(); gStyle->SetPalette(1); TH1F* tight_anal1 = makehist("PreSelection_lowmass"); TH1F* tight_anal2 = makehist("PreSelection_lowmass2"); TH1F* tight_anal3 = makehist("PreSelection_lowmass3"); TLegend* legendH = new TLegend(0.6, 0.7, 0.9, 0.9); legendH->SetFillColor(kWhite); legendH->SetTextSize(0.03); tight_anal3->GetXaxis()->SetTitle("m_{N} GeV"); tight_anal3->GetYaxis()->SetTitle("ID efficiency"); tight_anal1->SetMarkerColor(kRed); tight_anal1->SetMarkerStyle(20.); tight_anal2->SetMarkerColor(kRed); tight_anal2->SetMarkerStyle(21.); tight_anal3->SetMarkerColor(kRed); tight_anal3->SetMarkerStyle(22.); legendH->AddEntry(tight_anal1, "LowMass", "p"); legendH->AddEntry(tight_anal2, "LowMass + m(ee) < 60", "p"); legendH->AddEntry(tight_anal3, "LowMass + m(eejj) < 155", "p"); tight_anal3->GetYaxis()->SetRangeUser(0., 0.001); tight_anal3->Draw("p"); tight_anal1->Draw("psame"); tight_anal2->Draw("psame"); legendH->Draw(); TGraphAsymmErrors * g = new TGraphAsymmErrors(heff); g->SetLineWidth(2.0); g->SetMarkerSize(2.); // g->Draw( "9pXsame" ); CMS_lumi( c1, 2, 11 ); c1->Update(); c1->RedrawAxis(); c1->SaveAs(("/home/jalmond/WebPlots/PreApproval/SignalPlots/Punzi_presel_lowmasscuts.pdf" )); return; }
double entropy (byte* buf, size_t bufsize) { int *hist,histlen; hist=(int*)calloc(bufsize,sizeof(int)); histlen=makehist(buf,hist,bufsize); //hist now has no order (known to the program) but that doesn't matter return entropy_helper(hist,histlen,bufsize); }
//----------------------------------------------------------------- // Block hashing: From a file, calculate the MD5 hash value for // a block size of 512 or 4096 bytes in length //----------------------------------------------------------------- LPMD5BLOCK CalculateMD5Blocks(LPTSTR FileName, DWORD dwBlockSize) { HANDLE hashFile = NULL; BOOL bResult = FALSE; DWORD cbRead = 0; CHAR rgbDigits[] = "0123456789abcdef"; DWORD dwFileOffset = 0; BYTE* rgbFile; LPMD5BLOCK MD5Block; LPMD5BLOCK firstMD5Block; // Allocate space for the MD5BLOCK and actual block of data firstMD5Block = MYALLOC0(sizeof(LPMD5BLOCK)); rgbFile = MYALLOC0(dwBlockSize); // Open the file to perform hash hashFile = CreateFile(FileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); // Check for an invalid file handle if (INVALID_HANDLE_VALUE == hashFile) { printf(">>> ERROR: CalculateMD5Blocks: ERROR_OPENING_FILE"); } // Read input file in 512 byte blocks; calculate MD5 and entropy for each block while (bResult = ReadFile(hashFile, rgbFile, dwBlockSize, &cbRead, NULL)) { INT *hist; INT histlen; DOUBLE H; LPTSTR lpszEntropy; // If number of read bytes is 0, break loop due to EOF if (0 == cbRead) { break; } // Calculate the MD5 hash value of block MD5Block = md5Block(rgbFile, dwFileOffset, cbRead); // Calculate the entropy value of block // First get the histogram hist = MYALLOC0(cbRead * sizeof(INT)); histlen = makehist(rgbFile, hist, cbRead); H = entropy(hist, histlen, cbRead); // Second, calculate the actual block entropy lpszEntropy = MYALLOC0(10 * sizeof(TCHAR)); swprintf_s(lpszEntropy, 10, L"%f", H); // Add entropy value to block structure MD5Block->fEntropy = H; // Check block structure was created if (MD5Block == NULL) { printf(">>> ERROR: CalculateMD5Blocks: Error creating MD5BLOCK"); break; } // Add block to FILECONTENT if (dwFileOffset == 0) { firstMD5Block = MD5Block; } else { pushBlock(firstMD5Block, MD5Block); } // Increase the file offset based on number of bytes read dwFileOffset += cbRead; } // Close the file handle CloseHandle(hashFile); // Return the first block (linked to all other blocks) return firstMD5Block; }
double sc_entropy(const char *str, size_t len) { int *hist = (int *)calloc(len, sizeof(int)); int histlen = makehist(str, hist, len); return entropy_internal(hist,histlen,len); }