// Mapmt Root analysis tool // Reinhadrt CHAMONAL - University of Edinburgh - 2002 // ---------------------------------------------------- // pedestal(runNumber): computes the 5 sigma pedestal cut // signal(runNunmber): Integrates from the 5 digma cut to the end to get // : signal detected (in percent) needs pedestal(runNumber) // map(): draw the Mapmt cluster popualtion distribution nedds tabSignal[i] // : need to run signal(Runumber) which needs pedestal(runNumber) // row(runNumber): Displays population per row (8 rows) creates histo rowInfo // col(runNumber): Displays pop. per column (8 cols) creates histo colInfo // analysis(runNumber): launch signal(),map(), row() and col() // // Protocol to follow: // run pedestal(pedestalRunRumber) // run analysis (runNumber) #include //gROOT->Reset(); Int_t tabCut[64]; Int_t tabMean[64]; Double_t tabSignal[64]; void loopit(Int_t iloop) { for(Int_t k=0;k<3; k++) { signal(iloop); } } void signal(Int_t runNumber) { c1=new TCanvas("mapmt","MAPMT signal: R.CHAMONAL-Edinburgh-2002",10,40,400,400); TFile *run = new TFile(Form("data/root/run%d.root",runNumber),"recreate"); for (Int_t i=0; i<5;i++) { TFile *r99 = new TFile(Form("data/root/r%d.root",runNumber)); if (r99) break; cout<Start("Signal"); for(Int_t i=0;i<=63;i++){ TH1F *boundary = new TH1F("boundary",Form("Channel %i",i),256,-0.5,256.5); gPad->SetLogy(); h10->Draw("norm>>+boundary",Form("pdid==0 && pixid==%d",i+1)); //The Pedestal fit histomean=boundary->GetMean(); boundary->Fit("gaus","Q","same",0,100); TF1 *fgaus = boundary->GetFunction("gaus"); fgaus->SetLineWidth(1); fgaus->SetLineColor(2); mean = fgaus->GetParameter(1); sigma = fgaus->GetParameter(2); pedestalCut = mean+(5*sigma); //The pedestal cut and calculus of the signal by integrating TAxis *xaxis = boundary->GetXaxis(); Int_t binmin = xaxis->FindBin(pedestalCut); Double_t total=boundary->Integral(binmin,256); Double_t maxvalue=boundary->GetMaximum(); nbEntries=h10->GetEntries(); Double_t pourcent=total*100/nbEntries; tabSignal[i]=pourcent; //Display percentage into a little box label1 = new TPaveLabel(212,225,275,85,Form("%.1f %%",pourcent)); label1->SetFillColor(38); label1->SetBorderSize(1); label1->Draw(); //end //Display integration Int_t pedestalCutInt=pedestalCut; h10->SetFillColor(38); h10->Draw("norm",Form("pdid==0 && pixid==%d && norm>%d",i+1,pedestalCutInt),"same"); c1->Update(); run.cd(); boundary->Write(); r99.cd(); boundary->Delete(); } gBenchmark->Stop("Signal"); gBenchmark->Show("Signal"); c1->Delete(); //r99->Delete("h10"); r99->Close(); // Copy percentages into a histogram gBenchmark->Start("savehisto"); //TFile *f=new TFile(Form("data/root/h%d.root",runNumber),"recreate"); run.cd(); TTree t1("population","Magnetic Field Mapmt tests"); Float_t pop; t1.Branch("pop",&pop,"pop/F"); for (Int_t i=0;i<64;i++){ pop=tabSignal[i]; t1->Fill(); } t1->Write(); //-->end saving percentage into histogram run->Close(); gBenchmark->Show("savehisto"); gBenchmark->Reset(); }// Signal()