This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
root:storemcnumbers [2009/01/07 14:59] – decianm | root:storemcnumbers [2009/01/07 15:16] (current) – decianm | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Storing Monte Carlo numbers in a file ====== | + | ====== Storing Monte Carlo particle |
===== Idea ===== | ===== Idea ===== | ||
When analyzing signal or background using Monte Carlo truth information, | When analyzing signal or background using Monte Carlo truth information, | ||
Line 18: | Line 18: | ||
==== .cc File ==== | ==== .cc File ==== | ||
- | Add the following method to your **.cc-File** | + | Add the following method to your **.cc-File** |
< | < | ||
- | void ana:: | + | void yourclass:: |
| | ||
// -------------------------------------------------------------------------------- | // -------------------------------------------------------------------------------- | ||
Line 57: | Line 57: | ||
| | ||
// -- Open a file to save the output | // -- Open a file to save the output | ||
+ | // -- Note: The " | ||
fstream PIDfile(filename, | fstream PIDfile(filename, | ||
| | ||
Line 81: | Line 82: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ===== Notes ===== | ||
+ | If the output-file already exists, the output will be appended. This is useful if you call the method several times for different particles and want to store everything in one file. If you don't like this behaviour, delete the '' |