Subversion Repositories f9daq

Rev

Rev 1 | Blame | Compare with Previous | Last modification | View Log | RSS feed

//---------------------------------------------------
int plot2d(char *opt="colz", float max=0){
char hname[50];
  char hn[50];
  TCanvas *c;
  TH1I *gICh = (TH1I * ) gDirectory->Get("mapping");  
  for (int i=0;i<4;i++) {
    sprintf(hname,"cz%d",i);
    sprintf(hn,"Corr Pmt %d",i);
    c =new TCanvas(hname,hn, 1000,1000);
    c->Divide(4,4);
    for (int j=0;j<16;j++){
      c->cd(gICh->GetBinContent(j+1)+1);
      sprintf(hn,"corrch%d",i*16+j);
       TH1F*h=    (TH1F * ) gDirectory->Get(hn);
      if (max>0) h->SetMaximum(max);
      h->Draw(opt);
    }
    c->Modified();
    c->Update();
  }
return 0;
}

//---------------------------------------------------
int plot( char *fname=NULL, float max=0){
  if (fname!=NULL){
    cout << "Rootname:" << fname << endl;
    delete gROOT->GetListOfFiles()->FindObject(fname); // clear memory of file name
    if( gSystem->AccessPathName(fname) ) {
      cout << endl << "File: " << fname << " not there!!!" << endl << endl;
      return 0;
    }
    TFile *rootfile = new TFile(fname);
  }
 //if (buf)  delete buf;
  char hn[255];
 
  TCanvas *c1;
  for (int i=0;i<4;i++){
    sprintf(hn,"csumadc%d",i);
    c1=new TCanvas(hn,hn,1200,1200);
    c1->Divide(9,9,0,0);
    sprintf(hn,"sumadc%d",i);
    TH2F *h = ((TH2F * )gDirectory->Get(hn));
    for (int j=0;j<81;j++){
      c1->cd(1+j);
      TH1D *h0 = h->ProjectionX(" ",1+j,1+j);
      h0->DrawCopy();
    }
    c1->Modified();
    c1->Update();
  }  
 


  TCanvas *c2=new TCanvas("c2","c2",800,800);
  c2->Divide(2,2);
  for (int i=0;i<4;i++){
    c2->cd(1+i);
    sprintf(hn,"pmt1%d",i);
     ((TH1F * ) gDirectory->Get(hn))->Draw("colz");
  }
  c2->Modified();
  c2->Update();
 
  TCanvas *c6=new TCanvas("c6","c6",800,800);
  c6->Divide(2,2);
  for (int i=0;i<4;i++){
    c6->cd(1+i);
    sprintf(hn,"pmt3%d",i);
     ((TH1F * ) gDirectory->Get(hn))->Draw("colz");
  }
  c6->Modified();
  c6->Update();
 
  TCanvas *c5=new TCanvas("c5","c5",800,800);
 
 
  ((TH1F * ) gDirectory->Get("globalxy"))->Draw("colz");
 
  c5->Modified();
  c5->Update();
 
 
  TCanvas *c3=new TCanvas("c3","c3",800,800);
  c3->Divide(2,2);
  for (int i=0;i<4;i++){
    c3->cd(1+i);
    sprintf(hn,"pmt2%d",i);
     ((TH1F * ) gDirectory->Get(hn))->Draw("colz");
  }


  c3->Modified();
  c3->Update();

  TCanvas *c4=new TCanvas("c4","c4",800,800);
  c4->Divide(4,4);
  for (int i=0;i<16;i++){
    c4->cd(1+i)->SetLogy();
    sprintf(hn,"ach%d",i);
     ((TH1F * ) gDirectory->Get(hn))->Draw();
  }
  c4->Modified();
  c4->Update();
  plot2d("colz",max);
  return 0;
}

//---------------------------------------------------
int plotadc(){
  char hn[255];
  TCanvas *c;
  char hname[50];
  char hn[50];
  TH1I *gICh = (TH1I * ) gDirectory->Get("mapping");
  for (int i=0;i<4;i++) {
    sprintf(hname,"cx%d",i);
    sprintf(hn,"Pmt %d",i);
    c =new TCanvas(hname,hn, 1000,1000);
    c->Divide(4,4);
    for (int j=0;j<16;j++){
      c->cd(gICh->GetBinContent(j+1)+1)->SetLogy();
      sprintf(hn,"ach%d",i*16+j);  
       ((TH1F * ) gDirectory->Get(hn))->Draw();
    }
    c->Modified();
    c->Update();
  }

  return 0;
}

//---------------------------------------------------
int plotsingles(char *opt="colz", float max=0){
 char hname[50];
 char hn[50];
 TCanvas *c;
  TH1I *gICh = (TH1I * ) gDirectory->Get("mapping");
 for (int i=0;i<4;i++) {
    sprintf(hname,"cy%d",i);
    sprintf(hn,"Single Pmt %d",i);
    c =new TCanvas(hname,hn, 1000,1000);
    c->Divide(4,4);
    for (int j=0;j<16;j++){
       c->cd(gICh->GetBinContent(j+1)+1);
      sprintf(hn,"singlech%d",i*16+j);
      TH1F*h=    (TH1F * ) gDirectory->Get(hn);
      if (max>0) gHistoSingle[i*16+j]->SetMaximum(max);
      h->Draw(opt);
    }
    c->Modified();
    c->Update();
  }

  return 0;
}

 


//---------------------------------------------------
int plotcut(char *opt="", float max=0){
char hname[50];
  char hn[50];
  TCanvas *c;
  TH1I *gICh = (TH1I * ) gDirectory->Get("mapping");
  for (int i=0;i<4;i++) {
    sprintf(hname,"cz%d",i);
    sprintf(hn,"Cut Pmt %d",i);
    c =new TCanvas(hname,hn, 1000,1000);
    c->Divide(4,4);
    for (int j=0;j<16;j++){
       c->cd(gICh->GetBinContent(j+1)+1)->SetLogy();
       sprintf(hn,"corrch%d",i);
       TH1F*h=    (TH1F * ) gDirectory->Get(hn);
      if (max>0) h->SetMaximum(max);
      h->Draw(opt);
    }
    c->Modified();
    c->Update();
  }
return 0;
}
//---------------------------------------------------