Some programs

From New IAC Wiki
Revision as of 21:12, 3 May 2012 by Shaproma (talk | contribs)
Jump to navigation Jump to search

go back


some Alex program from Sep 2011 run

//to see spectrum for all 9 detectors

  • plot22.C
    • root *.root
    • .x plot22.C

//to asymmetry study

  • NDasymStudy3.C
  • ND_asymmetry.C
  • ND_integral.C
  • NDasymStudy2.C //D2O?

// to monitor beam current stability defined by pair spectrometer // from daq/data machine, Sep 21, 2011

  • NDpairStudy.C
  • ND_pair.C
    • root -l NDpairStudy.C'()'
    • .x NDpairStudy.C()


{ gROOT->Reset(); gStyle->SetOptStat(1111111); gStyle->SetOptDate(1);

       TH1F *TDC12=new TH1F("TDC12"," stop timing spectrum",1000,3,930);

TH1F *TDC11=new TH1F("TDC11"," stop timing spectrum",1000,3,930);

       TH1F *TDC15=new TH1F("TDC15","start by NaI(Tl) det, Cf-252 source",1000,3,930);
      // TH1F *Fsubtr=new TH1F("Fsubtr","Subtraction of the stops",1000,0,110);
 TH1F *Fsubtr=new TH1F("Fsubtr","Subtraction of the stops",1000,-930,930);


 TH2D *TDC11evt = new TH2D("TDC11evt", "TDC11evt", 900, 0., 90000., 4090, 0., 4096.);
 TH2D *TDC12evt = new TH2D("TDC12evt", "TDC12evt", 900, 0., 90000., 4096, 0., 4096.);
 TH2D *TDCsub = new TH2D("TDCsub", "Eveny-by-event subtraction", 1000, 0., 90000., 1000, -930., 930.);

TH2D *Subtr = new TH2D("Subtr", "Subtr", 900, 0., 900., 4096, 0., 4096.); //TH1D *Subtr=new TH1D("Subtr","Subtraction of the stops",4096,0,4096); TH1D *TDC11proj=new TH1D("TDC11proj","TDC11 projection",1000,0,4096); TH1D *TDC12proj=new TH1D("TDC12proj","TDC12 projection",1000,0,4096);

TCanvas *c = new TCanvas("c", "TDC", 900, 800);

c->Divide(2,2); c->Update(); c->cd(1); //ntuple->Draw("500*(TDC12)/4096 >> TDC12"); //ntuple->Draw("TDC11*0.2272>>TDC11","(EventNumber >=750000 && EventNumber <=1180000)"); ntuple->Draw("TDC11*0.2272>>TDC11"); //ADC4->GetYaxis()->SetNdivisions(12);

       //ADC4->GetXaxis()->SetNdivisions(26);

c->cd(1)->SetLogy(0); c->cd(1)->SetGrid(1,1); TDC11->SetXTitle("Time [ns]"); TDC11->SetYTitle("Events/(1.075)"); TDC11->SetLineColor(4); c->Update();


TLegend *leg = new TLegend(0.5,0.61,0.76,0.92); //coordinates are fractions

    		                                		//of pad dimensions
 //the header (or "title") for the legend
 leg->SetHeader("Run# 3073"); 
 leg->AddEntry(TDC11,"Real stop","l");  // "l" means line
 leg->AddEntry(TDC11,"rate(Max) =  Hz", "0");            // use "0" for a blank text
 leg->AddEntry(TDC11,"events =  ", "0");
 leg->AddEntry(TDC11,"time =  min ", "0");
 leg->AddEntry(TDC11,"U(right) = -1250 V", "0");
 leg->AddEntry(TDC11,"U(left) = -1250 V", "0");
 
 // oops we forgot the header (or "title") for the legend
 
 leg->Draw();

c->cd(2); //ntuple->Draw("500*(TDC12)/4096 >> TDC12"); ntuple->Draw("TDC15*0.2272>>TDC15"); //ADC4->GetYaxis()->SetNdivisions(12);

       //ADC4->GetXaxis()->SetNdivisions(26);

c->cd(2)->SetLogy(0); c->cd(2)->SetGrid(1,1); TDC15->SetXTitle("Time [ns]"); TDC15->SetYTitle("Events/(1.075)"); TDC15->SetLineColor(4); c->Update();


TLegend *leg = new TLegend(0.5,0.61,0.76,0.92); //coordinates are fractions

    		                                		//of pad dimensions
 //the header (or "title") for the legend
 leg->SetHeader("Run# 3073"); 
 leg->AddEntry(TDC15,"Real stop","l");  // "l" means line
 leg->AddEntry(TDC15,"rate(Max) =  Hz", "0");            // use "0" for a blank text
 leg->AddEntry(TDC15,"events =  ", "0");
 leg->AddEntry(TDC15,"time =  ", "0");
 leg->AddEntry(TDC15,"U(left) = -1250 V", "0");
 leg->AddEntry(TDC15,"U(right) = -1250 V", "0");
 
 // oops we forgot the header (or "title") for the legend
 
 leg->Draw();

c->cd(3); //ntuple->Draw("500*(TDC12)/4096 >> TDC12"); //ntuple->Draw("TDC12*0.2272>>TDC12","(EventNumber >=750000 && EventNumber <=1181198)"); ntuple->Draw("TDC12*0.2272>>TDC12"); //ADC4->GetYaxis()->SetNdivisions(12);

       //ADC4->GetXaxis()->SetNdivisions(26);

c->cd(3)->SetLogy(0); c->cd(3)->SetGrid(1,1); TDC12->SetXTitle("Time [ns]"); TDC12->SetYTitle("Events/(1.075)"); TDC12->SetLineColor(4); c->Update();


TLegend *leg = new TLegend(0.5,0.61,0.76,0.92); //coordinates are fractions

    		                                		//of pad dimensions
 //the header (or "title") for the legend
 leg->SetHeader("Run# 3073"); 
 leg->AddEntry(TDC15,"Real stop","l");  // "l" means line
 leg->AddEntry(TDC12,"rate(Max) =  Hz", "0");            // use "0" for a blank text
 leg->AddEntry(TDC12,"events =  ", "0");
 leg->AddEntry(TDC12,"time =  min ", "0");
 leg->AddEntry(TDC12,"U(left) = -1250 V", "0");
 leg->AddEntry(TDC12,"U(right) = -1250 V", "0");
 
 // oops we forgot the header (or "title") for the legend
 
 leg->Draw();

c->cd(4); c->cd(4)->SetLogy(0); c->cd(4)->SetGrid(1,1); //ntuple -> Draw("(((TDC11*0.2272)-(TDC12*0.2272))-103.1)/0.1097>>Fsubtr"); //ntuple -> Draw("(TDC11*0.2272)-(TDC12*0.2272)>>Fsubtr","(EventNumber >=750000 && EventNumber <=1181198)"); ntuple -> Draw("(TDC11*0.2272)-(TDC12*0.2272)>>Fsubtr"); Fsubtr->SetXTitle("X-coordinate, cm"); //TDC15->SetYTitle("Events/(1.075)"); TDC15->SetLineColor(4);

c->Update();

TCanvas *c2 = new TCanvas("c2", "TDC", 900, 800);
c2->Divide(2,2);
c2->Update();

c2->cd(1); ntuple->Draw("(TDC12):EventNumber>>TDC12evt"); c2->Update();

c2->cd(2); ntuple->Draw("(TDC11):EventNumber>>TDC11evt"); c2->Update();

c2->cd(3); //TH1D *py = TDC11evt->ProjectionY("Y-projection TDC11", 0, 4096);

//TH1D *py = TDCsub->ProjectionY("Y-projection", -930, 930); // where firstXbin = 0 and lastXbin = 9 //py->Draw(); /* Int_t nx11 = TDC11evt->GetNbinsX(); Int_t ny11 = TDC11evt->GetNbinsY();

for (int i=1;i<=nx11;i++) {

 for (int j=1;j<=ny11;j++) {
  
     Double_t c11 =TDC11evt->GetBinContent(i,j);
     Double_t c12 =TDC12evt->GetBinContent(i,j);
 if(c11) Int_t binN11 = j;
 if(c12) Int_t binN12 = j;

//if(c12) cout<<"c12: "<<c12<<endl;

   //if (c11 && c12 >  0.) {

Double_t a = binN11-binN12;

Subtr->SetBinContent(i,j,a);

binN11 = 0; binN12 = 0; //double a = c11;

//if(!a) Subtr->SetBinContent(0,0);

//a=0.;

     //    }

} }

//TDC11evt->Draw(); //TDCsub->Draw("TDC11evt*0.2272-TDC12evt*0.2272"); Subtr->Draw();

  • /

//TDC11evt->Add(TDC12evt,-1.);

//TDC11evt->Draw(); c2->Update();


c2->cd(4);

//TH1D *y2 = TDC12evt->ProjectionY("Y-projection TDC12", 0, 4096);

//TH1D *py = TDCsub->ProjectionY("Y-projection", -930, 930); // where firstXbin = 0 and lastXbin = 9 //y2->Draw();


c2->Update();

//TCanvas *c3 = new TCanvas("c3", "TDC", 900, 800);

//py->Add(y2,1); //py->Draw();

char printName[256]; char printName2[256]; sprintf(printName,"/data/Oleksiy/Cf_252_test/5_2_2012/run3080.eps"); c->SaveAs(printName);

       sprintf(printName2,"/data/Oleksiy/Cf_252_test/5_2_2012/run3080.jpg");

c->SaveAs(printName2);

}