]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/Tracks/AliEMCalTriggerPatchAnalysisComponent.cxx
Add components for event counting and trigger patch analysis
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / Tracks / AliEMCalTriggerPatchAnalysisComponent.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2014, 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 /*
16  * Analysis component for different trigger patches
17  *
18  *   Author: Markus Fasel
19  */
20 #include <TClonesArray.h>
21
22 #include "AliEmcalTriggerPatchInfo.h"
23 #include "AliEMCalTriggerBinningComponent.h"
24 #include "AliEMCalTriggerEventData.h"
25 #include "AliEMCalTriggerPatchAnalysisComponent.h"
26
27 ClassImp(EMCalTriggerPtAnalysis::AliEMCalTriggerPatchAnalysisComponent)
28
29 namespace EMCalTriggerPtAnalysis {
30
31 //______________________________________________________________________________
32 AliEMCalTriggerPatchAnalysisComponent::AliEMCalTriggerPatchAnalysisComponent() :
33   AliEMCalTriggerTracksAnalysisComponent()
34 {
35   /*
36    * Dummy (I/O) constructor, not to be used
37    */
38 }
39
40 //______________________________________________________________________________
41 AliEMCalTriggerPatchAnalysisComponent::AliEMCalTriggerPatchAnalysisComponent(const char *name) :
42   AliEMCalTriggerTracksAnalysisComponent(name)
43 {
44   /*
45    * Main constructor, to be used by the users
46    */
47 }
48
49 //______________________________________________________________________________
50 void AliEMCalTriggerPatchAnalysisComponent::CreateHistos() {
51   /*
52    * Create histograms for the trigger patch analysis
53    */
54   AliEMCalTriggerBinningDimension *etabinning = fBinning->GetBinning("eta"),
55       *phibinning = fBinning->GetBinning("phi");
56   const TAxis *patchenergyaxes[4] = {
57     DefineAxis("energy", 100, 0., 100),
58     DefineAxis("eta", etabinning),
59     DefineAxis("phi", phibinning),
60     DefineAxis("isMain", 2, -0.5, 1.5)
61   };
62   const TAxis *patchampaxes[4] = {
63     DefineAxis("amplitude", 10000, 0., 10000.),
64     DefineAxis("eta", etabinning),
65     DefineAxis("phi",  phibinning),
66     DefineAxis("isMain", 2, -0.5, 1.5)
67   };
68
69   std::string patchnames[] = {"Level0", "JetHigh", "JetLow", "GammaHigh", "GammaLow"};
70   for(std::string * triggerpatch = patchnames; triggerpatch < patchnames + sizeof(patchnames)/sizeof(std::string); ++triggerpatch){
71     fHistos->CreateTHnSparse(Form("Energy%s", triggerpatch->c_str()), Form("Patch energy for %s trigger patches", triggerpatch->c_str()), 4, patchenergyaxes, "s");
72     fHistos->CreateTHnSparse(Form("EnergyRough%s", triggerpatch->c_str()), Form("Rough patch energy for %s trigger patches", triggerpatch->c_str()), 4, patchenergyaxes, "s");
73     fHistos->CreateTHnSparse(Form("Amplitude%s", triggerpatch->c_str()), Form("Patch amplitude for %s trigger patches", triggerpatch->c_str()), 4, patchampaxes, "s");
74   }
75
76 }
77
78 //______________________________________________________________________________
79 void AliEMCalTriggerPatchAnalysisComponent::Process(const AliEMCalTriggerEventData* const data) {
80   /*
81    * Run trigger patch analysis
82    */
83   AliEmcalTriggerPatchInfo *triggerpatch(NULL);
84   TIter patchIter(data->GetTriggerPatchContainer());
85   while((triggerpatch = dynamic_cast<AliEmcalTriggerPatchInfo *>(patchIter()))){
86     double triggerpatchinfo[4] = {triggerpatch->GetPatchE(), triggerpatch->GetEtaGeo(), triggerpatch->GetPhiGeo(), triggerpatch->IsMainTrigger() ? 1. : 0.};
87     double triggerpatchinfoamp[4] = {static_cast<double>(triggerpatch->GetADCAmp()), triggerpatch->GetEtaGeo(), triggerpatch->GetPhiGeo(), triggerpatch->IsMainTrigger() ? 1. : 0.};
88     double triggerpatchinfoer[4] = {triggerpatch->GetADCAmpGeVRough(), triggerpatch->GetEtaGeo(), triggerpatch->GetPhiGeo(), triggerpatch->IsMainTrigger() ? 1. : 0.};
89     if(triggerpatch->IsJetHigh()){
90       fHistos->FillTHnSparse("EnergyJetHigh", triggerpatchinfo);
91       fHistos->FillTHnSparse("AmplitudeJetHigh", triggerpatchinfoamp);
92       fHistos->FillTHnSparse("EnergyRoughJetHigh", triggerpatchinfoer);
93     }
94     if(triggerpatch->IsJetLow()){
95       fHistos->FillTHnSparse("EnergyJetLow", triggerpatchinfo);
96       fHistos->FillTHnSparse("AmplitudeJetLow", triggerpatchinfoamp);
97       fHistos->FillTHnSparse("EnergyRoughJetLow", triggerpatchinfoer);
98     }
99     if(triggerpatch->IsGammaHigh()){
100       fHistos->FillTHnSparse("EnergyGammaHigh", triggerpatchinfo);
101       fHistos->FillTHnSparse("AmplitudeGammaHigh", triggerpatchinfoamp);
102       fHistos->FillTHnSparse("EnergyRoughGammaHigh", triggerpatchinfoer);
103     }
104     if(triggerpatch->IsGammaLow()){
105       fHistos->FillTHnSparse("EnergyGammaLow", triggerpatchinfo);
106       fHistos->FillTHnSparse("AmplitudeGammaLow", triggerpatchinfoamp);
107       fHistos->FillTHnSparse("EnergyRoughGammaLow", triggerpatchinfoer);
108     }
109     if(triggerpatch->IsLevel0()){
110       fHistos->FillTHnSparse("EnergyLevel0", triggerpatchinfo);
111       fHistos->FillTHnSparse("AmplitudeLevel0", triggerpatchinfoamp);
112       fHistos->FillTHnSparse("EnergyRoughLevel0", triggerpatchinfoer);
113     }
114   }
115 }
116
117 } /* namespace EMCalTriggerPtAnalysis */