Open jtenavidal opened 7 months ago
Exercise with ROOT file So following our chat it will be great if you could take a look at a few kinematic variables, save their distribution and think a bit about the reason they look this way:
For events with 1 negative pion take a look at:
The momentum of the outgoing electron The scattering angle of the electron The azimuthal angle (phi) of the electron
The momentum of the outgoing pion The scattering angle of the outgoing pion The azimuthal angel (phi) of the outgoing pion
W Q2
How many events are QE/MEC/RES/DIS
The momentum of the outgoing electron vs. its scattering angle Q2 vs. W
For the 2d histograms it’s advisable to draw them with the "colz” option
A reminder: The cross section can be calculated as the number of events divided by the luminosity or take the events in your histogram and normalize it to the cross section like Julia showed you from the spline file
inclusive cross section you take from the spline root file by taking Eval of the relevant TGraph in the value of the incoming energy.
histogram->Scale(inclusive cross section / total generated number of events)
To plot the gst W branch for 1pim only:
gst->Draw("W","nfpim==1&&nfpip==0&&nfem==0")
//////////////////////////////////////////////////////////////////////////////////
int plot_GENIEgst() {
std::string MC_file_name = "/Users/juliatenavidal/Downloads/GENIE_MC_File_example.gst.root" ;
TCanvas * c1 = new TCanvas("c1","c1",800,600);
TFile * file_true_MC = new TFile((MC_file_name).c_str(),"ROOT");
TTree * my_gst_tree = (TTree*)file_true_MC->Get("gst");
if( !file_true_MC ) { std::cout << "ERROR: the "<< file_true_MC << " does not exist." <<std::endl; return 0;}
if( !my_gst_tree) std::cout << " Tree does not exist " << std::endl;
// TH1D * myh = new TH1D( "myh", "title", 100, 0, 50) ;
TH1D * myh_1p0pi = new TH1D( "myh_1p0pi", "myh_1p0pi", 100, 0, 5) ;
TH1D * myh_1p0pi_qel = new TH1D( "myh_1p0pi_qel", "myh_1p0pi_qel", 100, 0, 5) ;
TH2D * myh = new TH2D( "myh", "title", 100, 0, 4, 100,0,4) ;
// OBSERVABLE DEFINITION:
int nf ;
double Ev, W, Q2 ; // Electron energy
Int_t pdgf[120] ;
double pxf[120],pyf[120],pzf[120],Ef[120];
double pl ;
bool res, dis, qel;
my_gst_tree->SetBranchAddress("Ev", &Ev);
my_gst_tree->SetBranchAddress("nf", &nf);
my_gst_tree->SetBranchAddress("pl", &pl);
my_gst_tree->SetBranchAddress("pdgf", &pdgf);
my_gst_tree->SetBranchAddress("pxf", &pxf);
my_gst_tree->SetBranchAddress("pyf", &pyf);
my_gst_tree->SetBranchAddress("pzf", &pzf);
my_gst_tree->SetBranchAddress("Ef", &Ef);
my_gst_tree->SetBranchAddress("qel", &qel);
my_gst_tree->SetBranchAddress("res", &res);
my_gst_tree->SetBranchAddress("dis", &dis);
my_gst_tree->SetBranchAddress("W", &W);
my_gst_tree->SetBranchAddress("Q2", &Q2);
for( int j = 0 ; j < NEntries ; ++j ) {
my_gst_tree->GetEntry(j) ;
int number_pip = 0 ;
int number_p = 0 ;
int number_pim = 0 ;
int number_em = 0 ;
double mom = 0 ;
double phi = 0 ;
double theta = 0 ;
for( unsigned int k = 0 ; k < nf ; ++k ){
TLorentzVector my4mom;
my4mom.SetPxPyPzE (pxf[k], pyf[k], pzf[k], Ef[k]);
if( pdgf[k] == -211 ) { mom = my4mom.P(); theta = my4mom.Theta(); phi = my4mom.Phi() ; }
if( pdgf[k] == 211 ) ++number_pip; // number_pip = number_pip + 1;
if( pdgf[k] == -211 ) ++number_pim;
if( pdgf[k] == 2212 ) ++number_p;
if( pdgf[k] == 22 ) ++number_em; // photon
}
if( number_pip == 0 && number_pim ==1 && number_em == 0 ) myh->Fill(W,Q2);
}
myh->SetLineColor(kBlack);
myh_1p0pi->SetLineColor(kBlue);
myh_1p0pi_qel->SetLineColor(kRed);
myh->Draw("hist colz");
myh_1p0pi->Draw("hist same");
myh_1p0pi_qel->Draw("hist same");
c1->SaveAs("test.pdf");
return 0;
Add Reconstructed Ev from pion and outgoing electron momentum
[ ] Add new function in Kinematics.h (definition in Kinematics.cxx): https://github.com/e4nu/e4nuanalysiscode/blob/master/src/utils/KinematicUtils.h
[ ] We want to store the results in the analysis output root file. To do so, we need to modify the analysis code for the MC and the data. Both have a Store Tree function which will define the branches and add the event content in the branch. See:
[ ] The next step is to run the analysis with the MC and CLAS data files. As you don't have access, I will run it once the implementation is complete. For testing, you can use a smaller root file ().
./e4nuanalysis --conf-file ConfFiles/mc_conf/clas6mc_1pimanalysis_eC12_1GeV.txt --root-file example_root_file.gst.root --output-file test_RecoEvPion --analysis-type ComputeTrueAccCorr --xsec-file example_xsec.root
Interesting paper https://arxiv.org/pdf/2102.03346.pdf
For the plots,
1D Plot:
2D Plot:
For Julia:
Neutrino summer school recordings https://npc.fnal.gov/inss/ Day 1 day 2, are the most relevant: https://indico.cern.ch/event/1011452/timetable/
Here you can find my latest slides: https://indico.jlab.org/event/829/contributions/14080/attachments/10742/16277/CLAS6_introduction_analysis_1p1pi_JTena_March2024.pdf
It is a good summary of what you will do, you will just look at 1pi events instead.
There's also work done by collaborators of our on similar topologies using different data. This is the latest update of their work: https://indico.jlab.org/event/829/contributions/14082/attachments/10739/16269/2024_cfogler_NPWG_v1.pdf
Include New observables in data format We want to add the reconstructed Ev for pion production, and the reconstructed W. To do so, we need two new functions here:
https://github.com/e4nu/e4nuanalysiscode/blob/master/src/utils/KinematicUtils.cxx
and the definition in the .h file.
double utils::GetRecoEvPionProduction( const TVector3 p1 /*out electron*/, const TVector3 p2/*pion*/ );
double utils::GetRecoWPionProduction( const TVector3 p1 /*out electron*/, const TVector3 p2/*pion*/ );
and maybe also
double utils::GetRecoQ2PionProduction( const TVector3 p1 /*out electron*/, const TVector3 p2/*pion*/ );
Once this is done, we just need to compute these for all events that pass our selection criteria. This can be done by computing the variables (calling the functions above) in this function as well as storing the new variables in the TTree with a new name: https://github.com/e4nu/e4nuanalysiscode/blob/027d82485321c83859499beb00bdb700771fbf43/src/analysis/MCCLAS6AnalysisI.cxx#L412
The above is for the MC, and for the data, https://github.com/e4nu/e4nuanalysiscode/blob/027d82485321c83859499beb00bdb700771fbf43/src/analysis/CLAS6AnalysisI.cxx#L294
They must have the same name
Once this is done, I will run the code and send you the files
To get the Costh:
brCosthl = TMath::Cos( k2.Vect().Angle(k1.Vect()) );
TLorentzVector pi_mom(0,0,0,0) ;
if( topology_has_pip ) {
double max_mom = 0 ;
for( unsigned int i = 0 ; i < hadron_map[conf::kPdgPiP].size() ; ++i ) {
if( hadron_map[conf::kPdgPiP][i].P() > max_mom ) {
max_mom = hadron_map[conf::kPdgPiP][i].P() ;
pi_max = hadron_map[conf::kPdgPiP][i] ;
}
}
} else if( topology_has_pim ) {
double max_mom = 0 ;
for( unsigned int i = 0 ; i < hadron_map[conf::kPdgPiM].size() ; ++i ) {
if( hadron_map[conf::kPdgPiM][i].P() > max_mom ) {
max_mom = hadron_map[conf::kPdgPiM][i].P() ;
pi_max = hadron_map[conf::kPdgPiM][i] ;
}
}
To plot the MC predictions out of the analysis code you need
src/plotting_apps/plot_e4nuanalysis.cxx
Example:
MCLOC=/storage/t3_data/tvjulia/e4nuanalysis_files/1pi_analysis/analised_MC/
OUTLOC=/storage/t3_data/brittany/e4nuanalysis_files/1pi_analysis/Plots
./plot_e4nuanalysis --mc_location $MCLOC --output_location $OUTLOC --output_name clas6analysis_1pim_1GeV --input_mc_files e4nuanalysis_1pim_G18_10a_Dipole_LFG_Q2_01_1GeV_eCarbon_NoRad --model_names G18_10a --title "CLAS6 C^{12} 1#pi^{-} 1GeV" --observable_list "pim_mom" --analysis_id "1pim"
scp -o "ProxyJump jtena@login.jlab.org " -r jtena@ifarm1802.jlab.org:/storage/t3_data/tvjulia/e4nuanalysis_files/1pi_analysis/Plots/TotalXSec/clas6analysis_1pim_1GeV_with_breakdown_dxsec_dpim_mom.pdf .
Add Name of variable in the Tree as new observable
Change GetAxisName ( add new entry ) : https://github.com/e4nu/e4nuanalysiscode/blob/027d82485321c83859499beb00bdb700771fbf43/src/plotting/PlottingUtils.cxx#L65
Add new analysis key "pim" and within that if statement, add range for the new variables for each energy: https://github.com/e4nu/e4nuanalysiscode/blob/027d82485321c83859499beb00bdb700771fbf43/src/plotting/PlottingUtils.cxx#L246
Add definition of new variables and read from TBranch: https://github.com/e4nu/e4nuanalysiscode/blob/027d82485321c83859499beb00bdb700771fbf43/src/plotting/XSecUtils.cxx#L235 and also here https://github.com/e4nu/e4nuanalysiscode/blob/027d82485321c83859499beb00bdb700771fbf43/src/plotting/AcceptanceUtils.cxx#L103
Location of data files:
/storage/t3_data/tvjulia/e4nuanalysis_files/1pi_analysis/analised_data
To do for Julia
Small update
New G18_10a files at 2GeV available in
/storage/t3_data/tvjulia/e4nuanalysis_files/1pi_analysis/analised_MC/e4nuanalysis_1pim_G18_10a_Dipole_LFG_Q2_04_2GeV_eCarbon_NoRad_truereco.root
and
/storage/t3_data/tvjulia/e4nuanalysis_files/1pi_analysis/analised_MC/e4nuanalysis_1pim_G18_10a_Dipole_LFG_Q2_04_2GeV_eCarbon_NoRad_true.root
Ok I double checked. We do not have ElectronPT or pimom_T. It would be great if you could add them. To get the transverse momentum, you have to consider that the beam goes in the z direction, as you said. Here is an example function you can use: https://github.com/e4nu/e4nuanalysiscode/blob/9a845737f4d4743d054f17fac6488fa8c622a6a7/src/utils/KinematicUtils.cxx#L80
For instance, for the electron case it could look like this, after https://github.com/e4nu/e4nuanalysiscode/blob/9a845737f4d4743d054f17fac6488fa8c622a6a7/src/analysis/MCCLAS6AnalysisI.cxx#L259
double ElectronPT = utils::GetPT( out_mom.Vect() ).Mag() ;
# in line 265
and then just add it in the branches like we did for the other variables (for data and MC)
The same should be done for pip (L369) and pim (L389)
There are new files available at the analysis_MC folder:
e4nuanalysis_1pim_G18_10a_Rarita_LFG_Q2_01_1GeV_eCarbon_NoRad_true.root
e4nuanalysis_1pim_G18_10a_Rarita_LFG_Q2_04_2GeV_eCarbon_NoRad_true.root
e4nuanalysis_1pim_G18_10a_Rarita_LFG_Q2_08_4GeV_eCarbon_NoRad_true.root
e4nuanalysis_1pim_G18_10a_Dipole_LFG_Q2_04_2GeV_eCarbon_NoRad_true.root
and the corresponding reconstructed ones
I will update the NOFSI ones as soon as I can, not sure I will have time tomorrow but you have plenty for now
Let me know if the new 4GeV ones make sense or look also wrong
Other things to do are adding the new axes in the plotting (like Adi mentioned)
TDL after meeting 12 September 2024:
ElectronPT:
PionPT:
Total (HadDeltaPT):
The data files are now available on the tau cluster:
Location:
/storage/t3_data/tvjulia/e4nuanalysis_files/1pi_analysis/analised_data/
Files:
PionPT 1GeV Dipole breakdown w/ data:
ElectronPT 1GeV Dipole breakdown w/ data:
I opened a Drive containing all of the current PDF images and ROOT files where applicable: https://drive.google.com/drive/u/0/folders/1JqKBIaOI7pBHejtzVa3y7xcdjmH23OsW
Current progress and problems:
Comparison between Dipole and Rarita models has been completed for 1pim, for all energy levels and for all relevant variables (Angleqvshad, ECal, pim_mom, pim_theta, HadDeltaPT, PionPT, ElectronPT, RecoEvPion, RecoWPion, RecoW) - see https://drive.google.com/drive/u/0/folders/1JqKBIaOI7pBHejtzVa3y7xcdjmH23OsW: go to MC and Data Results -> 1pim -> any of the Dipole_vs_Rarita_Acceptance folders
MC vs Data results are completed for all of the relevant variables, for 1pim, for 1GeV only. 2GeV and 4GeV give weird results, even for the Dipole model:
2GeV Dipole comparison (Angleqvshad):
4GeV Dipole comparison (Angleqvshad)
Example when plotting using the Rarita model on its own:
./plot_e4nuanalysis --mc_location $MCLOC --output_location $OUTLOC --output_name clas6analysis_1pim_1GeV --input_mc_files e4nuanalysis_1pim_G18_10a_Rarita_LFG_Q2_01_1GeV_eCarbon_NoRad --model_names G18_10a --title "CLAS6 C^{12} 1#pi^{-} 1GeV" --observable_list ECal --analysis_id "1pim" --data_location $DATALOC --input_data_file e4nuanalysis_1pimanalysis_e_on_1000060120_1161MeV_4MaxBkgMult_clas6data
This command prints Warning in <TH1::TH1>: nbins is <=0 - set to nbins = 1
to the screen and then we get a segmentation fault. Other variables plot with very big cross sections instead (like ElectronPT).
Example when trying to plot Rarita and Dipole models on the same axis:
./plot_e4nuanalysis --mc_location $MCLOC --output_location $OUTLOC --output_name clas6analysis_1pim_1GeV --input_mc_files e4nuanalysis_1pim_G18_10a_Dipole_LFG_Q2_01_1GeV_eCarbon_NoRad,e4nuanalysis_1pim_G18_10a_Rarita_LFG_Q2_01_1GeV_eCarbon_NoRad --model_names G18_10a,G18_10a_Rarita --title "CLAS6 C^{12} 1#pi^{-} 1GeV" --observable_list Angleqvshad --analysis_id "1pim" --data_location $DATALOC --input_data_file e4nuanalysis_1pimanalysis_e_on_1000060120_1161MeV_4MaxBkgMult_clas6data --store_root true
In this case we get no errors and the graph looks like this:
I'm not sure what to make of this so I only did it for 1GeV for Angleqvshad as of now
No FSI files location
e4nuanalysis_1pim_GEM21_11a_Dipole_LFG_NoFSI_Q2_01_1GeV_eCarbon_NoRad_truereco.root
This paper has information on the transverse variables: https://arxiv.org/pdf/1512.05748 https://journals.aps.org/prd/pdf/10.1103/PhysRevD.108.053002 (For neutrinos) https://www.nature.com/articles/s41586-021-04046-5 (Nature paper e4nu collaboration)
Boosting angle - AlphaPT (HadAlphaPT
)
Angle between delta PT and electron
In the code: DeltaPT = | Vector_Electron_Transverse_Momentum + Vector_Highest_momentum_Pion_Transverse_Momentum|
HadDeltaPT = | Vector_Electron_Transverse_Momentum + Vector_Sum_Final_state_Hadrons_Transverse_Momentum| = (in your case, only 1 pion ) = | Vector_Electron_Transverse_Momentum + Vector_Pion_Transverse_Momentum|
you should get the cross section plots for:
1 - Introduction Goals of the analysis. We want to study single pion production with electron-scattering to understand nuclear effects and how to correctly model it for neutrinos DUNE flux -
Near detector flux = neutrino peaks at 3 GeV Far detector - peaks at 1 and 4, shifts in MC prediction due to incorrect pion modelling will affect the results of the oscillation fit.
We fit far detector to near detector ratio and fit it to the MC prediction. We need good understanding of Ev, also cross section. Exclusive is important as it helps us determine bias in Ev!
https://arxiv.org/abs/2009.07228
2 - Signal definition and run details Introduce GENIE (event generator used widely for neutrino community. Can run electron scattering as well as neutrinos) Constraining electron models we can improve neutrinos. You should refer to this paper: https://arxiv.org/pdf/2009.07228
You are using the G2018 model which uses the Rosenbluth cross section with the Local Fermi Gas for QE scattering and the Empirical MEC model [21]. RES is modeled using the Berger- Sehgal model [23] and DIS reactions are modeled using Bodek and Yang[24]. The models are described in more detail in Ref(). This model set is formally marked as the G18 10a 02 11a configura- tion of GENIE v3.
Define your event selection
Run events on Deuterium, what energy Run events on Carbon what energy
Particle cuts defined here: https://github.com/e4nu/e4nuanalysiscode/blob/c2c85c429729316a11cb54706475d4c1c93eacfd/src/conf/AnalysisCutsI.cxx#L13
Angle cut
3 - GENIE True level studies On hydrogen (and deuterium), all events with W> m_pi have a pion in the final state. Neutrino experiments, we use heavy nuclear targets. In this case, we have significant nuclear effects which alter the final state particles we detect and their kinematics. In this case, separating pion production events by using reconstructed W is not possible. In neutrino physics we can't compute the true W (depends on neutrino kinematics) but we can only guess it from the detected final state particles (muon, pion). Equations. With electrons we can do both, we can use it to understand the bias in Wreco.
https://journals.aps.org/prd/pdf/10.1103/PhysRevD.104.072009
GENIE for deuterium doesnt compute FSI.
Here show GENIE true level studies.
for all energies. Mention in two lines what you got from the multiplicity study.
The method used shows that it is not possible to reconstruct Wreco accurately and cuts on Wreco should not be used to isolate pion production.
We could attempt to correct the data from the reconstructed space (Wreco) back to the true variable using Monte carlo. This assumes our model can correctly describe this bias. We will show in the next section that this is not possible because our models are not good/precise/ enough. We will quantify how bad it is using electron data because we can compute both true and reconstructed only with data. bias = ( Wreco - W ) / W (We can use electrons to understand if we can correctly quantify the bias using just neutrinos, or if the event generators are wrong.)
4 - CLAS (maybe in introduction) and data analysis
Empathise that it is a large acceptance spectrometer (angular acceptance is 2pi).
Put the picture of clas with the sectors
Here you should say again what targets and energies CLAS6 used. (He, C, Fe) and 1.161, 2.261 and 4.461 GeV. Say we focus on Carbon
data analysis: here maybe put a table saying what momentum cuts. We correct for gaps in the detector, background contamination (corrects for additional particles in detector gaps), we account for particles momentum smearing ( we account for it in MC prediction).
How we convert to cross section:
5 - Results with data 5a ) Simple variables - momentum and angle of particles 5b ) Beam energy reconstruction - ECal and RecoEvPion Here mention they are the same equations than used in Sec 3
5c ) Event invariant mass (W) bias Here mention they are the same equations than used in Sec 3
5d ) Deeper look into nuclear effects Transverse invariance variables and theta qpi
No FSI files for 4GeV now also available at:
/storage/t3_data/tvjulia/e4nuanalysis_files/1pi_analysis/analised_MC/e4nuanalysis_1pim_GEM21_11a_Dipole_LFG_NoFSI_Q2_08_4GeV_eCarbon_NoRad_true.root
/storage/t3_data/tvjulia/e4nuanalysis_files/1pi_analysis/analised_MC/e4nuanalysis_1pim_GEM21_11a_Dipole_LFG_NoFSI_Q2_08_4GeV_eCarbon_NoRad_truereco.root
Presentation2.pptx Slides
References of interest: We want to have a look at what is done in neutrino physics in the case of pion production.
[ ] https://arxiv.org/pdf/1011.3572.pdf
[ ] https://cds.cern.ch/record/2623949?ln=ca Page 118 - 131 ( good overview of variables of interest ) Some of these variables are not available in the code yet. We want to add the missing variables here: https://github.com/e4nu/e4nuanalysiscode/blob/master/src/utils/KinematicUtils.cxx and https://github.com/e4nu/e4nuanalysiscode/blob/master/src/utils/KinematicUtils.h We will have to store them in the analysed ROOT file
[ ] Gide Brittany on the plotting scripts. Get cross-section measurement for different energies and targets
[ ] Plotting scripts. As of now, we plot RES (Delta + Above Delta contribution). We want to have the option to turn off Non-RES contribution as it is very off.
Quantify Background subtraction systematics with fiducial variations