#include "TH1.h" #include "TF1.h" #include "TLegend.h" #include "TCanvas.h" #include "Riostream.h" // fattori di calibrazione sono 66.20+-0.022 channels/microsecondo e // 3.151 +- 0.2739 channels. // then t=(nchan-3.151)/66.20 // calibration function, convert adc channel to time //Double_t t_calibrate(Double_t chan) {return (chan-3.151)/66.20;} // calib sabrina //Double_t t_calibrate(Double_t chan) {return (chan+4.351)/66.88;} //calib Stefania (>microsec) //Double_t t_calibrate(Double_t chan) {return (chan-2.745)/65.06;} //calib Stefania (<1microsec) better //Double_t t_calibrate(Double_t chan) {return (chan+0.1836)/69.49;} //calib Stefania (<1microsec 14-05-2005) Double_t t_calibrate(Double_t chan) {return (chan-1.944)/65.79;} //calib Stefania (all; Dt moved on vert.scale) //Double_t t_calibrate(Double_t chan) //{ // if (chan>250.) return (chan+4.351)/66.88; // else return (chan-2.745)/65.06; //} // flat background function Double_t background(Double_t *x, Double_t *par) {return par[0];} // exponential function Double_t exponential(Double_t *x, Double_t *par) {return (par[0]*par[1])*(exp(-x[0]/par[1]));} // exponential + background function Double_t expobckg(Double_t *x, Double_t *par) {return background(x,par) + exponential(x,&par[1]);} // Sum of background and two exponential functions Double_t fitFunction(Double_t *x, Double_t *par) { return background(x,par) + exponential(x,&par[1])+exponential(x,&par[3]); } // Sum two exponential functions Double_t twoexpo(Double_t *x, Double_t *par) {return exponential(x,&par[0])+exponential(x,&par[2]);} void muonMacro(int limit=2048,int fact=4, float lowl=2., float highl=14.0){ gROOT->Reset(); gStyle->SetOptStat(1); gStyle->SetOptFit(1); gBenchmark->Start("canvas"); // create and set canvas style TCanvas *c1 = new TCanvas("c1","Canvas Title",10,10,1000,800); // c1->SetFillColor(33); c1->SetFillColor(17); // c1->SetFrameFillColor(41); c1->SetFrameFillColor(40); c1->SetGrid(); c1->Divide(1,2); c1->cd(1); //c1->SetLogy(1); // ADC histo TH1F *histo = new TH1F("ADC histo","Laboratorio Alte Energie",limit+1,-0.5,(float)limit+0.5); histo->SetMarkerStyle(21); histo->SetMarkerSize(0.8); // TIME histo int nbin = 1000; float Tmax = 20.;//microseconds float binSize = Tmax/nbin; float xmin = 0.-binSize/2.; float xmax = Tmax+binSize/2.; nbin+=1; TH1F *time = new TH1F("Time histo","Laboratorio Alte Energie",nbin,xmin,xmax); time->SetXTitle("Time / micros"); time->SetYTitle("yields / ch"); printf("Histo. min, max, Nbin are %8f %8f %d \n ",xmin, xmax, nbin); time->SetMarkerStyle(21); time->SetMarkerSize(0.8); // here open the data file and fills the histogram std::string myLine; Int_t nlines = 0; Int_t nevents = 0; ifstream in; //in.open("edo.dat"); // in.open("dati_veto_16052005_linux.text"); // fittando da 2 a 14 1 exp bin 1/1 calib stefania Dt on vert scale OK in.open("adc2009_0_Jun01-03.lvm"); Float_t adcn = 0.; Float_t value = 0.; Float_t ADCvalue = 0.; while (1) { in >> myLine; if (!in.good()) break; ++nlines; //cout<<"nlines, event - line "<> adcn >> value; //cout<<"&&&&&&&&&&&&&&&&&&& "<Fill(ADCvalue); // si converte ADCvalue in ADCtime (in microsecondi) time->Fill(t_calibrate(ADCvalue)); } } } if (nevents >200) break; } cout<<"N. of events = "<Draw(); c1->cd(2); time->Draw(); c1->Update(); }