1#ifndef __JRUNANALYZER__
2#define __JRUNANALYZER__
66 numberOfTimeslices (nTimeslices),
67 numberOfSummaryslices (nSummaryslices),
68 numberOfEvents (nEvents),
69 analysis_level (analysislevel)
90 while (scanner.hasNext()) {
101 if (event.hasTriggerBit(i)) {
107 int counter_3dmuon = 0;
109 JRange_t range(JRange_t::DEFAULT_RANGE());
114 const double t1 =
getTime(hit->getT(), module.
getPMT(hit->getPMT()));
122 if (router.
hasModule(hit->getModuleID())) {
129 int String =
module.getString();
131 int Floor =
module.getFloor();
141 if (hit -> hasTriggerBit(i)) {
147 FATAL(
"JModuleRouter trying to access non existing identifier: "<< hit->getModuleID());
159 if (router.
hasModule(hit->getModuleID())) {
163 int String =
module.getString();
165 int Floor =
module.getFloor();
166 int pmt = hit-> getPMT();
168 if(analysis_level == 1){
179 FATAL(
"JModuleRouter trying to access non existing identifier: "<< hit->getModuleID());
193 TH1D* h_tres =
new TH1D(
"h_tres",
";Time residuals [ns]; Entries", 100, -50, 150);
194 TH1D* h_likelihood =
new TH1D (
"h_likelihood",
" ; Likelihood; Reconstructed Events ", 100, -1000, 1000);
195 TH1D* h_beta0 =
new TH1D(
"h_beta0",
"; beta0; Reconstructed Events", 20, 0, 1);
196 TH1D* h_energy =
new TH1D (
"h_energy",
" ; Energy [GeV]; Reconstructed Events ", 65, 0, 9);
198 TH1D* h_zenith =
new TH1D(
"h_zenith",
"; cosZenith; Reconstructed Events", 20, -1, 1);
199 TH1D* h_azimuth =
new TH1D(
"h_azimuth",
"; cosAzimuth; Reconstructed Events", 20, -1, 1);
200 TH1D* h_radial_position =
new TH1D (
"h_radial_position",
"; Radial Position [m]; Reconstructed Events", 60, 0, 4.2);
202 TH1D* h_z_position =
new TH1D (
"h_z_position",
"; Z Position [m] ; Reconstructed Events", 50, 0, 3.2);
205 while (scanner.hasNext()) {
214 JEvt::iterator best = evt->begin();
215 h_energy -> Fill(best->getE());
216 h_likelihood -> Fill(best->getQ());
217 h_z_position -> Fill(best->getZ());
218 h_radial_position -> Fill(sqrt(best->getX()*best->getX() + best->getY()*best->getY()));
227 buildL0(
JDAQTimeslice(*event,
false), router, back_inserter(dataL0));
229 for (std::vector<JHitL0>::const_iterator hit = dataL0.begin(); hit != dataL0.end(); ++hit) {
231 h_tres -> Fill(hit->getT() - track.
getT(hit->getPosition()));
240 h_likelihood -> Write();
241 h_z_position -> Write();
242 h_radial_position -> Write();
244 h_azimuth -> Write();
270 while (scanner.hasNext()){
274 for (JDAQSummaryslice::const_iterator frame = slice.begin() ; frame != slice.end() ; ++ frame) {
276 if (router.
hasModule(frame->getModuleID())) {
280 int string =
module.getString();
282 int floor =
module.getFloor ();
298 if(analysis_level == 1){
303 const double factor = 1.0e-3;
307 rate += frame->getRate(i, factor);
309 h2->Fill(i , frame->getRate(i, factor));
311 PMT_rate_quantiles[string][floor][i].put(frame->getRate(i, factor));
319 DOM_rate_quantiles[string][floor].put(rate);
324 const double factor = 1.0e-3;
328 rate += frame->getRate(i, factor);
335 DOM_rate_quantiles[string][floor].put(rate);
340 FATAL(
"JModuleRouter trying to access non existing identifier: "<< frame->getModuleID());
345 for (
const auto& i1 : DOM_rate_quantiles) {
346 for (
const auto& i2 : i1.second) {
347 if (i2.second.getCount() > 0) {
353 if (analysis_level == 1){
354 for (
const auto& i1 : PMT_rate_quantiles){
359 for (
const auto& i2 : i1.second) {
361 if (i2.second[i3].getCount() > 0){
362 h2->Fill(i3, i2.first, i2.second[i3].getMean());
363 h1->Fill(i2.second[i3].getMean());
381 std::map < int , std::map <int , JQuantile> > DOM_rate_quantiles;
383 double inverseFrameTimeSec = 1. / (1.0e-9 *
getFrameTime());
385 while (scanner.hasNext()){
387 T slice = *(scanner.next());
389 for(
auto & frame : slice) {
390 if (router.
hasModule(frame.getModuleID())) {
393 double rate = frame.numberOfHits * inverseFrameTimeSec;
394 int string =
module.getString();
395 int floor =
module.getFloor ();
397 DOM_rate_quantiles[string][floor].put(rate);
399 vector <int> pmt_hit_count (NUMBER_OF_PMTS , 0) ;
401 if(analysis_level == 1){
407 h2 -> Fill(hit->getPMT() , hit->getToT()) ;
409 pmt_hit_count[hit->getPMT()]++;
422 FATAL(
"JModuleRouter trying to access non existing identifier: "<< frame.getModuleID());
443 JTreeScanner <JDAQSummaryslice> scanner(inputFile, numberOfSummaryslices);
444 if (scanner.hasNext()) {
459 JTreeScanner <T> scanner(inputFile, numberOfTimeslices);
460 if(scanner.hasNext()) {
475 JTreeScanner <JDAQEvent> scanner(inputFile, numberOfEvents);
477 if(scanner.hasNext()) {
506 f->mkdir(
"Detector");
523 for (
typename JManager < string , TH2D >::const_iterator
j = (*i) -> begin() ;
j != (*i) -> end() ; ++
j){
525 j->second->Scale(1.,
"width");
Basic data structure for L0 hit.
Dynamic ROOT object management.
Direct access to module in detector data structure.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
#define MAKE_STRING(A)
Make string.
Auxiliary class to define a range between two values.
ROOT TTree parameter settings of various packages.
Router for direct addressing of module data in detector data structure.
bool hasModule(const JObjectID &id) const
Has module.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
Data structure for a composite optical module.
const JPMT & getPMT(const int index) const
Get PMT.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
JVersor3D getDirection(const JVector3D &pos) const
Get photon direction of Cherenkov light on PMT.
double getTheta() const
Get theta angle.
double getPhi() const
Get phi angle.
TimesliceHistograms h_timeslice
void initialize_trigger_histograms()
void Write_manager_table_in_key_dir(TFile &f, vector< JManager< T, V > * > table)
int string_to_index(int string)
TriggerHistograms h_trigger
void Write_manager_in_key_dir(TFile &f, JManager< T, V > *manager)
void initialize_summary_histograms()
void initialize_timeslice_histograms()
void Write_histogram_table_to_file(TFile &f, string dirname, vector< vector< T * > > table)
SummaryHistograms h_summary
Class dedicated to the analysis of KM3NeT runs.
void iterateSummarysliceTree(JTreeScanner< JDAQSummaryslice > &scanner)
JSingleFileScanner inputFile
JRA_Histograms histograms
JRunAnalyzer(const JSingleFileScanner<> &file, const JDetector &detector, TFile *out, JLimit_t nTimeslices, JLimit_t nSummaryslices, JLimit_t nEvents, int analysislevel)
Constructor.
void iterateEventTree(JTreeScanner< JDAQEvent > &scanner)
void iterateRecoEventTree(JParallelFileScanner< JTypeList< JDAQEvent, JFIT::JEvt > > &scanner, TFile &f)
JLimit_t numberOfTimeslices
void iterateTimesliceTree(JTreeScanner< T > &scanner)
void writeToFile(TFile *f, int analysis_level)
~JRunAnalyzer()
Destructor.
JLimit_t numberOfSummaryslices
General purpose class for parallel reading of objects from a single file or multiple files.
virtual const multi_pointer_type & next() override
Get next element.
Object reading from a list of files.
virtual void rewind() override
Rewind.
virtual bool hasNext() override
Check availability of next element.
int countHighRateVeto() const
Count high-rate veto status.
int countFIFOStatus() const
Count FIFO status.
bool testDAQStatus() const
Test DAQ status of packets.
Auxiliary class for trigger mask.
bool hasTriggerBit(const unsigned int bit) const
Check trigger bit.
static const int JGANDALF_BETA0_RAD
KM3NeT Data Definitions v3.6.1-2-g905a24d https://git.km3net.de/common/km3net-dataformat.
JTrack3E getTrack(const Trk &track)
Get track.
void setLogarithmicX(TList *list)
Make x-axis of objects in list logarithmic (e.g. after using log10()).
std::string to_string(const T &value)
Convert value to string.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
const char * getTime()
Get current local time conform ISO-8601 standard.
JTriggerbit_t getTriggerBit()
Get the trigger bit.
double getFrameTime()
Get frame time duration.
static const unsigned int NUMBER_OF_TRIGGER_BITS
Number of trigger bits.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Type definition of range.
General purpose string class.
Indexing of data type in type list.
Auxiliary class for defining the range of iterations of objects.
JManager< string, TH1D > * m_mean_summary_rate_distribution
JManager< string, TH2D > * m_mean_summary_rate
TH1D * h_pmt_rate_distribution
TH2D * h_daq_status_per_dom
JManager< string, TH2D > * m_summary_rate_distribution
TH1D * h_dom_rate_distribution
vector< JManager< string, TH2D > * > m_pmt_tot_distributions
void Fill_mean_ToT_histograms()
vector< JManager< string, TH2D > * > m_pmt_rate_distributions
vector< JManager< string, TH2D > * > m_mean_ToT
vector< TH2D * > h_dom_mean_rates
vector< JManager< string, TH1D > * > m_mean_ToT_distribution
TH2D * h_Triggered_hits_3dmuon_per_module
TH2D * h_Triggered_hits_per_module
JManager< string, TH2D > * m_Snapshot_hits_per_pmt
TH1D * h_tot_distribution_snapshot_hits
TH1D * h_Trigger_bit_event
TH1D * h_pmt_distribution_snapshot_hits
TH2D * h_Snapshot_hits_per_module
TH1D * h_pmt_distribution_triggered_hits
TH1D * h_tot_distribution_triggered_hits
TH1D * h_Number_of_overlays
TH1D * h_Triggered_over_Snapshot_hits
TH1D * h_Triggered_hits_3dmuon