9 #include <JANA/JApplication.h>
21 static pthread_mutex_t
hddmMutex = PTHREAD_MUTEX_INITIALIZER;
38 jout << std::endl <<
" Default JEventProcessor_danahddm invoked"
39 << std::endl << std::endl;
42 gPARMS->SetDefaultParameter(
"hddm:FILENAME",
hddmFileName);
43 jout << std::endl <<
" hddm output file name is " <<
hddmFileName
44 << std::endl << std::endl;
48 "Turn on/off compression of the output HDDM stream."
49 " Set to \"0\" to turn off (it's on by default)");
51 gPARMS->SetDefaultParameter(
"HDDM:USE_INTEGRITY_CHECKS",
53 "Turn on/off automatic integrity checking on the"
54 " output HDDM stream."
55 " Set to \"0\" to turn off (it's on by default)");
93 JEvent&
event = loop->GetJEvent();
94 JEventSource *source =
event.GetJEventSource();
97 std::cerr <<
" This program MUST be used with an HDDM file as input!" << std::endl;
108 jout <<
" Enabling bz2 compression of output HDDM file stream"
110 fout->setCompression(hddm_s::k_bz2_compression);
113 jout <<
" HDDM compression disabled" << std::endl;
118 jout <<
" Enabling CRC data integrity check in output HDDM file stream"
120 fout->setIntegrityChecks(hddm_s::k_crc32_integrity);
123 jout <<
" HDDM integrity checks disabled" << std::endl;
137 JEvent&
event = loop->GetJEvent();
138 JEventSource *source =
event.GetJEventSource();
141 std::cerr <<
" This program MUST be used only with HDDM files as inputs!"
145 hddm_s::HDDM *hddm = (hddm_s::HDDM*)event.GetRef();
150 hddm->getPhysicsEvent().deleteReconViews();
153 hddm_s::ReconViewList revs = hddm->getPhysicsEvent().addReconViews();
186 std::cout << std::endl <<
"Closed HDDM file" << std::endl;
198 hddm_s::ReconViewList::iterator riter)
201 vector<const DTrackTimeBased*> tracktimebaseds;
202 loop->Get(tracktimebaseds);
203 if (tracktimebaseds.size() == 0)
207 unsigned int ntbts = tracktimebaseds.size();
208 hddm_s::TracktimebasedList tbts = riter->addTracktimebaseds(ntbts);
209 for (
unsigned int i=0; i < ntbts; i++) {
214 tbts(i).setFOM(tbt_dana->
FOM);
216 tbts(i).setTrackid(tbt_dana->
trackid);
217 tbts(i).setId(tbt_dana->id);
218 tbts(i).setChisq(tbt_dana->
chisq);
219 tbts(i).setNdof(tbt_dana->
Ndof);
221 hddm_s::MomentumList tmoms = tbts(i).addMomenta();
222 hddm_s::PropertiesList tpros = tbts(i).addPropertiesList();
223 hddm_s::OriginList torig = tbts(i).addOrigins();
224 hddm_s::ErrorMatrixList terrs = tbts(i).addErrorMatrixs();
225 hddm_s::TrackingErrorMatrixList tters =
226 tbts(i).addTrackingErrorMatrixs();
228 tmoms().setE(tbt_dana->
energy());
229 tmoms().setPx(mom.x());
230 tmoms().setPy(mom.y());
231 tmoms().setPz(mom.z());
233 tpros().setCharge((
int)tbt_dana->
charge());
234 tpros().setMass(tbt_dana->
mass());
237 torig().setVx(pos.x());
238 torig().setVy(pos.y());
239 torig().setVz(pos.z());
244 terrs().setType(
"DMatrixDSym");
245 terrs().setVals(vals.c_str());
249 tters().setType(
"DMatrixDSym");
263 for (
int irow=0; irow<mat.GetNrows(); irow++) {
264 for (
int icol=irow; icol<mat.GetNcols(); icol++) {
265 ss << mat[irow][icol] <<
" ";
void Add_DTrackTimeBased(JEventLoop *loop, hddm_s::ReconViewList::iterator riter)
float chisq
Chi-squared for the track (not chisq/dof!)
static pthread_mutex_t hddmMutex
string DMatrixDSymToString(const DMatrixDSym &mat)
jerror_t fini(void)
Called after last event of last event source has been processed.
double energy(void) const
oid_t trackid
id of DTrackWireBased corresponding to this track
const DVector3 & position(void) const
jerror_t brun(JEventLoop *loop, int32_t runnumber)
Called everytime a new run number is detected.
unsigned long Nevents_written
static string hddmFileName
oid_t candidateid
id of DTrackCandidate corresponding to this track
bool HDDM_USE_INTEGRITY_CHECKS
jerror_t init(void)
Called once at program start.
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
bool HDDM_USE_COMPRESSION
~JEventProcessor_danahddm()
int Ndof
Number of degrees of freedom in the fit.
double charge(void) const
JEventProcessor_danahddm()
const DVector3 & momentum(void) const
shared_ptr< const TMatrixFSym > errorMatrix(void) const
jerror_t evnt(JEventLoop *loop, uint64_t eventnumber)
Called every event.
shared_ptr< const TMatrixFSym > TrackingErrorMatrix(void) const