StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjSimuBBCMaker.C
1 #include "StMaker.h"
2 
3 
4 #include <StMuDSTMaker/COMMON/StMuDstMaker.h>
5 #include <StMuDSTMaker/COMMON/StMuDst.h>
6 #include <StMuDSTMaker/COMMON/StMuEvent.h>
7 
8 #include <StTriggerUtilities/StTriggerSimuMaker.h>
9 #include <StTriggerUtilities/StTriggerSimuResult.h>
10 #include <StTriggerUtilities/Bemc/StBemcTriggerSimu.h>
11 
12 #include <TChain.h>
13 #include <TDirectory.h>
14 
15 #include <libgen.h>
16 
17 #include <string>
18 #include <cstring>
19 
20 using namespace std;
21 
22 class StjSimuBBCMaker : public StMaker {
23 
24 public:
25 
26  StjSimuBBCMaker(const Char_t *name, TDirectory* file, StMuDstMaker* uDstMaker, int trgID)
27  : StMaker(name), _file(file), _uDstMaker(uDstMaker), _trgID(trgID)
28  { }
29 
30  virtual ~StjSimuBBCMaker() { }
31 
32  const char* GetCVS() const
33  {static const char cvs[]="Tag $Name: $ $Id: StjSimuBBCMaker.C,v 1.3 2014/08/06 11:43:24 jeromel Exp $ built " __DATE__ " " __TIME__; return cvs;}
34 
35 private:
36 
37  TDirectory* _file;
38  TTree* _tree;
39 
40  int _trgID;
41 
42  StMuDstMaker* _uDstMaker;
43 
44  Int_t _runNumber;
45  Int_t _eventId;
46  Int_t _bbc;
47  Double_t _vertexZ;
48 
49 public:
50 
51  Int_t Init()
52  {
53  _file->cd();
54  _tree = new TTree("simuBBC", "simuBBC");
55  _tree->Branch("runNumber" , &_runNumber , "runNumber/I" );
56  _tree->Branch("eventId" , &_eventId , "eventId/I" );
57  _tree->Branch("bbc" , &_bbc , "bbc/I" );
58  _tree->Branch("vertexZ" , &_vertexZ , "vertexZ/D" );
59  return kStOk;
60  }
61 
62  Int_t Make()
63  {
64  _runNumber = _uDstMaker->muDst()->event()->runId();
65  _eventId = _uDstMaker->muDst()->event()->eventId();
66  _vertexZ = _uDstMaker->muDst()->event()->primaryVertexPosition().z();
67 
68  StTriggerSimuMaker* trigSimu = dynamic_cast<StTriggerSimuMaker*>(GetMaker("StarTrigSimu"));
69  StTriggerSimuResult trigResult = trigSimu->detailedResult(_trgID);
70 
71  _bbc = trigResult.bbcDecision();
72 
73  _tree->Fill();
74  return kStOk;
75  }
76 
77  Int_t Finish()
78  {
79  _tree->BuildIndex("runNumber", "eventId");
80  return kStOk;
81  }
82  ClassDef(StjSimuBBCMaker, 0)
83 };
const StTriggerSimuResult & detailedResult(int trigId)
returns object containing detailed information about simulation of given trigger
Definition: Stypes.h:41