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 **************************************************************************/
18 #include "AliAnalysisManager.h"
19 #include "AliInputEventHandler.h"
20 #include "AliMultiInputEventHandler.h"
21 #include "AliVEvent.h"
23 #include "AliPHOSClusterSelection.h"
25 AliPHOSClusterSelection::AliPHOSClusterSelection()
26 : fMinChargedParticleTrackDistance(-1.),
32 // Defaults to the most lenient selection allowable
36 AliPHOSClusterSelection::~AliPHOSClusterSelection()
40 Bool_t AliPHOSClusterSelection::IsSelected(AliVCluster* cluster) const
42 return IsSelectedCPV(cluster)
43 && IsSelectedUnfolded(cluster)
44 && IsSelectedDisp(cluster)
45 && IsSelectedDispCore(cluster)
46 && IsSelectedTOF(cluster);
49 Bool_t IsSelectedCPV(AliVCluster* cluster) const
51 if( 0 > SetMinChargedParticleTrackDistance )
53 //TODO: implement positive case
56 AliPHOSClusterSelection* AliPHOSClusterSelection::SetMinChargedParticleTrackDistance(Float_t distance)
58 // 'distance' set the minimal allowable distance between the cluster
59 // and the nearest extrapolated track.
60 // If 'distance' is negative, then all clusters are sellected, the selection
61 // being "not applied" or "disabled".
63 fMinChargedParticleTrackDistance = distance;
66 TString AliPHOSClusterSelection::ToString() const
68 // returns a string an quasi-unique string for whatever selection
69 // parameters the instance contains. The uniqueness of the string
70 // is limited by the precision given in the formatting of the string.
71 // Take care that the precision is sufficient for your needs.
73 return TString::Format("%f_%i_%f_%f_%f",
74 fMinChargedParticleTrackDistance,
83 Float_t AliPHOSClusterSelection::SetMinChargedParticleTrackDistance(const TString& string)
85 TObjArray * objarray = string.Tokenize("_");
86 Float_t flt = objarray->At(0)->Atof();
92 AliVEvent* AliPHOSClusterSelection::GetCurrentEvent() const
94 // Hackish way of getting the current event.
95 // Its probably not appropriate to call this function outside of
96 // AliAnalysisTaskSE::UserExec
98 AliAnalysisManager* analysisManager = dynamic_cast<AliAnalysisManager*>(AliAnalysisManager::GetAnalysisManager());
99 AliInputEventHandler* inputHandler = dynamic_cast<AliInputEventHandler*>(analysisManager->GetInputEventHandler());
100 AliMultiInputEventHandler *multiInputHandler = dynamic_cast<AliMultiInputEventHandler *>(fInputHandler);
101 if (multiInputHandler)
102 inputHandler = dynamic_cast<AliInputEventHandler *>(multiInputHandler->GetFirstInputEventHandler());
104 AliVEvent* inputEvent = dynamic_cast<AliVEvent*>(inputHandler->GetEvent());
106 AliError("Was not able to retrieve event!");