]>
Commit | Line | Data |
---|---|---|
d77d1945 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | /* | |
16 | * Task providing an event selection for EMCAL-triggered events based on the | |
17 | * reconstructed EMCAL trigger patches | |
18 | * | |
19 | * Author: Markus Fasel | |
20 | */ | |
21 | ||
22 | #include "AliAnalysisTaskEmcalTriggerSelection.h" | |
23 | #include "AliEmcalTriggerDecision.h" | |
24 | #include "AliEmcalTriggerDecisionContainer.h" | |
25 | #include "AliEmcalTriggerSelection.h" | |
26 | ||
27 | ClassImp(AliAnalysisTaskEmcalTriggerSelection) | |
28 | ||
29 | //______________________________________________________________________________ | |
30 | AliAnalysisTaskEmcalTriggerSelection::AliAnalysisTaskEmcalTriggerSelection(): | |
31 | AliAnalysisTaskEmcal(), | |
32 | fGlobalDecisionContainerName(), | |
33 | fTriggerSelections() | |
34 | { | |
35 | /* | |
36 | * Dummy constructor, only for I/O, not to be used by the user | |
37 | */ | |
38 | fTriggerSelections.SetOwner(kTRUE); | |
39 | } | |
40 | ||
41 | //______________________________________________________________________________ | |
42 | AliAnalysisTaskEmcalTriggerSelection::AliAnalysisTaskEmcalTriggerSelection(const char* name): | |
43 | AliAnalysisTaskEmcal(name, kFALSE), | |
44 | fGlobalDecisionContainerName(), | |
45 | fTriggerSelections() | |
46 | { | |
47 | /* | |
48 | * Main constructor, to be called by the users | |
49 | */ | |
50 | fTriggerSelections.SetOwner(kTRUE); | |
51 | } | |
52 | ||
53 | //______________________________________________________________________________ | |
54 | void AliAnalysisTaskEmcalTriggerSelection::AddTriggerSelection(AliEmcalTriggerSelection * const selection){ | |
55 | /* | |
56 | * Add trigger selection to the trigger selection task | |
57 | * | |
58 | * @param selection: the trigger selection to be added | |
59 | */ | |
60 | fTriggerSelections.Add(selection); | |
61 | } | |
62 | ||
63 | //______________________________________________________________________________ | |
64 | Bool_t AliAnalysisTaskEmcalTriggerSelection::Run(){ | |
65 | /* | |
66 | * Run over all trigger selections, and append the selection to the global trigger selection container | |
67 | */ | |
68 | AliEmcalTriggerDecisionContainer *cont = GetGlobalTriggerDecisionContainer(); | |
69 | cont->Reset(); | |
70 | TClonesArray *triggerPatches(fTriggerPatchInfo); | |
71 | TIter selectionIter(&fTriggerSelections); | |
72 | AliEmcalTriggerSelection *selection(NULL); | |
73 | while((selection = dynamic_cast<AliEmcalTriggerSelection *>(selectionIter()))){ | |
74 | cont->AddTriggerDecision(selection->MakeDecison(triggerPatches)); | |
75 | } | |
76 | return kTRUE; | |
77 | } | |
78 | ||
79 | //______________________________________________________________________________ | |
80 | AliEmcalTriggerDecisionContainer *AliAnalysisTaskEmcalTriggerSelection::GetGlobalTriggerDecisionContainer(){ | |
81 | /* | |
82 | * Find the main trigger container in the input event. If not available, create it and add it to the input event | |
83 | */ | |
84 | AliEmcalTriggerDecisionContainer *cont(dynamic_cast<AliEmcalTriggerDecisionContainer *>(fInputEvent->FindListObject(fGlobalDecisionContainerName.Data()))); | |
85 | if(!cont){ | |
86 | cont = new AliEmcalTriggerDecisionContainer(fGlobalDecisionContainerName.Data()); | |
87 | fInputEvent->AddObject(cont); | |
88 | } | |
89 | return cont; | |
90 | } |