//This macros is supposed to be used for the Hands on Neutrino Workshop void FillDetection(TH1D*,int events, double resol,TF1 *spectrum, TF1 *oscil); void Neutrino_2021() { gStyle->SetHistLineWidth(2); cout<<"Please use this macro to guide you through the neutrino's exercises."<Draw(); //return; //comment '//' the two lines above to proceed with the exercise. cout<<"Step 2: You now need to write also the oscillation function, with variable parameters."<SetParameter(1,0.856); oscil->FixParameter(1,0.856); oscil->SetParameter(2,8.e-5); oscil->FixParameter(2,8.e-5); cout<<"Then you need to enter also the relevant distance for the Far Detector."<SetParameter(0,dFar); //oscil->Draw(); //return; //comment '//' the two lines above to proceed with the exercise. cout<<"Step 3: The actual survival probability is defined as the product of the reactor antineutrino energy spectrum (the reactor function) and the survival probability function."<SetParameter(0,dNear); TF1 *near=new TF1("near","reactor*oscil",0.,10.); near->SetLineColor(kRed); near->SetTitle("Spectrum; E [MeV]; expected flux"); near->SetMinimum(0.); near->SetMaximum(0.25); oscil->SetParameter(0,dFar); TF1 *far=new TF1("far","reactor*oscil",0.,10.); far->SetLineColor(kBlue); //Draw the functions TCanvas *functions=new TCanvas(); near->Draw(); far->Draw("same"); reactor->SetLineColor(kBlack); reactor->SetLineStyle(4); reactor->Draw("same"); //Once done with this step, comment the line below //return; cout<<"We can now calculate the numbers of events in each spectrum (using the function Integral)"<Integral(x,8.2); double farVisibleFraction = far->Integral(x,8.2); cout<<"Fraction of ND events "<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 your macro the value for EventsInNearDetector, the resolution and calculate the value for size"<SetParameter(0,dNear); FillDetection(ND,EventsInNearDetector,resolution,reactor,oscil); ND->DrawClone("hist,pe"); new TCanvas; oscil->SetParameter(0,dFar); FillDetection(FD,EventsInFarDetector,resolution,reactor,oscil); FD->DrawClone("hist,pe"); cout<Integral()<<" and fraction of FD events "<Integral()< 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,1.,1./size); division->Draw("pe"); cout<<"What does this ratio correspond too?"<Draw("same"); //Comment this line once done //return; oscil->SetParameter(0,dFar); oscil->FixParameter(0,dFar); oscil->ReleaseParameter(1); oscil->ReleaseParameter(2); oscil->SetParameter(1,0.5); oscil->SetParameter(2,1.e-5); //You can change these parameters here //division->Fit("oscil","R","",2.5,7.5); //you can choose the fitting range, here 2.5 MeV to 7.5 MeV division->Fit("oscil"); //you can choose the fitting range, here 2.5 MeV to 7.5 MeV cout<GetParError(1)<GetParameter(2)<<" +/- "<GetParError(2)<<") eV^2"<GetRandom(); //obtain the energy from the given spectrum distribution //What will we detect? if(tmp.Uniform()>oscil->Eval(NeutrinoEnergy)) continue; //oscillated to another neutrino type, do not plot it if(NeutrinoEnergyFill(NeutrinoRecoE,1.); // this is what will be seen for this 1 event } return; }