Beispiel #1
0
void 
DoExportClientLUT(XParms xp, Parms p, int reps)
{
    	int     i, j, done;

    	for (i = 0; i != reps; i++) {
		XieExecutePhotoflo( xp->d, flo, flo_notify );
                XSync( xp->d, 0 );
                ReadNotifyExportData( xp, p, 0, flo, 2,
                        sizeof( unsigned char ), lutSize, 
			&data, &done );
               	WaitForXIEEvent( xp, xieEvnNoPhotofloDone, flo, 0, False ); 
		for ( j = 0; j < lutSize; j++ )
		{
			histos[ j ].value = j;
			histos[ j ].count = (( unsigned char * ) data)[ j ];
		}
                if ( memcmp( lut, data, lutSize * sizeof( unsigned char ) ) )
                {
                        fprintf( stderr, "ExportClientLUT failed\n" );
                        break;
                }
		DrawHistogram( xp, monitorWindow, ( XieHistogramData * ) histos,
			lutSize, xp->vinfo.colormap_size ); 
    	}
}
int main() {
    Vector<int> scores;
    for (int i = 0; i < 10; i++) {
        scores.add(0);
    }
    GetScores(scores);
    DrawHistogram(scores);
    
    return 0;
}
Beispiel #3
0
void UpdateButton(GtkObject *object, gpointer user_data) {

	int 		numBins = 256;
	float 		range[] = {0, 255};
	float 		*ranges[] = { range };


	cvReleaseImage(&imgStack8bit);
	imgStack8bit = AdjustHistogram(imgStack, (float)gtk_adjustment_get_value(adjHistLow), (float)gtk_adjustment_get_value(adjHistHigh));
	UpdateMainImage(imgStack8bit);	

	//Generate histogram from 8bit stacked image
	hist = cvCreateHist(1, &numBins, CV_HIST_ARRAY, ranges, 1);
	cvClearHist(hist);
	
	imgRed = cvCreateImage(cvGetSize(imgStack8bit), 8, 1);
	imgGreen = cvCreateImage(cvGetSize(imgStack8bit), 8, 1);
	imgBlue = cvCreateImage(cvGetSize(imgStack8bit), 8, 1);

	cvSplit(imgStack8bit, imgBlue, imgGreen, imgRed, NULL);

	cvCalcHist(&imgRed, hist, 0, 0);
	imgHistRed = DrawHistogram(hist,1,1);
	cvClearHist(hist);

	cvCalcHist(&imgGreen, hist, 0, 0);
	imgHistGreen = DrawHistogram(hist,1,1);
	cvClearHist(hist);
 
	cvCalcHist(&imgBlue, hist, 0, 0);
	imgHistBlue = DrawHistogram(hist,1,1);
 	cvClearHist(hist);

	//Display the histogram images
	UpdateRedHistImage(imgHistRed);
	UpdateGreenHistImage(imgHistGreen);	 
	UpdateBlueHistImage(imgHistBlue);	 


}
Beispiel #4
0
void 
DoExportClientHistogram(XParms xp, Parms p, int reps)
{
    	int     i, done, numHistos;

    	for (i = 0; i != reps; i++) {
		XieExecutePhotoflo( xp->d, flo, flo_notify );
		XSync( xp->d, 0 );
		numHistos = ReadNotifyExportData( xp, p, 0, flo, histoSrc, 
			sizeof( XieHistogramData ), 0, ( char ** ) &histos, 
			&done ) / sizeof( XieHistogramData );
		WaitForXIEEvent( xp, xieEvnNoPhotofloDone, flo, 0, False );	
		DrawHistogram( xp, monitorWindow, ( XieHistogramData * ) histos,
			numHistos, 1<< xp->vinfo.depth ); 
    	}
}
Beispiel #5
0
// the main function!!
int main()
{
    // Load the image with no noise
    IplImage* img = cvLoadImage("image.jpg", 0);
    IplImage* imgTemp;
    IplImage* imgHist;

    // The default choice
    int noiseType=NOISE_IMPULSE;

    // Initialize the window systems
    int trackPos = 20;
    cvNamedWindow("NOISE_IMPULSE");
    //cvNamedWindow("Histogram");

    imgTemp = GenerateNoise(img, noiseType, trackPos);
    imgHist = DrawHistogram(imgTemp);

    // Display it all
    cvShowImage("NOISE_IMPULSE", imgTemp);
    //cvShowImage("Histogram", imgHist);

    // filter blur
    IplImage *blur = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1);
    IplImage *gaussian = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1);
    IplImage *median = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1);
    cvSmooth(imgTemp, blur, CV_BLUR, 3);
    cvSmooth(imgTemp, gaussian, CV_GAUSSIAN, 3);
    cvSmooth(imgTemp, median, CV_MEDIAN, 3);
    cvShowImage("original", img);
    cvShowImage("blur", blur);
    cvShowImage("gaussian", gaussian);
    cvShowImage("median", median);

    // And release the images. We don't want memory leaks
    //cvReleaseImage(&imgHist);
    cvReleaseImage(&imgTemp);
    cvWaitKey(0);

    // Finaly, exit
    cvReleaseImage(&img);
    return 0;
}
// back-end, delete pen selection
static void
DrawHistogramFull (int cy, int hist_width, int hist_count)
{
    int i;

//    SelectObject( hdcPB, GetStockObject(BLACK_PEN) );

    for( i=0; i<hist_count; i++ ) {
        int index = currFirst + i;
        int x = MarginX + MarginW + index * hist_width;

        /* Draw a separator every 10 moves */
        DrawSeparator( index, x );

        /* Draw histogram */
        if( currPvInfo[i].depth > 0 ) {
            DrawHistogram( x, cy, hist_width, GetPvScore(index), index & 1 );
        }
    }
}
Beispiel #7
0
//------------------------------------------------------------------------------
// DrawNM1
//------------------------------------------------------------------------------
void DrawNM1(TString  hname,
	     TString  xtitle,
	     Int_t    ngroup       = -1,
	     Int_t    precision    = 1,
	     TString  units        = "NULL",
	     Double_t xmin         = -999,
	     Double_t xmax         =  999)
{
  for (UInt_t i=0; i<nLevels; i++)
    {
      if (hname.Contains("PtDiLepton") && !sLevel[i].Contains("Ptll"))    continue;
      if (hname.Contains("NJetsPF30")  && !sLevel[i].Contains("JetVeto")) continue;

      DrawHistogram(hname + sLevel[i] + "_NM1",
		    NM1Label[i] + xtitle,
		    ngroup,
		    precision,
		    units,
		    xmin,
		    xmax);
    }
} 
Beispiel #8
0
void GuiInit(char *guiFilename) {
	GtkBuilder      *builder; 
	GtkWidget       *window;
   	GtkLabel	*labelStatus;

	int 		numBins = 256;
	float 		range[] = {0, 255};
	float 		*ranges[] = { range };

    	builder = gtk_builder_new();
    	gtk_builder_add_from_file(builder, guiFilename, NULL);
	//Assign all the widgets
    	window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
    	imageMain = GTK_WIDGET(gtk_builder_get_object(builder, "imageMain"));
    	
    	imageRedHist = GTK_WIDGET(gtk_builder_get_object(builder, "imageRedHist"));
    	imageGreenHist = GTK_WIDGET(gtk_builder_get_object(builder, "imageGreenHist"));
    	imageBlueHist = GTK_WIDGET(gtk_builder_get_object(builder, "imageBlueHist"));

	labelStatus = GTK_WIDGET(gtk_builder_get_object(builder, "labelStatus"));
    	adjHistLow = GTK_WIDGET(gtk_builder_get_object(builder, "adjHistLow"));
    	adjHistHigh = GTK_WIDGET(gtk_builder_get_object(builder, "adjHistHigh"));
	txtMinHist = GTK_WIDGET(gtk_builder_get_object(builder, "txtMinHist"));
	txtMaxHist = GTK_WIDGET(gtk_builder_get_object(builder, "txtMaxHist"));
	//Assign all the function calls
	gtk_builder_connect_signals(builder, NULL);
	//unreference the builder object
    	g_object_unref(G_OBJECT(builder));

	gtk_widget_show(window);               

	gtk_label_set_text(labelStatus, ""); 
	//convert stacked image to 8bit image
	imgStack8bit = AdjustHistogram(imgStack, (float)0.0, (float)255.0);

	//Generate histogram from 8bit stacked image
	
	hist = cvCreateHist(1, &numBins, CV_HIST_ARRAY, ranges, 1);
	cvClearHist(hist);
	
	imgRed = cvCreateImage(cvGetSize(imgStack8bit), 8, 1);
	imgGreen = cvCreateImage(cvGetSize(imgStack8bit), 8, 1);
	imgBlue = cvCreateImage(cvGetSize(imgStack8bit), 8, 1);

	cvSplit(imgStack8bit, imgBlue, imgGreen, imgRed, NULL);

	cvCalcHist(&imgRed, hist, 0, 0);
	imgHistRed = DrawHistogram(hist,1,1);
	cvClearHist(hist);

	cvCalcHist(&imgGreen, hist, 0, 0);
	imgHistGreen = DrawHistogram(hist,1,1);
	cvClearHist(hist);
 
	cvCalcHist(&imgBlue, hist, 0, 0);
	imgHistBlue = DrawHistogram(hist,1,1);
 	cvClearHist(hist);
	
	//Display the histogram images
	UpdateRedHistImage(imgHistRed);
	UpdateGreenHistImage(imgHistGreen);	 
	UpdateBlueHistImage(imgHistBlue);	 

	//Update the main image with the scaled stack image
	UpdateMainImage(imgStack8bit);	 

		 
	//Enter the GUI main
	gtk_main();
}
int main(int argc, char *argv[])
{
    IplImage* img = cvLoadImage("lowContrastPollen.jpg");
	//IplImage* img = cvLoadImage("darkpollen.jpg");

    setbuf(stdout, NULL);
    if(!img){
      printf("Could not load image file: %s\n",argv[1]);
      exit(0);
    }
    int height,width,step,channels;


    // get the image data
    height    = img->height;
    width     = img->width;
    step      = img->widthStep;
    channels  = img->nChannels;

    // Checking...
    printf("Processing a %dx%d image with %d channels\n",height,width,channels);

    // Histogram.
    int numBins = 256;
    float range[] = {0, 255};
    float *ranges[] = { range };
    CvHistogram *hist = cvCreateHist(1, &numBins, CV_HIST_ARRAY, ranges, 1);
    cvClearHist(hist);

    // Create image(s).
    IplImage* imgRed = cvCreateImage(cvGetSize(img), 8, 1);
    IplImage* imgGreen = cvCreateImage(cvGetSize(img), 8, 1);
    IplImage* imgBlue = cvCreateImage(cvGetSize(img), 8, 1);
    IplImage* imgGrayscale = cvCreateImage(cvGetSize(img), 8, 1);
    IplImage* imgHistEqualized = cvCreateImage(cvGetSize(img), 8, 1);

    // Split image into the color planes.
    cvSplit(img, imgBlue, imgGreen, imgRed, NULL);
    // Convert the image into its corresponding gray-scale image.
	// Add weight to rgb values
    // Y = 0.2126*R + 0.7152*G + 0.0722*B.
	cvAddWeighted( imgRed, 0.2126 , imgGreen, 0.7152 , 0.0, imgGrayscale );
	cvAddWeighted( imgGrayscale, 1.0, imgBlue, 0.0722 , 0.0, imgGrayscale );

	// Compute and draw histogram(s).
    cvClearHist(hist);
    cvCalcHist(&imgGrayscale, hist, 0, 0);
    IplImage* imgHistGrayscale = DrawHistogram(hist);

    // Work on the histogram equalization.
  	cvCopy(imgGrayscale, imgHistEqualized);
    equalizeHistogram(hist, imgHistEqualized);
    //cvEqualizeHist(imgGrayscale, imgHistEqualized);

  	// Compute and draw histogram(s) of the equalized-histogram image.
    cvClearHist(hist);
    cvCalcHist(&imgHistEqualized, hist, 0, 0);
    IplImage* imgHistHistEqualized = DrawHistogram(hist);

    //show window(s).
    cvNamedWindow("Gray scale");
    cvNamedWindow("Gray scale image");
    cvNamedWindow("Histogram equalization");
    cvNamedWindow("Histogram equalization image");

    cvShowImage("Gray scale", imgHistGrayscale);
    cvShowImage("Gray scale image", imgGrayscale);
    cvShowImage("Histogram equalization", imgHistHistEqualized);
    cvShowImage("Histogram equalization image", imgHistEqualized);

    cvWaitKey(0);

    // destroy window(s).
    cvDestroyWindow("Gray scale");
    cvDestroyWindow("Gray scale image");
    cvDestroyWindow("Histogram equalization");
    cvDestroyWindow("Histogram equalization image");

    // release the image
    cvReleaseImage(&imgGrayscale);
    cvReleaseImage(&imgHistGrayscale);
    cvReleaseImage(&imgHistEqualized);
    cvReleaseImage(&imgHistHistEqualized);

    return 0;
}
Beispiel #10
0
//------------------------------------------------------------------------------
// drawDistributions
//------------------------------------------------------------------------------
void drawDistributions(Int_t    njet       = 0,
		       TString  channel    = "All",
		       Double_t luminosity = 19365,
		       TString  format     = "png",
		       Bool_t   drawRatio  = true,
		       Bool_t   dataDriven = true,
		       Bool_t   setLogy    = false)
{
  _channel    = channel;
  _njet       = njet;
  _luminosity = luminosity;
  _format     = format;
  _dataDriven = dataDriven;
  _setLogy    = setLogy;

  process[iData]   = "DataRun2015";
  process[itt]     = "TTbar";
  process[itW]     = "TW";
  process[iWW]     = "WWTo2L2Nu";
  process[iWZ]     = "WZ3LNu";
  //process[iWZ]     = "WZ";
  process[iZZ]     = "ZZ";
  process[iWg]     = "WgammaNoStar";
  process[iWgSMu]  = "WgammaStarToLNuMuMu";
  process[iWgSEl]  = "WgammaStarToLNuEE";
  process[iWj]     = "WJetsLNu";
  process[iDY]     = "DY";
  process[iDYtau]  = "DYtautau";
  process[iZgamma] = "Zgamma";
  process[iH125]   = "HWW125";


  color[iData]   = kBlack;
  color[itt]     = kYellow;
  color[itW]     = kYellow-2;
  color[iWW]     = kAzure-9;
  color[iWZ]     = kAzure;
  color[iZZ]     = kBlack;
  color[iWg]     = kViolet;
  color[iWgSMu]  = kAzure-2;
  color[iWgSEl]  = kPink;
  color[iWj]     = kGray+1;
  color[iDY]     = kGreen+3;
  color[iDYtau]  = kGreen-4;
  color[iZgamma] = kGreen-6;
  color[iH125]   = kRed;

  systError[iData] = 0.0;
// syst. / yield for the 0-jet bin. These numbers are for the WW study. We need to calculate systematic uncertainty for the case ggH
  systError[itt]     = 21.7 / 166.0;
  systError[itW]     = 21.7 / 166.0;
  systError[iWW]     = 67.7 / 939.5;
  systError[iWZ]     =  3.3 /  41.2;
  systError[iZZ]     =  3.3 /  41.2;
  systError[iWg]     =  6.1 /  19.3;
  systError[iWj]     = 36.9 / 102.5;
  systError[iDY]     =  9.8 /  58.2;
  systError[iDYtau]  =  9.8 /  58.2;
  systError[iZgamma] =  2.7 /  36.1;
  systError[iH125]   =  2.7 /  36.1;

  MakeDirectory();

  gStyle->SetHatchesLineWidth(1.00);
  gStyle->SetHatchesSpacing  (0.55);


  // Read input files
  //----------------------------------------------------------------------------
  TString path_MC   = Form("../MakeHisto/rootfiles/%djet/%s/", _njet, _channel.Data());
  TString path_Data = Form("../MakeHisto/rootfiles/%djet/%s/", _njet, _channel.Data());
  //TString path_MC   = Form("rootfiles_WgIso_mll_110_met25pt30103/%djet/%s/", _njet, _channel.Data());
  //TString path_Data = Form("rootfiles_WgIso_mll_110_met25pt30103/%djet/%s/", _njet, _channel.Data());
  //TString path_MC   = Form("rootfiles_LeptIDbyGstar_mll_110_met25pt30tight103/%djet/%s/", _njet, _channel.Data());
  //TString path_Data = Form("rootfiles_LeptIDbyGstar_mll_110_met25pt30tight103/%djet/%s/", _njet, _channel.Data());
  //TString path_MC   = Form("rootfiles_LeptIDbyGstar_mll_110_met25pt30103/%djet/%s/", _njet, _channel.Data());
  //TString path_Data = Form("rootfiles_LeptIDbyGstar_mll_110_met25pt30103/%djet/%s/", _njet, _channel.Data());
  //TString path_MC   = Form("rootfiles_MC/%djet/%s/", _njet, _channel.Data());
  //TString path_Data = Form("rootfiles/%djet/%s/", _njet, _channel.Data());

  for (UInt_t ip=0; ip<nProcesses; ip++)
  {
    if(ip == iData){
      input[ip] = new TFile(path_Data + process[ip] + ".root", "read");
    }else{
      input[ip] = new TFile(path_MC + process[ip] + ".root", "read");
    }
  }


  DrawHistogram("hInvDimu_Recon",  "m_{#font[12]{ll}}", 1, 0, "GeV",0, 110,false);


}
Beispiel #11
0
// Ah, the main function!!
int main()
{
	// Load the image with no noise
	IplImage* img = cvLoadImage("noise_tester.jpg", 0);
	IplImage* imgTemp;
	IplImage* imgHist;

	// The default choice
	int noiseType=NOISE_UNIFORM;

	// Initialize the window systems
	int trackPos = 20;
	cvNamedWindow("Image");
	cvNamedWindow("Histogram");
	cvCreateTrackbar("amount", "Image", &trackPos, 255, NULL);

	// The main loop
	bool runLoop = true;
	printf("Press space to exit\n\n");
	while(runLoop)
	{
		// Generate noise and its corresponding histogram
		imgTemp = GenerateNoise(img, noiseType, trackPos);
		imgHist = DrawHistogram(imgTemp);
		
		// Display it all
		cvShowImage("Image", imgTemp);
		cvShowImage("Histogram", imgHist);

		// And release the images. We don't want memory leaks
		cvReleaseImage(&imgHist);
		cvReleaseImage(&imgTemp);

		// Check for a key press
		char keyPress = cvWaitKey(10);

		switch(keyPress)
		{
		case '1':
			noiseType = NOISE_UNIFORM;
			printf("Uniform noise\n");
			break;

		case '2':
			noiseType = NOISE_GAUSSIAN;
			printf("Gaussian noise\n");
			break;

		case '3':
			noiseType = NOISE_EXPONENTIAL;
			printf("Exponential noise\n");
			break;

		case '4':
			noiseType = NOISE_RAYLEIGH;
			printf("Rayleigh noise\n");
			break;

		case '5':
			noiseType = NOISE_GAMMA;
			printf("Gamma noise\n");
			break;

		case '6':
			noiseType = NOISE_IMPULSE;
			printf("Impulse/Salt and pepper noise\n");
			break;

		case ' ':
			runLoop = false;
			break;
		}
	}

	// Finally, exit
	cvReleaseImage(&img);
	return 0;
}
Beispiel #12
0
//------------------------------------------------------------------------------
// drawDistributions
//------------------------------------------------------------------------------
void drawDistributions_SS(Int_t    njet       = 10,
		          TString  channel    = "SS",
		          Double_t luminosity = 19365,
		          TString  format     = "png",
		          Bool_t   drawRatio  = true,
		          Bool_t   dataDriven = true,
		          Bool_t   setLogy    = false)
{
  _channel    = channel;
  _njet       = njet;
  _luminosity = luminosity;
  _format     = format;
  _dataDriven = dataDriven;
  _setLogy    = setLogy;

  MakeDirectory();

  gStyle->SetHatchesLineWidth(1.00);
  gStyle->SetHatchesSpacing  (0.55);


  cout<<"Njet: "<<_njet<<"++++++++++++++++++++"<<endl;
  // Read input files
  //----------------------------------------------------------------------------
  if (_njet == 10){
    TString path_0jet = Form("rootfiles/0jet/%s/", _channel.Data());
    TString path_1jet = Form("rootfiles/1jet/%s/", _channel.Data());
  }

  for (UInt_t ip=0; ip<nProcesses; ip++){
    if(_njet == 10){
      input_0[ip] = new TFile(path_0jet + process[ip] + ".root", "read");
      input_1[ip] = new TFile(path_1jet + process[ip] + ".root", "read");
    }else{
      //input[ip] = new TFile(path + process[ip] + ".root", "read");
    }
  }


  // DY distributions
  //----------------------------------------------------------------------------
  if (0) {
    DrawHistogram("hMassInZevents45.00",  "m_{#font[12]{ll}}", 1, 0, "GeV", 76, 106);
    DrawHistogram("hMassOutZevents45.00", "m_{#font[12]{ll}}", 5, 0, "GeV");
  }


  // Top distributions
  //----------------------------------------------------------------------------
  if (1) {
    //DrawHistogram("hbTagDisNTopTaggedTopControlRegion", "2^{nd} jet TCHE", 5, 1, "NULL", -999, 999, false);
    //DrawHistogram("hbTagDisNTopControlRegion",          "2^{nd} jet TCHE", 5, 1, "NULL", -999, 999, false);
    //DrawHistogram("hbTagDisTopTaggedEvents",            "2^{nd} jet TCHE", 5, 1, "NULL", -999, 999, false);

    //DrawHistogram("hbTagDisNTopTaggedTopControlRegion_channel", "channel", 1, 1, "NULL", -999, 999, false);
    DrawHistogram("hbTagDisNTopControlRegion_channel",          "channel", 1, 1, "NULL", -999, 999, false);
    //DrawHistogram("hbTagDisTopTaggedEvents_channel",            "channel", 1, 1, "NULL", -999, 999, false);

    //DrawHistogram("hbTagDisNTopTaggedTopControlRegion_dphill", "#Delta#phi_{ll} [^{0}]", 1, 1, "NULL", -999, 999, false);
    DrawHistogram("hbTagDisNTopControlRegion_dphill",          "#Delta#phi_{ll} [^{0}]", 1, 1, "NULL", -999, 999, false);
    //DrawHistogram("hbTagDisTopTaggedEvents_dphill",            "#Delta#phi_{ll} [^{0}]", 1, 1, "NULL", -999, 999, false);

    //DrawHistogram("hbTagDisNTopTaggedTopControlRegion_jetpt1", "p_{T}^{jet, max} [GeV/c]", 1, 1, "NULL", -999, 999, false);
    DrawHistogram("hbTagDisNTopControlRegion_jetpt1",          "p_{T}^{jet, max} [GeV/c]", 1, 1, "NULL", -999, 999, false);
    //DrawHistogram("hbTagDisTopTaggedEvents_jetpt1",            "p_{T}^{jet, max} [GeV/c]", 1, 1, "NULL", -999, 999, false);

    //_setLogy    = true;
    //DrawHistogram("hbTagDisNTopTaggedTopControlRegion_bdt1", "BDT1 distribution", 5, 1, "NULL", -999, 999, false);
    //DrawHistogram("hbTagDisNTopControlRegion_bdt1",          "BDT1 distribution", 5, 1, "NULL", -999, 999, false);
    //DrawHistogram("hbTagDisTopTaggedEvents_bdt1",            "BDT1 distribution", 5, 1, "NULL", -999, 999, false);

    //DrawHistogram("hbTagDisNTopTaggedTopControlRegion_bdt2", "BDT2 distribution", 5, 1, "NULL", -999, 999, false);
    //DrawHistogram("hbTagDisNTopControlRegion_bdt2",          "BDT2 distribution", 5, 1, "NULL", -999, 999, false);
    //DrawHistogram("hbTagDisTopTaggedEvents_bdt2",            "BDT2 distribution", 5, 1, "NULL", -999, 999, false);

    //DrawHistogram("hbTagDisNTopTaggedTopControlRegion_jetmva1", "1st jet JetMVA", 1, 1, "NULL", -999, 999, false);
    //DrawHistogram("hbTagDisNTopControlRegion_jetmva1",          "1st jet JetMVA", 1, 1, "NULL", -999, 999, false);
    //DrawHistogram("hbTagDisTopTaggedEvents_jetmva1",            "1st jet JetMVA", 1, 1, "NULL", -999, 999, false);
    //_setLogy    = false;

    //DrawHistogram("hbTagDisNTopTaggedTopControlRegion_HwidthMVAbkg", "MVA (Sig, Bkg)", 1, 1, "NULL", -999, 999, false);
    DrawHistogram("hbTagDisNTopControlRegion_HwidthMVAbkg",          "MVA (Sig, Bkg)", 1, 1, "NULL", -999, 999, false);
    DrawHistogram("hbTagDisTopTaggedEvents_HwidthMVAbkg",            "MVA (Sig, Bkg)", 1, 1, "NULL", -999, 999, false);
    DrawHistogram("hbTagDisTopTaggedEvents_HwidthMVAbkg_nobveto_tche1",            "MVA (Sig, Bkg)", 1, 1, "NULL", -999, 999, false);
    DrawHistogram("hbTagDisTopTaggedEvents_HwidthMVAbkg_nobveto",            "MVA (Sig, Bkg)", 1, 1, "NULL", -999, 999, false);
    DrawHistogram("hbTagDisTopTaggedEvents_HwidthMVAbkg_tche1",            "MVA (Sig, Bkg)", 1, 1, "NULL", -999, 999, false);
    
    //DrawHistogram("hbTagDisNTopTaggedTopControlRegion_softtche", "TCHE b-Tag (15<p_{T}^{jet}<30 GeV/c)", 1, 1, "NULL", -999, 999, false);
    DrawHistogram("hbTagDisNTopControlRegion_softtche",          "TCHE b-Tag (15<p_{T}^{jet}<30 GeV/c)", 1, 1, "NULL", -999, 999, false);
    //DrawHistogram("hbTagDisTopTaggedEvents_softtche",            "TCHE b-Tag (15<p_{T}^{jet}<30 GeV/c)", 1, 1, "NULL", -999, 999, false);

    //DrawHistogram("hbTagDisNTopTaggedTopControlRegion_hardtche", "TCHE b-Tag (p_{T}^{jet}>30 GeV/c)", 1, 1, "NULL", -999, 999, false);
    DrawHistogram("hbTagDisNTopControlRegion_hardtche",          "TCHE b-Tag (p_{T}^{jet}>30 GeV/c)", 1, 1, "NULL", -999, 999, false);
    //DrawHistogram("hbTagDisTopTaggedEvents_hardtche",            "TCHE b-Tag (p_{T}^{jet}>30 GeV/c)", 1, 1, "NULL", -999, 999, false);
	
    //Subtraction("hbTagDisNTopTaggedTopControlRegion_channel", "channel", 1, 1, "NULL", -999, 999, false);
    //Subtraction("hbTagDisNTopControlRegion_channel",          "channel", 1, 1, "NULL", -999, 999, false);
    //Subtraction("hbTagDisTopTaggedEvents_channel",            "channel", 1, 1, "NULL", -999, 999, false);
  }


  // PAS distributions
  //----------------------------------------------------------------------------
  if (0) {
    DrawHistogram("hPtLepton1TopTagging",       "p_{T}^{max}",                 5, 0, "GeV",  0, 160);
    DrawHistogram("hPtLepton2TopTagging",       "p_{T}^{min}",                 5, 0, "GeV", 15,  80);
    DrawHistogram("hPtDiLeptonTopTagging",      "p_{T}^{#font[12]{ll}}",       5, 0, "GeV", 40, 120);
    DrawHistogram("hMinvTopTagging",            "m_{#font[12]{ll}}",           5, 0, "GeV");
    DrawHistogram("hDeltaPhiLeptonsTopTagging", "#Delta#phi_{#font[12]{ll}}", -1, 1, "rad");
    
  }


  // N-1 distributions
  //----------------------------------------------------------------------------
  if (0) {
    DrawNM1("hDeltaPhiLeptons", "#Delta#phi_{#font[12]{ll}}", -1, 1, "rad");
    DrawNM1("hMinv",            "m_{#font[12]{ll}}",           4, 0, "GeV");
    DrawNM1("hPtDiLepton",      "p_{T}^{#font[12]{ll}}",       4, 0, "GeV", 0, 120);
    DrawNM1("hNJetsPF30",       "N_{jets}",                   -1, 0, "NULL");
  }
}
void process_image(){







///////////////////////////////////////////////////////
//////////////////// PUPIL/////////////////////////////
///////////////////////////////////////////////////////

int numBins = 256;
float range[] = {0, 255};
float *ranges[] = { range };
 
 CvHistogram *hist = cvCreateHist(1, &numBins, CV_HIST_ARRAY, ranges, 1);
 cvClearHist(hist);


	cvCalcHist(&smooth, hist, 0, 0);
    IplImage* imgHist = DrawHistogram(hist,1,1);
    cvClearHist(hist);
	

//cvShowImage("hist", imgHist);



cvThreshold(smooth,pupil,50,255,CV_THRESH_BINARY);
//cvShowImage( "pupi_binary",pupil);

cvCanny(pupil,pedge,40,50);
//cvShowImage( "pupil_edge",pedge);


//////////////////////////////////////////////////////////
//////////////////////IRIS////////////////////////////////
//////////////////////////////////////////////////////////

//cvEqualizeHist(smooth,smooth);
//cvShowImage("Equalized",smooth);

cvThreshold(smooth,iris,100,255,CV_THRESH_BINARY); //115
//cvShowImage( "iris_binary",iris);


//cvSobel(iris,iedge,1,0,3);
cvCanny(iris,iedge,1,255);
//cvShowImage( "iris_edge",iedge);


/////////////////////////////////////////////////////////
///////////////////////Eyelids///////////////////////////
/////////////////////////////////////////////////////////



cvThreshold(smooth,eyelid_mask,150,255,CV_THRESH_OTSU);
cvNot(eyelid_mask,eyelid_mask);
//cvShowImage("eyelid",eyelid_mask);



//cvAdaptiveThreshold(smooth,contour,255,CV_ADAPTIVE_THRESH_MEAN_C,CV_THRESH_BINARY,9,1);

//cvThreshold(smooth,contour,130,255,CV_THRESH_BINARY);
//cvShowImage( "contour",contour);


//CvSeq* firstContour = NULL;
//CvMemStorage* cstorage = cvCreateMemStorage(0);
//cvFindContours(con, cstorage, &firstContour,sizeof(CvContour), CV_RETR_LIST,CV_CHAIN_APPROX_SIMPLE);
//cvDrawContours(dst,firstContour,CV_RGB(0,255,0),CV_RGB(0,0,255),10,2,8);



CvMemStorage* storage_pupil = cvCreateMemStorage(0);

CvSeq* presults = cvHoughCircles(pedge,storage_pupil,CV_HOUGH_GRADIENT,2,src->width,255,1);
for( int i = 0; i < presults->total; i++ )
{
float* p = (float*) cvGetSeqElem( presults, i );
CvPoint pt = cvPoint( cvRound( p[0] ),cvRound( p[1] ) );

xp=cvRound( p[0] );
yp=cvRound( p[1] );
rp=p[2];

cvCircle(dst,pt,cvRound( p[2] ),CV_RGB(0,255,255),1,400);


xroi= xp-shift;
yroi= yp-shift;

cvRectangle(dst,cvPoint(( p[0] )-shift,p[1]-shift),cvPoint(( p[0] )+shift,p[1]+shift),CV_RGB(255,0,255), 1);

CvRect roi= cvRect(xroi  ,yroi,shift*2,shift*2);



cvSetImageROI( iedge, roi );


//cvShowImage("ROI",iedge);


}
////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////

CvMemStorage* storage_iris = cvCreateMemStorage(0);

CvSeq* iresults = cvHoughCircles(iedge,storage_iris,CV_HOUGH_GRADIENT,2,src->width,1,50,50);
for( int i = 0; i < iresults->total; i++ )
{
float* p = (float*) cvGetSeqElem( iresults, i );

CvPoint pt = cvPoint( cvRound( p[0] )+xroi,cvRound( p[1] )+yroi );
cvCircle(dst,pt,cvRound( p[2] ),CV_RGB(255,0,0),1,400);


xi=cvRound( p[0] )+xroi;
yi=cvRound( p[1] )+yroi;
ri=(p[2]);


cvCircle(iris_mask,pt,cvRound( p[2] ),CV_RGB(255, 255, 255),-1, 8, 0);
//cvShowImage("iris_mask",iris_mask);


}
///////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
///////////////////////////////////////////


cvResetImageROI(iedge);

cvAnd(dst,dst,res,iris_mask);
//cvShowImage("iris_mask",res);

cvAnd(res,res, mask, eyelid_mask);
//cvShowImage("Mask",mask);



//cvLogPolar(mask,finalres,cvPoint2D32f (xp,yp),100, CV_INTER_LINEAR  );
//cvShowImage("Final Result",finalres);


/////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
/*




*/



}
Beispiel #14
0
//void PlotSimPbPb(char *filename = "rootFiles/LHC11a4_bis/Et.ESD.new.sim.LHC11a4_bis.root", Bool_t sim = kFALSE, Bool_t sysErr = kTRUE, char *corrfilename = "rootFiles/corrections/corrections.LHC11a4_bis.PbPb.ForData.root", Bool_t isEMCal = kTRUE, Bool_t isTPC = kTRUE){
void PlotHadEtDistributions(char *filename = "rootFiles/LHC10hPass2/Et.ESD.sim.LHC10hPass2.Run139465.root",char *corrfilename = "rootFiles/corrections/corrections.LHC11a10a_bis.PbPb.139465.ForData.root"){
  gStyle->SetOptTitle(0);
  gStyle->SetOptStat(0);
  gStyle->SetOptFit(0);

  TFile *file = new TFile(filename);
  TCanvas *c1 = new TCanvas("c1","Reconstructed Hadronic Et",700,500);
  c1->SetTopMargin(0.04);
  c1->SetRightMargin(0.04);
  c1->SetBorderSize(0);
  c1->SetFillColor(0);
  c1->SetFillColor(0);
  c1->SetBorderMode(0);
  c1->SetFrameFillColor(0);
  c1->SetFrameBorderMode(0);
  c1->SetLeftMargin(0.140805);
  c1->SetRightMargin(0.0158046);
  c1->SetBottomMargin(0.16);
  c1->SetTopMargin(0.0168776);
  c1->SetLogy();
//   TH1D *histoHadRecoAll = out2->FindObject("RecoHadEtFullAcceptanceTPC");
//   histoHadRecoAll->Rebin(2);
//   histoHadRecoAll->Draw();
  TH1D *histoHadRecoAll = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPC","",2,1,20,1.0);
  Float_t scale = 1.0 / histoHadRecoAll->GetEntries() / histoHadRecoAll->GetXaxis()->GetBinWidth(1);
  histoHadRecoAll->Scale(scale);
  histoHadRecoAll->GetXaxis()->SetRange( 1, histoHadRecoAll->GetXaxis()->FindBin(2700));
  histoHadRecoAll->SetMinimum(1e-6);
  histoHadRecoAll->SetMaximum(5e-3);
  histoHadRecoAll->GetXaxis()->SetLabelSize(0.06);
  histoHadRecoAll->GetYaxis()->SetLabelSize(0.06);
  histoHadRecoAll->GetXaxis()->SetTitleSize(0.07);
  histoHadRecoAll->GetYaxis()->SetTitleSize(0.07);
  histoHadRecoAll->GetXaxis()->SetTitle("dE_{T}^{had}/d#eta (GeV)");
  histoHadRecoAll->GetYaxis()->SetTitle("1/N_{eve} dN_{eve}/d(dE_{T}^{had}/d#eta) (1/GeV)");
  Int_t rebin = 4;
  Int_t color = 0;
  TH1D *histoHadReco0 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB0","same",rebin,colors[color],markers[color],scale);
  color++;
  TH1D *histoHadReco1 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB1","same",rebin,colors[color],markers[color],scale);
  color++;
  TH1D *histoHadReco2 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB2","same",rebin,colors[color],markers[color],scale);
  color++;
  TH1D *histoHadReco3 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB3","same",rebin,colors[color],markers[color],scale);
  color++;
  TH1D *histoHadReco4 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB4","same",rebin,colors[color],markers[color],scale);
  color++;
  rebin = 2;
  TH1D *histoHadReco5 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB5","same",rebin,colors[color],markers[color],scale);
  color++;
  TH1D *histoHadReco6 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB6","same",rebin,colors[color],markers[color],scale);
  color++;
  TH1D *histoHadReco7 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB7","same",rebin,colors[color],markers[color],scale);
  color++;
  TH1D *histoHadReco8 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB8","same",rebin,colors[color],markers[color],scale);
  TH1D *histoHadReco9 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB9","same",rebin,colors[color],markers[color],scale,kFALSE);
  color++;
  histoHadReco8->Add(histoHadReco9);
  rebin = 1;
  TH1D *histoHadReco10 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB10","same",rebin,colors[color],markers[color],scale);
  TH1D *histoHadReco11 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB11","same",rebin,colors[color],markers[color],scale,kFALSE);
  color++;
  histoHadReco10->Add(histoHadReco11);
  TH1D *histoHadReco12 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB12","same",rebin,colors[color],markers[color],scale);
  TH1D *histoHadReco13 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB13","same",rebin,colors[color],markers[color],scale,kFALSE);
  color++;
  histoHadReco12->Add(histoHadReco13);
  TH1D *histoHadReco14 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB14","same",rebin,colors[color],markers[color],scale);
  TH1D *histoHadReco15 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB15","same",rebin,colors[color],markers[color],scale,kFALSE);
  TH1D *histoHadReco16 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB16","same",rebin,colors[color],markers[color],scale,kFALSE);
  TH1D *histoHadReco17 = DrawHistogram(out2,"RecoHadEtFullAcceptanceTPCCB17","same",rebin,colors[color],markers[color],scale,kFALSE);
  color++;
  histoHadReco14->Add(histoHadReco15);
  //histoHadReco14->Add(histoHadReco16);
  //histoHadReco14->Add(histoHadReco17);
  TLegend *leg1 = new TLegend(0.66523,0.64346,0.784483,0.964135);//(0.505747,0.64346,0.625,0.964135);
  leg1->SetFillStyle(0);
  leg1->SetFillColor(0);
  leg1->SetBorderSize(0);
  leg1->SetTextSize(0.056962);
  leg1->AddEntry(histoHadReco0,"0-5%");
  leg1->AddEntry(histoHadReco1,"5-10%");
  leg1->AddEntry(histoHadReco2,"10-15%");
  leg1->AddEntry(histoHadReco3,"15-20%");
  leg1->AddEntry(histoHadReco4,"20-25%");
  leg1->AddEntry(histoHadReco5,"25-30%");
  leg1->Draw();
  TLegend *leg2 = new TLegend(0.824713,0.64346,0.945402,0.964135);//(0.66523,0.64346,0.784483,0.964135);
  leg2->SetFillStyle(0);
  leg2->SetFillColor(0);
  leg2->SetBorderSize(0);
  leg2->SetTextSize(0.056962);
  leg2->AddEntry(histoHadReco6,"30-35%");
  leg2->AddEntry(histoHadReco7,"35-40%");
  leg2->AddEntry(histoHadReco8,"40-50%");
  //leg2->AddEntry(histoHadReco9,"45-50%");
  leg2->AddEntry(histoHadReco10,"50-60%");
  //leg2->AddEntry(histoHadReco11,"55-60%");
  leg2->AddEntry(histoHadReco12,"60-70%");
  //leg3->AddEntry(histoHadReco13,"65-70%");
  leg2->AddEntry(histoHadReco14,"70-80%");
  leg2->Draw();
  TLegend *leg3 = new TLegend(0.824713,0.64346,0.945402,0.964135);
  leg3->SetFillStyle(0);
  leg3->SetFillColor(0);
  leg3->SetBorderSize(0);
  leg3->SetTextSize(0.056962);
  leg3->AddEntry(histoHadReco12,"60-70%");
  //leg3->AddEntry(histoHadReco13,"65-70%");
  leg3->AddEntry(histoHadReco14,"70-90%");
  //leg3->AddEntry(histoHadReco15,"75-80%");
  //leg3->AddEntry(histoHadReco16,"80-90%");
  //leg3->AddEntry(histoHadReco17,"85-90%");
  //leg3->Draw();

  TLatex *tex = new TLatex(64.871,0.00259747,"ALICE Pb-Pb #sqrt{s_{NN}}=2.76 TeV");
	tex->SetTextSize(0.0590717);
	tex->Draw();
  c1->SaveAs("/tmp/ETHadDistributions.eps");
  c1->SaveAs("/tmp/ETHadDistributions.png");
  c1->SaveAs("/tmp/ETHadDistributions.pdf");

}