2 /* Copyright (C) 2007 Christian Holm Christensen <cholm@nbi.dk>
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.
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.
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
20 @brief Declaration of an Axis in a Flow "histogram" */
21 #ifndef ALIFMDFLOWSPLITTER_H
22 #define ALIFMDFLOWSPLITTER_H
23 #include "flow/AliFMDFlowAxis.h"
34 // Object used by AliFMDFlowBinned1D to split an event into sub-events.
35 // Default is to split randomly.
36 // User defined derived classes can do other stuff.
38 //______________________________________________________
39 /** @class AliFMDFlowSplitter flow/AliFMDFlowSplitter.h <flow/AliFMDFlowSplitter.h>
41 @brief Object used by AliFMDFlowBinned1D to split an event into
42 sub-events. Default is to split randomly. User defined derived
43 classes can do other stuff.
47 class AliFMDFlowSplitter : public TObject
51 @param axis Axis object */
52 AliFMDFlowSplitter() : fRandom(0) {}
54 @param axis Axis object */
55 AliFMDFlowSplitter(ULong_t seed) : fRandom(seed) {}
57 @param o Other splitter to copy from */
58 AliFMDFlowSplitter(const AliFMDFlowSplitter& o)
59 : TObject(o), fRandom(o.fRandom)
63 virtual ~AliFMDFlowSplitter() {}
64 /** Assignment operator
65 @param o Other splitter to assign from.
66 @return Reference to this object */
67 AliFMDFlowSplitter& operator=(const AliFMDFlowSplitter&);
68 /** Called at the beginning of an event */
69 virtual void Begin() {}
70 /** Prepare for an event
71 @param phis List of phis.
72 @param xs List of bin variable
73 @param n Number of entries in @a phis and @a n
74 @return true on success, false otherwise */
75 virtual void Event(Double_t* phis, Double_t* xs, ULong_t n);
76 /** Decide whether entry should go in A or B sub-event.
77 @param entry The entry number
78 @return true if this should go in sub-event A */
79 virtual Bool_t Select(ULong_t entry) const;
80 /** Called at the end of an event */
83 mutable TRandom fRandom;
84 /** Reference to axis object */
85 ClassDef(AliFMDFlowSplitter,1) // Split events
87 inline AliFMDFlowSplitter&
88 AliFMDFlowSplitter::operator=(const AliFMDFlowSplitter& /*o*/)
93 AliFMDFlowSplitter::Event(Double_t*, Double_t*,ULong_t)
96 //____________________________________________________________________
97 class AliFMDFlowShuffle : public AliFMDFlowSplitter
101 AliFMDFlowShuffle() : fIdx(), fN(0) {}
102 /** Prepare for an event
103 @param phis List of phis.
104 @param xs List of bin variable
105 @param n Number of entries in @a phis and @a n
106 @return true on success, false otherwise */
107 virtual void Event(Double_t* phis, Double_t* xs, ULong_t n);
108 /** Decide whether entry should go in A or B sub-event.
109 @param entry The entry number
110 @return true if this should go in sub-event A */
111 virtual Bool_t Select(ULong_t entry) const;
113 /** Function to shuffle */
115 /** Array of indicies */
117 /** Curren number of entries */
119 ClassDef(AliFMDFlowShuffle,1) // Split events