StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEStructEmptyAnalysis.cxx
1 /**********************************************************************
2  *
3  * $Id: StEStructEmptyAnalysis.cxx,v 1.9 2007/05/27 22:43:33 msd Exp $
4  *
5  * Author: Jeff Porter and Michael Daugherity
6  *
7  **********************************************************************
8  *
9  * Description: Empty analysis code for testing
10  * Can replace StEStruct2ptCorrelations for an analysis that
11  * reads events, applies all event and track (NOT pair) cuts,
12  * and outputs a few histograms.
13  * Makes Nch distributions for centrality analysis.
14  *
15  **********************************************************************/
16 #include "StEStructEmptyAnalysis.h"
17 #include "StEStructPool/EventMaker/StEStructEvent.h"
18 #include "StEStructPool/EventMaker/StEStructTrack.h"
19 #include "Stiostream.h"
20 #include "TH1F.h"
21 #include "TH2F.h"
22 #include "TFile.h"
23 
24 
25 ClassImp(StEStructEmptyAnalysis)
26 
28 
29  hNEvent = new TH1F("hNEvent","dNevent/dNch - Centrality",1200,0,1200);
30  hnt = new TH1F("hnt","dNevent/dNch - Ntrack",1200,0,1200);
31  href = new TH1F("href","refMult", 1000,0,1000);
32  hnumPrim = new TH1F("hnumPrim", "Number of Good Primary Tracks", 2000, 0, 2000);
33  hctb = new TH1D("hctb","CTB Multiplicity", 1500,0,15000);
34 
35  hnev14 = new TH1F("hnev14","centrality ^ 1/4",100,0,7); // I guess round numbers don't matter here...
36  hnt14 = new TH1F("hnt14","Ntrack ^ 1/4",100,0,7);
37  href14 = new TH1F("href14","refMult ^ 1/4", 100,0,7);
38  hnumPrim14 = new TH1F("hnumPrim14","Primaries ^ 1/4", 100,0,7);
39  hctb14 = new TH1D("hctb14","CTB ^ 1/4", 200,0,15);
40 
41  hmeanpt = new TH1F("hmeanpt","mean pt",100,0,2);
42  hmeanpt14 = new TH1F("hmeanpt14","mean pt ^ 1/4",1000,0,2);
43 
44  float varxbins[1200];
45  varxbins[0]=0;
46  for(int i=1; i<1200; i++) varxbins[i]=pow(i,0.25)-0.00001;
47  hvar = new TH1F("hvar","var bin",1199,varxbins);
48 
49 };
50 
51 bool StEStructEmptyAnalysis::doEvent(StEStructEvent* event){
52 
53  if(!event) return false;
54 
55  int mult = (int)event->Centrality();
56  //cout << " doing event " << event->EventID() << " with mult " << mult << endl; //***
57 
58  hNEvent->Fill(mult);
59  hnt->Fill(event->Ntrack());
60  href->Fill(event->RefMult());
61  hnumPrim->Fill(event->NumPrim());
62  hctb->Fill(event->ctbMult());
63 
64 
65  hnev14->Fill(pow(mult,0.25));
66  hvar->Fill(pow(mult,0.25));
67  hnt14->Fill(pow(event->Ntrack(),0.25));
68  href14->Fill(pow(event->RefMult(),0.25));
69  hnumPrim14->Fill(pow(event->NumPrim(),0.25));
70  hctb14->Fill(pow(event->ctbMult(),0.25));
71 
72 
73  double ptsum = 0;
74  int count = 0;
75 
76  StEStructTrackCollection* tcol;
77  for(int i=0;i<2;i++){
78 
79  if(i==0)tcol=event->TrackCollectionP();
80  if(i==1)tcol=event->TrackCollectionM();
81  StEStructTrackIterator Iter;
82  for(Iter=tcol->begin(); Iter!=tcol->end();++Iter){
83  if(*Iter) {
84  count++;
85  ptsum+=(*Iter)->Pt();
86  }
87  }
88  }
89 
90  hmeanpt->Fill( ptsum/count );
91  hmeanpt14->Fill( pow(ptsum/count,0.25) );
92 
93  delete event;
94 
95  return true;
96 }
97 
98 //------------------------------------------------------------------------
99 void StEStructEmptyAnalysis::finish(){
100 
101  if(!moutFileName){
102  cout<<" NO OUTPUTFILE TO WRITE TO ..... giving up ...."<<endl;
103  return;
104  }
105 
106  TFile * tf=new TFile(moutFileName,"RECREATE");
107  tf->cd();
108 
109  for(int i=1; i<=hvar->GetNbinsX(); i++) hvar->SetBinContent(i, hvar->GetBinContent(i)*4*pow(hvar->GetBinLowEdge(i),3) );
110 
111  hNEvent->Write();
112  hnt->Write();
113  hvar->Write();
114  href->Write();
115  hnumPrim->Write();
116  hctb->Write();
117 
118  hnev14->Write();
119  hnt14->Write();
120  href14->Write();
121  hnumPrim14->Write();
122  hctb14->Write();
123 
124  hmeanpt->Write();
125  hmeanpt14->Write();
126 
127  tf->Close();
128 
129 }
130 
131 /**********************************************************************
132  *
133  * $Log: StEStructEmptyAnalysis.cxx,v $
134  * Revision 1.9 2007/05/27 22:43:33 msd
135  * Added new centrality plots to Empty analysis
136  *
137  * Revision 1.8 2007/01/26 17:09:27 msd
138  * Minor bug fix in AnalysisMaker, cleaned up EmptyAnalysis
139  *
140  * Revision 1.7 2006/04/04 22:05:04 porter
141  * a handful of changes:
142  * - changed the StEStructAnalysisMaker to contain 1 reader not a list of readers
143  * - added StEStructQAHists object to contain histograms that did exist in macros or elsewhere
144  * - made centrality event cut taken from StEStructCentrality singleton
145  * - put in ability to get any max,min val from the cut class - one must call setRange in class
146  *
147  * Revision 1.6 2005/10/14 13:51:05 msd
148  * Yet another fix of code I'm not using
149  *
150  * Revision 1.5 2005/10/10 16:22:28 msd
151  * stability fixes, yet another tweak of output hists
152  *
153  * Revision 1.4 2005/10/04 16:06:15 msd
154  * Finalized centrality plots
155  *
156  * Revision 1.3 2005/09/29 17:40:30 msd
157  * Changed empty analysis to create plots for determining centrality bins
158  *
159  * Revision 1.2 2004/06/25 03:10:28 porter
160  * added a new common statistics output and added electron cut with momentum slices
161  *
162  * Revision 1.1 2003/10/15 18:20:32 porter
163  * initial check in of Estruct Analysis maker codes.
164  *
165  *
166  *********************************************************************/