StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtTagMaker.cxx
1 //
3 // StHbtTagMaker.hh
4 //
5 // Author List:
6 // Frank Laue, The Ohio State University, laue@bnl.gov
7 //
9 //
10 // Description: Maker to Fill the Hbt EbyE Tag database
11 //
13 
14 #include <Stiostream.h>
15 //#include <stdlib.h>
16 #include <math.h>
17 #include "StHbtTagMaker.h"
18 #define PR(x) cout << "##### HbtTag: " << (#x) << " = " << (x) << endl;
19 
20 ClassImp(StHbtTagMaker)
21 
22 //-------------------------------------------------------------
23 StHbtTagMaker::StHbtTagMaker(const Char_t* name) : StMaker(name) {
24  mHbtTag = 0;
25  mSt_HbtTag = 0;
26  mShowTags=0;
27  mTagWriter = StHbtTagWriter::Instance();
28 }
29 
30 //-------------------------------------------------------------
31 
32 StHbtTagMaker::~StHbtTagMaker() {
33 }
34 //-------------------------------------------------------------
35 Int_t StHbtTagMaker::Init() {
36  return StMaker::Init();
37 }
38 //-------------------------------------------------------------
39 void StHbtTagMaker::Clear(Option_t* opt) {
40  if (mTagWriter) mTagWriter->Clear();
41  cout << " StHbtTagMaker::Clear() " << endl;
42 }
43 //-------------------------------------------------------------
44 Int_t StHbtTagMaker::Make() {
45  // Create a new tag
46 
47  // instantiate new St_HbtTag class
48  mSt_HbtTag = new St_HbtTag("HbtTag",1); // table header
49  // set the size of the table
50  mSt_HbtTag->SetNRows(1);
51  // add HbtTag table to the root .data directory
52  AddData(mSt_HbtTag,".data");
53  // get a pointer to the c-struct containing the variables
54  mHbtTag = mSt_HbtTag->GetTable(); // table structure
55 
56  // print pointer to hbttag
57  if (Debug()) cout << "StTagPointer: " << mSt_HbtTag << endl;
58  if (Debug()) cout << "TagPointer: " << mHbtTag << endl;
59 
60  // fill the Hbt Tags
61  if (mTagWriter) {
62  cout << "StHbtTagMaker::Make() - fill tags now " << endl;
63  Fill(mTagWriter);
64  }
65  else {
66  cout << "StHbtTagMaker::Make() - no tags written " << endl;
67  }
68 
69  if ( mShowTags>0) PrintTag();
70  return kStOK;
71 }
72 
73 //-------------------------------------------------------------
74 void StHbtTagMaker::Fill(StHbtTagWriter* writer) {
75  *mHbtTag = writer->mHbtTag;
76 }
77 //-------------------------------------------------------------
78 
79 void StHbtTagMaker::PrintInfo() {
80  if (Debug()) StMaker::PrintInfo();
81 }
82 
83 //-------------------------------------------------------------
84 
85 void StHbtTagMaker::PrintTag(ostream& os) {
86  os << " HbtTag: " << endl;
87  os << " ************ " << endl;
88  int nFloats = sizeof(*mHbtTag) / sizeof(float);
89 
90  for ( int i=0; i<nFloats; i++) {
91  if (i%5==0) os << endl;
92  os << " " << ((float*)mHbtTag)[i];
93  }
94  os << endl;
95 }
96 
97 //-------------------------------------------------------------
98 
99 Int_t StHbtTagMaker::Finish() {
100  return StMaker::Finish();
101 }
102 
103 
Definition: Stypes.h:40
virtual Int_t Finish()
Definition: StMaker.cxx:776