66 int main(
int argc,
char **argv)
70 using namespace KM3NETDAQ;
80 JCalibration_t calibrationFile;
89 JParser<> zap(
"Auxiliary program to convert fit results to Evt format.\
90 \nThe option -L corresponds to the name of a shared library \
91 \nand function so to rearrange the order of fit results.");
95 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
106 catch(
const exception& error) {
107 FATAL(error.what() << endl);
110 if (detectorFile ==
"" && !calibrationFile.empty()) {
111 FATAL(
"Missing detector file." << endl);
115 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
119 if (detectorFile !=
"") {
128 unique_ptr<JDynamics> dynamics;
134 dynamics->load(calibrationFile);
136 catch(
const exception& error) {
137 if (!calibrationFile.empty()) {
153 }
catch(
const exception& error) {}
164 copy(buffer, header);
167 if (detectorFile !=
"") {
169 buffer.
calibration.
buffer = (dynamics ? calibration::dynamical() : calibration::statical());
172 copy(buffer, header);
188 STATUS(
"Processing: " << *
i << endl);
190 JParallelFileScanner_t
in(*
i);
193 in.setLimit(inputFile.getLimit());
203 center = get<Vec>(head);
206 }
catch(
const exception& error) {}
209 while (in.hasNext()) {
211 STATUS(
"event: " << setw(10) << in.getCounter() <<
'\r');
DEBUG(endl);
213 multi_pointer_type ps = in.next();
219 dynamics->update(*tev);
222 JFIT::JEvt::iterator __end = evt->end();
224 if (numberOfFits > 0) {
225 advance(__end = evt->begin(), min(numberOfFits, evt->size()));
229 partial_sort(evt->begin(), __end, evt->end(),
qualitySorter);
234 if (mc.getEntries() != 0) {
254 if (!pmt_router->empty()) {
258 if (pmt_router.hasPMT(
i->pmt_id)) {
260 const JPMTAddress address = pmt_router.getAddress(
i->pmt_id);
262 const JPMT& pmt = pmt_router.getPMT(address);
264 i->dom_id =
id.getID();
265 i->channel_id =
id.getPMTAddress();
271 miss_pmt[
i->pmt_id] += 1;
276 if (!mod_router->empty()) {
280 if (mod_router.hasModule(
i->dom_id)) {
287 const JPMT& pmt = mod_router.getPMT(
id);
302 miss_mod[
i->dom_id] += 1;
307 struct :
public set<JUUID> {
309 inline int get_index(
const JUUID& element)
const
311 const_iterator
i = this->find(element);
313 if (i != this->end())
320 for (JFIT::JEvt::const_iterator fit = evt->begin(); fit != __end; ++fit) {
321 uuid.insert(fit->getUUID());
324 for (JFIT::JEvt::const_iterator fit = evt->begin(); fit != __end; ++fit) {
328 trk.
id = uuid.get_index(fit->getUUID());
329 trk.
pos =
Vec(fit->getX(), fit->getY(), fit->getZ());
330 trk.
dir =
Vec(fit->getDX(), fit->getDY(), fit->getDZ());
333 trk.
lik = fit->getQ();
337 if (fit->hasParentUUID()) {
338 trk.
mother_id = uuid.get_index(fit->getParentUUID());
341 for (JHistory::const_iterator
i = fit->getHistory().begin();
i != fit->getHistory().end(); ++
i) {
345 for (
int i = 0;
i != fit->getN(); ++
i) {
346 trk.
fitinf.push_back(fit->getW(
i));
351 out.
trks.push_back(trk);
354 out.
id = ++number_of_events;
362 for (
const auto&
i : miss_pmt) {
ERROR(
"Misses PMT " << setw(8) <<
i.first <<
' ' << setw(8) <<
i.second << endl); }
363 for (
const auto&
i : miss_mod) {
ERROR(
"Misses module " << setw(8) <<
i.first <<
' ' << setw(8) <<
i.second << endl); }
Router for direct addressing of PMT data in detector data structure.
double getT() const
Get calibrated time of hit.
Utility class to parse command line options.
int main(int argc, char *argv[])
ROOT TTree parameter settings of various packages.
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
const_iterator pull(T JHead::*pd) const
Pull given data member from Head.
static void setSlewing(const bool slewing)
Set slewing option.
double t
track time [ns] (when the particle is at pos )
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
const JCalibration & getCalibration() const
Get calibration.
ROOT TTree parameter settings.
Recording of objects on file according a format that follows from the file name extension.
Router for direct addressing of module data in detector data structure.
General purpose sorter of fit results.
JAANET::start_run start_run
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
General purpose class for parallel reading of objects from a single file or multiple files...
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Long64_t counter_type
Type definition for counter.
double livetime_s
Live time [s].
double getTime(const Hit &hit)
Get true time of hit.
Basic data structure for time and time over threshold information of hit.
double E
Energy [GeV] (either MC truth or reconstructed)
Data structure for detector geometry and calibration.
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
ROOT TTree parameter settings.
JAANET::calibration calibration
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
int mother_id
MC id of the parent particle.
double getToT() const
Get calibrated time over threshold of hit.
Auxiliary class for defining the range of iterations of objects.
bool slewing
time slewing of analogue signal
std::string buffer
General purpose name.
The Vec class is a straightforward 3-d vector, which also works in pyroot.
JDirection3D getDirection(const Vec &dir)
Get direction.
int mc_run_id
MC run identifier.
Auxiliary class for recursive type list generation.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int getID() const
Get identifier.
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
Data structure for PMT geometry, calibration and status.
JPosition3D getPosition(const Vec &pos)
Get position.
std::vector< double > fitinf
place to store additional fit info, see km3net-dataformat/definitions/fitparameters.csv
virtual double getNPE(const double tot_ns) const override
Get number of photo-electrons.
Auxiliary class for map of PMT parameters.
Dynamic detector calibration.
Direct access to PMT in detector data structure.
static const int TRK_ST_UNDEFINED
status was not defined for this MC track (all reco tracks have this value)
General purpose messaging.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
void push(T JHead::*pd)
Push given data member to Head.
int status
MC status code, see km3net-dataformat/definitions/trkmembers.csv for values.
Direct access to module in detector data structure.
PMT analogue signal processor.
Dynamic detector calibration.
static const int TRK_ST_FINALSTATE
for MC: the particle must be processed by detector simulation ('track_in' tag in evt files)...
Vec pos
postion [m] of the track at time t
Address of PMT in detector data structure.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Data structure for set of track fit results.
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
double getLivetime(const std::string &file_name)
Get data taking live time.
std::vector< int > rec_stages
list of identifyers of succesfull fitting stages resulting in this track
General purpose class for object reading from a list of file names.
std::vector< double > error_matrix
(NxN) error covariance matrix for fit parameters (stored as linear vector)
double lik
likelihood or lambda value (for aafit, lambda)
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Utility class to parse command line options.
std::vector< Hit > mc_hits
MC: list of MC truth hits.
static const int JPP_RECONSTRUCTION_TYPE
KM3NeT Data Definitions v3.3.0 https://git.km3net.de/common/km3net-dataformat.
void copy(const Head &from, JHead &to)
Copy header from from to to.
PMT analogue signal processor.
int id
offline event identifier
const JLimit & getLimit() const
Get limit.
Compass event data types.
Data structure for PMT parameters.
std::vector< Hit > hits
list of hits
do set_variable DETECTOR_TXT $WORKDIR detector
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
JTriggerCounter_t getCounter() const
Get trigger counter.
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
#define DEBUG(A)
Message macros.
int rec_type
identifier of the fitting algorithm/chain/strategy, see km3net-dataformat/definitions/reconstruction...