1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 **************************************************************************/
17 // Select all tracks surviving cuts in one special cut step
18 // Used in AliHFEtrackFilter
21 // Markus Fasel <M.Fasel@gsi.de>
23 #include <TObjArray.h>
25 #include "AliAnalysisCuts.h"
26 #include "AliCFCutBase.h"
27 #include "AliHFEcutStep.h"
29 #include "AliMCEvent.h"
31 ClassImp(AliHFEcutStep)
33 //__________________________________________________________________
34 AliHFEcutStep::AliHFEcutStep(const Char_t *name):
39 // Default Constructor
41 fCuts = new TObjArray;
44 //__________________________________________________________________
45 AliHFEcutStep::AliHFEcutStep(const AliHFEcutStep &o):
55 //__________________________________________________________________
56 AliHFEcutStep &AliHFEcutStep::operator=(const AliHFEcutStep &o){
58 // Assignment operator
65 //__________________________________________________________________
66 AliHFEcutStep::~AliHFEcutStep(){
73 //__________________________________________________________________
74 void AliHFEcutStep::Copy(TObject &o) const{
76 // Copy into content into object o
79 AliHFEcutStep &target = dynamic_cast<AliHFEcutStep &>(o);
82 target.fCuts = dynamic_cast<TObjArray *>(fCuts->Clone());
85 //__________________________________________________________________
86 Bool_t AliHFEcutStep::IsSelected(TObject *o){
88 // Filter tracks in the given cut step
89 // Apply all cut objects
91 AliDebug(1, Form("Cut Step %s: Number of cut objects: %d", GetName(), fCuts->GetEntriesFast()));
92 if(!fCuts->GetEntriesFast()) return kTRUE;
93 Bool_t isSelected = kTRUE;
94 for(Int_t iCut = 0; iCut < fCuts->GetEntriesFast(); iCut++){
95 if(!(dynamic_cast<AliAnalysisCuts *>(fCuts->UncheckedAt(iCut)))->IsSelected(o)) isSelected = kFALSE;
97 AliDebug(1, Form("Accepted: %s", isSelected ? "yes" : "no"));
101 //__________________________________________________________________
102 AliAnalysisCuts *AliHFEcutStep::GetCut(const Char_t *cutName){
106 return dynamic_cast<AliAnalysisCuts *>(fCuts->FindObject(cutName));
109 //__________________________________________________________________
110 void AliHFEcutStep::AddCut(AliAnalysisCuts *cut){
112 // Add cut object to the cut step
117 //__________________________________________________________________
118 void AliHFEcutStep::SetMC(AliMCEvent *mc){
120 // Set MC information to the cuts in the cut step
122 for(Int_t icut = 0; icut < fCuts->GetEntriesFast(); icut++){
123 if(fCuts->UncheckedAt(icut)->InheritsFrom("AliCFCutBase"))
124 (dynamic_cast<AliCFCutBase *>(fCuts->UncheckedAt(icut)))->SetMCEventInfo(mc);
128 //__________________________________________________________________
129 void AliHFEcutStep::SetRecEvent(AliVEvent *rec){
131 // Publish rec event to the cut step
133 for(Int_t icut = 0; icut < fCuts->GetEntriesFast(); icut++){
134 if(fCuts->UncheckedAt(icut)->InheritsFrom("AliCFCutBase"))
135 (dynamic_cast<AliCFCutBase *>(fCuts->UncheckedAt(icut)))->SetRecEventInfo(rec);