Skip to content

Commit

Permalink
Merge pull request #126 from AndrewEdmonds11/tutorial-patch
Browse files Browse the repository at this point in the history
Tutorial Patch
  • Loading branch information
AndrewEdmonds11 authored Mar 7, 2024
2 parents f6ba0be + 3113ff2 commit 9861980
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion tutorial/pages/genealogy.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ c1->SetGridy(true);
Now we can draw the X-Z starting position of the conversion electrons like this:

```
trkana->Draw("demmcsim.pos.x():demmcsim.pos.z()>>hist(1000,-20000,1000, 1000,-700,9000)", "demmcsim.prirel._rem==1 && demmcsim.prirel._rel==2", "COLZ");
TH2D* hist = new TH2D("hist", "", 1000,-20000,1000, 1000,-700,9000);
trkana->Draw("demmcsim.pos.x():demmcsim.pos.z()>>hist", "demmcsim.prirel._rem==1 && demmcsim.prirel._rel==2", "COLZ");
```
where ```prirel._rel==2``` is for parent. You should see the S-bend of the transport solenoid and also the production solenoid.

Expand Down
3 changes: 2 additions & 1 deletion tutorial/pages/mom-res.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ c1->SetGridy(true);
We can first plot the reconstructed momentum and the MC truth information separately:

```
trkana->Draw("demfit.mom.R()>>hist(100,100,110)", "demfit.sid==0", "HIST");
TH1D* hist = new TH1D("hist", "", 100,100,110));
trkana->Draw("demfit.mom.R()>>hist", "demfit.sid==0", "HIST");
trkana->Draw("demmcvd.mom.R()>>hist2", "demmcvd.sid==0", "HIST SAMES");
```

Expand Down
3 changes: 2 additions & 1 deletion tutorial/pages/n-hits.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ c1->SetGridy(true);
We can then plot a histogram of the number of hits on each track like so:

```
trkana->Draw("dem.nhits>>hist(100,0,100)", "", "goff");
TH1D* hist = new TH1D("hist", "", 100,0,100)
trkana->Draw("dem.nhits>>hist", "", "goff");
```

where ```goff``` is the drawing option to now draw since we are still missing some important information: axis labels
Expand Down
5 changes: 3 additions & 2 deletions tutorial/pages/reco-mom.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,16 @@ We want to plot the momentum of the tracks. If you ```Print()``` the ```demfit``
We want to plot the magnitude of the momentum vector. We could calculate it ourselves from the components but in ROOT, we can use member functions of [XYZVectorF](https://root.cern.ch/doc/v628/namespaceROOT_1_1Math.html#a767e8c52a85dc9538fe00603961eab98). We will use ```R()``` function:

```
trkana->Draw("demfit.mom.R()>>hist(100,100,110)", "", "HIST");
TH1D* hist = new TH1D("hist", "", 100,100,110")
trkana->Draw("demfit.mom.R()>>hist, "", "HIST");
```

You may notice that the peak is rather broad... That's because we are plotting the reconstructed track momentum at all the intersections - the entrance, middle, and exit of the tracker.

To see just the track momentum at one of the intersections, we need to apply a cut using the second argument to the ```Draw()``` function:

```
trkana->Draw("demfit.mom.R()>>hist(100,100,110)", "demfit.sid==0", "HIST")
trkana->Draw("demfit.mom.R()>>hist", "demfit.sid==0", "HIST")
```

where ```sid``` is the surface id of the intersection we want to plot (```sid=0``` is the entrance to the tracker).
Expand Down
3 changes: 2 additions & 1 deletion tutorial/pages/start-pos.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ c1->SetGridy(true);
Now we can draw the X-Y starting position of the conversion electrons like this:

```
trkana->Draw("demmcsim.pos.y():demmcsim.pos.x()>>hist(200,-100,100, 200,-100,100)", "demmcsim.prirel._rem==0", "COLZ");
TH2D* hist = new TH2D("hist", "", 100-100,100, 200,-100,100)
trkana->Draw("demmcsim.pos.y():demmcsim.pos.x()>>hist", "demmcsim.prirel._rem==0", "COLZ");
```

where ```COLZ``` tells ROOT to draw with a color map. Note that the coordinate system used by TrkAna is the detector coordinate system (origin = center of tracker) and not the global Mu2e coordinate system (origin = center of TS3).
Expand Down

0 comments on commit 9861980

Please sign in to comment.