]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/other/code/FlowEventSimpleMaker.cxx
macro and flowevent maker to run part of the code in root
[u/mrichter/AliRoot.git] / PWG2 / FLOW / other / code / FlowEventSimpleMaker.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 #include "Riostream.h"
18 #include "FlowEventSimpleMaker.h"
19 #include "AliFlowEventSimple.h"
20 #include "AliFlowTrackSimple.h"
21 #include "TTree.h"
22 #include "TParticle.h"
23 #include "AliFlowTrackSimpleCuts.h"
24
25
26 // FlowEventSimpleMaker:
27 // Class to fill the AliFlowEventSimple
28 // with AliFlowTrackSimple objects
29 // ouside the AliRoot Framework
30 // Has fill methods for TTree, 
31
32 ClassImp(FlowEventSimpleMaker)
33 //----------------------------------------------------------------------- 
34 FlowEventSimpleMaker::FlowEventSimpleMaker()
35 {
36   //constructor
37 }
38
39 //-----------------------------------------------------------------------   
40 FlowEventSimpleMaker::~FlowEventSimpleMaker()
41 {
42   //destructor
43 }
44
45 //-----------------------------------------------------------------------   
46 AliFlowEventSimple* FlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowTrackSimpleCuts* intCuts, AliFlowTrackSimpleCuts* diffCuts)
47 {
48   //fills the event from a TTree of kinematic.root files
49   
50   // number of times to use the same particle (trick to introduce nonflow)
51   Int_t iLoops = 1;
52   
53   //flags for particles passing int. and diff. flow cuts
54   Bool_t bPassedIntFlowCuts  = kFALSE;
55   Bool_t bPassedDiffFlowCuts = kFALSE;
56   
57   //track cut values
58   Double_t dPtMaxInt  = intCuts->GetPtMax();
59   Double_t dPtMinInt  = intCuts->GetPtMin();
60   Double_t dEtaMaxInt = intCuts->GetEtaMax();
61   Double_t dEtaMinInt = intCuts->GetEtaMin();
62   Double_t dPhiMaxInt = intCuts->GetPhiMax();
63   Double_t dPhiMinInt = intCuts->GetPhiMin();
64   Int_t iPIDInt       = intCuts->GetPID();
65   
66   Double_t dPtMaxDiff  = diffCuts->GetPtMax();
67   Double_t dPtMinDiff  = diffCuts->GetPtMin();
68   Double_t dEtaMaxDiff = diffCuts->GetEtaMax();
69   Double_t dEtaMinDiff = diffCuts->GetEtaMin();
70   Double_t dPhiMaxDiff = diffCuts->GetPhiMax();
71   Double_t dPhiMinDiff = diffCuts->GetPhiMin();
72   Int_t iPIDDiff       = diffCuts->GetPID();
73   
74   Int_t iNumberOfInputTracks = anInput->GetEntries() ;
75   //cerr<<"iNumberOfInputTracks = "<<iNumberOfInputTracks<<endl;
76   TParticle* pParticle = new TParticle();
77   anInput->SetBranchAddress("Particles",&pParticle);  
78   //  AliFlowEventSimple* pEvent = new AliFlowEventSimple(iNumberOfInputTracks);
79   AliFlowEventSimple* pEvent = new AliFlowEventSimple(10);
80   //cerr<<pEvent<<" pEvent "<<endl;
81   
82   Int_t iN = iNumberOfInputTracks; // additional variable to artificially fix the number of tracks
83   //  Int_t iN = 576; //multiplicity for chi=1.5
84   //  Int_t iN = 256; //multiplicity for chi=1
85   //  Int_t iN = 164; //multiplicity for chi=0.8
86   
87   Int_t iGoodTracks = 0;
88   Int_t itrkN = 0;
89   Int_t iSelParticlesDiff = 0;
90   Int_t iSelParticlesInt = 0;
91   
92   while (itrkN < iNumberOfInputTracks) {
93     anInput->GetEntry(itrkN);   //get input particle
94     //checking the cuts for int. and diff. flow
95     if (pParticle->Pt() > dPtMinInt && pParticle->Pt() < dPtMaxInt &&
96         pParticle->Eta() > dEtaMinInt && pParticle->Eta() < dEtaMaxInt &&
97         pParticle->Phi() > dPhiMinInt && pParticle->Phi() < dPhiMaxInt &&
98         TMath::Abs(pParticle->GetPdgCode()) == iPIDInt) { 
99       bPassedIntFlowCuts = kTRUE; 
100     } 
101     
102     if (pParticle->Pt() > dPtMinDiff && pParticle->Pt() < dPtMaxDiff &&
103         pParticle->Eta() > dEtaMinDiff && pParticle->Eta() < dEtaMaxDiff &&
104         pParticle->Phi() > dPhiMinDiff && pParticle->Phi() < dPhiMaxDiff &&
105         TMath::Abs(pParticle->GetPdgCode()) == iPIDDiff){ 
106       bPassedDiffFlowCuts = kTRUE; 
107     }
108     
109     if (bPassedIntFlowCuts || bPassedDiffFlowCuts) {
110       for(Int_t d=0;d<iLoops;d++) {
111         AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
112         pTrack->SetPt(pParticle->Pt());
113         pTrack->SetEta(pParticle->Eta());
114         pTrack->SetPhi(pParticle->Phi());
115         
116         //marking the particles used for int. flow:
117         if(bPassedIntFlowCuts && iSelParticlesInt < iN*iLoops) {  
118           pTrack->SetForIntegratedFlow(kTRUE);
119           iSelParticlesInt++;
120         }
121         //marking the particles used for diff. flow:
122         if(bPassedDiffFlowCuts) {
123           pTrack->SetForDifferentialFlow(kTRUE);
124           iSelParticlesDiff++;
125         }
126         //adding a particles which were used either for int. or diff. flow to the list
127         pEvent->TrackCollection()->Add(pTrack);
128         iGoodTracks++;
129       }//end of for(Int_t d=0;d<iLoops;d++)
130     }//end of if(bPassedIntFlowCuts || bPassedDiffFlowCuts) 
131     itrkN++;  
132     bPassedIntFlowCuts  = kFALSE;
133     bPassedDiffFlowCuts = kFALSE;
134   }//end of while (itrkN < iNumberOfInputTracks)
135   
136   pEvent->SetEventNSelTracksIntFlow(iSelParticlesInt);  
137   pEvent->SetNumberOfTracks(iGoodTracks);//tracks used either for int. or for diff. flow
138
139   cout<<" iGoodTracks = "<<iGoodTracks<<endl;
140   cout<<" # of selected tracks for int. flow  = "<<iSelParticlesInt<<endl;
141   cout<<" # of selected tracks for diff. flow = "<<iSelParticlesDiff<<endl;  
142
143   delete pParticle;
144   return pEvent;
145 }
146
147
148
149
150