StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcMixHistMaker.cxx
1 #include "StEEmcMixHistMaker.h"
2 #include "TLine.h"
3 #include <iostream>
4 
5 ClassImp(StEEmcMixHistMaker);
6 
7 // ----------------------------------------------------------------------------
8 StEEmcMixHistMaker::StEEmcMixHistMaker(const Char_t *name):StEEmcMixMaker(name)
9 {
10 
11  std::cout << "In constructor" << std::endl;
12 
13  mMin=0.1;
14  mMax=0.18;
15 
16  std::cout << "..." << std::endl;
17 
18 }
19 
20 // ----------------------------------------------------------------------------
22 {
23 
24  book(hMass,"hMass","Dipoint invariant mass spectrum",120,0.,1.2);
25  book(hEnergy,"hEnergy","Dipoint energy distribution",100,0.,40.);
26  book(hPT,"hPT","Dipoint PT distribution",100,0.,20.);
27  book(hZgg,"hZgg","Dipoint asymmetry",100,0.,1.);
28  book(hPhigg,"hPhigg","Dipoint opening angle",100,0.,0.2);
29  book(hU1,"hU1","U seed strip for higher energy gamma",288,0.,288.);
30  book(hU2,"hU2","U seed strip for lower energy gamma",288,0.,288.);
31  book(hV1,"hV1","V seed strip for higher energy gamma",288,0.,288.);
32  book(hV2,"hV2","V seed strip for lower energy gamma",288,0.,288.);
33 
34  return StEEmcMixMaker::Init();
35 }
36 
37 // ----------------------------------------------------------------------------
38 void StEEmcMixHistMaker::book( TH1F **h, const Char_t *name, const Char_t *title, Int_t nbin, Float_t min, Float_t max )
39 {
40 
41  const Char_t *n[]={"R","B","S"};
42  const Char_t *t[]={", real events", ", mixed events", ", background subtracked"};
43  const Int_t col[]={1,2,4};
44 
45  for ( Int_t i=0;i<3;i++ )
46  {
47  h[i]=new TH1F(TString(name)+n[i], TString(title)+t[i], nbin, min, max );
48  h[i]->Sumw2();
49  h[i]->SetLineColor( col[i] );
50  }
51 
52 }
53 
54 // ----------------------------------------------------------------------------
56 {
57  Int_t stat=StEEmcMixMaker::Make();
58  if ( stat != kStOK ) return stat;
59 
60  /*
61  std::cout << "candidates=" << mCandidates.size() << std::endl;
62  std::cout << "background=" << mBackground.size() << std::endl;
63  */
64 
66  if ( mCandidates.size() > 1 ) return kStOK;
67 
68 
69  for ( UInt_t i=0; i<mCandidates.size(); i++ )
70  {
71  if ( accept(mCandidates[i] ) )
72  fill( 0, mCandidates[i] );
73  }
74 
75  for ( UInt_t i=0; i<mBackground.size(); i++ )
76  {
77  if ( accept(mBackground[i]) )
78  fill( 1, mBackground[i] );
79  }
80 
81  return kStOK;
82 
83 }
84 
85 // ----------------------------------------------------------------------------
86 void StEEmcMixHistMaker::fill( Int_t mode, StEEmcPair &pair )
87 {
88  hMass[mode]->Fill( pair.mass() );
89  if ( pair.mass() >= mMin && pair.mass() < mMax ) {
90  hEnergy[mode]->Fill( pair.energy() );
91  hPT[mode]->Fill( pair.momentum().Perp() );
92  hZgg[mode]->Fill( pair.zgg() );
93  hPhigg[mode]->Fill( pair.phigg() );
94  hU1[mode]->Fill( pair.point(0).cluster(0).mean() );
95  hU2[mode]->Fill( pair.point(1).cluster(0).mean() );
96  hV1[mode]->Fill( pair.point(0).cluster(1).mean() );
97  hV2[mode]->Fill( pair.point(1).cluster(1).mean() );
98  }
99 }
100 
101 // ----------------------------------------------------------------------------
103 {
104 
106  Float_t norm=1.0;
107  // hMass[0]->GetXaxis()->SetRangeUser(0.8,1.2);
108  // hMass[1]->GetXaxis()->SetRangeUser(0.8,1.2);
109 
110  Float_t a=hMass[0]->Integral(80,120);
111  Float_t b=hMass[1]->Integral(80,120);
112  if ( b > 0. ) norm = a/b;
113 
114  subtract(hMass,norm);
115  subtract(hEnergy,norm);
116  subtract(hPT,norm);
117  subtract(hZgg,norm);
118  subtract(hPhigg,norm);
119  subtract(hU1,norm);
120  subtract(hU2,norm);
121  subtract(hV1,norm);
122  subtract(hV2,norm);
123 
124  return kStOK;
125 
126 }
127 
128 void StEEmcMixHistMaker::subtract( TH1F **h, Float_t norm )
129 {
130  h[1]->Scale(norm);
131  h[2]->Add(h[0], 1.0);
132  h[2]->Add(h[1],-1.0);
133 }
134 
135 Bool_t StEEmcMixHistMaker::accept( StEEmcPair &pair )
136 {
137  if ( pair.pt() < 2.0 ) return false;
138  return true;
139 }
void cluster(const StEEmcSmdCluster &c, Int_t plane)
Add an smd cluster to this point.
Definition: StEEmcPoint.h:40
Int_t Init()
Initialize.
Int_t Init()
Initialize.
void book()
create 1d and 2d histograms
Int_t Make()
Process.
void fill()
fill 1d and 2d histograms
const TVector3 & momentum() const
Returns momentum of pair.
Definition: StEEmcPair.h:78
const StEEmcPoint & point(Int_t index) const
Definition: StEEmcPair.h:30
Int_t Make()
Process.
Float_t zgg() const
Returns energy-sharing of pair.
Definition: StEEmcPair.h:75
Float_t energy() const
Returns energy of pair.
Definition: StEEmcPair.h:74
Definition: Stypes.h:40
Float_t mass() const
Returns invariant mass of pair.
Definition: StEEmcPair.h:73
A class for mixing pi0 candidates.
Float_t phigg() const
Returns opening-angle of pair.
Definition: StEEmcPair.h:76
StEEmcPairVec_t mBackground
Background pairs mixed on each event.
Float_t pt() const
Returns pt of pair.
Definition: StEEmcPair.h:77
StEEmcPairVec_t mCandidates
Point pairs mixed on each event.
A class to represent pairs of points.
Definition: StEEmcPair.h:9