AliPhysics  c923f52 (c923f52)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalMaxPatch.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 <iostream>
16 #include <TClonesArray.h>
17 #include <THashList.h>
18 #include <THistManager.h>
19 
20 #include "AliAnalysisUtils.h"
23 #include "AliEMCALTriggerPatchInfo.h"
24 #include "AliInputEventHandler.h"
25 #include "AliLog.h"
26 
30 
31 namespace EMCalTriggerPtAnalysis {
32 
33 AliAnalysisTaskEmcalMaxPatch::AliAnalysisTaskEmcalMaxPatch() :
35  fWeightHandler(nullptr),
36  fHistos(nullptr),
37  fSelectTrigger(AliVEvent::kINT7)
38 {
39  SetCaloTriggerPatchInfoName("EmcalTriggers");
40 }
41 
43  AliAnalysisTaskEmcal(name, kTRUE),
44  fWeightHandler(nullptr),
45  fHistos(nullptr),
46  fSelectTrigger(AliVEvent::kINT7)
47 {
48  SetCaloTriggerPatchInfoName("EmcalTriggers");
50 }
51 
53 }
54 
57 
58  if(!fAliAnalysisUtils) fAliAnalysisUtils = new AliAnalysisUtils;
59 
60  fHistos = new THistManager("histMaxPatch");
61  fHistos->CreateTH1("hTrueEventCount", "Maximum energy patch in the event", 1, 0.5, 1.5);
62  fHistos->CreateTH1("hPatchEnergyMaxEGA", "Energy spectrum of the maximum EGA patch", 2000, 0., 200.);
63  fHistos->CreateTH1("hPatchEnergyMaxEJE", "Energy spectrum of the maximum EJE patch", 2000, 0., 200.);
64  for(auto h : *(fHistos->GetListOfHistograms())) fOutput->Add(h);
65 
66  PostData(1, fOutput);
67 }
68 
70  AliDebugStream(2) << GetName() << ": Using custom event selection method" << std::endl;
71  if(!fTriggerPatchInfo){
72  AliErrorStream() << GetName() << ": Trigger patch container not found but required" << std::endl;
73  return false;
74  }
75  if(!(fInputHandler->IsEventSelected() & AliVEvent::kINT7)) return false;
76  if(fTriggerPattern.Length()){
77  TString triggerstring = InputEvent()->GetFiredTriggerClasses();
78  if(!triggerstring.Contains(fTriggerPattern)) return false;
79  }
80  AliDebugStream(3) << GetName() << "Event is an INT7 event" << std::endl;
81 
82  // Generall event quality cuts
83  // The vertex cut also contains cuts on the number
84  // of contributors and the position in z
85  AliDebugStream(3) << GetName() << ": Applying vertex selection" << std::endl;
87  if(!fAliAnalysisUtils->IsVertexSelected2013pA(InputEvent())) return false;
88  if(fAliAnalysisUtils->IsPileUpEvent(InputEvent())) return false;
89  AliDebugStream(3) << GetName() << ": Vertex selection passed" << std::endl;
90  }
91 
92  AliDebugStream(2) << GetName() << "Event selected" << std::endl;
93  return true;
94 }
95 
97  fHistos->FillTH1("hTrueEventCount", 1);
98 
99  double maxEGA(0), maxEJE(0);
100  int nEGA(0), nEJE(0);
101  AliEMCALTriggerPatchInfo *currentpatch(nullptr);
102  for(TIter patchiter = TIter(this->fTriggerPatchInfo).Begin(); patchiter != TIter::End(); ++patchiter){
103  currentpatch = static_cast<AliEMCALTriggerPatchInfo *>(*patchiter);
104  if(!currentpatch->IsOfflineSimple()) continue;
105  if(currentpatch->IsGammaHighSimple()){
106  nEGA++;
107  maxEGA = currentpatch->GetPatchE() > maxEGA ? currentpatch->GetPatchE() : maxEGA;
108  } else if(currentpatch->IsJetHighSimple()) {
109  nEJE++;
110  maxEJE = currentpatch->GetPatchE() > maxEJE ? currentpatch->GetPatchE() : maxEJE;
111  }
112  }
113 
114  if(nEGA) fHistos->FillTH1("hPatchEnergyMaxEGA", maxEGA);
115  if(nEJE) fHistos->FillTH1("hPatchEnergyMaxEJE", maxEJE);
116 
117  return true;
118 }
119 
120 } /* namespace EMCalTriggerPtAnalysis */
Base task in the EMCAL framework.
TString fTriggerPattern
Trigger pattern string (i.e. EG1)
Simple task monitoring the energy spectrum of the maximum patch in the event.
void SetCaloTriggerPatchInfoName(const char *n)
THistManager * fHistos
! Local Histogram handler. Histograms are stored in the AliEmcalList later
THashList * GetListOfHistograms() const
Definition: THistManager.h:504
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
AliAnalysisUtils * fAliAnalysisUtils
!vertex selection (optional)
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
AliEmcalList * fOutput
!output list
void SetMakeGeneralHistograms(Bool_t g)
TClonesArray * fTriggerPatchInfo
!trigger patch info array
Container class for histograms for the high- charged particle analysis.
Definition: THistManager.h:43
bool Bool_t
Definition: External.C:53
ClassImp(AliAnalysisTaskCascadeTester) AliAnalysisTaskCascadeTester