Skip to content

Commit 2bacbc4

Browse files
committed
ADD: Command line option to show the location of the first interaction
1 parent eba2dff commit 2bacbc4

1 file changed

Lines changed: 27 additions & 21 deletions

File tree

src/mimrec/src/MInterfaceMimrec.cxx

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ bool MInterfaceMimrec::ParseCommandLine(int argc, char** argv)
166166
Usage<<" Create the scatter-angle distributions. If the -o option is given then the image is saved to this file."<<endl;
167167
Usage<<" --sequence-length:"<<endl;
168168
Usage<<" Create the sequence length plots. If the -o option is given then the image is saved to this file."<<endl;
169+
Usage<<" --location-first-interaction:"<<endl;
170+
Usage<<" Create histograms on the detector locations of the first interaction."<<endl;
169171
Usage<<" -x --extract:"<<endl;
170172
Usage<<" Extract events using the given event selection to the file given by -o"<<endl;
171173
Usage<<" -e --event-selections:"<<endl;
@@ -364,9 +366,13 @@ bool MInterfaceMimrec::ParseCommandLine(int argc, char** argv)
364366
DistanceDistribution();
365367
return KeepAlive;
366368
} else if (Option == "--sequence-length") {
367-
cout<<"Command-line parser: Generating Compton-sequence length plot..."<<endl;
369+
cout<<"Command-line parser: Generating Compton-sequence length plot..."<<endl;
368370
SequenceLengths();
369371
return KeepAlive;
372+
} else if (Option == "--location-first-interaction") {
373+
cout<<"Command-line parser: Generating Compton-sequence length plot..."<<endl;
374+
LocationOfInitialInteraction();
375+
return KeepAlive;
370376
} else if (Option == "--extract" || Option == "-x") {
371377
cout<<"Command-line parser: Extracting events..."<<endl;
372378
ExtractEvents();
@@ -6184,8 +6190,8 @@ void MInterfaceMimrec::LocationOfInitialInteraction()
61846190
// Step 2: Create the histograms
61856191
DetermineAxis(xMin, xMax, yMin, yMax, zMin, zMax, Positions);
61866192

6187-
TH3D* xyzHist = new TH3D("SpacialHitDistributionXYZ",
6188-
"Spacial hit distribution xyz",
6193+
TH3D* xyzHist = new TH3D("SpatialHitDistributionXYZ",
6194+
"Spatial hit distribution xyz",
61896195
MaxNBins, xMin, +xMax,
61906196
MaxNBins, yMin, +yMax,
61916197
MaxNBins, zMin, +zMax);
@@ -6194,22 +6200,22 @@ void MInterfaceMimrec::LocationOfInitialInteraction()
61946200
xyzHist->GetYaxis()->SetTitle("y [cm]");
61956201
xyzHist->GetZaxis()->SetTitle("z [cm]");
61966202

6197-
TH1D* xHist = new TH1D("SpacialHitDistributionX",
6198-
"Spacial hit distribution x",
6203+
TH1D* xHist = new TH1D("SpatialHitDistributionX",
6204+
"Spatial hit distribution x",
61996205
MaxNBins, xMin, +xMax);
62006206
xHist->SetBit(kCanDelete);
62016207
xHist->GetXaxis()->SetTitle("x [cm]");
62026208
xHist->GetYaxis()->SetTitle("counts");
62036209

6204-
TH1D* yHist = new TH1D("SpacialHitDistributionY",
6205-
"Spacial hit distribution y",
6210+
TH1D* yHist = new TH1D("SpatialHitDistributionY",
6211+
"Spatial hit distribution y",
62066212
MaxNBins, yMin, +yMax);
62076213
yHist->SetBit(kCanDelete);
62086214
yHist->GetXaxis()->SetTitle("y [cm]");
62096215
yHist->GetYaxis()->SetTitle("counts");
62106216

6211-
TH1D* zHist = new TH1D("SpacialHitDistributionZ",
6212-
"Spacial hit distribution z",
6217+
TH1D* zHist = new TH1D("SpatialHitDistributionZ",
6218+
"Spatial hit distribution z",
62136219
MaxNBins, zMin, +zMax);
62146220
zHist->SetBit(kCanDelete);
62156221
zHist->GetXaxis()->SetTitle("z [cm]");
@@ -6259,25 +6265,25 @@ void MInterfaceMimrec::LocationOfInitialInteraction()
62596265

62606266
// Step 5: Show the histograms
62616267

6262-
TCanvas* xyzCanvas = new TCanvas();
6263-
xyzCanvas->cd();
6268+
TCanvas* Canvas = new TCanvas();
6269+
Canvas->Divide(2, 2);
6270+
6271+
Canvas->cd(4);
62646272
xyzHist->Draw();
6265-
xyzCanvas->Update();
62666273

6267-
TCanvas* xCanvas = new TCanvas();
6268-
xCanvas->cd();
6274+
Canvas->cd(1);
62696275
xHist->Draw();
6270-
xCanvas->Update();
62716276

6272-
TCanvas* yCanvas = new TCanvas();
6273-
yCanvas->cd();
6277+
Canvas->cd(2);
62746278
yHist->Draw();
6275-
yCanvas->Update();
62766279

6277-
TCanvas* zCanvas = new TCanvas();
6278-
zCanvas->cd();
6280+
Canvas->cd(3);
62796281
zHist->Draw();
6280-
zCanvas->Update();
6282+
6283+
Canvas->Update();
6284+
if (m_OutputFileName.IsEmpty() == false) {
6285+
Canvas->SaveAs(m_OutputFileName);
6286+
}
62816287

62826288
// Dump the info:
62836289
map<MString, int>::iterator Iter;

0 commit comments

Comments
 (0)