Restore changes of 1.101 and 1.102 which have been accidently deleted.
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisFilter.cxx
CommitLineData
7c38d6ee 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16//
17// Manager class for filter decisions based on cuts
18// The filter contains a list of sets of cuts.
19// A bit field is filled in order to store the decision of each cut-set.
20// Author: Andreas Morsch
21// andreas.morsch@cern.ch
22
23#include <TObject.h>
24#include <TList.h>
25#include "AliAnalysisFilter.h"
26#include "AliAnalysisCuts.h"
27
28
29ClassImp(AliAnalysisFilter)
30
31
32////////////////////////////////////////////////////////////////////////
33
34AliAnalysisFilter::AliAnalysisFilter():
35 TNamed(),
36 fCuts(0)
37{
38 // Default constructor
39}
40
41AliAnalysisFilter::AliAnalysisFilter(const char* name, const char* title):
42 TNamed(name, title),
43 fCuts(new TList())
44{
45 // Constructor
46}
47
48AliAnalysisFilter::AliAnalysisFilter(const AliAnalysisFilter& obj):
49 TNamed(obj)
50{
51// Copy constructor
52}
53
54
55UInt_t AliAnalysisFilter::IsSelected(TObject* obj)
56{
57 //
58 // Loop over all set of cuts
59 // and store the decision
60 UInt_t result = 0;
61 TIter next(fCuts);
62 AliAnalysisCuts *cuts;
63 Int_t iCutB = 1;
64
65 while((cuts = (AliAnalysisCuts*)next())) {
66 Bool_t acc = cuts->IsSelected(obj);
67 if (acc) {result |= iCutB & 0x00ffffff;}
68 iCutB *= 2;
69 }
70
71 return result;
72}
73
74void AliAnalysisFilter::AddCuts(AliAnalysisCuts* cuts)
75{
76 // Add a set of cuts
77 fCuts->Add(cuts);
78}