From 7c38d6ee92d9b856f159e994f0a8b47082dc5f3c Mon Sep 17 00:00:00 2001 From: morsch Date: Fri, 29 Jun 2007 12:57:20 +0000 Subject: [PATCH] Filter and cuts classes to be used with filter tasks. --- ANALYSIS/ANALYSISLinkDef.h | 4 +- ANALYSIS/AliAnalysisCuts.cxx | 44 +++++++++++++++++++ ANALYSIS/AliAnalysisCuts.h | 25 +++++++++++ ANALYSIS/AliAnalysisFilter.cxx | 78 ++++++++++++++++++++++++++++++++++ ANALYSIS/AliAnalysisFilter.h | 29 +++++++++++++ ANALYSIS/libANALYSIS.pkg | 4 +- 6 files changed, 181 insertions(+), 3 deletions(-) create mode 100644 ANALYSIS/AliAnalysisCuts.cxx create mode 100644 ANALYSIS/AliAnalysisCuts.h create mode 100644 ANALYSIS/AliAnalysisFilter.cxx create mode 100644 ANALYSIS/AliAnalysisFilter.h diff --git a/ANALYSIS/ANALYSISLinkDef.h b/ANALYSIS/ANALYSISLinkDef.h index c14e5a65469..7d380bc4407 100644 --- a/ANALYSIS/ANALYSISLinkDef.h +++ b/ANALYSIS/ANALYSISLinkDef.h @@ -9,9 +9,9 @@ #pragma link C++ class AliAnalysisTask+; #pragma link C++ class AliAnalysisDataSlot+; #pragma link C++ class AliAnalysisManager+; - #pragma link C++ class AliAnalysisSelector+; - +#pragma link C++ class AliAnalysisFilter+; +#pragma link C++ class AliAnalysisCuts+; #ifdef WITHXML #pragma link C++ class AliAnalysisGoodies+; #pragma link C++ class AliTagAnalysis+; diff --git a/ANALYSIS/AliAnalysisCuts.cxx b/ANALYSIS/AliAnalysisCuts.cxx new file mode 100644 index 00000000000..b3187b7edbe --- /dev/null +++ b/ANALYSIS/AliAnalysisCuts.cxx @@ -0,0 +1,44 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +// Base class for analysis cuts +// Author Andreas Morsch +// andreas.morsch@cern.ch + +#include +#include "AliAnalysisCuts.h" + + +ClassImp(AliAnalysisCuts) + + +//////////////////////////////////////////////////////////////////////// + +AliAnalysisCuts::AliAnalysisCuts(): + TNamed() +{ + // Default constructor +} + +AliAnalysisCuts::AliAnalysisCuts(const char* name, const char* title): + TNamed(name, title) +{ + // Constructor +} + +AliAnalysisCuts::AliAnalysisCuts(const AliAnalysisCuts& obj): + TNamed(obj) +{ +} diff --git a/ANALYSIS/AliAnalysisCuts.h b/ANALYSIS/AliAnalysisCuts.h new file mode 100644 index 00000000000..ff28a606168 --- /dev/null +++ b/ANALYSIS/AliAnalysisCuts.h @@ -0,0 +1,25 @@ +#ifndef ALIANALYSISCUTS_H +#define ALIANALYSISCUTS_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +// Base class for analysis cuts +// Author Andreas Morsch +// andreas.morsch@cern.ch + +#include + +class AliAnalysisCuts : public TNamed +{ + public: + AliAnalysisCuts(); + AliAnalysisCuts(const char* name, const char* title); + AliAnalysisCuts(const AliAnalysisCuts& obj); + virtual ~AliAnalysisCuts() {;} + virtual Bool_t IsSelected(TObject* obj) = 0; + private: + ClassDef(AliAnalysisCuts, 1); // Base class for filter decisions on ESD objects +}; + +#endif diff --git a/ANALYSIS/AliAnalysisFilter.cxx b/ANALYSIS/AliAnalysisFilter.cxx new file mode 100644 index 00000000000..6c9f4102f2f --- /dev/null +++ b/ANALYSIS/AliAnalysisFilter.cxx @@ -0,0 +1,78 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +// +// Manager class for filter decisions based on cuts +// The filter contains a list of sets of cuts. +// A bit field is filled in order to store the decision of each cut-set. +// Author: Andreas Morsch +// andreas.morsch@cern.ch + +#include +#include +#include "AliAnalysisFilter.h" +#include "AliAnalysisCuts.h" + + +ClassImp(AliAnalysisFilter) + + +//////////////////////////////////////////////////////////////////////// + +AliAnalysisFilter::AliAnalysisFilter(): + TNamed(), + fCuts(0) +{ + // Default constructor +} + +AliAnalysisFilter::AliAnalysisFilter(const char* name, const char* title): + TNamed(name, title), + fCuts(new TList()) +{ + // Constructor +} + +AliAnalysisFilter::AliAnalysisFilter(const AliAnalysisFilter& obj): + TNamed(obj) +{ +// Copy constructor +} + + +UInt_t AliAnalysisFilter::IsSelected(TObject* obj) +{ + // + // Loop over all set of cuts + // and store the decision + UInt_t result = 0; + TIter next(fCuts); + AliAnalysisCuts *cuts; + Int_t iCutB = 1; + + while((cuts = (AliAnalysisCuts*)next())) { + Bool_t acc = cuts->IsSelected(obj); + if (acc) {result |= iCutB & 0x00ffffff;} + iCutB *= 2; + } + + return result; +} + +void AliAnalysisFilter::AddCuts(AliAnalysisCuts* cuts) +{ + // Add a set of cuts + fCuts->Add(cuts); +} diff --git a/ANALYSIS/AliAnalysisFilter.h b/ANALYSIS/AliAnalysisFilter.h new file mode 100644 index 00000000000..e7b01877ef9 --- /dev/null +++ b/ANALYSIS/AliAnalysisFilter.h @@ -0,0 +1,29 @@ +#ifndef ALIANALYSISFILTER_H +#define ALIANALYSISFILTER_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +// +// Manager class for filter decisions based on cuts +// Author: Andreas Morsch +// andreas.morsch@cern.ch + +#include + +class AliAnalysisCuts; + +class AliAnalysisFilter : public TNamed +{ + public: + AliAnalysisFilter(); + AliAnalysisFilter(const char* name, const char* title = "AnalysisFilter"); + AliAnalysisFilter(const AliAnalysisFilter& obj); + virtual ~AliAnalysisFilter() {;} + virtual UInt_t IsSelected(TObject* obj); + virtual void AddCuts(AliAnalysisCuts* cuts); + private: + TList* fCuts; // List of cuts + ClassDef(AliAnalysisFilter, 1); // Manager class for filter decisions +}; + +#endif diff --git a/ANALYSIS/libANALYSIS.pkg b/ANALYSIS/libANALYSIS.pkg index 0c7c4ec3611..33e8c3f6d81 100644 --- a/ANALYSIS/libANALYSIS.pkg +++ b/ANALYSIS/libANALYSIS.pkg @@ -1,6 +1,8 @@ SRCS = AliAnalysisDataContainer.cxx AliAnalysisDataSlot.cxx \ AliAnalysisManager.cxx AliAnalysisTask.cxx \ - AliAnalysisSelector.cxx + AliAnalysisSelector.cxx \ + AliAnalysisFilter.cxx AliAnalysisCuts.cxx + CHECKALIEN = $(shell root-config --has-alien) ifeq (yes,$(CHECKALIEN)) -- 2.43.0