/[PAMELA software]/PamCut/CollectionActions/SaveEventsAction/SaveEventsAction.h
ViewVC logotype

Annotation of /PamCut/CollectionActions/SaveEventsAction/SaveEventsAction.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Thu Jul 8 14:00:24 2010 UTC (14 years, 5 months ago) by pam-fi
Branch: MAIN
CVS Tags: MergedFromV8_1, V9, HEAD
Changes since 1.2: +13 -2 lines
File MIME type: text/plain
Merged from branch V8 (tag MergedToHEAD_1). Tag before the merge: BeforeMergingFromV8_1.

1 pam-fi 1.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 pam-fi 1.3 * This action saves the selected events into a ROOT file. WARNING: since this class uses the PamLevel2 clone trees, you can
18     * have NO MORE THAN 1 SaveEventsAction objects in your code (otherwise they will share the same PamLevel2 clone trees, resulting
19     * in an undefined behavior).
20 pam-fi 1.1 */
21     class SaveEventsAction: public CollectionAction {
22    
23     public:
24     /*! @brief Constructor.
25     *
26     * outOptions is to be passed as the argument of a PamLevel2::SetWhichTrees() call,
27     * so it must be encoded in a compatible format. See the PamLevel2 documentation.
28     *
29     * @param actionName The action's name.
30     * @param outFileName The output file name, with path (absolute or relative).
31     * @param outOptions The output options.
32 pam-fi 1.3 * @param maxFileSize The maximum output file size in bytes; default is 4 GB. If the maximum size will exceed this value
33     * an error will be generated, since the first clone tree in PamLevel2 which during its Fill will exceed
34     * this value will try to close the current file and open another one (this is the predefined TTree behavior)
35     * leaving the other clone trees with no file to write on.
36     * Note: if specifying the size you get a compiler warning like "warning: this decimal constant is unsigned
37     * only in ISO C90" then append LL to the numerical constant, to tell the compiler that it has to be interpreted
38     * as a long long int.
39 pam-fi 1.1 */
40 pam-fi 1.3 SaveEventsAction(const char *actionName, TString outFileName, TString outOptions = TString(""), Long64_t maxFileSize =
41     4000000000LL);
42 pam-fi 1.1
43     /*! @brief Destructor */
44     ~SaveEventsAction() {
45     }
46    
47     /*! @brief The setup procedure.
48     *
49     * This routine will set the trees to be saved, by calling PamLevel2::SetWhichTrees().
50     *
51     * @param events The events pointer.
52     */
53     void Setup(PamLevel2 *events);
54    
55     /*! @brief Fills the tree with the selected event.
56     *
57     * @param event The selected event.
58     */
59     void OnGood(PamLevel2 *event);
60    
61     /*! @brief Writes the tree of saved events to the output file. */
62     void Finalize();
63    
64     private:
65    
66     TFile *_outTreeFile;
67     PamLevel2 *_events;
68     TString _outOptions;
69 pam-fi 1.2 TString _outFileName;
70 pam-fi 1.3 Long64_t _maxFileSize;
71 pam-fi 1.1 };
72    
73     #endif /* SAVEEVENTSACTION_H_ */

  ViewVC Help
Powered by ViewVC 1.1.23