Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DEventProcessor_dirc_reactions.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DEventProcessor_dirc_reactions.cc
4 //
5 
7 
8 // Routine used to create our DEventProcessor
9 
10 extern "C"
11 {
12  void InitPlugin(JApplication *locApplication)
13  {
14  InitJANAPlugin(locApplication);
15  locApplication->AddProcessor(new DEventProcessor_dirc_reactions()); //register this plugin
16  locApplication->AddFactoryGenerator(new DFactoryGenerator_dirc_reactions()); //register the factory generator
17  }
18 } // "C"
19 
20 //------------------
21 // init
22 //------------------
24 {
25  // This is called once at program startup. If you are creating
26  // and filling historgrams in this plugin, you should lock the
27  // ROOT mutex like this:
28  //
29  // japp->RootWriteLock();
30  // ... create historgrams or trees ...
31  // japp->RootUnLock();
32  //
33 
34  return NOERROR;
35 }
36 
37 //------------------
38 // brun
39 //------------------
40 jerror_t DEventProcessor_dirc_reactions::brun(jana::JEventLoop* locEventLoop, int locRunNumber)
41 {
42  // This is called whenever the run number changes
43 
44  return NOERROR;
45 }
46 
47 //------------------
48 // evnt
49 //------------------
50 jerror_t DEventProcessor_dirc_reactions::evnt(jana::JEventLoop* locEventLoop, uint64_t locEventNumber)
51 {
52  // This is called for every event. Use of common resources like writing
53  // to a file or filling a histogram should be mutex protected. Using
54  // locEventLoop->Get(...) to get reconstructed objects (and thereby activating the
55  // reconstruction algorithm) should be done outside of any mutex lock
56  // since multiple threads may call this method at the same time.
57  //
58  // Here's an example:
59  //
60  // vector<const MyDataClass*> mydataclasses;
61  // locEventLoop->Get(mydataclasses);
62  //
63  // japp->RootWriteLock();
64  // ... fill historgrams or trees ...
65  // japp->RootUnLock();
66 
67  // DOCUMENTATION:
68  // ANALYSIS library: https://halldweb1.jlab.org/wiki/index.php/GlueX_Analysis_Software
69 
70  //Recommended: Write surviving particle combinations (if any) to output ROOT TTree
71  //If no cuts are performed by the analysis actions added to a DReaction, then this saves all of its particle combinations.
72  //The event writer gets the DAnalysisResults objects from JANA, performing the analysis.
73  // string is DReaction factory tag: will fill trees for all DReactions that are defined in the specified factory
74  //const DEventWriterROOT* locEventWriterROOT = NULL;
75  //locEventLoop->GetSingle(locEventWriterROOT);
76  //locEventWriterROOT->Fill_DataTrees(locEventLoop, "p2pi_dirc");
77  //locEventWriterROOT->Fill_DataTrees(locEventLoop, "p2k_dirc");
78 
79  // Get the analysis results for all DReactions.
80  //Getting these objects triggers the analysis, if it wasn't performed already.
81  //These objects contain the DParticleCombo objects that survived the DAnalysisAction cuts that were added to the DReactions
82  vector<const DAnalysisResults*> locAnalysisResultsVector;
83  locEventLoop->Get(locAnalysisResultsVector);
84 
85  return NOERROR;
86 }
87 
88 //------------------
89 // erun
90 //------------------
92 {
93  // This is called whenever the run number changes, before it is
94  // changed to give you a chance to clean up before processing
95  // events from the next run number.
96  return NOERROR;
97 }
98 
99 //------------------
100 // fini
101 //------------------
103 {
104  // Called before program exit after event processing is finished.
105  return NOERROR;
106 }
107 
jerror_t erun(void)
Called every time run number changes, provided brun has been called.
jerror_t brun(jana::JEventLoop *locEventLoop, int locRunNumber)
Called every time a new run number is detected.
InitPlugin_t InitPlugin
jerror_t fini(void)
Called after last event of last event source has been processed.
jerror_t init(void)
Called once at program start.
jerror_t evnt(jana::JEventLoop *locEventLoop, uint64_t locEventNumber)
Called every event.