]>
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 | * 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. | |
19 | * | |
20 | * Author: Markus Fasel | |
21 | */ | |
22 | #include <vector> | |
23 | #include <TClonesArray.h> | |
24 | ||
25 | #include "AliEmcalTriggerDecision.h" | |
26 | #include "AliEmcalTriggerPatchInfo.h" | |
27 | #include "AliEmcalTriggerSelection.h" | |
28 | #include "AliEmcalTriggerSelectionCuts.h" | |
29 | ||
30 | ClassImp(AliEmcalTriggerSelection) | |
31 | ||
32 | //______________________________________________________________________________ | |
33 | AliEmcalTriggerSelection::AliEmcalTriggerSelection() : | |
34 | TNamed(), | |
35 | fSelectionCuts(NULL), | |
36 | fOutputName("") | |
37 | { | |
38 | /* | |
39 | * Dummy constructor, used by I/O, not to be used by the user | |
40 | */ | |
41 | } | |
42 | ||
43 | //______________________________________________________________________________ | |
44 | AliEmcalTriggerSelection::AliEmcalTriggerSelection(const char *name, const AliEmcalTriggerSelectionCuts * const cuts): | |
45 | TNamed(name, ""), | |
46 | fSelectionCuts(cuts), | |
47 | fOutputName("") | |
48 | { | |
49 | /* | |
50 | * Main constructor, initialises the trigger selection | |
51 | * | |
52 | * @param name: name of the trigger selection | |
53 | * @param cuts(optional): selection cuts to be applied | |
54 | */ | |
55 | } | |
56 | ||
57 | //______________________________________________________________________________ | |
58 | AliEmcalTriggerDecision* AliEmcalTriggerSelection::MakeDecison(const TClonesArray * const inputPatches) const { | |
59 | /* | |
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 | |
62 | * decision as well. | |
63 | * | |
64 | * @param input patches: A list of input patches, created by the trigger patch maker and read out from the | |
65 | * input event | |
66 | * @return: the trigger decision (an event is selected when it has a main patch that fired the decision) | |
67 | */ | |
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); | |
75 | } | |
76 | } | |
77 | // Find the main patch | |
78 | AliEmcalTriggerPatchInfo *mainPatch(NULL), *testpatch(NULL); | |
79 | for(std::vector<AliEmcalTriggerPatchInfo *>::iterator it = selectedPatches.begin(); it != selectedPatches.end(); ++it){ | |
80 | testpatch = *it; | |
81 | if(!mainPatch) mainPatch = testpatch; | |
82 | else if(fSelectionCuts->CompareTriggerPatches(testpatch, mainPatch) > 0) mainPatch = testpatch; | |
83 | result->AddAcceptedPatch(testpatch); | |
84 | } | |
85 | if(mainPatch) result->SetMainPatch(mainPatch); | |
86 | result->SetSelectionCuts(fSelectionCuts); | |
87 | return result; | |
88 | } |