StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StarEmbedMaker.cxx
1 #include "StarEmbedMaker.h"
2 
3 #include "StGenericVertexMaker/StGenericVertexMaker.h"
4 #include "StGenericVertexMaker/StFixedVertexFinder.h"
5 
6 //_____________________________________________________________________________
7 StarEmbedMaker::StarEmbedMaker() : StarPrimaryMaker(), mFzdInput( true ), mFilename(), mFile(0), mTree(0), mCurrentEntry(0), mRun(0), mEvent(0), mVertexX(-9E9), mVertexY(-9E9), mVertexZ(-9E9), mSigmaX(-9E9), mSigmaY(-9E9), mSigmaZ(-9E9) {
8 }
9 //_____________________________________________________________________________
10 StarEmbedMaker::~StarEmbedMaker() {
11 
12 }
13 //_____________________________________________________________________________
14 void StarEmbedMaker::SetInputFile(const char* filename){
15  mFilename = filename;
16  mFile = TFile::Open(mFilename.c_str()); assert(mFile);
17  mTree = dynamic_cast<TTree*>( mFile->Get("Tag") ); assert(mTree);
18  mTree->SetBranchAddress( "EvtHddr.mRunNumber", &mRun );
19  mTree->SetBranchAddress( "EvtHddr.mEventNumber", &mEvent );
20  mTree->SetBranchAddress( "GlobalTag.primaryVertexX", &mVertexX );
21  mTree->SetBranchAddress( "GlobalTag.primaryVertexY", &mVertexY );
22  mTree->SetBranchAddress( "GlobalTag.primaryVertexZ", &mVertexZ );
23  mTree->SetBranchAddress( "GlobalTag.sigmaPVX", &mSigmaX );
24  mTree->SetBranchAddress( "GlobalTag.sigmaPVY", &mSigmaY );
25  mTree->SetBranchAddress( "GlobalTag.sigmaPVZ", &mSigmaZ );
26  mRun = mEvent = -1;
27  mVertexX = mVertexY = mVertexZ = mSigmaX = mSigmaY = mSigmaZ = -9E9;
28 }
29 //_____________________________________________________________________________
30 void StarEmbedMaker::Clear(const Option_t* opts )
31 {
32  mRun = mEvent = -1;
33  mVertexX = mVertexY = mVertexZ = mSigmaX = mSigmaY = mSigmaZ = -9E9;
34  StarPrimaryMaker::Clear(opts);
35 }
36 //_____________________________________________________________________________
37 // And now for the business end of this maker. We will be setting up the event
38 // for embedding. In this initial release, we will be reading in events from
39 // the FZD file (so event generation and simulation are already done). We only
40 // need to read in the vertex from the tags file and setup the vertex finder
41 // to use it as the fixed vertex.
42 //
43 // This initial version will be limited to the HFT embedding jobs. We will
44 // plan to read in from the FZD file. But
45 //
46 // Future versions will support simulation within the embedding job.
47 //
49 {
50 
51  mTree -> GetEntry( mCurrentEntry++ );
52 
53  SetVertex( mVertexX, mVertexY, mVertexZ );
54  SetSigma ( mSigmaX, mSigmaY, mSigmaZ ); // smears the simulated vertex by the real vtx error... should be an option
55 
56  int result = kStOK;
57  if ( 0 == mFzdInput ) {
58 
59  result = StarPrimaryMaker::Make();
60 
61  }
62 
63  // Now we set the vertex for the vertex finder
64  auto* vertexMaker = dynamic_cast<StGenericVertexMaker *>( GetMaker("GenericVertex") ); assert(vertexMaker);
65  auto* vertexFinder = dynamic_cast<StFixedVertexFinder *>( vertexMaker->GetGenericFinder() ); assert(vertexFinder);
66 
67  vertexFinder->SetVertexPosition( mVertexX, mVertexY, mVertexZ );
68  vertexFinder->SetVertexError ( mSigmaX, mSigmaY, mSigmaZ );
69 
70  return result;
71 }
72 //
73 //_____________________________________________________________________________
void SetSigma(Double_t sx, Double_t sy, Double_t sz, Double_t rho=0)
StGenericVertexFinder implementation for fixing vertex.
Definition: Stypes.h:40
Main steering class for event generation.
void SetVertex(Double_t x, Double_t y, Double_t z)
Set the x, y and z vertex position.