ANASEN_analysis/Armory/README_anasenMS.md
James Szalkie a0f0a7083d redo
2026-03-30 10:49:41 -04:00

64 lines
2.2 KiB
Markdown

# ANASEN Monte Carlo (anasenMS.cpp)
## Overview
`anasenMS.cpp` is a standalone Monte Carlo simulation for an ANASEN-style detector setup. It generates transfer reaction kinematics, propagates products to a wire chamber (PW) and a silicon array (SX3), reconstructs tracks, and writes output to a ROOT tree.
## Requirements
- ROOT (e.g. `root-config` for compile flags)
- C++ compiler (gcc/g++)
- Project includes: `ClassTransfer.h`, `ClassAnasen.h`, plus their dependent implementation files.
## Build
In `Armory` directory:
```bash
g++ -O2 -o anasenMS anasenMS.cpp ClassTransfer.cpp ClassAnasen.cpp ... `root-config --cflags --libs`
```
(Adjust source file list based on actual project layout.)
## Run
```bash
./anasenMS [numEvents]
```
- `numEvents`: optional integer, default `1000000`
- Outputs: `SimAnasen1.root` containing `tree`
## What the code does
- Initializes reaction: `TransferReaction transfer`
- `SetA(24,12,0)` target
- `SetIncidentEnergyAngle(10,0,0)` beam energy and direction
- `Seta`, `Setb` reaction fragment indices
- Sets excitation lists: `ExAList`, `ExList`
- Vertex and resolution settings:
- `vertexX/Y/Z` ranges
- `sigmaSX3_W`, `sigmaSX3_L`, `sigmaPW_A`, `sigmaPW_C`
- Prepares ROOT output tree and branches for truth/reconstructed
- Loop over events:
- Sample excitation and CM direction
- `transfer.Event(thetaCM, phiCM)` outputs `TLorentzVector` products
- Compute lab angles/energies
- Random vertex inside target volume
- Run detector response:
- `pw->FindWireID(...)`
- `sx3->FindSX3Pos(...)`
- Read out wire hits and SX3 channel + depth
- Apply position smearing for SX3
- Reconstruct track via `pw->CalTrack` and `pw->CalTrack2`
- Fill ROOT tree
- At end: write tree, close file, clean up
## Notes
- The code now has expanded inline comments explaining each stage.
- Important methods are from:
- `ClassTransfer` (`SetA`, `SetIncidentEnergyAngle`, `Seta`, `Setb`, `SetExA`, `SetExB`, `CalReactionConstant`, `Event`)
- `ClassAnasen` / `SX3` / `PW` (`FindWireID`, `FindSX3Pos`, `GetHitInfo`, `CalTrack`, `CalTrack2`, `GetTrackTheta`, `GetTrackPhi`, `GetZ0`, `GetHitPosWithSigma`, `GetID`, etc.)
- Optional: change excitation lists, vertex spread, and sigma values to mimic different beam/target conditions.