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 AliAnalysisCuts *cuts = NULL;
95 for(Int_t iCut = 0; iCut < fCuts->GetEntriesFast(); iCut++){
96 cuts = dynamic_cast<AliAnalysisCuts *>(fCuts->UncheckedAt(iCut));
97 if(cuts && (!cuts->IsSelected(o))) isSelected = kFALSE;
99 AliDebug(1, Form("Accepted: %s", isSelected ? "yes" : "no"));
103 //__________________________________________________________________
104 AliAnalysisCuts *AliHFEcutStep::GetCut(const Char_t *cutName){
108 return dynamic_cast<AliAnalysisCuts *>(fCuts->FindObject(cutName));
111 //__________________________________________________________________
112 void AliHFEcutStep::AddCut(AliAnalysisCuts *cut){
114 // Add cut object to the cut step
119 //__________________________________________________________________
120 void AliHFEcutStep::SetMC(const AliMCEvent *mc){
122 // Set MC information to the cuts in the cut step
124 AliCFCutBase *cfc = NULL;
125 for(Int_t icut = 0; icut < fCuts->GetEntriesFast(); icut++){
126 if((cfc = dynamic_cast<AliCFCutBase *>(fCuts->UncheckedAt(icut)))) cfc->SetMCEventInfo(mc);
130 //__________________________________________________________________
131 void AliHFEcutStep::SetRecEvent(const AliVEvent *rec){
133 // Publish rec event to the cut step
135 AliCFCutBase *cfc = NULL;
136 for(Int_t icut = 0; icut < fCuts->GetEntriesFast(); icut++){
137 if((cfc = dynamic_cast<AliCFCutBase *>(fCuts->UncheckedAt(icut)))) cfc->SetRecEventInfo(rec);