AliPhysics  8630145 (8630145)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalTriggerOfflineSelection.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2016, 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 #include <TClonesArray.h>
16 #include <TH2.h>
17 #include <TRandom.h>
18 
19 #include "AliEMCALTriggerPatchInfo.h"
21 
25 
26 namespace EMCalTriggerPtAnalysis {
27 
28 AliEmcalTriggerOfflineSelection::AliEmcalTriggerOfflineSelection() {
29  memset(fOfflineEnergyThreshold, 0, sizeof(Double_t) * kTrgn);
30  memset(fAcceptanceMaps, 0, sizeof(TH2 *) * kTrgn);
31 }
32 
33 AliEmcalTriggerOfflineSelection::~AliEmcalTriggerOfflineSelection(){
34  for(int itrg = 0; itrg < kTrgn; itrg++){
35  if(fAcceptanceMaps[itrg]) delete fAcceptanceMaps[itrg];
36  }
37 }
38 
39 Bool_t AliEmcalTriggerOfflineSelection::IsOfflineSelected(EmcalTriggerClass trgcls, const TClonesArray * const triggerpatches) const {
40  if(fOfflineEnergyThreshold[trgcls] < 0) return true;
41  bool isSingleShower = IsSingleShower(trgcls);
42  int nfound = 0;
43  AliEMCALTriggerPatchInfo *patch = NULL;
44  for(TIter patchIter = TIter(triggerpatches).Begin(); patchIter != TIter::End(); ++patchIter){
45  patch = static_cast<AliEMCALTriggerPatchInfo *>(*patchIter);
46  if(!patch->IsOfflineSimple()) continue;
47  if(isSingleShower){
48  if(!patch->IsGammaLowSimple()) continue;
49  } else {
50  if(!patch->IsJetLowSimple()) continue;
51  }
52  if(patch->GetPatchE() > fOfflineEnergyThreshold[trgcls]){
53  // Handle offline acceptance maps (if providede)
54  if(fAcceptanceMaps[trgcls]){
55  double acceptanceprob = fAcceptanceMaps[trgcls]->GetBinContent(patch->GetColStart(), patch->GetRowStart()),
56  patchprob = gRandom->Uniform(0., 1.);
57  if(patchprob < acceptanceprob) nfound++;
58  } else{
59  nfound++;
60  }
61  }
62  }
63  return nfound > 0;
64 }
65 
66 Bool_t AliEmcalTriggerOfflineSelection::IsSingleShower(EmcalTriggerClass cls){
67  return ((cls == kTrgEG1) || (cls == kTrgEG2) || (cls == kTrgEL0) || (cls == kTrgDG1) || (cls == kTrgDG2) || (cls == kTrgDL0));
68 
69 }
70 
71 Bool_t AliEmcalTriggerOfflineSelection::IsDCAL(EmcalTriggerClass cls){
72  return ((cls == kTrgDL0) || (cls == kTrgDG1) || (cls == kTrgDG2) || (cls == kTrgDJ1) || (cls == kTrgDJ2));
73 }
74 
75 } /* namespace EMCalTriggerPtAnalysis */
double Double_t
Definition: External.C:58
Helper class selecting events on the presence of a trigger patch for the given type above threshold...
TRandom * gRandom
EmcalTriggerClass
Definition of the various supported trigger types.
Definition: External.C:220
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
bool Bool_t
Definition: External.C:53