AliPhysics  6bc8652 (6bc8652)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalTriggerPosition.cxx
Go to the documentation of this file.
1 /*
2  * AliAnalysisTaskEmcalTriggerPosition.cxx
3  *
4  * Created on: 11.07.2016
5  * Author: markusfasel
6  */
7 #include <iostream>
8 #include <TClonesArray.h>
9 #include <THistManager.h>
10 #include <TString.h>
11 
12 #include "AliLog.h"
13 #include "AliVEvent.h"
14 #include "AliEMCALTriggerPatchInfo.h"
15 
17 
19 
22  fHistos(nullptr),
23  fThresholdEG1(0.)
24 {
25 
26 }
27 
29  AliAnalysisTaskSE(name),
30  fHistos(nullptr),
31  fThresholdEG1(0.)
32 {
33  DefineOutput(1, TList::Class());
34 }
35 
37 }
38 
40  fHistos = new THistManager("EG1position");
41 
42  fHistos->CreateTH2("posRecalcEG1", "Position of recalc EG1 patches", 48, -0.5, 47.5, 104, -0.5, 103.5);
43  fHistos->CreateTH2("posOnlineEG1", "Position of recalc EG1 patches", 48, -0.5, 47.5, 104, -0.5, 103.5);
44 
45  PostData(1, fHistos->GetListOfHistograms());
46 }
47 
49  // Select only EG1 events
50  TString firedtriggers(InputEvent()->GetFiredTriggerClasses());
51  if(!firedtriggers.Contains("EG1")) return;
52  if(!(fInputHandler->IsEventSelected() & AliVEvent::kEMCEGA)) return;
53 
54  TClonesArray *triggerpatches = dynamic_cast<TClonesArray *>(InputEvent()->FindListObject("EmcalTriggers"));
55  if(!triggerpatches)
56  AliErrorStream() << "Trigger patch container EmcalTriggers not found in task " << GetName() << std::endl;
57 
58  AliEMCALTriggerPatchInfo *currentpatch(nullptr);
59  for(TIter patchiter = TIter(triggerpatches).Begin(); patchiter != TIter::End(); ++patchiter){
60  currentpatch = static_cast<AliEMCALTriggerPatchInfo *>(*patchiter);
61  if(currentpatch->GetPatchSize() != 2) continue;
62  // Reject L0 patches
63  if(currentpatch->IsLevel0() || currentpatch->IsLevel0Recalc() || currentpatch->IsLevel0Simple()) continue;
64  if(currentpatch->GetADCAmp() > this->fThresholdEG1)
65  fHistos->FillTH1("posRecalcEG1", currentpatch->GetColStart(), currentpatch->GetRowStart());
66  if(currentpatch->IsGammaHigh())
67  fHistos->FillTH1("posOnlineEG1", currentpatch->GetColStart(), currentpatch->GetRowStart());
68  }
69 
70  PostData(1, fHistos->GetListOfHistograms());
71 }
72 
ClassImp(AliAnalysisTaskEmcalTriggerPosition) AliAnalysisTaskEmcalTriggerPosition
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
THashList * GetListOfHistograms() const
Definition: THistManager.h:504
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Container class for histograms.
Definition: THistManager.h:43
const char Option_t
Definition: External.C:48