1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 /* History of cvs commits:
20 * Revision 1.1 2007/10/29 13:50:39 gustavo
21 * New class for particle selection
27 //_________________________________________________________________________
28 // Class for plotting particle/cluster/track distributions without cuts
29 // and select clusters/tracks/particles needed in the analysis
30 // depending on PID criteria or other.
33 //*-- Author: Gustavo Conesa (LNF-INFN)
34 //////////////////////////////////////////////////////////////////////////////
37 // --- ROOT system ---
38 #include <TParticle.h>
41 #include "Riostream.h"
44 // --- AliRoot system ---
45 #include "AliAnaGammaSelection.h"
48 ClassImp(AliAnaGammaSelection)
50 //____________________________________________________________________________
51 AliAnaGammaSelection::AliAnaGammaSelection() :
52 TObject(), fAnaMC(0), fFillCTS(0),
53 fntEMCAL(0), fntPHOS(0), fntCTS(0)
57 //Initialize parameters
62 //____________________________________________________________________________
63 AliAnaGammaSelection::AliAnaGammaSelection(const AliAnaGammaSelection & g) :
64 TObject(g), fAnaMC(g.fAnaMC), fFillCTS(g.fFillCTS),
65 fntEMCAL(g.fntEMCAL), fntPHOS(g.fntPHOS), fntCTS(g.fntCTS)
71 //_________________________________________________________________________
72 AliAnaGammaSelection & AliAnaGammaSelection::operator = (const AliAnaGammaSelection & source)
74 // assignment operator
76 if(&source == this) return *this;
78 fAnaMC = source.fAnaMC ;
79 fFillCTS = source.fFillCTS ;
80 fntEMCAL = source.fntEMCAL ;
81 fntPHOS = source.fntPHOS ;
82 fntCTS = source.fntCTS ;
88 //____________________________________________________________________________
89 AliAnaGammaSelection::~AliAnaGammaSelection()
91 // Remove all pointers except analysis output pointers.
95 //________________________________________________________________________
96 TList * AliAnaGammaSelection::GetCreateOutputObjects()
99 // Create histograms to be saved in output file and
100 // store them in outputContainer
101 TList * outputContainer = new TList() ;
102 outputContainer->SetName("SelectionHistos") ;
104 // //Histograms of highest gamma identified in Event
105 // fhNGamma = new TH1F("NGamma","Number of #gamma over calorimeter",240,0,120);
106 // fhNGamma->SetYTitle("N");
107 // fhNGamma->SetXTitle("p_{T #gamma}(GeV/c)");
108 // outputContainer->Add(fhNGamma) ;
112 fntEMCAL = new TNtuple("ntEMCAL", "Tree of EMCAL particles before selection", "pt:phi:eta:pdg:status:ptprimary:phiprimary:etaprimary:pdgprimary:statusprimary");
113 outputContainer->Add(fntEMCAL) ;
114 fntPHOS = new TNtuple("ntPHOS", "Tree of PHOS particles before selection", "pt:phi:eta:pdg:status:ptprimary:phiprimary:etaprimary:pdgprimary:statusprimary");
115 //outputContainer->Add(fntPHOS) ;
116 fntCTS = new TNtuple("ntCTS", "Tree of CTS particles before selection", "pt:phi:eta:pdg:status:ptprimary:phiprimary:etaprimary:pdgprimary:statusprimary");
117 //outputContainer->Add(fntCTS) ;
121 return outputContainer ;
125 //____________________________________________________________________________
126 void AliAnaGammaSelection::Selection(TString det, TClonesArray * pl, TClonesArray * plPrim) const
128 //Select particles from detector "det"
130 //Keep some particle info before selection
131 Float_t pt = 0, ptprimary = 0 ;
132 Float_t phi = 0, phiprimary = 0 ;
133 Float_t eta = 0, etaprimary = 0 ;
134 Int_t pdg = 0, pdgprimary = 0 ;
135 Int_t status = 0, statusprimary = 0 ;
137 for(Int_t ipr = 0;ipr < pl->GetEntries() ; ipr ++ ){
138 TParticle * particle = dynamic_cast<TParticle *>(pl->At(ipr)) ;
140 phi = particle->Phi();
141 eta = particle->Eta();
142 pdg = TMath::Abs(particle->GetPdgCode()) ;
143 status = particle->GetStatusCode(); // = 2 means decay gamma!!!
146 TParticle * primary = dynamic_cast<TParticle *>(plPrim->At(ipr)) ;
147 ptprimary = primary->Pt();
148 phiprimary = primary->Phi();
149 etaprimary = primary->Eta();
150 pdgprimary = TMath::Abs(primary->GetPdgCode()) ;
151 statusprimary = primary->GetStatusCode(); // = 2 means decay gamma!!!
156 fntEMCAL->Fill(pt,phi,eta,pdg,status,ptprimary,phiprimary, etaprimary,pdgprimary,statusprimary);
157 else if(det == "PHOS")
158 fntPHOS->Fill(pt,phi,eta,pdg,status,ptprimary,phiprimary, etaprimary,pdgprimary,statusprimary);
160 fntCTS->Fill(pt,phi,eta,pdg,status,ptprimary,phiprimary, etaprimary,pdgprimary,statusprimary);
165 //____________________________________________________________________________
166 void AliAnaGammaSelection::InitParameters()
169 //Initialize the parameters of the analysis.
177 //__________________________________________________________________
178 void AliAnaGammaSelection::Print(const Option_t * opt) const
181 //Print some relevant parameters set for the analysis
185 Info("Print", "%s %s", GetName(), GetTitle() ) ;
186 printf("Is MC option selected %d\n", fAnaMC) ;