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 * Object performing an offline EMCAL trigger decision based on user defined criterions
17 * (trigger patch type, energy threshold,...). The main method MakeTriggerDecision performs
18 * an event selection and creates a trigger decision object with the relevant information.
20 * Author: Markus Fasel
23 #include <TClonesArray.h>
25 #include "AliEmcalTriggerDecision.h"
26 #include "AliEmcalTriggerPatchInfo.h"
27 #include "AliEmcalTriggerSelection.h"
28 #include "AliEmcalTriggerSelectionCuts.h"
30 ClassImp(AliEmcalTriggerSelection)
32 //______________________________________________________________________________
33 AliEmcalTriggerSelection::AliEmcalTriggerSelection() :
39 * Dummy constructor, used by I/O, not to be used by the user
43 //______________________________________________________________________________
44 AliEmcalTriggerSelection::AliEmcalTriggerSelection(const char *name, const AliEmcalTriggerSelectionCuts * const cuts):
50 * Main constructor, initialises the trigger selection
52 * @param name: name of the trigger selection
53 * @param cuts(optional): selection cuts to be applied
57 //______________________________________________________________________________
58 AliEmcalTriggerDecision* AliEmcalTriggerSelection::MakeDecison(const TClonesArray * const inputPatches) const {
60 * Perform event selection based on user-defined criteria and create an output trigger decision containing
61 * the threshold, the main patch which fired the decision, and all other patches which would have fired the
64 * @param input patches: A list of input patches, created by the trigger patch maker and read out from the
66 * @return: the trigger decision (an event is selected when it has a main patch that fired the decision)
68 AliEmcalTriggerDecision *result = new AliEmcalTriggerDecision(fOutputName.Data());
69 TIter patchIter(inputPatches);
70 AliEmcalTriggerPatchInfo *patch(NULL);
71 std::vector<AliEmcalTriggerPatchInfo *> selectedPatches;
72 while((patch = dynamic_cast<AliEmcalTriggerPatchInfo *>(patchIter()))){
73 if(fSelectionCuts->IsSelected(patch)){
74 selectedPatches.push_back(patch);
77 // Find the main patch
78 AliEmcalTriggerPatchInfo *mainPatch(NULL), *testpatch(NULL);
79 for(std::vector<AliEmcalTriggerPatchInfo *>::iterator it = selectedPatches.begin(); it != selectedPatches.end(); ++it){
81 if(!mainPatch) mainPatch = testpatch;
82 else if(fSelectionCuts->CompareTriggerPatches(testpatch, mainPatch) > 0) mainPatch = testpatch;
83 result->AddAcceptedPatch(testpatch);
85 if(mainPatch) result->SetMainPatch(mainPatch);
86 result->SetSelectionCuts(fSelectionCuts);