AliPhysics  ec7afe5 (ec7afe5)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalIteratorTest.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 <THistManager.h>
16 
17 #include "AliClusterContainer.h"
18 #include "AliMCParticleContainer.h"
19 #include "AliTrackContainer.h"
20 
22 
26 
32  fHistos(NULL),
33  fNameClusterContainer(""),
34  fNameMCParticleContainer(""),
35  fNameTrackContainer("")
36 {
37 
38 }
39 
44  AliAnalysisTaskEmcal(name, true),
45  fHistos(NULL),
46  fNameClusterContainer(""),
47  fNameMCParticleContainer(""),
48  fNameTrackContainer("")
49 {
50 
51 }
52 
57 }
58 
65  fHistos = new THistManager("testhistos");
67 
68  const int kNcontNames = 3, kNiterNames = 2;
69  TString containernames[kNcontNames] = {"ClusterContainer", "MCParticleContainer", "TrackContainer"},
70  iternames[kNiterNames] = {"Accept", "All"};
71  for(int icont = 0; icont < kNcontNames; icont++)
72  for(int iiter = 0; iiter < kNiterNames; iiter++)
74  Form("hTest%sIter%s", containernames[icont].Data(), iternames[iiter].Data()),
75  Form("Test results for container %s and iterator %s", containernames[icont].Data(), iternames[iiter].Data()),
76  3, -0.5, 2.5);
77 
78  for(TIter histiter = TIter(fHistos->GetListOfHistograms()).Begin(); histiter != TIter::End(); ++histiter){
79  fOutput->Add(*histiter);
80  }
81  PostData(1, fOutput);
82 }
83 
101  int testresult = -1;
102  if(clustercont){
103  // Run test suite of the cluster container
104  testresult = TestClusterContainerIterator(clustercont, 0);
105  fHistos->FillTH1("hTestClusterContainerIterAccept", testresult);
106  testresult = TestClusterContainerIterator(clustercont, 1);
107  fHistos->FillTH1("hTestClusterContainerIterAll", testresult);
108  }
109 
111  if(mcpcont){
112  // Run test suite of the particle container
113  testresult = TestParticleContainerIterator(mcpcont, 0);
114  fHistos->FillTH1("hTestMCParticleContainerIterAccept", testresult);
115  testresult = TestParticleContainerIterator(mcpcont, 1);
116  fHistos->FillTH1("hTestMCParticleContainerIterAll", testresult);
117  }
118 
119  AliTrackContainer *trackcont = this->GetTrackContainer(fNameTrackContainer.Data());
120  if(mcpcont){
121  // Run test suite of the particle container
122  testresult = TestParticleContainerIterator(trackcont, 0);
123  fHistos->FillTH1("hTestTrackContainerIterAccept", testresult);
124  testresult = TestParticleContainerIterator(trackcont, 1);
125  fHistos->FillTH1("hTestTrackContainerIterAll", testresult);
126  }
127 
128  return kTRUE;
129 }
TString fNameMCParticleContainer
Name of the cluster container.
Base task in the EMCAL framework.
Container with name, TClonesArray and cuts for particles.
THistManager * fHistos
! Histogram manager
Unit test for the c++ stl iterators in the EMCAL containers.
THashList * GetListOfHistograms() const
Get the list of histograms.
Definition: THistManager.h:658
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Get cluster container attached to this task.
void ReleaseOwner()
Definition: THistManager.h:254
TString fNameTrackContainer
Name of the MC particle container.
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
AliEmcalList * fOutput
!output list
int TestClusterContainerIterator(const AliClusterContainer *const cont, int iteratorType, bool verbose)
AliMCParticleContainer * GetMCParticleContainer(Int_t i=0) const
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
AliTrackContainer * GetTrackContainer(Int_t i=0) const
Container class for histograms.
Definition: THistManager.h:99
int TestParticleContainerIterator(const AliParticleContainer *const cont, int iteratorType, bool verbose)
void UserCreateOutputObjects()
Main initialization function on the worker.
Container structure for EMCAL clusters.
Container for MC-true particles within the EMCAL framework.