Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DEventProcessor_phys_tree.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DEventProcessor_phys_tree.h
4 // Created: Wed Sep 2 20:25:05 EDT 2009
5 // Creator: davidl (on Darwin harriet.jlab.org 9.6.0 i386)
6 //
7 
8 #ifndef _DEventProcessor_phys_tree_
9 #define _DEventProcessor_phys_tree_
10 
11 #include <vector>
12 using namespace std;
13 
14 #include <TTree.h>
15 #include <TFile.h>
16 #include <TH1.h>
17 #include <TH2.h>
18 
19 #include <JANA/JFactory.h>
20 #include <JANA/JEventProcessor.h>
21 #include <JANA/JEventLoop.h>
22 
23 #include <PID/DKinematicData.h>
24 #include <PID/DChargedTrack.h>
25 #include <PID/DNeutralParticle.h>
27 #include <TRACKING/DMCTrackHit.h>
30 #include <TRACKING/DMCThrown.h>
31 #include <CDC/DCDCTrackHit.h>
32 #include <FDC/DFDCHit.h>
33 #include <PID/DVertex.h>
34 
35 #include "Event.h"
36 #include "Particle.h"
37 
38 class DMCTrajectoryPoint;
39 class DCoordinateSystem;
40 
41 class DEventProcessor_phys_tree:public JEventProcessor{
42  public:
45  const char* className(void){return "DEventProcessor_trackres_tree";}
46 
47  class particle_set{
48  public:
49  vector<Particle> photons;
50  vector<Particle> neutrons;
51  vector<Particle> piplus;
52  vector<Particle> piminus;
53  vector<Particle> protons;
54  vector<Particle> Kplus;
55  vector<Particle> Kminus;
56  };
57 
60  TTree *tree_recon;
61  TTree *tree_thrwn;
62 
63  pthread_mutex_t mutex;
64 
65  private:
66  jerror_t init(void); ///< Called once at program start.
67  jerror_t brun(JEventLoop *eventLoop, int32_t runnumber); ///< Called everytime a new run number is detected.
68  jerror_t evnt(JEventLoop *eventLoop, uint64_t eventnumber); ///< Called every event.
69  jerror_t erun(void); ///< Called everytime run number changes, provided brun has been called.
70  jerror_t fini(void); ///< Called after last event of last event source has been processed.
71 
72  Particle MakeParticle(const DKinematicData *kd, double mass);
73  Particle MakeParticle(const DChargedTrackHypothesis *locChargedTrackHypothesis, double mass);
74  Particle MakeParticle(const DNeutralParticleHypothesis *locNeutralParticleHypothesis, double mass);
75  bool IsFiducial(const DKinematicData *kd);
76  void FillEvent(Event *evt, particle_set &pset, particle_set &pset_match);
77  Particle FindBestMatch(const Particle &primary, vector<Particle> &secondaries);
78  double GetFOM(const Particle &a, const Particle &b) const;
79 };
80 
81 #endif // _DEventProcessor_trackres_tree_
82