AliPhysics  master (3d17d9d)
AliAnalysisTaskEmcalHighEClusterTree.cxx
Go to the documentation of this file.
1 /************************************************************************************
2  * Copyright (C) 2019, Copyright Holders of the ALICE Collaboration *
3  * All rights reserved. *
4  * *
5  * Redistribution and use in source and binary forms, with or without *
6  * modification, are permitted provided that the following conditions are met: *
7  * * Redistributions of source code must retain the above copyright *
8  * notice, this list of conditions and the following disclaimer. *
9  * * Redistributions in binary form must reproduce the above copyright *
10  * notice, this list of conditions and the following disclaimer in the *
11  * documentation and/or other materials provided with the distribution. *
12  * * Neither the name of the <organization> nor the *
13  * names of its contributors may be used to endorse or promote products *
14  * derived from this software without specific prior written permission. *
15  * *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
19  * DISCLAIMED. IN NO EVENT SHALL ALICE COLLABORATION BE LIABLE FOR ANY *
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
26  ************************************************************************************/
27 #include <TLorentzVector.h>
28 #include <TNtuple.h>
29 
30 #include "AliAODInputHandler.h"
31 #include "AliAnalysisManager.h"
33 #include "AliClusterContainer.h"
34 #include "AliLog.h"
35 #include "AliVCaloCells.h"
36 
38 
39 using namespace PWGJE::EMCALJetTasks;
40 
43  fOutputTree(nullptr),
44  fMinClusterE(150.)
45 {
46 
47 }
48 
49 AliAnalysisTaskEmcalHighEClusterTree::AliAnalysisTaskEmcalHighEClusterTree(const char *name):
50  AliAnalysisTaskEmcal(name, kTRUE),
51  fOutputTree(nullptr),
52  fMinClusterE(150.)
53 {
54  DefineOutput(2, TNtuple::Class());
56 }
57 
59 
60 }
61 
64  fOutputTree = new TNtuple("HighEClusters", "Tree for high-energy clusters", "Eraw:Enonlin:Eleading:Exotic:Lambda02:Lambda20:Ncell:Time:Eta:Phi:IsMinBias:IsEJ1:IsEJ2:IsDJ1:IsDJ2");
65  PostData(1, fOutput);
66  PostData(2, fOutputTree);
67 }
68 
70  auto clustercont = GetClusterContainer("clustercontainer");
71  float IsMinBias = (fInputHandler->IsEventSelected() & AliVEvent::kINT7) ? 1. : 0.,
72  IsEJ1 = ((fInputHandler->IsEventSelected() & AliVEvent::kINT7) && fInputEvent->GetFiredTriggerClasses().Contains("EJ1")) ? 1. : 0.,
73  IsEJ2 = ((fInputHandler->IsEventSelected() & AliVEvent::kINT7) && fInputEvent->GetFiredTriggerClasses().Contains("EJ2")) ? 1. : 0.,
74  IsDJ1 = ((fInputHandler->IsEventSelected() & AliVEvent::kINT7) && fInputEvent->GetFiredTriggerClasses().Contains("DJ1")) ? 1. : 0.,
75  IsDJ2 = ((fInputHandler->IsEventSelected() & AliVEvent::kINT7) && fInputEvent->GetFiredTriggerClasses().Contains("DJ2")) ? 1. : 0.;
76  for(auto c : clustercont->all()) {
77  if(c->E() < fMinClusterE) continue;
78 
79  TLorentzVector pvec;
80  c->GetMomentum(pvec, fVertex);
81 
82  float datapoint[15] = {static_cast<float>(c->E()), static_cast<float>(c->GetNonLinCorrEnergy()), 0., static_cast<float>(c->GetIsExotic() ? 1. : 0.),
83  static_cast<float>(c->GetM02()), static_cast<float>(c->GetM20()), static_cast<float>(c->GetNCells()), static_cast<float>(c->GetTOF()*1e9),
84  static_cast<float>(pvec.Eta()), static_cast<float>(pvec.Phi()), IsMinBias, IsEJ1, IsEJ2, IsDJ1, IsDJ2 };
85  float emaxcell(0.);
86  for(auto icell = 0; icell < c->GetNCells(); icell++){
87  float celltmp = fInputEvent->GetEMCALCells()->GetCellAmplitude(c->GetCellAbsId(icell));
88  if(celltmp > emaxcell) emaxcell = celltmp;
89  }
90  datapoint[2] = emaxcell;
91  fOutputTree->Fill(datapoint);
92  }
93 }
94 
96  return ((fInputHandler->IsEventSelected() && AliVEvent::kINT7) || (fInputHandler->IsEventSelected() && AliVEvent::kEMCEJE));
97 }
98 
100  auto mgr = AliAnalysisManager::GetAnalysisManager();
101  if(!mgr) {
102  AliErrorGeneralStream("AliAnalysisTaskEmcalHighEClusterTree::AddTaskEmcalHighClusterE") << "No analysis manager available" << std::endl;
103  return nullptr;
104  }
105 
106  bool isAOD = mgr->GetInputEventHandler()->IsA() == AliAODInputHandler::Class();
107 
108  auto task = new AliAnalysisTaskEmcalHighEClusterTree(name);
109  mgr->AddTask(task);
110 
111  auto clustercont = task->AddClusterContainer("usedefault");
112  clustercont->SetExoticCut(false);
113  clustercont->SetName("clustercontainer");
114 
115  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
116  mgr->ConnectOutput(task, 1, mgr->CreateContainer("highEClusterHistograms", TList::Class(), AliAnalysisManager::kOutputContainer, mgr->GetCommonFileName()));
117  mgr->ConnectOutput(task, 2, mgr->CreateContainer("highEClusterTree", TNtuple::Class(), AliAnalysisManager::kOutputContainer, mgr->GetCommonFileName()));
118 
119  return task;
120 }
Base task in the EMCAL framework.
TCanvas * c
Definition: TestFitELoss.C:172
static AliAnalysisTaskEmcalHighEClusterTree * AddTaskEmcalHighClusterE(const char *name)
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Get cluster container attached to this task.
AliEmcalList * fOutput
!output list
Double_t fVertex[3]
!event vertex
void SetMakeGeneralHistograms(Bool_t g)
Enable general histograms.
virtual bool Run()
Run function. This is the core function of the analysis and contains the user code. Therefore users have to implement this function.
void UserCreateOutputObjects()
Main initialization function on the worker.