//This macro is supposed to be used for the Hands on Neutrino Workshop void FillDetection(TH1D*,int events, double resol,TF1 *spectrum, TF1 *oscil); void Neutrino_2022() { 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. /********************** STEP 2 **********************/ 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->SetNpx(300); oscil->Draw(); return; //comment '//' the two lines above to proceed with the exercise. /********************** STEP 3 **********************/ 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 reactor->SetLineColor(kBlack); reactor->SetLineStyle(4); TCanvas *functions=new TCanvas(); near->Draw(); far->Draw("same"); reactor->Draw("same"); return; //comment '//' the 3 lines above to proceed with the exercise. 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 EventRatio"<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 number of FD events "<Integral()<Integral()/EventsInNearDetector<<" and fraction of FD events "<Integral()/EventsInFarDetector<DrawClone(); lines and the next line to proceed return; /********************** STEP 5 **********************/ cout<<"Step 5: Next let's fit the oscillation parameters."< Divide (H1, H2, c1, c2) means Histogram = (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./EventRatio); division->Draw("pe"); cout<<"What does this ratio correspond to?"<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"); //division->Fit("oscil","R","",2.5,7.5); //you can also choose the fitting range, here 2.5 MeV to 7.5 MeV cout<GetParError(1)<GetParameter(2)<<" +/- "<GetParError(2)<<") eV^2"<Draw("same"); return; } //This is the FillDetection function -- do NOT modify this function //The function generates an histogram given Ntotal events, an energy resultion res1, and the two initial functions: the reactor function (orig) and the oscillation function (oscil) void FillDetection(TH1D *detection,int Ntotal,double res1, TF1 *orig, TF1 *oscil) { double IBDthr = 1.8;//MeV This is the threhold of your reaction double emass = 0.511;//MeV This is the electron's mass TRandom tmp; for(int iev = 0; iev < Ntotal; iev++)//Loop over the input number of events { double NeutrinoEnergy=orig->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; }