Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SyncReco.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SyncReco.cc
1 #include "SyncReco.h"
2 
3 #include <ffaobjects/SyncDefs.h>
6 
9 #include <fun4all/SubsysReco.h> // for SubsysReco
10 
11 #include <phool/PHCompositeNode.h>
12 #include <phool/PHIODataNode.h>
13 #include <phool/PHNode.h> // for PHNode
14 #include <phool/PHNodeIterator.h> // for PHNodeIterator
15 #include <phool/PHObject.h> // for PHObject
16 #include <phool/getClass.h>
17 #include <phool/phool.h> // for PHWHERE
18 #include <phool/recoConsts.h>
19 
20 #include <iostream>
21 
23  : SubsysReco(name)
24 {
25  return;
26 }
27 
29 {
30  int iret = CreateNodeTree(topNode);
31  return iret;
32 }
33 
35 {
36  SyncObject *syncobject = findNode::getClass<SyncObject>(topNode, syncdefs::SYNCNODENAME);
38  syncobject->RunNumber(rc->get_IntFlag("RUNNUMBER"));
40 }
41 
43 {
44  PHNodeIterator iter(topNode);
45  PHCompositeNode *dstNode;
46  dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST"));
47  if (!dstNode)
48  {
49  std::cout << PHWHERE << " DST Node is missing doing nothing" << std::endl;
51  }
52 
53  SyncObject *syncobject = findNode::getClass<SyncObject>(topNode, syncdefs::SYNCNODENAME);
54  if (!syncobject)
55  {
56  syncobject = new SyncObjectv1();
57  PHIODataNode<PHObject> *SyncObjectNode = new PHIODataNode<PHObject>(syncobject, syncdefs::SYNCNODENAME, "PHObject"); // contains PHObject
58  dstNode->addNode(SyncObjectNode);
59  }
60 
62 }
63 
65 {
67  SyncObject *syncobject = findNode::getClass<SyncObject>(topNode, syncdefs::SYNCNODENAME);
68  if (!syncobject)
69  {
70  std::cout << PHWHERE << " No Synchronisation Object, no parallel reading of multiple inputs" << std::endl;
72  }
73 
74  syncobject->EventCounter(se->EventCounter());
75  syncobject->EventNumber(se->EventNumber());
76  syncobject->RunNumber(se->RunNumber());
77  if (forced_segment >= 0)
78  {
79  syncobject->SegmentNumber(forced_segment);
80  }
81  else
82  {
83  syncobject->SegmentNumber(se->SegmentNumber());
84  }
85 
86  if (Verbosity() > 0)
87  {
88  syncobject->identify();
89  }
91 }