AliPhysics  9538fdd (9538fdd)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalTriggerSelection.cxx
Go to the documentation of this file.
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 "AliEMCALTriggerPatchInfo.h"
29 
31 
32 //______________________________________________________________________________
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 //______________________________________________________________________________
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  */
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);
87  return result;
88 }
ClassImp(AliEmcalTriggerSelection) AliEmcalTriggerSelection
Bool_t IsSelected(const AliEMCALTriggerPatchInfo *const patch) const
const AliEmcalTriggerSelectionCuts * fSelectionCuts
Int_t CompareTriggerPatches(const AliEMCALTriggerPatchInfo *first, const AliEMCALTriggerPatchInfo *second) const
void SetSelectionCuts(const AliEmcalTriggerSelectionCuts *const cuts)
void AddAcceptedPatch(AliEMCALTriggerPatchInfo *const acceptedPatch)
AliEmcalTriggerDecision * MakeDecison(const TClonesArray *const reconstructedPatches) const
void SetMainPatch(const AliEMCALTriggerPatchInfo *const mainpatch)