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 Bool_t AliDielectronCutGroup::IsSelected(TObject* track)
62 // Selection-finder handling different comparison operations
66 //Different init for and/or makes code shorter
67 Bool_t selectionResult=fCompOperator;
69 TIter listIterator(&fCutGroupList);
70 while (AliAnalysisCuts *thisCut = (AliAnalysisCuts*) listIterator()) {
71 if (fCompOperator == kCompOR) {
72 selectionResult = (selectionResult || thisCut->IsSelected(track));
75 selectionResult = (selectionResult && thisCut->IsSelected(track));
76 if (selectionResult==kFALSE) break; //Save loops vs. additional check?
80 return selectionResult;
83 //_____________________________________________________________________
85 void AliDielectronCutGroup::AddCut(AliAnalysisCuts* fCut)
88 // Add a defined cut to the list
91 fCutGroupList.Add(fCut);
94 //_____________________________________________________________________
95 void AliDielectronCutGroup::SetCompOperator(Bool_t compOperator)
98 // Switch between AND/OR
101 fCompOperator = compOperator;