]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGDQ/dielectron/AliDielectronCutGroup.cxx
add task pp filter
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / AliDielectronCutGroup.cxx
CommitLineData
2a14a7b1 1/*************************************************************************
2 * Copyright(c) 1998-2009, 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// CutGroup //
18// //
19// //
20// Allow to define groups of cut conditions which are tested with //
21// an OR condition between groups and an AND within groups //
22// //
23//////////////////////////////////////////////////////////////////////////
24
25#include "AliDielectronCutGroup.h"
26
27ClassImp(AliDielectronCutGroup)
28
29AliDielectronCutGroup::AliDielectronCutGroup(Bool_t compOperator /*=kCompOR*/) :
30 AliAnalysisCuts(),
31 fCutGroupList(0x0),
32 fCompOperator(compOperator)
33{
34 //
35 // Default constructor
36 //
37}
38
39//_____________________________________________________________________
40AliDielectronCutGroup::AliDielectronCutGroup(const char* name, const char* title, Bool_t compOperator /*=kCompOR*/) :
41 AliAnalysisCuts(name, title),
42 fCutGroupList(0x0),
43 fCompOperator(compOperator)
44{
45 //
46 // Named Constructor
47 //
48}
49
50//_____________________________________________________________________
51AliDielectronCutGroup::~AliDielectronCutGroup()
52{
53 //
54 //Default Destructor
55 //
56}
57
99345a64 58//_____________________________________________________________________
59void AliDielectronCutGroup::Init()
60{
61 // Loop over all cuts and call Init
62 TIter next(&fCutGroupList);
63 while (AliAnalysisCuts *thisCut = (AliAnalysisCuts*) next()) thisCut->Init();
64}
65
2a14a7b1 66//_____________________________________________________________________
67Bool_t AliDielectronCutGroup::IsSelected(TObject* track)
68{
69 //
70 // Selection-finder handling different comparison operations
71 //
72
73
74 //Different init for and/or makes code shorter
75 Bool_t selectionResult=fCompOperator;
76
77 TIter listIterator(&fCutGroupList);
78 while (AliAnalysisCuts *thisCut = (AliAnalysisCuts*) listIterator()) {
79 if (fCompOperator == kCompOR) {
80 selectionResult = (selectionResult || thisCut->IsSelected(track));
81 }
82 else { //kCompAND
83 selectionResult = (selectionResult && thisCut->IsSelected(track));
dd718b9c 84 // if (selectionResult==kFALSE) break; //Save loops vs. additional check?
2a14a7b1 85 }
2a14a7b1 86 }
87 return selectionResult;
88}
89
90//_____________________________________________________________________
91
92void AliDielectronCutGroup::AddCut(AliAnalysisCuts* fCut)
93{
94 //
95 // Add a defined cut to the list
96 //
97
98 fCutGroupList.Add(fCut);
99}
100
101//_____________________________________________________________________
102void AliDielectronCutGroup::SetCompOperator(Bool_t compOperator)
103{
104 //
105 // Switch between AND/OR
106 //
107
108 fCompOperator = compOperator;
109}
6bd73568 110
111//________________________________________________________________________
112void AliDielectronCutGroup::Print(const Option_t* /*option*/) const
113{
114 //
115 // Print cuts and the range
116 //
117
d4619886 118 // TODO: add compOperator printout
6bd73568 119 TIter listIterator(&fCutGroupList);
120 while (AliAnalysisCuts *thisCut = (AliAnalysisCuts*) listIterator()) {
121 thisCut->Print();
122 }
123
124}