1 /*************************************************************************
2 * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //////////////////////////////////////////////////////////////////////////
20 // Allow to define groups of cut conditions which are tested with //
21 // an OR condition between groups and an AND within groups //
23 //////////////////////////////////////////////////////////////////////////
25 #include "AliDielectronCutGroup.h"
27 ClassImp(AliDielectronCutGroup)
29 AliDielectronCutGroup::AliDielectronCutGroup(Bool_t compOperator /*=kCompOR*/) :
32 fCompOperator(compOperator)
35 // Default constructor
39 //_____________________________________________________________________
40 AliDielectronCutGroup::AliDielectronCutGroup(const char* name, const char* title, Bool_t compOperator /*=kCompOR*/) :
41 AliAnalysisCuts(name, title),
43 fCompOperator(compOperator)
50 //_____________________________________________________________________
51 AliDielectronCutGroup::~AliDielectronCutGroup()
58 //_____________________________________________________________________
59 void AliDielectronCutGroup::Init()
61 // Loop over all cuts and call Init
62 TIter next(&fCutGroupList);
63 while (AliAnalysisCuts *thisCut = (AliAnalysisCuts*) next()) thisCut->Init();
66 //_____________________________________________________________________
67 Bool_t AliDielectronCutGroup::IsSelected(TObject* track)
70 // Selection-finder handling different comparison operations
74 //Different init for and/or makes code shorter
75 Bool_t selectionResult=fCompOperator;
77 TIter listIterator(&fCutGroupList);
78 while (AliAnalysisCuts *thisCut = (AliAnalysisCuts*) listIterator()) {
79 if (fCompOperator == kCompOR) {
80 selectionResult = (selectionResult || thisCut->IsSelected(track));
83 selectionResult = (selectionResult && thisCut->IsSelected(track));
84 // if (selectionResult==kFALSE) break; //Save loops vs. additional check?
87 return selectionResult;
90 //_____________________________________________________________________
92 void AliDielectronCutGroup::AddCut(AliAnalysisCuts* fCut)
95 // Add a defined cut to the list
98 fCutGroupList.Add(fCut);
101 //_____________________________________________________________________
102 void AliDielectronCutGroup::SetCompOperator(Bool_t compOperator)
105 // Switch between AND/OR
108 fCompOperator = compOperator;
111 //________________________________________________________________________
112 void AliDielectronCutGroup::Print(const Option_t* /*option*/) const
115 // Print cuts and the range
118 TIter listIterator(&fCutGroupList);
119 while (AliAnalysisCuts *thisCut = (AliAnalysisCuts*) listIterator()) {