| 1 |
/* |
| 2 |
* SaveEventsAction.h |
| 3 |
* |
| 4 |
* Created on: 16-mag-2009 |
| 5 |
* Author: Nicola Mori |
| 6 |
*/ |
| 7 |
|
| 8 |
/*! @file SaveEventsAction.h The SaveEventsAction class declaration file */ |
| 9 |
|
| 10 |
#ifndef SAVEEVENTSACTION_H_ |
| 11 |
#define SAVEEVENTSACTION_H_ |
| 12 |
|
| 13 |
#include "../CollectionAction/CollectionAction.h" |
| 14 |
|
| 15 |
/*! @brief An action that saves the selected events |
| 16 |
* |
| 17 |
* This action saves the selected events into a ROOT file. |
| 18 |
*/ |
| 19 |
class SaveEventsAction: public CollectionAction { |
| 20 |
|
| 21 |
public: |
| 22 |
/*! @brief Constructor. |
| 23 |
* |
| 24 |
* outOptions is to be passed as the argument of a PamLevel2::SetWhichTrees() call, |
| 25 |
* so it must be encoded in a compatible format. See the PamLevel2 documentation. |
| 26 |
* |
| 27 |
* @param actionName The action's name. |
| 28 |
* @param outFileName The output file name, with path (absolute or relative). |
| 29 |
* @param outOptions The output options. |
| 30 |
*/ |
| 31 |
SaveEventsAction(const char *actionName, TString outFileName, TString outOptions = TString("")); |
| 32 |
|
| 33 |
/*! @brief Destructor */ |
| 34 |
~SaveEventsAction() { |
| 35 |
} |
| 36 |
|
| 37 |
/*! @brief The setup procedure. |
| 38 |
* |
| 39 |
* This routine will set the trees to be saved, by calling PamLevel2::SetWhichTrees(). |
| 40 |
* |
| 41 |
* @param events The events pointer. |
| 42 |
*/ |
| 43 |
void Setup(PamLevel2 *events); |
| 44 |
|
| 45 |
/*! @brief Fills the tree with the selected event. |
| 46 |
* |
| 47 |
* @param event The selected event. |
| 48 |
*/ |
| 49 |
void OnGood(PamLevel2 *event); |
| 50 |
|
| 51 |
/*! @brief Writes the tree of saved events to the output file. */ |
| 52 |
void Finalize(); |
| 53 |
|
| 54 |
private: |
| 55 |
|
| 56 |
TFile *_outTreeFile; |
| 57 |
PamLevel2 *_events; |
| 58 |
TString _outOptions; |
| 59 |
}; |
| 60 |
|
| 61 |
#endif /* SAVEEVENTSACTION_H_ */ |