Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:16:05

0001 #include "FlagHandler.h"
0002 
0003 #include <ffaobjects/FlagSave.h>
0004 #include <ffaobjects/FlagSavev1.h>
0005 
0006 #include <fun4all/Fun4AllReturnCodes.h>
0007 #include <fun4all/SubsysReco.h>
0008 
0009 #include <phool/PHCompositeNode.h>
0010 #include <phool/PHIODataNode.h>    // for PHIODataNode
0011 #include <phool/PHNode.h>          // for PHNode
0012 #include <phool/PHNodeIterator.h>  // for PHNodeIterator
0013 #include <phool/PHObject.h>        // for PHObject
0014 #include <phool/getClass.h>
0015 #include <phool/recoConsts.h>
0016 
0017 //____________________________________________________________________________..
0018 FlagHandler::FlagHandler(const std::string &name)
0019   : SubsysReco(name)
0020 {
0021 }
0022 
0023 //____________________________________________________________________________..
0024 int FlagHandler::InitRun(PHCompositeNode *topNode)
0025 {
0026   PHNodeIterator iter(topNode);
0027   PHCompositeNode *runNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "RUN"));
0028   FlagSave *flgsv = findNode::getClass<FlagSave>(runNode, "Flags");
0029   if (!flgsv)
0030   {
0031     flgsv = new FlagSavev1();
0032     PHIODataNode<PHObject> *newNode = new PHIODataNode<PHObject>(flgsv, "Flags", "PHObject");
0033     runNode->addNode(newNode);
0034   }
0035   else
0036   {
0037     recoConsts *rc = recoConsts::instance();
0038     flgsv->PutFlagsBack(rc, false);
0039   }
0040   return Fun4AllReturnCodes::EVENT_OK;
0041 }
0042 
0043 //____________________________________________________________________________..
0044 int FlagHandler::End(PHCompositeNode *topNode)
0045 {
0046   FlagSave *flagsave = findNode::getClass<FlagSave>(topNode, "Flags");
0047   if (flagsave)
0048   {
0049     recoConsts *rc = recoConsts::instance();
0050     flagsave->FillFromPHFlag(rc, true);
0051     flagsave->identify();
0052   }
0053   return Fun4AllReturnCodes::EVENT_OK;
0054 }
0055 
0056 //____________________________________________________________________________..
0057 void FlagHandler::Print(const std::string & /* what */) const
0058 {
0059   recoConsts *rc = recoConsts::instance();
0060   rc->Print();
0061 }