]>
Commit | Line | Data |
---|---|---|
9b98d361 | 1 | // -*- mode: C++ -*- |
2 | /* Copyright (C) 2007 Christian Holm Christensen <cholm@nbi.dk> | |
3 | * | |
4 | * This library is free software; you can redistribute it and/or | |
5 | * modify it under the terms of the GNU Lesser General Public License | |
6 | * as published by the Free Software Foundation; either version 2.1 of | |
7 | * the License, or (at your option) any later version. | |
8 | * | |
9 | * This library is distributed in the hope that it will be useful, but | |
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | * Lesser General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU Lesser General Public | |
15 | * License along with this library; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |
17 | * USA | |
18 | */ | |
19 | /** @file | |
20 | @brief Declaration of an Axis in a Flow "histogram" */ | |
21 | #ifndef ALIFMDFLOWSPLITTER_H | |
22 | #define ALIFMDFLOWSPLITTER_H | |
23 | #include "flow/AliFMDFlowAxis.h" | |
24 | #include <TArrayI.h> | |
25 | #ifndef ROOT_TObject | |
26 | # include <TObject.h> | |
27 | #endif | |
28 | class AliFMDFlowAxis; | |
29 | class TProfile; | |
30 | // | |
31 | // Object used by AliFMDFlowBinned1D to split an event into sub-events. | |
32 | // Default is to split randomly. | |
33 | // User defined derived classes can do other stuff. | |
34 | // | |
35 | //______________________________________________________ | |
36 | /** @class AliFMDFlowSplitter flow/AliFMDFlowSplitter.h <flow/AliFMDFlowSplitter.h> | |
37 | ||
38 | @brief Object used by AliFMDFlowBinned1D to split an event into | |
39 | sub-events. Default is to split randomly. User defined derived | |
40 | classes can do other stuff. | |
41 | ||
42 | @ingroup c_binned | |
43 | */ | |
44 | class AliFMDFlowSplitter : public TObject | |
45 | { | |
46 | public: | |
47 | /** Constructor | |
48 | @param axis Axis object */ | |
49 | AliFMDFlowSplitter() {} | |
50 | /** Copy constructor | |
51 | @param o Other splitter to copy from */ | |
52 | AliFMDFlowSplitter(const AliFMDFlowSplitter& o) {} | |
53 | /** Destructor */ | |
54 | virtual ~AliFMDFlowSplitter() {} | |
55 | /** Assignment operator | |
56 | @param o Other splitter to assign from. | |
57 | @return Reference to this object */ | |
58 | AliFMDFlowSplitter& operator=(const AliFMDFlowSplitter& o) { return *this; } | |
59 | /** Called at the beginning of an event */ | |
60 | virtual void Begin() {} | |
61 | /** Prepare for an event | |
62 | @param phis List of phis. | |
63 | @param xs List of bin variable | |
64 | @param n Number of entries in @a phis and @a n | |
65 | @return true on success, false otherwise */ | |
66 | virtual void Event(Double_t* phis, Double_t* xs, ULong_t n) {} | |
67 | /** Decide whether entry should go in A or B sub-event. | |
68 | @param entry The entry number | |
69 | @return true if this should go in sub-event A */ | |
70 | virtual Bool_t Select(ULong_t entry) const; | |
71 | /** Called at the end of an event */ | |
72 | virtual void End() {} | |
73 | protected: | |
74 | /** Reference to axis object */ | |
75 | ClassDef(AliFMDFlowSplitter,1) // Split events | |
76 | }; | |
77 | ||
78 | //____________________________________________________________________ | |
79 | class AliFMDFlowShuffle : public AliFMDFlowSplitter | |
80 | { | |
81 | public: | |
82 | /** Constuctor */ | |
83 | AliFMDFlowShuffle() {} | |
84 | /** Prepare for an event | |
85 | @param phis List of phis. | |
86 | @param xs List of bin variable | |
87 | @param n Number of entries in @a phis and @a n | |
88 | @return true on success, false otherwise */ | |
89 | virtual void Event(Double_t* phis, Double_t* xs, ULong_t n); | |
90 | /** Decide whether entry should go in A or B sub-event. | |
91 | @param entry The entry number | |
92 | @return true if this should go in sub-event A */ | |
93 | virtual Bool_t Select(ULong_t entry) const; | |
94 | protected: | |
95 | /** Function to shuffle */ | |
96 | void Shuffle(); | |
97 | /** Array of indicies */ | |
98 | TArrayI fIdx; | |
99 | /** Curren number of entries */ | |
100 | ULong_t fN; | |
101 | ClassDef(AliFMDFlowShuffle,1) // Split events | |
102 | }; | |
103 | ||
104 | ||
105 | #endif | |
106 | // | |
107 | // EOF | |
108 | // |