92 void compile(
const double Tmax,
93 const unsigned int L1 = 2)
95 std::sort(this->begin(), this->end());
99 for (const_iterator i = this->begin(); i != this->end(); ) {
112 buffer.insert(i->getID());
114 const_iterator
j = i;
116 for (
double t1 = i->getLowerLimit(); ++j != this->end() && j->getLowerLimit() - t1 < Tmax; t1 = j->getLowerLimit()) {
117 buffer.insert(j->getID());
120 if (buffer.size() >= L1) {
121 *out =
JPulse(*i, *((--j)++));
129 this->erase(out, end());
140 inline bool has(
const JTimeRange& timerange)
const
142 const_iterator i = std::lower_bound(this->begin(), this->end(), timerange.
getLowerLimit());
144 return i != this->end() && i->overlap(timerange);
174 JHorizon(
const double ct,
188 bool operator()(
const JHitL1& hit)
const
192 for (JHitL1::const_iterator i = hit.begin(); i != hit.end(); ++i) {
212 int main(
int argc,
char **argv)
216 using namespace KM3NETDAQ;
232 JParser<> zap(
"Example program to test performance of various hit filters.");
242 zap[
'c'] =
make_field(cluster) =
'A',
'B',
'C',
'D',
'E',
'F';
248 catch(
const exception &error) {
249 FATAL(error.what() << endl);
253 using namespace KM3NETDAQ;
279 if (histogram == 1) {
285 for ( ; x < 30.0; x += 1.0)
288 for ( ; x < 50.0; x += 2.0)
291 for ( ; x < 100.0; x += 5.0)
294 for ( ; x < 200.0; x += 10.0)
297 he =
new TProfile(
"he", NULL, X.size() - 1, X.data());
298 hp =
new TProfile(
"hp", NULL, X.size() - 1, X.data());
302 he =
new TProfile(
"he", NULL, 28, 0.0, 7.0);
303 hp =
new TProfile(
"hp", NULL, 28, 0.0, 7.0);
306 TH1D ht1(
"ht1", NULL, 550, -50.0, +500.0);
307 TH1D ht2(
"ht2", NULL, 550, -50.0, +500.0);
308 TH1D hd1(
"hd1", NULL, 100, -1.0, +1.0);
309 TH1D hd2(
"hd2", NULL, 100, -1.0, +1.0);
310 TH1D hx1(
"hx1", NULL, 100, 0.0, +250.0);
311 TH1D hx2(
"hx2", NULL, 100, 0.0, +250.0);
312 TH1D hw1(
"hw1", NULL, 100, -0.5, +99.5);
313 TH1D hw2(
"hw2", NULL, 100, -0.5, +99.5);
325 const JHorizon horizon(0.2, 2);
330 while (inputFile.hasNext()) {
332 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
337 const Evt*
event = ps;
342 const double E = neutrino.
E;
354 if (
is_muon(*track) && track->E > Emax) {
361 if (muon != event->mc_trks.end()) {
387 for (JMap_t::iterator i = zmap.begin(); i != zmap.end(); ) {
389 i->second.compile(Tmax_ns, 2);
391 if (i->second.empty())
397 const int L1mc = zmap.size();
407 for (JDAQTimeslice::const_iterator i = timeslice.begin(); i != timeslice.end(); ++i) {
411 buildL2(*i, moduleRouter.
getModule(i->getModuleID()), back_inserter(zbuf));
415 sort(zbuf.begin(), zbuf.end(), timeSorter<JHitL1>);
417 dataL1.push_back(*zbuf.begin());
424 JDataL1_t::iterator __end = dataL1.begin();
434 __end =
clusterize(dataL1.begin(), dataL1.end(), weightSorter<JHitL1>, match3D);
438 __end =
clusterize(dataL1.begin(), dataL1.end(), match3B);
447 for (JDataL1_t::iterator i = dataL1.begin(); i != dataL1.end(); ++i)
452 for (JDataL1_t::iterator i = dataL1.begin(); i != dataL1.end(); ++i)
461 for (JDataL1_t::iterator i = dataL1.begin(); i != dataL1.end(); ++i)
464 __end = partition(dataL1.begin(), __end, horizon);
467 for (JDataL1_t::iterator i = dataL1.begin(); i != dataL1.end(); ++i)
473 __end = dataL1.end();
480 JDataL1_t::iterator __q = __end;
499 iter_swap(hit, --__q);
504 if (L1mc != 0 && !L1.empty()) {
506 Double_t
x = numeric_limits<Double_t>::max();
513 he->Fill(x, (Double_t) L1ok.size() / (Double_t) L1mc);
514 hp->Fill(x, (Double_t) L1ok.size() / (Double_t) L1.size());
519 for (JDataL1_t::iterator hit = dataL1.begin(); hit != __end; ++hit) {
524 for (JDataL1_t::iterator hit = dataL1.begin(); hit != __end; ++hit) {
530 for (JHitL1::const_iterator i = hit->begin(); i != hit->end(); ++i) {
531 if (i->getDot(gui) < dot)
532 dot = i->getDot(gui);
535 const double w = (hit->rbegin()->
getT() - hit->begin()->
getT());
540 hx1.Fill(hit->
getX());
545 hx2.Fill(hit->
getX());
Match operator for Cherenkov light from muon in any direction.
Router for direct addressing of PMT data in detector data structure.
Utility class to parse command line options.
int main(int argc, char *argv[])
ROOT TTree parameter settings of various packages.
int getModuleID() const
Get module identifier.
Match operator for Cherenkov light from muon with given direction.
Data structure for L1 hit.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
Algorithms for hit clustering and sorting.
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.
bool has_neutrino(const Evt &evt)
Test whether given event has an incoming neutrino.
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
JTOOLS::JRange< double > JTimeRange
Type definition for time range (unit [ns]).
Router for direct addressing of module data in detector data structure.
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
double getT(const unsigned int i) const
Get time of hit i.
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
JMatchHelper< JHit_t > make_match(bool(*match)(const JHit_t &, const JHit_t &))
Auxiliary method to make JMatch object based on pointer to match function.
static counter_type max()
Get maximum counter value.
Auxiliary class to convert DAQ hit time to/from Monte Carlo hit time.
static struct JTRIGGER::@82 clusterizeWeight
Anonymous struct for weighed clustering of hits.
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.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
bool is_noise(const Hit &hit)
Verify hit origin.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Basic data structure for L0 hit.
double getCosThetaC()
Get average cosine of Cherenkov angle of water corresponding to group velocity.
Auxiliary class for defining the range of iterations of objects.
void transform(const JRotation3D &R, const JVector3D &pos)
Transform hit.
Match operator for Cherenkov light from muon in any direction.
JDirection3D getDirection(const Vec &dir)
Get direction.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
static struct JTRIGGER::@80 clusterize
Anonymous structure for clustering of hits.
set_variable E_E log10(E_{fit}/E_{#mu})"
JPosition3D getPosition(const Vec &pos)
Get position.
then break fi done getCenter read X Y Z let X
Direct access to PMT in detector data structure.
then usage $script[distance] fi case set_variable R
General purpose messaging.
Auxiliary include file for time conversion between DAQ/trigger hit and Monte Carlo hit...
Direct access to module in detector data structure.
Time-over-threshold (ToT) pulse from a PMT.
Data structure for L2 parameters.
double getZ() const
Get z position.
Auxiliary class for a time-over-threshold pulse from a PMT.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Utility class to parse command line options.
const double getInverseSpeedOfLight()
Get inverse speed of light.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.
Data structure for position in three dimensions.
const JLimit & getLimit() const
Get limit.
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
do set_variable DETECTOR_TXT $WORKDIR detector
Data structure for normalised vector in three dimensions.
General purpose class for multiple pointers.
double getTime() const
Get DAQ/trigger time minus Monte Carlo time.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
double getX() const
Get x position.
int getParentModuleID(const JObjectID &id) const
Get parent module identifier.
Basic data structure for L1 hit.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
double getSinThetaC()
Get average sine of Cherenkov angle of water corresponding to group velocity.
3D match criterion with road width.