1 /**************************************************************************
2 * Copyright(c) 1998-2007, 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 **************************************************************************/
16 * Class for the selection of trigger patches in the EMCAL triggered event selection
18 * Author: Markus Fasel
20 #include "AliEmcalTriggerPatchInfo.h"
21 #include "AliEmcalTriggerSelectionCuts.h"
23 ClassImp(AliEmcalTriggerSelectionCuts)
25 //______________________________________________________________________________
26 AliEmcalTriggerSelectionCuts::AliEmcalTriggerSelectionCuts() :
28 fSelectionMethod(kADC),
29 fPatchType(kAnyPatch),
31 fUseSimpleOffline(kFALSE)
38 //______________________________________________________________________________
39 Bool_t AliEmcalTriggerSelectionCuts::IsSelected(const AliEmcalTriggerPatchInfo * const patch) const {
41 * Apply selection of the given trigger patch according to the selections described in the object
43 * @param patch: the trigger patch to check
44 * @return" the decision (true if selected, false otherwise)
46 if(fUseSimpleOffline && !patch->IsOfflineSimple()) return kFALSE;
47 else if(!fUseSimpleOffline && patch->IsOfflineSimple()) return kFALSE;
48 if(!SelectPatchType(patch)) return kFALSE;
49 if(GetCutPrimitive(patch) <= fThreshold) return kFALSE;
53 //______________________________________________________________________________
54 Int_t AliEmcalTriggerSelectionCuts::CompareTriggerPatches(const AliEmcalTriggerPatchInfo *first, const AliEmcalTriggerPatchInfo *second) const {
56 * Compare two patches according to the energy measure specified in the cut object
58 * @param first: the first patch
59 * @param second: the second patch
60 * @return: the result of the comparison (0 if equal, 1 if the first patch has a larger primitive,
61 * -1 if the second patch has a larger primitive)
63 Double_t valfirst = GetCutPrimitive(first), valsecond = GetCutPrimitive(second);
64 if(valfirst == valsecond) return 0;
65 if(valfirst > valsecond) return 1;
69 //______________________________________________________________________________
70 Double_t AliEmcalTriggerSelectionCuts::GetCutPrimitive(const AliEmcalTriggerPatchInfo * const patch) const{
72 * Return (energy) measure we cut on, depending on the selection method specified
74 * @param patch: The patch from which to obtain the value
75 * @return: The energy measure of the patch
77 if(fSelectionMethod == kADC) return static_cast<Double_t>(patch->GetADCAmp());
78 else if(fSelectionMethod == kEnergyRough) return patch->GetADCAmpGeVRough();
79 return patch->GetPatchE();
82 //______________________________________________________________________________
83 Bool_t AliEmcalTriggerSelectionCuts::SelectPatchType(const AliEmcalTriggerPatchInfo * const patch) const{
85 * Select type of the patch according the definitions in the header file
87 * @param patch: the patch to be checked
88 * @return: selection result (true ig the patch is selected)
90 if(fPatchType == kAnyPatch) return kTRUE;
91 if(fUseSimpleOffline){
92 if(patch->IsJetLowSimple() && ((fPatchType == kL1JetPatch) || (fPatchType == kL1JetLowPatch))) return kTRUE;
93 if(patch->IsJetHighSimple() && ((fPatchType == kL1JetPatch) || (fPatchType == kL1JetHighPatch))) return kTRUE;
94 if(patch->IsGammaLowSimple() && ((fPatchType == kL1GammaPatch) || (fPatchType == kL1GammaLowPatch))) return kTRUE;
95 if(patch->IsGammaHighSimple() && ((fPatchType == kL1GammaPatch) || (fPatchType == kL1GammaHighPatch))) return kTRUE;
97 if(patch->IsJetLow() && ((fPatchType == kL1JetPatch) || (fPatchType == kL1JetLowPatch))) return kTRUE;
98 if(patch->IsJetHigh() && ((fPatchType == kL1JetPatch) || (fPatchType == kL1JetHighPatch))) return kTRUE;
99 if(patch->IsGammaLow() && ((fPatchType == kL1GammaPatch) || (fPatchType == kL1GammaLowPatch))) return kTRUE;
100 if(patch->IsGammaHigh() && ((fPatchType == kL1GammaPatch) || (fPatchType == kL1GammaHighPatch))) return kTRUE;
101 if(patch->IsLevel0() && fPatchType == kL0Patch) return kTRUE;