StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StZdcVertexMaker.cxx
1 /***************************************************************************
2  *
3  * $Id: StZdcVertexMaker.cxx,v 1.10 2016/12/12 17:18:04 smirnovd Exp $
4  *
5  * Author: Johan E. Gonzalez, August 2001
6  ***************************************************************************
7  *
8  * Description: This Maker makes use of parameters obtained after calibrating the ZDC's to
9  * calculate the z-vertex as determined by the ZDC's. The calibration
10  * parameters are retrieved from a database in init(), then the z-vertex is
11  * calculated in Make() by using these parameters in conjunction with ADC and
12  * TDC signals.
13  *
14  ***************************************************************************
15  *
16  * $Log: StZdcVertexMaker.cxx,v $
17  * Revision 1.10 2016/12/12 17:18:04 smirnovd
18  * Removed outdated ClassImp ROOT macro
19  *
20  * Revision 1.9 2009/01/26 15:11:05 fisyak
21  * Clean up access to Calibrations/trg/ZdcCalPars table
22  *
23  * Revision 1.8 2007/04/28 17:57:28 perev
24  * Redundant StChain.h removed
25  *
26  * Revision 1.7 2004/09/09 22:45:56 fisyak
27  * Add protection for missing StTriggerData
28  *
29  * Revision 1.6 2004/03/02 15:52:16 lbarnby
30  * Completely updated to use StTriggerData from StEvent
31  *
32  * Revision 1.5 2004/01/14 22:57:29 fisyak
33  * Add declaration of InitRun
34  *
35  * Revision 1.4 2003/09/02 17:59:21 perev
36  * gcc 3.2 updates + WarnOff
37  *
38  * Revision 1.3 2001/10/05 13:39:56 jeromel
39  * Changes made by Lee Barnby.
40  *
41  * Revision 1.2 2001/08/31 19:07:36 macross
42  * Modified code to retrieve ADC and TDC pulses from TrgDet table
43  *
44  **************************************************************************/
45 #include "StZdcVertexMaker.h"
46 
47 #include <stdlib.h>
48 #include <math.h>
49 
50 #include "StEventTypes.h"
51 #include "StMessMgr.h"
52 #include "St_DataSet.h"
53 #include "St_DataSetIter.h"
54 #include "ZdcCalPars.h"
55 #include "tables/St_ZdcCalPars_Table.h"
56 #include "tables/St_dst_TrgDet_Table.h"
57 #include "StDaqLib/TRG/trgStructures.h"
58 
59 
60 //#include "StEventMaker/StEventMaker.h"
61 
62 static const char rcsid[] = "$Id: StZdcVertexMaker.cxx,v 1.10 2016/12/12 17:18:04 smirnovd Exp $";
63 
64 
65 //_________________________________________________
66 StZdcVertexMaker::StZdcVertexMaker(const char *name, const char *title):StMaker(name,title)
67 {
68  mEAP0 = 0;
69  mEAP1 = 0;
70  mEAP2 = 0;
71  mEAP3 = 0;
72  mWAP0 = 0;
73  mWAP1 = 0;
74  mWAP2 = 0;
75  mWAP3 = 0;
76  mVPAR = 0;
77  mOFF = 0;
78 }
79 
80 //_________________________________________________
81 StZdcVertexMaker::~StZdcVertexMaker()
82 {
83  // StZdcVertexMaker Destructor
84 
85 }
86 
87 //_________________________________________________
88 void StZdcVertexMaker::Clear(const char*)
89 {
90  // StZdcVertexMaker - Clear,
91 
93 }
94 
95 //_________________________________________________
97 {
98 
99  return StMaker::Finish();
100 }
101 
102 //_________________________________________________
103 Int_t StZdcVertexMaker::Init() {return StMaker::Init(); }
104 //_________________________________________________
105 Int_t StZdcVertexMaker::InitRun(int runumber)
106 {
107 
108  // Getting Database info
109  St_ZdcCalPars * t = (St_ZdcCalPars *)GetDataBase("Calibrations/trg/ZdcCalPars");
110  if (! t) {
111  gMessMgr->Error() << "StZdcVertexMaker::Init(): in ZdcVertexMaker did not find ZdcCalPars." << endm;
112  return kStErr;
113  }
114 
115  ZdcCalPars_st* s = (ZdcCalPars_st*)t->GetArray();
116 
117  mEAP0 = s[0].EAP0;
118  mEAP1 = s[0].EAP1;
119  mEAP2 = s[0].EAP2;
120  mEAP3 = s[0].EAP3;
121  mWAP0 = s[0].WAP0;
122  mWAP1 = s[0].WAP1;
123  mWAP2 = s[0].WAP2;
124  mWAP3 = s[0].WAP3;
125  mVPAR = s[0].VPAR;
126  mOFF = s[0].OFF;
127 
128  return kStOK;
129 }
130 
131 //_________________________________________________
133 {
134 
135  //
136  // Get StEvent
137  //
138  StEvent* event;
139  event = (StEvent *) GetInputDS("StEvent");
140  if (!event) {
141  gMessMgr->Error() << "StZdcVertexMaker::Make() : unable to get StEvent." << endm;
142  return kStOK;
143  }
144 
145  //
146  // Get trigger data
147  //
148  StTriggerData *td=event->triggerData();
149  if (!td) {
150  gMessMgr->Error() << "StZdcVertexMaker::Make() : unable to get StTriggerData." << endm;
151  return kStOK;
152  }
153 
154  // If change to getting StTriggerData before StEvent created then
155  // everything in Make() function above here should be changed but
156  // lines below can be preserved.
157 
158  //
159  // Get appropriate data
160  //
161  float adcE = td->zdcAttenuated(east,0);
162  float adcW = td->zdcAttenuated(west,0);
163  float tdcE = td->zdcTDC(east,0);
164  float tdcW = td->zdcTDC(west,0);
165 
166  //
167  // Vertex algorithm
168  //
169  float VertexZ = ((tdcW-(mWAP0+(mWAP1*adcW)+(mWAP2*::pow(adcW,2))+(mWAP3*::pow(adcW,3))))-
170  (tdcE-(mEAP0+(mEAP1*adcE)+(mEAP2*::pow(adcE,2))+(mEAP3*::pow(adcE,3)))))*mVPAR + mOFF;
171 
172  //
173  // Store VertexZ
174  //
175  td->setZdcVertexZ(VertexZ);
176 
177  return kStOK;
178 }
179 
180 
181 
182 
183 
184 
185 
186 
187 
188 
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StMaker.cxx:634
Definition: Stypes.h:40
virtual Int_t Finish()
Definition: StMaker.cxx:776
Definition: Stypes.h:44