Beispiel #1
0
void pixelHistos(const char *filenames = "/export/data1/dambach/hardware/ntpls/gradeC/*.root", const char *cuts =  "defects == 0")
{

  Init();      // do not forget to load the Utilities.C

  TH1D *gainH = new TH1D("gainH", "Gain", 1000, 0., 10.);
  TH1D *pedH = new TH1D("pedH", "Pedestal", 1000, -1000., 1000.);
  TH1D *noiseH = new TH1D("noiseH", "Noise", 1100, -100., 1000.);
  TH1D *tthrH = new TH1D("tthrH", "Trimmed Threshold", 100, 0., 100.);
  
  TChain *c = new TChain("mod");
  c->Add(filenames);
  
  canvas->Clear();
  canvas->Divide(2,2);

  canvas->cd(1);
  InitPad("log");
  gainH->GetXaxis()->SetTitle("ADC units/DAC units");
  gainH->GetYaxis()->SetTitle("# pixels");
  gainH->GetXaxis()->SetTitleSize(0.055);
  gainH->GetYaxis()->SetTitleSize(0.055);
  c->Draw("gain>>gainH", cuts);

  TBox *box = new TBox();

  canvas->cd(2);
  InitPad("log");
  pedH->GetXaxis()->SetTitle("DAC units");
  pedH->GetYaxis()->SetTitle("# pixels");
  pedH->GetXaxis()->SetTitleSize(0.055);
  pedH->GetYaxis()->SetTitleSize(0.055);
  c->Draw("ped>>pedH", cuts);

  canvas->cd(3);
  InitPad("log");
  noiseH->GetXaxis()->SetTitle("e^{-}");
  noiseH->GetYaxis()->SetTitle("# pixels");
  noiseH->GetYaxis()->SetRangeUser(0.1,400000);
  noiseH->GetXaxis()->SetTitleSize(0.055);
  noiseH->GetYaxis()->SetTitleSize(0.055);
  c->Draw("noise>>noiseH", cuts);
  noiseH->Fit("gaus");
//   box->SetFillStyle(3003);
//   box->SetFillColor(kBlue);
//   box->DrawBox(0.1,0.,500.,400000.);
//   box->SetFillColor(kRed);
//   box->DrawBox(500.,0.,1000.,400000.);

  canvas->cd(4);
  tthrH->GetXaxis()->SetTitle("DAC units");
  tthrH->GetYaxis()->SetTitle("# pixels");
  tthrH->GetXaxis()->SetTitleSize(0.055);
  tthrH->GetYaxis()->SetTitleSize(0.055);
  InitPad("log");
  c->Draw("tthr>>tthrH", cuts);

}
Beispiel #2
0
void Initialize(void) {
    fatInitDefault();
    DebugStart(true, "sd://WiiCraft.log");
    Debug("\n");
    Debug("\n");
    Debug("\n");
    Debug("-------------------[WiiCraft Debug Log]----------------------");
    InitVideo();
    Debug("InitVideo() Done");
    InitPad();
    Debug("InitPad() Done");
    initFPS();
    Debug("InitFPS() Done");
//	ASND_Init();
//	Debug("ASND_Init() Done");
//	MP3Player_Init();
//	Debug("MP3Player_Init Done");

}
Beispiel #3
0
int main(int argc, char **argv)
#endif
{
    char fname[256];
    char defname[] = "game.dat";
    Boolean b_play;
    int dir;
    int inch;
    int num_step;
    int num;
    unsigned char steplog[MaxSteps];

#ifdef ENABLE_DL
    char buf[10];
    struct high_record high;

    while (1) {
        num = 0;
        clear();
        ansimore2("game/worker/welcome", false, 0, 0);
        while (num <= 0 || num > MAXDATA) {
	    buf[0]=0;
            getdata(5, 61, "", buf, 5, 1, NULL, true);
            if (buf[0] == 0)
                return 0;
            num = atoi(buf);
        }
        sprintf(fname, "game/worker/%s.%d", defname, num);
	clear();
#else
    {
        if (argc > 2) {
            sprintf(fname, "%s/%s.%s", argv[1], defname, argv[2]);
            num=atoi(argv[2]);
        } else if (2 == argc) {
            if (strlen(argv[1]) > 255)
                exit(1);
            sprintf(fname, "%s.%s", defname, argv[1]);
            num=atoi(argv[1]);
        } else {
            strcpy(fname, defname);
            num==-1;
        }
#endif
        num_step=0;
        load_highrecord(num, &high, -1);
        if (TRUE == InitData(fname)) {
            if (TRUE == InitPad()) {
                b_play = TRUE;
                DrawPad();
                update_endline1(&high,num_step);
                inch = 0;
                while (b_play) {
                    if (inch) {
                        showdiff();
                        cleardiff();
                        move(scr_lns-1, scr_cols - 1);
                        refresh();
                    }
                    if (wingame()) {
                    	   int newrecord;
			   char buf[100];
                    	   newrecord=0;
                    	   if (num_step<high.shortest||high.shortest==0) 
                    	   	newrecord=load_highrecord(num, &high, num_step);
                    	   clear();
                    	   move(12,15);
                    	   prints("祝贺你,你成功的完成了这一关");
                    	   move(13,15);
                    	   if (newrecord==1) {
                    	       sprintf(buf,"你也创造了本关使用步数的纪录(%d步)!好厉害~",num_step);
			   } else
                    	   if (newrecord!=0) {
                    	       sprintf(buf,"你也创造了本关使用步数的纪录(%d步)!",num_step);
			       prints(buf);
                    	       move(14,15);
			       sprintf(buf,"不过,让点创纪录机会给别人吧~你都有%d个记录了:P\n",newrecord);
                    	   } else {
			       sprintf(buf,"你用了%d步,纪录是%d步。",num_step,high.shortest);
			   }
			   prints(buf);
                        move(23, 0);
                        clrtoeol();
                        prints("\x1b[m                                \x1b[5;1;33m按任何键继续 ..\x1b[m");
                        igetkey();
                        break;
                    }
                    if (num_step>MaxSteps) {
			    char askbuf[100];
                    	    clear();
                    	    sprintf(askbuf,"你已经用了%d步还没有成功,重来么?(Y/N)",num_step);
                    	    getdata(12,0,askbuf,buf,2,1,NULL,true);
                    	    if (toupper(buf[0])=='N')
                    	    	break;
                         b_play = InitPad();
                         DrawPad();
                         num_step=0;
                    	}
                    inch = igetkey();
                    if ((' ' == inch)||(inch == '\n')||(inch=='\r'))
                        break;
                    dir = NullDir;
                    switch (inch) {
                    case 'i':
                    case 'I':
                    case KEY_UP:
                        dir = North;
                        break;
                    case 'j':
                    case 'J':
                    case KEY_LEFT:
                        dir = West;
                        break;
                    case 'l':
                    case 'L':
                    case KEY_RIGHT:
                        dir = East;
                        break;
                    case 'k':
                    case 'K':
                    case KEY_DOWN:
                        dir = South;
                        break;
                    case 12:   //      Ctrl-L
                    case 'R':   //      Ctrl-L
                        clear();
                        DrawPad();
                        break;
                    case '\t':
                        b_play = InitPad();
                        DrawPad();
                        num_step=0;
                        update_endline1(&high,num_step);
                        break;
	            case Ctrl('H'):
                    case '\177':
                    case KEY_DEL:
                    	  if (num_step!=0) {
                    	  	num_step--;
                    	       regretmove(steplog[num_step]);
                            update_endline1(&high,num_step);
                    	  }
                    	  break;
                    default:
                        break;
                    }
                    if (NullDir != dir) {
                    	    int ret;
                         if ((ret=workermove(dir))!=0) {
                         	if (ret==2)
                                 steplog[num_step]=dir+8;
                         	else
                                 steplog[num_step]=dir;
                             num_step++;
                             update_endline1(&high,num_step);
                	    }
                    }
                }
            }
            DestroyPad();
        }
        DestroyData();
    }
    return 0;
}
Beispiel #4
0
void chipHistos(const char *filenames = "/export/data1/dambach/hardware/ntpls/gradeA/*.root")
{

  Init();      // do not forget to load the Utilities.C

  TH1D *gainH = new TH1D("gainH", "RMS(gain)/Mean(gain)", 100, 0., 0.2);
  TH1D *pedH = new TH1D("pedH", "RMS(pedestal)", 100, 0., 100.);
  TH1D *noiseH = new TH1D("noiseH", "RMS(trimmed threshold)", 100, 0., 8.);
  TH1D *tthrH = new TH1D("tthrH", "Mean (trimmed threshold)", 100, 50., 70.);
  
  TH1D *gainDist = new TH1D("gainDist", "gainR/gainM", 100, 0., 10.);
  TH1D *pedDist = new TH1D("pedDist", "pedR", 100, -1000., 1000.);
  
  TChain *c = new TChain("mod");
  c->Add(filenames);
  
  float ped[16][4160], gain[16][4160];
  int defects[16][4160];
  c->SetBranchAddress("ped", ped); 
  c->SetBranchAddress("gain", gain);
  c->SetBranchAddress("defects", defects);
  
  int nb(0), nbytes(0);
  
  for (int i = 0; i < c->GetEntries(); ++i)
    {
      nb = c->GetEntry(i);   nbytes += nb;
      
      
      for(int chipId = 0; chipId < 16; chipId++)
	{
	  gainDist->Reset();
	  pedDist->Reset();
	  
	  int allPix = 4160; 
	  for (int p = 0; p < allPix; p++)
	    {
	      if(defects[chipId][p] == 0)
		{
		  gainDist->Fill(gain[chipId][p]);
		  pedDist->Fill(ped[chipId][p]);	      
		}
	    }
	  double gainRMS = gainDist->GetRMS();
	  double pedRMS = pedDist->GetRMS();
	  double gainMean = gainDist->GetMean();
	  double pedMean = pedDist->GetMean();
	  
	  if (gainMean != 0) gainH->Fill(gainRMS/gainMean);
	  pedH->Fill(pedRMS);
	}
    }
  
  canvas->Clear();
  canvas->Divide(2,2);
  
  canvas->cd(1);
  InitPad("log");
  gainH->GetXaxis()->SetTitle("DAC units");
  gainH->GetYaxis()->SetTitle("# pixels");
  gainH->GetXaxis()->SetTitleSize(0.055);
  gainH->GetYaxis()->SetTitleSize(0.055);
  gainH->Draw();
  
  canvas->cd(2);
  InitPad("log");
  pedH->GetXaxis()->SetTitle("DAC units");
  pedH->GetYaxis()->SetTitle("# pixels");
  pedH->GetXaxis()->SetTitleSize(0.055);
  pedH->GetYaxis()->SetTitleSize(0.055);
  pedH->Draw();

  canvas->cd(3);
  InitPad("log");
  noiseH->GetXaxis()->SetTitle("DAC units");
  noiseH->GetYaxis()->SetTitle("# pixels");
  noiseH->GetXaxis()->SetTitleSize(0.055);
  noiseH->GetYaxis()->SetTitleSize(0.055);
  c->Draw("tthrR>>noiseH");

  canvas->cd(4);
  InitPad("log");
  tthrH->SetMinimum(0.5);
  tthrH->GetXaxis()->SetTitle("DAC units");
  tthrH->GetYaxis()->SetTitle("# pixels");
  tthrH->GetXaxis()->SetTitleSize(0.055);
  tthrH->GetYaxis()->SetTitleSize(0.055);
  c->Draw("tthrM>>tthrH");

}