]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/hfe/AliHFEcutStep.cxx
Updates, adding EMCal (committing on behalf of Silvia)
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliHFEcutStep.cxx
CommitLineData
70da6c5a 1/**************************************************************************
2* Copyright(c) 1998-1999, 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**************************************************************************/
27de2dfb 15
16/* $Id$ */
17
70da6c5a 18//
19// Cut step class
20// Select all tracks surviving cuts in one special cut step
21// Used in AliHFEtrackFilter
22//
23// Author:
24// Markus Fasel <M.Fasel@gsi.de>
25//
26#include <TObjArray.h>
27
28#include "AliAnalysisCuts.h"
29#include "AliCFCutBase.h"
30#include "AliHFEcutStep.h"
31#include "AliLog.h"
32#include "AliMCEvent.h"
33
34ClassImp(AliHFEcutStep)
35
36//__________________________________________________________________
37AliHFEcutStep::AliHFEcutStep(const Char_t *name):
38 TNamed(name, ""),
39 fCuts(NULL)
40{
41 //
42 // Default Constructor
43 //
44 fCuts = new TObjArray;
45}
46
47//__________________________________________________________________
48AliHFEcutStep::AliHFEcutStep(const AliHFEcutStep &o):
49 TNamed(o),
50 fCuts(NULL)
51{
52 //
53 // Copy constructor
54 //
55 o.Copy(*this);
56}
57
58//__________________________________________________________________
59AliHFEcutStep &AliHFEcutStep::operator=(const AliHFEcutStep &o){
60 //
61 // Assignment operator
62 //
63 if(this != &o)
64 o.Copy(*this);
65 return *this;
66}
67
68//__________________________________________________________________
69AliHFEcutStep::~AliHFEcutStep(){
70 //
71 // destructor
72 //
73 delete fCuts;
74}
75
76//__________________________________________________________________
77void AliHFEcutStep::Copy(TObject &o) const{
78 //
79 // Copy into content into object o
80 //
81 TNamed::Copy(o);
82 AliHFEcutStep &target = dynamic_cast<AliHFEcutStep &>(o);
83
84 // Make copy
85 target.fCuts = dynamic_cast<TObjArray *>(fCuts->Clone());
86}
87
88//__________________________________________________________________
89Bool_t AliHFEcutStep::IsSelected(TObject *o){
90 //
91 // Filter tracks in the given cut step
92 // Apply all cut objects
93 //
91c7e1ec 94 AliDebug(1, Form("Cut Step %s: Number of cut objects: %d", GetName(), fCuts->GetEntriesFast()));
70da6c5a 95 if(!fCuts->GetEntriesFast()) return kTRUE;
96 Bool_t isSelected = kTRUE;
e3ae862b 97 AliAnalysisCuts *cuts = NULL;
70da6c5a 98 for(Int_t iCut = 0; iCut < fCuts->GetEntriesFast(); iCut++){
e3ae862b 99 cuts = dynamic_cast<AliAnalysisCuts *>(fCuts->UncheckedAt(iCut));
100 if(cuts && (!cuts->IsSelected(o))) isSelected = kFALSE;
70da6c5a 101 }
91c7e1ec 102 AliDebug(1, Form("Accepted: %s", isSelected ? "yes" : "no"));
70da6c5a 103 return isSelected;
104}
105
106//__________________________________________________________________
107AliAnalysisCuts *AliHFEcutStep::GetCut(const Char_t *cutName){
108 //
109 // return cut object
110 //
111 return dynamic_cast<AliAnalysisCuts *>(fCuts->FindObject(cutName));
112}
113
114//__________________________________________________________________
115void AliHFEcutStep::AddCut(AliAnalysisCuts *cut){
116 //
117 // Add cut object to the cut step
118 //
119 fCuts->Add(cut);
120}
121
122//__________________________________________________________________
123void AliHFEcutStep::SetMC(AliMCEvent *mc){
124 //
125 // Set MC information to the cuts in the cut step
126 //
bf892a6a 127 AliCFCutBase *cfc = NULL;
70da6c5a 128 for(Int_t icut = 0; icut < fCuts->GetEntriesFast(); icut++){
bf892a6a 129 if((cfc = dynamic_cast<AliCFCutBase *>(fCuts->UncheckedAt(icut)))) cfc->SetMCEventInfo(mc);
70da6c5a 130 }
131}
132
133//__________________________________________________________________
134void AliHFEcutStep::SetRecEvent(AliVEvent *rec){
135 //
136 // Publish rec event to the cut step
137 //
bf892a6a 138 AliCFCutBase *cfc = NULL;
70da6c5a 139 for(Int_t icut = 0; icut < fCuts->GetEntriesFast(); icut++){
bf892a6a 140 if((cfc = dynamic_cast<AliCFCutBase *>(fCuts->UncheckedAt(icut)))) cfc->SetRecEventInfo(rec);
70da6c5a 141 }
142}
143