StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcMixTreeMaker.cxx
1 #include "StEEmcMixTreeMaker.h"
2 #include "StEEmcA2EMaker.h"
3 #include "StEEmcPointMaker.h"
4 
5 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
6 #include "StMuDSTMaker/COMMON/StMuDst.h"
7 #include "StMuDSTMaker/COMMON/StMuEvent.h"
8 
9 ClassImp(StEEmcMixTreeMaker);
10 
11 // ----------------------------------------------------------------------------
12 StEEmcMixTreeMaker::StEEmcMixTreeMaker(const Char_t *n):StEEmcMixMaker(n)
13 {
14  mFilename="NONE";
15  mMixEvent = new StEEmcMixEvent();
16  mFile=0;
17 }
18 
19 // ----------------------------------------------------------------------------
21 {
22 
23  if ( !mFilename.Contains("NONE") )
24  mFile = new TFile(mFilename,"recreate");
25 
26  mTree=new TTree("mTree","Real events");
27  mTree->Branch("mPi0event","StEEmcMixEvent",&mMixEvent);
28 
29  return StEEmcMixMaker::Init();
30 }
31 
32 
33 // ----------------------------------------------------------------------------
35 {
36 
37 
39  Int_t stat = StEEmcMixMaker::Make();
40  if ( stat != kStOK ) return stat;
41 
42 
44  mMixEvent -> setEvent( mMuDstMaker -> muDst() -> event() );
45 
46 
48  for ( UInt_t i = 0; i < mPoints.size(); i++ )
49  mMixEvent -> addPoint ( mPoints[i] );
50 
51 
54  Int_t ilead=-1;
55  Float_t ep1=0.;
56  Float_t ep2=0.;
57  for ( UInt_t i = 0; i < mCandidates.size(); i++ )
58  {
59  mMixEvent -> addPair ( mCandidates[i] );
60  if ( mCandidates[i].point(0).energy() > ep1 )
61  {
62  ep1=mCandidates[i].point(0).energy();
63  ilead=(Int_t)i;
64  }
65  if ( mCandidates[i].point(1).energy() > ep2 )
66  {
67  ep2=mCandidates[i].point(1).energy();
68  ilead=(Int_t)i;
69  }
70  }
71 
72  if ( mCandidates.size() )
73  mMixEvent->setLeadingPair( mCandidates[ilead] );
74  else {
75  StEEmcPair tmp;
76  mMixEvent->setLeadingPair(tmp);
77  }
78 
79 
80 
82  for ( UInt_t i = 0; i < mBackground.size(); i++ )
83  mMixEvent -> addMixed( mBackground[i] );
84 
85 
87  StEEmcTowerVec_t towers=mEEanalysis->towers();
88  Float_t etotal=0.;
89  Float_t emax=0.;
90  Int_t imax=-1;
91  for ( UInt_t i=0; i < towers.size(); i++ )
92  {
93  // need to add copy constructor before this line will work
94  // mMixEvent -> addTower( towers[i] );
95  etotal+= towers[i].energy();
96  if ( towers[i].energy() > emax ) {
97  emax=towers[i].energy();
98  imax=(UInt_t)i;
99  }
100  }
101  mMixEvent->setTotalEnergy(etotal);
102  mMixEvent->setEnergySeen(mEEpoints->energySeen());
103  if ( imax>=0 )
104  {
105  mMixEvent->setHighTower( towers[imax] );
106  }
107  else
108  {
109  StEEmcTower tmp;
110  mMixEvent -> setHighTower( tmp );
111  }
112 
113 
115  mTree -> Fill();
116 
117  return kStOK;
118 
119 }
120 
121 // ----------------------------------------------------------------------------
122 void StEEmcMixTreeMaker::Clear(Option_t *o)
123 {
124 
125  mMixEvent -> Clear();
126 
128 
129 }
130 
131 // ----------------------------------------------------------------------------
133 {
134 
135  if ( mFile ) {
136  mFile->Write();
137  }
138 
139  return kStOK;
140 
141 }
void Clear(Option_t *opts="")
Clear.
Int_t Init()
Initialize.
Float_t energySeen()
Total energy seen by the algorithm.
void Clear(Option_t *opts="")
Clear.
StEEmcTowerVec_t & towers(Int_t layer=0)
copied from muDst
StEEmcPointMaker * mEEpoints
Pointer to points.
Base class for representing tower, preshower and postshower elements.
Definition: StEEmcTower.h:11
StMuDstMaker * mMuDstMaker
Pointer to MuDst.
Int_t Make()
Process.
Definition: Stypes.h:40
A class for mixing pi0 candidates.
Int_t Make()
Process.
StEEmcPairVec_t mBackground
Background pairs mixed on each event.
StEEmcPairVec_t mCandidates
Point pairs mixed on each event.
A class to represent pairs of points.
Definition: StEEmcPair.h:9
StEEmcA2EMaker * mEEanalysis
Pointer to ADC 2 energy.
Int_t Init()
Initialize.
StEEmcPointVec_t mPoints
Vector of points to mix into X–&gt;gamma gamma.