StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StAddRunInfoMaker.cxx
1 /***************************************************************************
2  *
3  * $Id: StAddRunInfoMaker.cxx,v 1.3 2017/03/17 14:40:30 jeromel Exp $
4  * Author: Frank Laue, BNL, laue@bnl.gov
5  ***************************************************************************/
6 #include "StAddRunInfoMaker.h"
7 
8 #include "StEvent/StEvent.h"
9 #include "StEvent/StRunInfo.h"
10 #include "StEvent/StEventInfo.h"
11 #include "StEvent/StEventSummary.h"
12 #include "StarClassLibrary/SystemOfUnits.h"
13 
14 StAddRunInfoMaker::StAddRunInfoMaker(const char* name) : StMaker(name) {
15  /* no-op */
16 }
17 
18 StAddRunInfoMaker::~StAddRunInfoMaker() {
19  /* no=op */
20 }
21 
22 
23 
25  StEvent* event = (StEvent*) GetInputDS("StEvent");
26 
27  if ( event ) {
28  StEventInfo* eventInfo = event->info();
29  // ok, we got the event
30  if ( !event->runInfo() ) { // ok, we got no run info, so create, fill and add it
31  StRunInfo *pRunInfo = new StRunInfo();
32  pRunInfo->setRunId( eventInfo->runId() );
33  pRunInfo->setProductionTime(20011007);
34  pRunInfo->setProductionVersion("P01hi");
35  pRunInfo->setCenterOfMassEnergy(130. * GeV);
36  pRunInfo->setBeamMassNumber(east, 197);
37  pRunInfo->setBeamMassNumber(west, 197);
38  pRunInfo->setBeamEnergy(east, 65. * GeV);
39  pRunInfo->setBeamEnergy(west, 65. * GeV);
40  // pRunInfo->setBeamLifeTime(StBeamDirection, float);
41  // pRunInfo->setBeamFillNumber(StBeamDirection, float);
42  // pRunInfo->setInitialBeamIntensity(StBeamDirection, float);
43  pRunInfo->setMagneticField(event->summary()->magneticField());
44  // pRunInfo->setTpcDriftVelocity(StBeamDirection, double);
45  event->setRunInfo(pRunInfo);
46  }
47  }
48  return 0;
49 }
50 
51 
52 
53 ClassImp(StAddRunInfoMaker)
54 
55 /***************************************************************************
56  *
57  * $Log: StAddRunInfoMaker.cxx,v $
58  * Revision 1.3 2017/03/17 14:40:30 jeromel
59  * Checking event->info() before if(event) seem like a logic flow issue - fixed
60  *
61  * Revision 1.2 2003/09/07 03:49:03 perev
62  * gcc 3.2 + WarnOff
63  *
64  * Revision 1.1 2003/03/06 01:34:18 laue
65  * StAddRunInfoMaker is a make helper maker to add the StRunInfo for the
66  * only year1 Au+Au 130GeV data
67  *
68  *
69  **************************************************************************/
int Make()
add StRunInfo to StEvent
StAddRunInfoMaker(const char *name="addRunInfo")
Default constructor; get pointer to StMuDstMaker.