AliPhysics  97a96ce (97a96ce)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalFastOrMonitorTask.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 <THashList.h>
16 #include <THistManager.h>
17 
19 #include "AliEMCALGeometry.h"
20 #include "AliInputEventHandler.h"
21 #include "AliVCaloTrigger.h"
22 #include "AliVEvent.h"
23 
27 
30  fHistos(nullptr),
31  fGeom(nullptr),
32  fInitialized(false),
33  fOldRun(-1),
34  fRequestTrigger(AliVEvent::kAny),
35  fTriggerPattern("")
36 {
37 
38 }
39 
41  AliAnalysisTaskSE(name),
42  fHistos(nullptr),
43  fGeom(nullptr),
44  fInitialized(false),
45  fOldRun(-1),
46  fRequestTrigger(AliVEvent::kAny),
47  fTriggerPattern("")
48 {
49  DefineOutput(1, TList::Class());
50 }
51 
53 
54 }
55 
57  fHistos = new THistManager("fastOrHistos");
58 
59  const int kMaxCol = 48, kMaxRow = 104, kMaxFastOr = kMaxRow * kMaxCol;
60 
61  fHistos->CreateTH1("hEvents", "Number of events", 1, 0.5, 1.5);
62  fHistos->CreateTH1("hFastOrFrequency", "FastOr frequency", kMaxFastOr, -0.5, kMaxFastOr - 0.5);
63  fHistos->CreateTH2("hFastOrAmplitude", "FastOr amplitudes", kMaxFastOr, -0.5, kMaxFastOr - 0.5, 513, -0.5, 512.5);
64  fHistos->CreateTH2("hFastOrTimeSum", "FastOr time sum", kMaxFastOr, -0.5, kMaxFastOr - 0.5, 2049, -0.5, 2048.5);
65  fHistos->CreateTH2("hFastOrNL0Times", "FastOr Number of L0 times", kMaxFastOr, -0.5, kMaxFastOr - 0.5, 16, -0.5, 15.5);
66  fHistos->CreateTH2("hFastOrColRowFrequency", "FastOr Frequency (col-row)", kMaxCol, -0.5, kMaxCol - 0.5, kMaxRow, -0.5, kMaxRow - 0.5);
67 
68  PostData(1, fHistos->GetListOfHistograms());
69 }
70 
72  fGeom = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->GetRunNumber());
73 }
74 
76 
77 }
78 
80  if(!fInitialized){
81  ExecOnce();
82  fInitialized = true;
83  }
84 
85  // Run change
86  if(InputEvent()->GetRunNumber() != fOldRun){
87  RunChanged();
88  fOldRun = InputEvent()->GetRunNumber();
89  }
90 
91  // Check trigger
92  if(!(fInputHandler->IsEventSelected() & fRequestTrigger)) return;
93  if(fTriggerPattern.Length()){
94  if(!TString(InputEvent()->GetFiredTriggerClasses()).Contains(fTriggerPattern)) return;
95  }
96 
97  fHistos->FillTH1("hEvents", 1);
98 
99  AliVCaloTrigger *triggerdata = InputEvent()->GetCaloTrigger("EMCAL");
100  triggerdata->Reset();
101  Int_t nl0times, l1timesum, fastOrID, globCol, globRow;
102  Float_t amp;
103  while(triggerdata->Next()){
104  triggerdata->GetAmplitude(amp);
105  triggerdata->GetNL0Times(nl0times);
106  triggerdata->GetL1TimeSum(l1timesum);
107  triggerdata->GetPosition(globCol, globRow);
108  fGeom->GetTriggerMapping()->GetAbsFastORIndexFromPositionInEMCAL(globCol, globRow, fastOrID);
109 
110  fHistos->FillTH2("hFastOrColRowFrequency", globCol, globRow);
111  fHistos->FillTH1("hFastOrFrequency", fastOrID);
112  fHistos->FillTH2("hFastOrAmplitude", fastOrID, amp);
113  fHistos->FillTH2("hFastOrTimeSum", fastOrID, l1timesum);
114  fHistos->FillTH2("hFastOrNL0Times", fastOrID, nl0times);
115  }
116 
117  PostData(1, fHistos->GetListOfHistograms());
118 }
Int_t fOldRun
Old Run (for RunChanged())
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Bool_t fInitialized
Switch whether task is initialized (for ExecOnce)
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
int Int_t
Definition: External.C:63
ULong_t fRequestTrigger
Trigger selection bits.
THashList * GetListOfHistograms() const
Definition: THistManager.h:504
float Float_t
Definition: External.C:68
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
AliEMCALGeometry * fGeom
! EMCAL Geometry object
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
TString fTriggerPattern
Trigger string pattern used in addition to the trigger selection bits.
Container class for histograms for the high- charged particle analysis.
Definition: THistManager.h:43
Int_t GetRunNumber(TString)
Definition: PlotMuonQA.C:2235
const char Option_t
Definition: External.C:48
virtual void UserExec(Option_t *)
THistManager * fHistos
! Histogram handler
Simlple monitoring of EMCAL FastOr quantities.