50 bool hasIntersectingMuon(
const Evt& event,
63 const double Leff = (intersection.first < 0.0 ?
64 min(Lmuon, intersection.second) :
65 min(Lmuon, intersection.second) - intersection.
first);
67 if (Leff > 0.0) {
return true; }
84 int main(
int argc,
char **argv)
88 using namespace KM3NETDAQ;
106 JParser<> zap(
"Example program to histogram neutrino effective mass for triggered events.");
110 zap[
'R'] =
make_field(wall,
"Addition margin around the volume in which the considered events must reside") = 0.0;
111 zap[
'X'] =
make_field(logx,
"Use logarithm of energy");
114 zap[
'a'] =
make_field(detectorFile,
"Detector file: if not provided, trigger fraction is not calculated") =
"";
118 catch(
const exception &error) {
119 FATAL(error.what() << endl);
128 if (detectorFile !=
"") {
148 double Xmin = numeric_limits<double>::max();
149 double Xmax = numeric_limits<double>::lowest();
157 const JVolume volume(header, logx);
162 volumes.push_back(volume);
166 canvol.addMargin(wall);
168 if (can.
getVolume() > canvol.getVolume()) { canvol = can; }
178 if (inst.getVolume() > instvol.getVolume()) { instvol = inst; }
190 TH1::SetDefaultSumw2();
200 const size_t scannerIndex =
distance(scanners.begin(), scanner);
202 const JVolume& volume = volumes[scannerIndex];
204 NOTICE(
"JEffectiveMass1D: Instrumented volume dimensions (zmin, zmax, r): " << instvol.getZmin() <<
" " << instvol.getZmax() <<
" " << instvol.getRadius() << endl );
210 NOTICE(
"Scanning generated events for file type " << scannerIndex << endl);
212 while (scanner->hasNext()) {
214 STATUS(
"event: " << setw(10) << scanner->getCounter() <<
'\r');
DEBUG(endl);
216 const Evt*
event = scanner->next();
222 const bool isValid1 = (canvol.is_inside(vertex) || hasIntersectingMuon(*event, canvol));
223 const bool isValid2 = (instvol.is_inside(vertex) || hasIntersectingMuon(*event, instvol));
226 hNM[primary.
type]->Fill(volume.getX(primary.
E), isValid1 ? scanner->getWeight(*event) : 0.0);
229 hNm[primary.
type]->Fill(volume.getX(primary.
E), isValid2 ? scanner->getWeight(*event) : 0.0);
234 if (scanner->getCounter() == 0) {
235 FATAL(
"JEffectiveMass1D: generated events not stored in the input file, JTriggerEfficiency should be run without option -O");
242 NOTICE(
"Scanning triggered events for file type " << scannerIndex << endl);
246 while (
in.hasNext()) {
248 STATUS(
"event: " << setw(10) <<
in.getCounter() <<
'\r');
DEBUG(endl);
252 const Evt*
event = mp;
258 const bool isValid1 = (canvol.is_inside(vertex) || hasIntersectingMuon(*event, canvol));
259 const bool isValid2 = (instvol.is_inside(vertex) || hasIntersectingMuon(*event, instvol));
261 hM[primary.
type]->Fill(volume.getX(primary.
E), isValid1 ?
in.getWeight(*event) : 0.0);
262 hm[primary.
type]->Fill(volume.getX(primary.
E), isValid2 ?
in.getWeight(*event) : 0.0);
277 const int pdgID = *
i;
279 hM[pdgID]->Divide(hNM[pdgID]);
281 hm[pdgID]->Divide(hNm[pdgID]);
JVertex3D getVertex(const Trk &track)
Get vertex.
Utility class to parse command line options.
Double_t getXmin() const
Get minimal abscissa value.
int main(int argc, char *argv[])
ROOT TTree parameter settings of various packages.
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 is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
static const double MASS_MUON
muon mass [GeV]
Double_t getXmax() const
Get maximal abscissa value.
const Trk & get_primary(const Evt &evt)
Get primary.
static const JGeaneWater gWater
Function object for energy loss of muon in sea water.
virtual double getX(const double E0, const double E1) const override
Get distance traveled by muon.
static const double DENSITY_SEA_WATER
Fixed environment values.
Dynamic ROOT object management.
intersection_type getIntersection(const JAxis3D &axis) const
Get intersection points of axis with cylinder.
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_finalstate(const Trk &track)
Test whether given track corresponds to a final state particle.
Auxiliary class for histogramming of effective volume.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
JAxis3D getAxis(const Trk &track)
Get axis.
JPosition3D getPosition(const Vec &pos)
Get position.
void addMargin(const double D)
Add (safety) margin.
General purpose messaging.
int type
MC: particle type in PDG encoding.
double getVolume() const
Get volume.
Auxiliary base class for list of file names.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
std::vector< filescanner_type >::iterator iterator
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.
const JHead & getHeader() const
Get header.
Data structure for position in three dimensions.
Auxiliary class for organising Monte Carlo file scanners associated with event weighters.
Template event-weighter-associated file scanner.
do set_variable DETECTOR_TXT $WORKDIR detector
General purpose class for multiple pointers.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
std::vector< filescanner_type >::const_iterator const_iterator
int numberOfBins
number of bins for average CDF integral of optical module
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
const array_type< JKey_t > & get_keys(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of keys of map.
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.
#define DEBUG(A)
Message macros.
The cylinder used for photon tracking.