]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGDQ/dielectron/AliDielectronCutGroup.cxx
add the possibility to use an OCDB snapshot. Just put the file OCDB.root in the direc...
[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));
84 if (selectionResult==kFALSE) break; //Save loops vs. additional check?
85 }
86
87 }
88 return selectionResult;
89}
90
91//_____________________________________________________________________
92
93void AliDielectronCutGroup::AddCut(AliAnalysisCuts* fCut)
94{
95 //
96 // Add a defined cut to the list
97 //
98
99 fCutGroupList.Add(fCut);
100}
101
102//_____________________________________________________________________
103void AliDielectronCutGroup::SetCompOperator(Bool_t compOperator)
104{
105 //
106 // Switch between AND/OR
107 //
108
109 fCompOperator = compOperator;
110}
6bd73568 111
112//________________________________________________________________________
113void AliDielectronCutGroup::Print(const Option_t* /*option*/) const
114{
115 //
116 // Print cuts and the range
117 //
118
119 TIter listIterator(&fCutGroupList);
120 while (AliAnalysisCuts *thisCut = (AliAnalysisCuts*) listIterator()) {
121 thisCut->Print();
122 }
123
124}