AliPhysics  c69cd47 (c69cd47)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskLEDCheck.cxx
Go to the documentation of this file.
1 #include <THashList.h>
2 #include "THistManager.h"
3 #include <TLorentzVector.h>
4 #include <TMath.h>
5 #include <TVector.h>
6 
7 #include "AliEMCALGeometry.h"
9 #include "AliVCaloCells.h"
10 #include "AliVCluster.h"
11 
13 
15  AliAnalysisTaskSE(),
16  fHistos(NULL),
17  fGeometry(NULL)
18 {
19 }
20 
22  AliAnalysisTaskSE(name),
23  fHistos(NULL),
24  fGeometry(NULL)
25 {
26  DefineOutput(1, TList::Class());
27 }
28 
30 }
31 
33  fHistos = new THistManager("LEDCheck");
34 
35  fHistos->CreateTH1("fNumberOfFiringCells", "Number of non-zero cells per event", 10000, 0., 10000.);
36  fHistos->CreateTH1("fNumberOfFiringClusters", " Number of clusters per event", 1000, 0., 1000.);
37  fHistos->CreateTH2("fNumberOfFiringCellsSM", "Number of non-zero cells per event and supermodule", 20, -0.5, 19.5, 10000, 0., 10000.);
38  fHistos->CreateTH2("fNumberOfFiringClustersSM", " Number of clusters per event", 20, -0.5, 19.5, 1000, 0., 1000.);
39  PostData(1, fHistos->GetListOfHistograms());
40 }
41 
43  if(!fGeometry){
44  fGeometry = AliEMCALGeometry::GetInstance();
45  if(!fGeometry)
46  fGeometry = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->GetRunNumber());
47  }
48  // Look only at INT7-B, EMC7-B and DMC7-B events
49  TString triggers(InputEvent()->GetFiredTriggerClasses());
50  if(!(triggers.Contains("INT7-B") || triggers.Contains("EMC7-B") || triggers.Contains("DMC7-B"))) return;
51 
52  const int kNsupermodule = 20;
53  Int_t ncell = 0, nclusters = 0;
54  Int_t ncellsupermodule[kNsupermodule], nclustersupermodule[kNsupermodule];
55  memset(ncellsupermodule, 0, sizeof(Int_t) * kNsupermodule);
56  memset(nclustersupermodule, 0, sizeof(Int_t) * kNsupermodule);
57  AliVCaloCells *emcalcells = InputEvent()->GetEMCALCells();
58  for(int icell = 0; icell < emcalcells->GetNumberOfCells(); icell++){
59  if(emcalcells->GetCellAmplitude(icell) > 0){
60  ncell++;
61  Int_t supermoduleID = 0;
62  double globalpos[3];
63  fGeometry->GetGlobal(icell, globalpos);
64  TVector3 globalvec(globalpos[0], globalpos[1], globalpos[2]);
65  Double_t phi = globalvec.Phi();
66  if(phi < 0) phi += 2 * TMath::Pi();
67  fGeometry->SuperModuleNumberFromEtaPhi(globalvec.Eta(), phi, supermoduleID);
68  if(supermoduleID > -1)
69  ncellsupermodule[supermoduleID]++;
70  }
71  }
72  if(ncell)
73  fHistos->FillTH1("fNumberOfFiringCells", ncell);
74  AliVCluster *clust = NULL;
75  for(Int_t icluster = 0; icluster < InputEvent()->GetNumberOfCaloClusters(); icluster++){
76  clust = InputEvent()->GetCaloCluster(icluster);
77  if(clust->IsEMCAL()){
78  nclusters++;
79  TLorentzVector position;
80  Double_t vertex[3];
81  InputEvent()->GetPrimaryVertexSPD()->GetXYZ(vertex);
82  clust->GetMomentum(position, vertex);
83  Int_t supermoduleID(-1);
84  Double_t phi = position.Phi();
85  if(phi < 0) phi += 2 * TMath::Pi();
86  fGeometry->SuperModuleNumberFromEtaPhi(position.Eta(), phi, supermoduleID);
87  if(supermoduleID > -1)
88  nclustersupermodule[supermoduleID]++;
89  }
90  }
91  if(nclusters)
92  fHistos->FillTH1("fNumberOfFiringClusters", nclusters);
93 
94  for(int ism = 0; ism < 20; ism++){
95  if(ncellsupermodule[ism]) fHistos->FillTH2("fNumberOfFiringCellsSM", ism, ncellsupermodule[ism]);
96  if(nclustersupermodule[ism]) fHistos->FillTH2("fNumberOfFiringClustersSM", ism, nclustersupermodule[ism]);
97  }
98  PostData(1, fHistos->GetListOfHistograms());
99 }
ClassImp(AliAnalysisTaskLEDCheck) AliAnalysisTaskLEDCheck
virtual void UserExec(Option_t *)
Int_t GetRunNumber(TString)
Definition: PlotMuonQA.C:2235