]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/UserTasks/AliEMCalTriggerTaskGroup.cxx
More refactoring of the task
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / UserTasks / AliEMCalTriggerTaskGroup.cxx
CommitLineData
4d1a3169 1/**************************************************************************
2 * Copyright(c) 1998-2014, 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 * Group of analysis components with the same event selection
17 * Analysis components are initialised via the Initialise function, and executed, if
18 * the event is selected, via the function process
19 *
20 * Author: Markus Fasel
21 */
22#include <THashList.h>
23#include <TList.h>
24
25#include "AliEMCalTriggerTracksAnalysisComponent.h"
26#include "AliEMCalTriggerEventSelection.h"
27#include "AliEMCalTriggerTaskGroup.h"
28
29ClassImp(EMCalTriggerPtAnalysis::AliEMCalTriggerTaskGroup)
30
31namespace EMCalTriggerPtAnalysis {
32
33//______________________________________________________________________________
34AliEMCalTriggerTaskGroup::AliEMCalTriggerTaskGroup() :
35 TNamed(),
36 fAnalysisComponents(NULL),
9de87858 37 fEventSelection(NULL),
38 fBinning(NULL)
4d1a3169 39{
40 /*
41 * Dummy constructor, not to be used
42 */
43}
44
45//______________________________________________________________________________
46AliEMCalTriggerTaskGroup::AliEMCalTriggerTaskGroup(const char* name) :
47 TNamed(name, ""),
48 fAnalysisComponents(NULL),
9de87858 49 fEventSelection(NULL),
50 fBinning(NULL)
4d1a3169 51{
52 /*
53 * Main constructor: to be used by the users
54 */
55 fAnalysisComponents = new TObjArray();
56 fAnalysisComponents->SetOwner();
57}
58
59//______________________________________________________________________________
60AliEMCalTriggerTaskGroup::~AliEMCalTriggerTaskGroup() {
61 /*
62 * Destructor
63 */
64 if(fEventSelection) delete fEventSelection;
65 if(fAnalysisComponents) delete fAnalysisComponents;
66}
67
68//______________________________________________________________________________
69TList *AliEMCalTriggerTaskGroup::InitialiseAnalysisComponents() {
70 /*
71 * Initialise all analysis components. Build a global histlist for the full group
72 *
73 * @return: the global histogram list
74 */
75 TIter compIter(fAnalysisComponents);
76 AliEMCalTriggerTracksAnalysisComponent *ana(NULL);
77 // Build a global histogram list
78 TList *histlist = new TList;
79 TObject *htmp(NULL);
80 while((ana = dynamic_cast<AliEMCalTriggerTracksAnalysisComponent *>(compIter()))){
81 ana->CreateHistos();
9de87858 82 ana->SetBinning(fBinning);
4d1a3169 83 TList *ltmp = ana->GetHistList();
84 TIter hiter(ltmp);
85 while((htmp = hiter())) histlist->Add(htmp);
86 }
87 return histlist;
88}
89
90//______________________________________________________________________________
91void AliEMCalTriggerTaskGroup::Process(const AliEMCalTriggerEventData* const event) {
92 /*
93 * Run analysis of the different groups. Apply event selection if requested;
94 *
95 * @param event: The combined event data
96 */
97 if(fEventSelection && !fEventSelection->IsEventSelected(event)) return;
98 TIter compIter(fAnalysisComponents);
99 AliEMCalTriggerTracksAnalysisComponent *ana(NULL);
100 while((ana = dynamic_cast<AliEMCalTriggerTracksAnalysisComponent *>(compIter())))
101 ana->Process(event);
102}
103
104//______________________________________________________________________________
105void AliEMCalTriggerTaskGroup::AddAnalysisComponent(AliEMCalTriggerTracksAnalysisComponent * const analysis) {
106 /*
107 * Add new analysis component to the task group
108 *
109 * @param analysis: the analysis component to be added
110 */
111 fAnalysisComponents->Add(analysis);
112}
113
d824c93c 114//______________________________________________________________________________
115void EMCalTriggerPtAnalysis::AliEMCalTriggerTaskGroup::SetTriggerDecision(
116 const AliEMCalTriggerAnaTriggerDecision* trigger) {
117 /*
118 * Forward trigger decision to the analysis components
119 *
120 * @param trigger: the trigger decision
121 */
122 AliEMCalTriggerTracksAnalysisComponent *myana(NULL);
123 TIter compIter(fAnalysisComponents);
124 while((myana = dynamic_cast<AliEMCalTriggerTracksAnalysisComponent *>(compIter())))
125 myana->SetTriggerDecision(trigger);
126}
127
128
4d1a3169 129} /* namespace EMCalTriggerPtAnalysis */