34 int main(
int argc,
char **argv)
39 JMultipleFileScanner<JEvt> inputFile;
43 size_t numberOfPrefits;
44 JQualitySorter quality_sorter;
50 JParser<> zap(
"Example program to histogram fit results.");
55 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
63 catch(
const exception& error) {
64 FATAL(error.what() << endl);
72 load(detectorFile, detector);
74 catch(
const JException& error) {
78 JCylinder3D cylinder(detector.begin(), detector.end());
80 const double R_m = 2.0 * cylinder.getRadius();
81 const double zmin = -2.0 * cylinder.getZmin();
82 const double zmax = 2.0 * cylinder.getZmax();
85 TH1D job(
"job",
"", 2, -0.5, 1.5);
86 TH1D hz (
"hz ",
"", 21 , -1.0, 1.0);
87 TH2D hxy(
"hxy",
"", 201, -R_m, R_m, 201, -200.0, 200.0);
88 TH2D hzR(
"hzR",
"", 201, 0.0, R_m, 201, zmin, zmax);
89 TH1D hq1(
"hq1",
"", 200, -50.0, 150);
90 TH1D hq2(
"hq2",
"", 200, -5.0, 5.0);
91 TH1D hmu(
"hmu",
"", 100, -50, 50);
92 TH2D hmz(
"hmz",
"", 100, -50, 50, 21, -1.0, 1.0);
93 TH2D hqz(
"hqz",
"", 200, -5, 5, 21, -1.0, 1.0);
95 JAtmosphericMuon isAtmosphericMuon;
97 while (inputFile.hasNext()) {
99 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
101 JEvt* evt = inputFile.next();
107 JEvt::iterator __end = partition(evt->begin(), evt->end(), JHistory::is_event(application));
109 if (evt->begin() == __end) {
113 if (numberOfPrefits > 0) {
115 JEvt::iterator __q = __end;
117 advance(__end = evt->begin(), min(numberOfPrefits, (
size_t) distance(evt->begin(), __q)));
119 partial_sort(evt->begin(), __end, __q, quality_sorter);
123 sort(evt->begin(), __end, quality_sorter);
126 const double muon_probability = isAtmosphericMuon(evt->begin(), __end);
128 hmu.Fill(muon_probability);
130 if (numberOfPrefits > 0) {
131 advance(__end = evt->begin(), min(numberOfPrefits, evt->size()));
134 for (JEvt::const_iterator fit = evt->begin(); fit != __end; ++fit) {
137 track.sub(cylinder.getCenter());
139 hz.Fill(track.getDZ());
140 hxy.Fill(track.getX(), track.getY());
141 hzR.Fill(sqrt(track.getX()*track.getX() + track.getY()*track.getY()), track.getZ());
142 hq1.Fill(fit->getQ());
143 hmz.Fill(muon_probability, track.getDZ());
150 hqz.Fill(lambda, track.getDZ());
159 NOTICE(
"Number of events input " << setw(8) << right << job.GetBinContent(1) << endl);
160 NOTICE(
"Number of events with direction fit" << setw(8) << right << job.GetBinContent(2) << endl);
Utility class to parse command line options.
JTrack3E getTrack(const Trk &track)
Get track.
Empty structure for specification of parser element that is initialised (i.e.
Data structure for detector geometry and calibration.
JLimit JLimit_t
Type definition of limit.
Definition of fit parameters from various applications.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
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.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
number of hits from JGandalf.cc
Utility class to parse command line options.
ROOT TTree parameter settings.
const JLimit & getLimit() const
Get limit.
Definition of fit applications.
#define DEBUG(A)
Message macros.
int main(int argc, char *argv[])