]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/AliAnaGammaSelection.cxx
TPCNoiseMapComponent included into build (Kelly)
[u/mrichter/AliRoot.git] / PWG4 / AliAnaGammaSelection.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, 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 /* $Id$ */
16
17 /* History of cvs commits:
18  *
19  * $Log$
20  * Revision 1.1  2007/10/29 13:50:39  gustavo
21  * New class for particle selection
22  *
23  *
24  *
25  */
26
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. 
31 //
32 //
33 //*-- Author: Gustavo Conesa (LNF-INFN) 
34 //////////////////////////////////////////////////////////////////////////////
35   
36   
37 // --- ROOT system --- 
38 #include <TParticle.h>
39 #include <TH2.h>
40 #include <TList.h>
41 #include "Riostream.h"
42 #include "TROOT.h"
43
44 // --- AliRoot system --- 
45 #include "AliAnaGammaSelection.h" 
46 #include "AliLog.h"
47
48 ClassImp(AliAnaGammaSelection)
49   
50 //____________________________________________________________________________
51   AliAnaGammaSelection::AliAnaGammaSelection() : 
52     TObject(), fAnaMC(0), fFillCTS(0), 
53     fntEMCAL(0), fntPHOS(0), fntCTS(0)
54 {
55   //default ctor
56   
57   //Initialize parameters
58   InitParameters();
59
60 }
61
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)
66 {
67   // cpy ctor
68
69 }
70
71 //_________________________________________________________________________
72 AliAnaGammaSelection & AliAnaGammaSelection::operator = (const AliAnaGammaSelection & source)
73 {
74   // assignment operator
75   
76   if(&source == this) return *this;
77
78   fAnaMC = source.fAnaMC ;
79   fFillCTS = source.fFillCTS ;
80   fntEMCAL = source.fntEMCAL ;  
81   fntPHOS = source.fntPHOS ;
82   fntCTS = source.fntCTS ;
83
84   return *this;
85   
86 }
87
88 //____________________________________________________________________________
89 AliAnaGammaSelection::~AliAnaGammaSelection() 
90 {
91    // Remove all pointers except analysis output pointers.
92
93 }
94
95 //________________________________________________________________________
96 TList *  AliAnaGammaSelection::GetCreateOutputObjects()
97 {  
98
99   // Create histograms to be saved in output file and 
100   // store them in outputContainer
101   TList * outputContainer = new TList() ; 
102   outputContainer->SetName("SelectionHistos") ; 
103   
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) ; 
109   
110  
111   //NTUPLE
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) ;
118   
119 //  gROOT->cd();
120
121   return outputContainer ;
122
123 }
124
125 //____________________________________________________________________________
126 void AliAnaGammaSelection::Selection(TString det, TClonesArray * pl, TClonesArray * plPrim) const 
127 {
128   //Select particles from detector "det"
129
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 ;
136
137   for(Int_t ipr = 0;ipr < pl->GetEntries() ; ipr ++ ){
138     TParticle * particle = dynamic_cast<TParticle *>(pl->At(ipr)) ;
139     pt = particle->Pt();
140     phi = particle->Phi();
141     eta = particle->Eta();
142     pdg =  TMath::Abs(particle->GetPdgCode()) ;
143     status = particle->GetStatusCode(); // = 2 means decay gamma!!!
144     
145     if(fAnaMC){
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!!!
152     }
153
154     gROOT->cd();
155     if(det == "EMCAL")
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);
159     else
160       fntCTS->Fill(pt,phi,eta,pdg,status,ptprimary,phiprimary, etaprimary,pdgprimary,statusprimary);
161   }
162   
163 }
164
165   //____________________________________________________________________________
166 void AliAnaGammaSelection::InitParameters()
167 {
168  
169   //Initialize the parameters of the analysis.
170
171   fAnaMC = kFALSE ;
172  
173   fFillCTS = kFALSE ;
174 }
175
176
177 //__________________________________________________________________
178 void AliAnaGammaSelection::Print(const Option_t * opt) const
179 {
180   
181   //Print some relevant parameters set for the analysis
182   if(! opt)
183     return;
184   
185   Info("Print", "%s %s", GetName(), GetTitle() ) ; 
186   printf("Is MC option selected     %d\n",  fAnaMC) ;
187   printf("    \n") ;
188   
189