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 **************************************************************************/
20 // Select all tracks surviving cuts in one special cut step
21 // Used in AliHFEtrackFilter
24 // Markus Fasel <M.Fasel@gsi.de>
26 #include <TObjArray.h>
28 #include "AliAnalysisCuts.h"
29 #include "AliCFCutBase.h"
30 #include "AliHFEcutStep.h"
32 #include "AliMCEvent.h"
34 ClassImp(AliHFEcutStep)
36 //__________________________________________________________________
37 AliHFEcutStep::AliHFEcutStep(const Char_t *name):
42 // Default Constructor
44 fCuts = new TObjArray;
47 //__________________________________________________________________
48 AliHFEcutStep::AliHFEcutStep(const AliHFEcutStep &o):
58 //__________________________________________________________________
59 AliHFEcutStep &AliHFEcutStep::operator=(const AliHFEcutStep &o){
61 // Assignment operator
68 //__________________________________________________________________
69 AliHFEcutStep::~AliHFEcutStep(){
76 //__________________________________________________________________
77 void AliHFEcutStep::Copy(TObject &o) const{
79 // Copy into content into object o
82 AliHFEcutStep &target = dynamic_cast<AliHFEcutStep &>(o);
85 target.fCuts = dynamic_cast<TObjArray *>(fCuts->Clone());
88 //__________________________________________________________________
89 Bool_t AliHFEcutStep::IsSelected(TObject *o){
91 // Filter tracks in the given cut step
92 // Apply all cut objects
94 AliDebug(1, Form("Cut Step %s: Number of cut objects: %d", GetName(), fCuts->GetEntriesFast()));
95 if(!fCuts->GetEntriesFast()) return kTRUE;
96 Bool_t isSelected = kTRUE;
97 AliAnalysisCuts *cuts = NULL;
98 for(Int_t iCut = 0; iCut < fCuts->GetEntriesFast(); iCut++){
99 cuts = dynamic_cast<AliAnalysisCuts *>(fCuts->UncheckedAt(iCut));
100 if(cuts && (!cuts->IsSelected(o))) isSelected = kFALSE;
102 AliDebug(1, Form("Accepted: %s", isSelected ? "yes" : "no"));
106 //__________________________________________________________________
107 AliAnalysisCuts *AliHFEcutStep::GetCut(const Char_t *cutName){
111 return dynamic_cast<AliAnalysisCuts *>(fCuts->FindObject(cutName));
114 //__________________________________________________________________
115 void AliHFEcutStep::AddCut(AliAnalysisCuts *cut){
117 // Add cut object to the cut step
122 //__________________________________________________________________
123 void AliHFEcutStep::SetMC(AliMCEvent *mc){
125 // Set MC information to the cuts in the cut step
127 AliCFCutBase *cfc = NULL;
128 for(Int_t icut = 0; icut < fCuts->GetEntriesFast(); icut++){
129 if((cfc = dynamic_cast<AliCFCutBase *>(fCuts->UncheckedAt(icut)))) cfc->SetMCEventInfo(mc);
133 //__________________________________________________________________
134 void AliHFEcutStep::SetRecEvent(AliVEvent *rec){
136 // Publish rec event to the cut step
138 AliCFCutBase *cfc = NULL;
139 for(Int_t icut = 0; icut < fCuts->GetEntriesFast(); icut++){
140 if((cfc = dynamic_cast<AliCFCutBase *>(fCuts->UncheckedAt(icut)))) cfc->SetRecEventInfo(rec);