]>
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 */ | |
6ce810fc | 52 | AliFMDFlowSplitter(const AliFMDFlowSplitter& o) : TObject(o) {} |
53 | ||
9b98d361 | 54 | /** Destructor */ |
55 | virtual ~AliFMDFlowSplitter() {} | |
56 | /** Assignment operator | |
57 | @param o Other splitter to assign from. | |
58 | @return Reference to this object */ | |
6ce810fc | 59 | AliFMDFlowSplitter& operator=(const AliFMDFlowSplitter&); |
9b98d361 | 60 | /** Called at the beginning of an event */ |
61 | virtual void Begin() {} | |
62 | /** Prepare for an event | |
63 | @param phis List of phis. | |
64 | @param xs List of bin variable | |
65 | @param n Number of entries in @a phis and @a n | |
66 | @return true on success, false otherwise */ | |
6ce810fc | 67 | virtual void Event(Double_t* phis, Double_t* xs, ULong_t n); |
9b98d361 | 68 | /** Decide whether entry should go in A or B sub-event. |
69 | @param entry The entry number | |
70 | @return true if this should go in sub-event A */ | |
71 | virtual Bool_t Select(ULong_t entry) const; | |
72 | /** Called at the end of an event */ | |
73 | virtual void End() {} | |
74 | protected: | |
75 | /** Reference to axis object */ | |
76 | ClassDef(AliFMDFlowSplitter,1) // Split events | |
77 | }; | |
6ce810fc | 78 | inline AliFMDFlowSplitter& |
79 | AliFMDFlowSplitter::operator=(const AliFMDFlowSplitter& /*o*/) | |
80 | { | |
81 | return *this; | |
82 | } | |
83 | inline void | |
84 | AliFMDFlowSplitter::Event(Double_t*, Double_t*,ULong_t) | |
85 | {} | |
9b98d361 | 86 | |
87 | //____________________________________________________________________ | |
88 | class AliFMDFlowShuffle : public AliFMDFlowSplitter | |
89 | { | |
90 | public: | |
91 | /** Constuctor */ | |
6ce810fc | 92 | AliFMDFlowShuffle() : fIdx(), fN(0) {} |
9b98d361 | 93 | /** Prepare for an event |
94 | @param phis List of phis. | |
95 | @param xs List of bin variable | |
96 | @param n Number of entries in @a phis and @a n | |
97 | @return true on success, false otherwise */ | |
98 | virtual void Event(Double_t* phis, Double_t* xs, ULong_t n); | |
99 | /** Decide whether entry should go in A or B sub-event. | |
100 | @param entry The entry number | |
101 | @return true if this should go in sub-event A */ | |
102 | virtual Bool_t Select(ULong_t entry) const; | |
103 | protected: | |
104 | /** Function to shuffle */ | |
105 | void Shuffle(); | |
106 | /** Array of indicies */ | |
107 | TArrayI fIdx; | |
108 | /** Curren number of entries */ | |
109 | ULong_t fN; | |
110 | ClassDef(AliFMDFlowShuffle,1) // Split events | |
111 | }; | |
112 | ||
113 | ||
114 | #endif | |
115 | // | |
116 | // EOF | |
117 | // |