58 int main(
int argc,
char **argv)
65 JLimit_t& numberOfEvents = inputFile.getLimit();
79 JParser<> zap(
"Example program to test chi2 calculations of co-variance matrix including direction uncertainty.");
84 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
96 catch(
const exception& error) {
97 FATAL(error.what() << endl);
104 const unsigned int NUMBER_OF_HITS = 6;
105 const double STANDARD_DEVIATIONS = 3.0;
106 const double HIT_OFF = 1.0e3 * sigma_ns*sigma_ns;
127 TH1D h0(
"h0", NULL, 50, 0.0, 20.0);
128 TH1D h1(
"h1", NULL, 50, 0.0, 20.0);
130 TH1D p0(
"p0", NULL, 50, 0.0, 1.0);
131 TH1D
p1(
"p1", NULL, 50, 0.0, 1.0);
138 for ( ;
x < 10.0;
x += 1.0) { X.push_back(
x); }
139 for ( ;
x < 25.0;
x += 2.0) { X.push_back(
x); }
140 for ( ;
x < 100.0;
x += 5.0) { X.push_back(
x); }
143 TProfile n0(
"n0", NULL, X.size() - 1, X.data());
144 TProfile n1(
"n1", NULL, X.size() - 1, X.data());
152 JHit::setSlewing(!useTrue);
161 const Evt*
event = ps;
167 if (muon != event->mc_trks.end()) {
176 const double theta = alpha_deg *
PI / 180.0;
177 const double phi = gRandom->Uniform(0.0, 2*
PI);
186 buildL2(*tev, moduleRouter, back_inserter(
data));
188 data.erase(unique(
data.begin(),
data.end(), equal_to<JDAQModuleIdentifier>()),
data.end());
209 sort(i->second.begin(), i->second.end(), less<JHit>());
211 data.push_back(i->second[0]);
223 for (JData_t::iterator i =
data.begin(); i !=
data.end(); ++i) {
237 for (JData_t::iterator i =
data.begin(); i !=
data.end(); ++i) {
246 for (JData_t::iterator i =
data.begin(); i !=
data.end(); ++i) {
251 if (
data.size() >= NUMBER_OF_HITS + numberOfOutliers) {
253 JData_t::iterator __end =
data.end();
255 for (
int n = 0;
n < numberOfOutliers &&
distance(
data.begin(), __end) > NUMBER_OF_HITS; ++
n) {
258 JData_t::iterator kill = __end;
260 for (JData_t::iterator i =
data.begin(); i != __end; ++i) {
262 const double y = fabs(i->getT() - tz.
getT(*i)) / sigma_ns;
270 if (ymax >= STANDARD_DEVIATIONS)
271 iter_swap(kill, --__end);
276 const double chi2 =
getChi2(tz,
data.begin(), __end, sigma_ns);
280 p0.Fill(TMath::Prob(chi2, N));
281 n0.Fill((
double)
data.size(), (
double) N / (
double)
data.size());
285 if (
data.size() >= NUMBER_OF_HITS + numberOfOutliers) {
290 V.
set(tz,
data.begin(),
data.end(), alpha_deg, sigma_ns);
295 unsigned int N =
data.size();
297 for (
int n = 0; n < numberOfOutliers && N > NUMBER_OF_HITS; ++
n, --N) {
302 for (
unsigned int i = 0; i != V.
size(); ++i) {
312 if (ymax >= STANDARD_DEVIATIONS * STANDARD_DEVIATIONS)
318 const double chi2 = V.
getDot(Y);
321 p1.Fill(TMath::Prob(chi2, N));
322 n1.Fill((
double)
data.size(), (
double) N / (
double)
data.size());
Algorithms for hit clustering and sorting.
Data structure for detector geometry and calibration.
Recording of objects on file according a format that follows from the file name extension.
Basic data structure for L0 hit.
Basic data structure for L1 hit.
Match operator for Cherenkov light from muon with given direction.
Match operator for Cherenkov light from muon in any direction.
int main(int argc, char **argv)
General purpose messaging.
#define DEBUG(A)
Message macros.
Direct access to module in detector data structure.
Direct access to PMT in detector data structure.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
ROOT TTree parameter settings of various packages.
Basic data structure for time and time over threshold information of hit.
Synchronously read DAQ events and Monte Carlo events (and optionally other events).
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
int first
index of module in detector data structure
Router for direct addressing of module data in detector data structure.
Address of PMT in detector data structure.
Router for direct addressing of PMT data in detector data structure.
const JPMT & getPMT(const JPMTAddress &address) const
Get PMT.
JPMTIdentifier getIdentifier(const JPMTAddress &address) const
Get identifier of PMT.
const JPMTAddress & getAddress(const JObjectID &id) const
Get address of PMT.
Data structure for PMT geometry, calibration and status.
Data structure for fit of straight line paralel to z-axis.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
void setZ(const double z, const double velocity)
Set z-position of vertex.
Determination of the co-variance matrix of hits for a track along z-axis (JFIT::JLine1Z).
void set(const JVector3D &pos, T __begin, T __end, const double alpha, const double sigma)
Set co-variance matrix.
static double getDot(const variance &first, const variance &second)
Get dot product.
Determination of the time residual vector of hits for a track along z-axis (JFIT::JLine1Z).
void set(const JLine1Z &track, T __begin, T __end)
Set time residual vector.
Data structure for angles in three dimensions.
void setPosition(const JVector3D &pos)
Set position.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
const JPosition3D & getPosition() const
Get position.
Data structure for vector in three dimensions.
double getZ() const
Get z position.
JVertex3D & add(const JVertex3D &value)
Addition operator.
Utility class to parse command line options.
counter_type getCounter() const
Get counter.
Data structure for L0 hit.
3D match criterion with road width.
Auxiliary class to convert DAQ hit time to/from Monte Carlo hit time.
double putTime() const
Get Monte Carlo time minus DAQ/trigger time.
JDirection3D getDirection(const Vec &dir)
Get direction.
double getTime(const Hit &hit)
Get true time of hit.
JPosition3D getPosition(const Vec &pos)
Get position.
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
bool is_noise(const Hit &hit)
Verify hit origin.
Vec getOffset(const JHead &header)
Get offset.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
double getChi2(const double P)
Get chi2 corresponding to given probability.
static const double PI
Mathematical constants.
const double getSpeedOfLight()
Get speed of light.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
static const struct JTRIGGER::clusterizeWeight clusterizeWeight
KM3NeT DAQ data structures and auxiliaries.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
General purpose class for multiple pointers.
size_t size() const
Get dimension of matrix.
void update(const size_t k, const double value)
Update inverted matrix at given diagonal element.
void invert()
Invert matrix according LDU decomposition.
Auxiliary class for defining the range of iterations of objects.
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
virtual bool hasNext() override
Check availability of next element.
virtual const multi_pointer_type & next() override
Get next element.
Data structure for L2 parameters.
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Auxiliary include file for time conversion between DAQ/trigger hit and Monte Carlo hit.