13 #include <JANA/JApplication.h>
37 beam_origin =
DVector3(0.0, 0.0, 65.0);
55 MAX_CANDIDATE_FILTER = 1000;
56 gPARMS->SetDefaultParameter(
"MAX_CANDIDATE_FILTER", MAX_CANDIDATE_FILTER,
"Maximum number of candidates allowed in event before any are written to file.");
60 ofs =
new ofstream(
"gluex_candidates.txt");
74 jerr <<
"Couldn't get DGeometry pointer!!" << endl;
79 vector<vector<DCDCWire *> > cdcwires;
83 vector<vector<DFDCWire *> >
fdcwires;
84 dgeom->GetFDCWires(fdcwires);
92 for(
unsigned int i=0; i<cdcwires.size(); i++){
93 vector<DCDCWire *> &wires = cdcwires[i];
94 for(
unsigned int j=0; j<wires.size(); j++){
97 wireID[ GetCDCWireID(w) ] = index++;
101 for(
unsigned int i=0; i<fdcwires.size(); i++){
102 vector<DFDCWire *> &wires = fdcwires[i];
103 for(
unsigned int j=0; j<wires.size(); j++){
106 wireID[ GetFDCWireID(w) ] = index++;
120 vector<const DTrackCandidate*> candidates;
121 loop->Get(candidates);
122 if(candidates.size()==0 || candidates.size()>MAX_CANDIDATE_FILTER){
128 vector<const DTrackHitSelector *> hitselectors;
129 loop->Get(hitselectors);
130 if(hitselectors.size()<1){
131 _DBG_<<
"Unable to get a DTrackHitSelector object!"<<endl;
132 return UNKNOWN_ERROR;
137 vector<const DTrackFitter *> fitters;
139 if(fitters.size()<1){
140 _DBG_<<
"Unable to get a DTrackFitter object!"<<endl;
141 return UNKNOWN_ERROR;
145 for(
unsigned int i=0; i<candidates.size(); i++){
156 vector<const DCDCTrackHit*> cdctrackhits;
157 vector<const DFDCPseudo*> fdcpseudos;
158 loop->Get(cdctrackhits);
159 loop->Get(fdcpseudos);
163 vector<int> wire_ids;
164 for(
unsigned int j=0; j<cdctrackhits.size(); j++){
165 unsigned long id = GetCDCWireID( cdctrackhits[j]->wire );
166 wire_ids.push_back(GetWireIndex(
id ));
169 for(
unsigned int j=0; j<fdcpseudos.size(); j++){
170 unsigned long id = GetFDCWireID( fdcpseudos[j]->wire );
171 wire_ids.push_back(GetWireIndex(
id ));
180 double doca, var_doca;
181 rt->
FindPOCAtoLine(beam_origin, beam_dir, NULL, &kd, commonpos, doca, var_doca);
186 ss <<
" " << kd.
x() <<
" " << kd.
y() <<
" " << kd.
z();
187 ss <<
" " << -kd.
px() <<
" " << -kd.
py() <<
" " << -kd.
pz();
188 for(
unsigned int j=0; j<wire_ids.size(); j++){
189 ss <<
" " << wire_ids[j];
193 (*ofs) << ss.str() << endl;
220 cout <<
"Wrote " << events_written <<
" candidate events to output file (discarded " << events_discarded <<
")" << endl;
The DTrackFitter class is a base class for different charged track fitting algorithms. It does not actually fit the track itself, but provides the interface and some common support features most algorthims will need to implement.
jerror_t fini(void)
Called after last event of last event source has been processed.
static vector< vector< DFDCWire * > > fdcwires
JEventProcessor_dumpcandidates()
void SetMass(double mass)
const DVector3 & position(void) const
void Swim(const DVector3 &pos, const DVector3 &mom, double q=-1000.0, const TMatrixFSym *cov=NULL, double smax=2000.0, const DCoordinateSystem *wire=NULL)
static char index(char c)
The DTrackHitSelector class is a base class for algorithms that will select hits from the drift chamb...
void SetDGeometry(const DGeometry *geom)
bool GetCDCWires(vector< vector< DCDCWire * > > &cdcwires) const
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
DGeometry * GetDGeometry(unsigned int run_number)
double charge(void) const
<A href="index.html#legend"> <IMG src="CORE.png" width="100"> </A>
~JEventProcessor_dumpcandidates()
const DVector3 & momentum(void) const
const DTrackFitter * fitter
jerror_t FindPOCAtoLine(const DVector3 &origin, const DVector3 &dir, const DMatrixDSym *covpoint, DKinematicData *track_kd, DVector3 &commonpos, double &doca, double &var_doca) const
const DMagneticFieldMap * GetDMagneticFieldMap(void) const
jerror_t init(void)
Called once at program start.
jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
void GetAllHits(fit_type_t fit_type, const DReferenceTrajectory *rt, const vector< const DCDCTrackHit * > &cdchits_in, const vector< const DFDCPseudo * > &fdchits_in, DTrackFitter *fitter, int N=20) const
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.