StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcPointTreeMaker.cxx
1 #include "StEEmcPointTreeMaker.h"
2 #include "StEEmcA2EMaker.h"
3 #include "StEEmcClusterMaker.h"
4 #include "StEEmcMixEvent.h"
5 
6 ClassImp(StEEmcPointTreeMaker);
7 
8 // ----------------------------------------------------------------------------
9 StEEmcPointTreeMaker::StEEmcPointTreeMaker( const Char_t *n):StEEmcPointMaker(n)
10 {
11  mFilename="NONE";
12  mMixEvent=new StEEmcMixEvent();
13  mFile=0;
14 }
15 
16 // ----------------------------------------------------------------------------
18 {
19 
20  if ( !mFilename.Contains("NONE") )
21  {
22  mFile = new TFile(mFilename,"recreate");
23  }
24 
25  mTree=new TTree("mTree","Point maker tree");
26  mTree->Branch("mEEmcPoints","StEEmcMixEvent",&mMixEvent);
27 
28  return StEEmcPointMaker::Init();
29 }
30 
31 // ----------------------------------------------------------------------------
33 {
34  Int_t stat=StEEmcPointMaker::Make();
35  if ( stat != kStOK ) return stat;
36 
38  for ( UInt_t i = 0; i < mPoints.size(); i++ )
39  mMixEvent -> addPoint ( mPoints[i] );
40 
42  for ( Int_t sec=0; sec<12; sec++ )
43  for ( Int_t pln=0; pln<2; pln++ )
44  for ( Int_t cl=0;cl<mEEclusters->numberOfSmdClusters(sec,pln); cl++ )
45  {
46  mMixEvent->addCluster( mEEclusters->smdcluster(sec,pln,cl));
47  }
48 
50  StEEmcTowerVec_t towers=mEEanalysis->towers();
51  Float_t etotal=0.;
52  for ( UInt_t i=0; i < towers.size(); i++ )
53  {
54  // mMixEvent -> addTower( towers[i] );
55  etotal+= towers[i].energy();
56  }
57  mMixEvent->setTotalEnergy(etotal);
58  mMixEvent->setEnergySeen(energySeen());
59 
60  for ( Int_t i=0;i<12; i++ ) {
61  mMixEvent->setTotalEnergyU( i,mEEanalysis->energy(i,4) );
62  mMixEvent->setTotalEnergyV( i,mEEanalysis->energy(i,5) );
63  }
64 
66  mTree -> Fill();
67 
68  return kStOK;
69 
70 }
71 
72 // ----------------------------------------------------------------------------
73 void StEEmcPointTreeMaker::Clear(Option_t *o)
74 {
75  mMixEvent->Clear();
77 }
78 
79 // ----------------------------------------------------------------------------
81 {
82  if ( mFile )
83  {
84  std::cout << "StEEmcPointTreeMaker::Finish()" << std::endl;
85  mFile->Write();
86  }
87 
88  return kStOK;
89 }
StEEmcA2EMaker * mEEanalysis
ADC2E.
Int_t Init()
Initialize.
StEEmcPointVec_t mPoints
All fully reconstructed points.
Int_t numberOfSmdClusters(Int_t sec, Int_t plane) const
Return number of smd clusters for a given sector, plane.
Float_t energySeen()
Total energy seen by the algorithm.
StEEmcTowerVec_t & towers(Int_t layer=0)
Int_t Make()
Build points for this event.
Int_t Init()
Initialize.
Class for building points from smd clusters.
copied from muDst
Float_t energy(Int_t sector, Int_t layer) const
void Clear(Option_t *opts="")
Clear old points.
Definition: Stypes.h:40
void Clear(Option_t *opts="")
Clear old points.
StEEmcSmdCluster & smdcluster(Int_t sec, Int_t plane, Int_t index)
return a specific cluster from a given sector, plane
StEEmcClusterMaker * mEEclusters
Clusters.
Int_t Make()
Build points for this event.