void FillDetection(TH1D*,int events, double resol,TF1 *spectrum); void Neutrino() { gStyle->SetHistLineWidth(2); cout<<"Please use this macro to guide you through the neutrino exercise."<SetParameter(1,0.856); oscil->FixParameter(1,0.856); oscil->SetParameter(2,8.e-5); oscil->FixParameter(2,8.e-5); // set the distance for each detector in km double dNear=0.5;//km cout<<" what is the distance (in km) you have chosen? double dFar=?"<SetParameter(0,dNear); TF1 *near=new TF1("near","reactor*oscil",1.8,8.2); near->SetLineColor(kBlue); oscil->SetParameter(0,dFar); TF1 *far=new TF1("far","reactor*oscil",1.8,8.2); far->SetLineColor(kRed); near->SetTitle("Spectrum; E [MeV]; expected flux"); near->SetMinimum(0.); near->SetMaximum(0.25); TCanvas *functions=new TCanvas(); near->Draw(); far->Draw("same"); cout<<"And can calculate numbers of events (with Integral)"<Integral(1.8,8.2); double farVisibleFraction=far->Integral(1.8,8.2); cout<SetLineColor(kBlue); TH1D *FD=new TH1D("FD","Far Detector; E [MeV]; # events",32,1.8,8.2); FD->SetLineColor(kRed); ND->Sumw2(); FD->Sumw2(); //this line is necessary for root to store statistical uncertainties cout<<"Write in value for EventsInNearDetector and resolution"<DrawClone("hist,pe"); new TCanvas; FillDetection(FD,farEv,resolution,far); FD->DrawClone("hist,pe"); cout<Integral()<<" ND events and "<Integral()<<" FD events"< Divide (H1, H2, c1, c2) means HistFim = (c1.H1)/(c2.H2)"<Clone("division"); division->Reset(); division->SetLineColor(kBlack); division->SetTitle("Far Spectrum / Near Spectrum; E [MeV]; FD/ND"); division->Divide(FD,ND,100.,1.); division->Draw("pe"); cout<<"What does this division correspond too?"<SetParameter(0,dFar); oscil->FixParameter(0,dFar); oscil->ReleaseParameter(1);oscil->ReleaseParameter(2); division->Fit("oscil","R","",2.5,7.5); //you can choose the fitting range, here 2.5 MeV to 7.5 MeV cout<GetParError(1)<GetParameter(2)<<" +- "<GetParError(2)<<") eV^2"<GetRandom(); //choose energy from the given spectrum distribution double resolutionE=sqrt(TrueEnergy)*res1; //from statistical fluctuation on # photo-electrons double RecoEnergy=tmp.Gaus(TrueEnergy,resolutionE); //gaussian fluctuations on reconstruction detection->Fill(RecoEnergy,1.); // this is what will be seen for this 1 event } return; }