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 **************************************************************************/
18 //////////////////////////////////////////////////////////////////////////
22 // Allow to define groups of cut conditions which are tested with //
23 // an OR condition between groups and an AND within groups //
25 //////////////////////////////////////////////////////////////////////////
27 #include "AliDielectronCutGroup.h"
29 ClassImp(AliDielectronCutGroup)
31 AliDielectronCutGroup::AliDielectronCutGroup(Bool_t compOperator /*=kCompOR*/) :
34 fCompOperator(compOperator)
37 // Default constructor
41 //_____________________________________________________________________
42 AliDielectronCutGroup::AliDielectronCutGroup(const char* name, const char* title, Bool_t compOperator /*=kCompOR*/) :
43 AliAnalysisCuts(name, title),
45 fCompOperator(compOperator)
52 //_____________________________________________________________________
53 AliDielectronCutGroup::~AliDielectronCutGroup()
60 //_____________________________________________________________________
61 Bool_t AliDielectronCutGroup::IsSelected(TObject* track)
64 // Selection-finder handling different comparison operations
68 //Different init for and/or makes code shorter
69 Bool_t selectionResult=fCompOperator;
71 TIter listIterator(&fCutGroupList);
72 while (AliAnalysisCuts *thisCut = (AliAnalysisCuts*) listIterator()) {
73 if (fCompOperator == kCompOR) {
74 selectionResult = (selectionResult || thisCut->IsSelected(track));
77 selectionResult = (selectionResult && thisCut->IsSelected(track));
78 if (selectionResult==kFALSE) break; //Save loops vs. additional check?
82 return selectionResult;
85 //_____________________________________________________________________
87 void AliDielectronCutGroup::AddCut(AliAnalysisCuts* fCut)
90 // Add a defined cut to the list
93 fCutGroupList.Add(fCut);
96 //_____________________________________________________________________
97 void AliDielectronCutGroup::SetCompOperator(Bool_t compOperator)
100 // Switch between AND/OR
103 fCompOperator = compOperator;