// $Id$ // File: DDANAEVIO_factory.h // Created: Mon Mar 15 09:08:37 EDT 2010 // Creator: wolin (on Linux stan.jlab.org 2.6.18-164.el5 x86_64) #ifndef _DDANAEVIO_factory_ #define _DDANAEVIO_factory_ #include #include #include using namespace std; #include using namespace jana; #include // list of factory tags for dana objects that to be added to tree by default // use -PEVIO:DANAEVIO to override // *** NOTE: if you add to this list be sure to modify decode_object_parameters() appropriately *** static set emptySet; static string untagged[] = {string("")}; static set untaggedSet(untagged,untagged+1); static pair< string, set > danaObs[] = { pair< string, set > ("dmctrackhit", emptySet), pair< string, set > ("dbeamphoton", untaggedSet), pair< string, set > ("dmcthrown", untaggedSet), pair< string, set > ("dfcaltruthshower", untaggedSet), pair< string, set > ("dbcaltruthshower", untaggedSet), pair< string, set > ("dtoftruth", untaggedSet), pair< string, set > ("dsctruthhit", untaggedSet), pair< string, set > ("dmctrajectorypoint", emptySet), pair< string, set > ("dcdchit", untaggedSet), pair< string, set > ("dfdchit", untaggedSet), pair< string, set > ("dfcalhit", untaggedSet), pair< string, set > ("dhddmbcalhit", untaggedSet), pair< string, set > ("dhddmtofhit", untaggedSet), pair< string, set > ("dschit", untaggedSet), pair< string, set > ("dtrackwirebased", emptySet), pair< string, set > ("dtracktimebased", emptySet), pair< string, set > ("dchargedtrack", emptySet), pair< string, set > ("dphoton", emptySet), pair< string, set > ("dcdctrackhit", emptySet), pair< string, set > ("dfdcpseudo", emptySet), }; // global map of which factory/tags to convert static map > evioMap(danaObs,danaObs+sizeof(danaObs)/sizeof(danaObs[0])); // holds tag/num pairs for all DANA objects static map< string, pair > tagMap; //------------------------------------------------------------------------------------ class DDANAEVIO_factory : public JFactory { public: DDANAEVIO_factory(); ~DDANAEVIO_factory() {}; private: jerror_t evnt(JEventLoop *eventLoop, int eventnumber); void decode_DANAEVIO_parameter(void); void get_tagNum_dictionary(void); static void startElement(void *userData, const char *xmlname, const char **atts); void addObjIdBank(evioDOMTree &tree); void addDMCTrackHit(JEventLoop *eventLoop, evioDOMTree &tree); void addDBeamPhoton(JEventLoop *eventLoop, evioDOMTree &tree); void addDMCThrown(JEventLoop *eventLoop, evioDOMTree &tree); void addDFCALTruthShower(JEventLoop *eventLoop, evioDOMTree &tree); void addDBCALTruthShower(JEventLoop *eventLoop, evioDOMTree &tree); void addDTOFTruth(JEventLoop *eventLoop, evioDOMTree &tree); void addDSCTruthHit(JEventLoop *eventLoop, evioDOMTree &tree); void addDMCTrajectoryPoint(JEventLoop *eventLoop, evioDOMTree &tree); void addDCDCHit(JEventLoop *eventLoop, evioDOMTree &tree); void addDFDCHit(JEventLoop *eventLoop, evioDOMTree &tree); void addDFCALHit(JEventLoop *eventLoop, evioDOMTree &tree); void addDHDDMBCALHit(JEventLoop *eventLoop, evioDOMTree &tree); void addDHDDMTOFHit(JEventLoop *eventLoop, evioDOMTree &tree); void addDSCHit(JEventLoop *eventLoop, evioDOMTree &tree); void addDCDCTrackHit(JEventLoop *eventLoop, evioDOMTree &tree); void addDFDCPseudo(JEventLoop *eventLoop, evioDOMTree &tree); void addDTrackWireBased(JEventLoop *eventLoop, evioDOMTree &tree); void addDTrackTimeBased(JEventLoop *eventLoop, evioDOMTree &tree); void addDChargedTrack(JEventLoop *eventLoop, evioDOMTree &tree); void addDPhoton(JEventLoop *eventLoop, evioDOMTree &tree); // event-specific global object id map map objIdMap; // templated methods must be in header file template evioDOMNodeP createLeafNode(string nameId) { pair p = tagMap[nameId];; return(evioDOMNode::createEvioDOMNode(p.first,p.second)); } // might as well put this here... evioDOMNodeP createContainerNode(string nameId) { pair p = tagMap[nameId];; return(evioDOMNode::createEvioDOMNode(p.first,p.second)); } }; #endif // _DDANAEVIO_factory_ //------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------