forked from sPHENIX-Collaboration/coresoftware
/
PHG4TpcPadPlane.cc
49 lines (42 loc) · 1.56 KB
/
PHG4TpcPadPlane.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "PHG4TpcPadPlane.h"
#include <phparameter/PHParameterInterface.h> // for PHParameterInterface
#include <fun4all/Fun4AllReturnCodes.h>
#include <fun4all/SubsysReco.h> // for SubsysReco
#include <phool/PHCompositeNode.h>
#include <phool/PHNode.h> // for PHNode
#include <phool/PHNodeIterator.h>
#include <string>
PHG4TpcPadPlane::PHG4TpcPadPlane(const std::string &name)
: SubsysReco(name)
, PHParameterInterface(name)
, detector("TPC")
{
}
int PHG4TpcPadPlane::InitRun(PHCompositeNode *topNode)
{
PHNodeIterator iter(topNode);
PHCompositeNode *runNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "RUN"));
PHCompositeNode *parNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "PAR"));
std::string paramnodename = "G4TPCPADPLANE";
std::string geonodename = "G4TPCPADPLANEPAR";
UpdateParametersWithMacro();
PHNodeIterator runIter(runNode);
PHCompositeNode *RunDetNode = dynamic_cast<PHCompositeNode *>(runIter.findFirst("PHCompositeNode", detector));
if (!RunDetNode)
{
RunDetNode = new PHCompositeNode(detector);
runNode->addNode(RunDetNode);
}
SaveToNodeTree(RunDetNode, paramnodename);
// save this to the parNode for use
PHNodeIterator parIter(parNode);
PHCompositeNode *ParDetNode = dynamic_cast<PHCompositeNode *>(parIter.findFirst("PHCompositeNode", detector));
if (!ParDetNode)
{
ParDetNode = new PHCompositeNode(detector);
parNode->addNode(ParDetNode);
}
PutOnParNode(ParDetNode, geonodename);
UpdateInternalParameters();
return Fun4AllReturnCodes::EVENT_OK;
}