Jpp 20.0.0-195-g190c9e876
the software that should make you happy
Loading...
Searching...
No Matches
JShowerBjorkenY.hh
Go to the documentation of this file.
1
2#ifndef JSHOWERBJORKENY_INCLUDE
3#define JSHOWERBJORKENY_INCLUDE
4
5#include <string>
6#include <iostream>
7#include <set>
8#include <vector>
9#include <algorithm>
10#include <memory>
11
14
15#include "JTrigger/JHit.hh"
17#include "JTrigger/JHitL0.hh"
18#include "JTrigger/JHitL1.hh"
19#include "JTrigger/JHitR1.hh"
20#include "JTrigger/JBuildL0.hh"
21#include "JTrigger/JBuildL2.hh"
23#include "JTrigger/JMatch3G.hh"
24#include "JTrigger/JBind2nd.hh"
25
27
29#include "JFit/JFitToolkit.hh"
30#include "JFit/JPoint4D.hh"
31#include "JFit/JModel.hh"
32#include "JFit/JSimplex.hh"
33#include "JFit/JShowerEH.hh"
34
36
42
45
52
54
55
56/**
57 * \author adomi
58 */
59namespace JRECONSTRUCTION {}
60namespace JPP { using namespace JRECONSTRUCTION; }
61
62namespace JRECONSTRUCTION {
63
66 using JFIT::JRegressor;
67 using JFIT::JEnergy;
68 using JFIT::JShowerEH;
69 using JFIT::JSimplex;
70
71 /**
72 * class to handle the direction fit of the shower reconstruction, mainly dedicated for ORCA
73 */
76 public JRegressor<JShowerEH, JSimplex>
77 {
78
80 using JRegressor_t::operator();
81
82 public:
83
84 /**
85 * Parameterized constructor
86 *
87 * \param parameters struct that holds default-optimized parameters for the reconstruction, available in $JPP_DATA.
88 * \param router module router, this is built via detector file.
89 * \param summary summary router
90 * \param pdfFile PDF file
91 * \param correct energy correction
92 * \param debug debug
93 */
95 const JModuleRouter& router,
97 const std::string pdfFile,
99 const int debug = 0):
100 JShowerBjorkenYParameters_t(parameters),
101 JRegressor_t(pdfFile),
102 router(router),
105 {
106 using namespace JPP;
107
108 JRegressor_t::debug = debug;
109 JRegressor_t::T_ns.setRange(parameters.TMin_ns, parameters.TMax_ns);
110 JRegressor_t::Vmax_npe = VMax_npe;
111 JRegressor_t::MAXIMUM_ITERATIONS = NMax;
112
113 this->estimator.reset(getMEstimator(parameters.mestimator));
114 }
115
116 /**
117 * Declaration of the member function that actually performs the reconstruction
118 *
119 * \param event = JDAQEvent
120 * \param in = input fits
121 */
123 {
124 using namespace std;
125 using namespace JPP;
126
127 typedef vector<JHitL0> JDataL0_t;
128 JBuildL0<JHitL0> buildL0;
129
130 JEvt out;
131
133
134 JDataL0_t dataL0;
135
136 buildL0(JDAQTimeslice(event, true), router, back_inserter(dataL0));
137
138 for (JEvt::const_iterator shower = in.begin(); shower != in.end(); ++shower) {
139
140 JShower3EY sh(getShower(*shower), 0.0);
141
143
144 const JModel<JPoint4D> match(JPoint4D(sh.getPosition(), sh.getT()), roadWidth_m, JRegressor_t::T_ns);
145
146 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
147
148 if (match(*i)) {
149 top.insert(i->getPMTIdentifier());
150 }
151 }
152
154
155 const JDirection3D conversion(sh.getDirection());
156 const JRotation3D R(conversion);
157
158 vector<JPMTW0> buffer;
159
160 for (JDetectorSubset_t::iterator module = subdetector.begin();
161 module != subdetector.end(); ++module) {
162
163 const JDAQSummaryFrame& frame = summary.getSummaryFrame(module->getID(), R_Hz);
164
165 JModule dom(*module);
166
167 dom.rotate(R);
168
169 for (unsigned int i = 0; i != dom.size(); ++i) {
170
171 if (getDAQStatus(frame, *module, i) &&
172 getPMTStatus(frame, *module, i) &&
173 frame[i].is_valid() &&
174 !module->getPMT(i).has(PMT_DISABLE)) {
175
176 const JDAQPMTIdentifier id(module->getID(), i);
177
178 const double QE = 1.0;
179 const double rate_Hz = summary.getRate(id, this->R_Hz);
180 const size_t count = top.count(id);
181
182 buffer.push_back(JPMTW0(dom.getPMT(i), QE, rate_Hz, count));
183 }
184 }
185 }
186
187 this->step.resize(2);
188 this->step[0] = JShowerEH(JPoint4D(JVector3D(), 0.0), JVersor3Z(), fit_step, 0.0, 0.0);
189 this->step[1] = JShowerEH(JPoint4D(JVector3D(), 0.0), JVersor3Z(), 0.0, fit_step, 0.0);
190
191 double f_h = 1 - 0.681 * (std::pow(shower->getE()/0.863, -0.207));
192
193 double chi2 = (*this)(JShowerEH(JVertex3D(JVector3D(0,0,0), sh.getT()),
194 JVersor3Z(),
195 log10(sh.getE()),
196 log10(f_h*sh.getE()),
197 sh.getBjY()),
198 buffer.begin(), buffer.end());
199
200 double NDF = getCount(buffer.begin(), buffer.end()) - this->step.size();
201
202 JShower3EY result(JShower3E(JShower3D(this->value.getVertex(),
203 this->value.getDirection()),
204 correct(this->value.getEem() + this->value.getEh())),
205 this->value.getBy());
206
207 double y = getFinalBjY(this->value.getEem(), this->value.getEh());
208
209 result.rotate_back(R);
210
211 result.add(sh.getPosition());
212
213 out.push_back(getFit(JHistory(shower->getHistory()).add(JSHOWER_BJORKEN_Y), result, getQuality(chi2), NDF, result.getE()));
214
215 out.rbegin()->setW(5, y);
216 out.rbegin()->setW(6, this->value.getEem());
217 out.rbegin()->setW(7, this->value.getEh());
218
219 }
220
221 return out;
222 }
223
227
228 /*
229 * Function to get the reconstructed Bjorken Y from reconstructed energies.
230 *
231 * \param E_em reconstructed EM shower energy
232 * \param E_h reconstructed Hadronic shower energy
233 */
234 static inline double getFinalBjY(double E_em, double E_h){
235 return E_h / (E_em + E_h);
236 }
237
238 };
239}
240
241#endif
242
Definition of hit and track types and auxiliary methods for handling Monte Carlo data.
Algorithms for hit clustering and sorting.
Auxiliary class to extract a subset of optical modules from a detector.
Data structure for detector geometry and calibration.
Auxiliary methods to evaluate Poisson probabilities and chi2.
Basic data structure for L0 hit.
Basic data structure for L1 hit.
Reduced data structure for L1 hit.
Match operator for Cherenkov light from shower in any direction.
int debug
debug level
Definition JSirene.cc:74
Data regression method for JFIT::JShowerEH.
Basic data structure for time and time over threshold information of hit.
Detector subset without binary search functionality.
Detector data structure.
Definition JDetector.hh:96
Router for direct addressing of module data in detector data structure.
Data structure for a composite optical module.
Definition JModule.hh:76
void rotate(const JRotation3D &R)
Rotate module.
Definition JModule.hh:315
const JPMT & getPMT(const int index) const
Get PMT.
Definition JModule.hh:173
Data structure for fit of energy.
Data structure for set of track fit results.
Data structure for vertex fit.
Definition JPoint4D.hh:24
Data structure for fit of straight line in positive z-direction with energy.
Definition JShowerEH.hh:32
Simple fit method based on Powell's algorithm, see reference: Numerical Recipes in C++,...
Definition JSimplex.hh:44
double getBjY() const
Get Borken-y.
Definition JBjorkenY.hh:64
Data structure for direction in three dimensions.
double getE() const
Get energy.
const JPosition3D & getPosition() const
Get position.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition JShower3D.hh:97
JVersor3D getDirection(const JVector3D &pos) const
Get photon direction of Cherenkov light on PMT.
Definition JShower3D.hh:111
3D shower with energy and Bjorken-y.
Definition JShower3EY.hh:31
3D shower with energy.
Definition JShower3E.hh:31
Data structure for vector in three dimensions.
Definition JVector3D.hh:36
Data structure for normalised vector in positive z-direction.
Definition JVersor3Z.hh:41
const JClass_t & getReference() const
Get reference to object.
Definition JReference.hh:38
Auxiliary class for correction of energy determined by JEnergy.cc.
class to handle the direction fit of the shower reconstruction, mainly dedicated for ORCA
const JEnergyCorrection & correct
static double getFinalBjY(double E_em, double E_h)
JEvt operator()(const KM3NETDAQ::JDAQEvent &event, const JFIT::JEvt &in)
Declaration of the member function that actually performs the reconstruction.
JRegressor< JShowerEH, JSimplex > JRegressor_t
JShowerBjorkenY(const JShowerBjorkenYParameters_t &parameters, const JModuleRouter &router, const JSummaryRouter &summary, const std::string pdfFile, const JEnergyCorrection &correct, const int debug=0)
Parameterized constructor.
Router for fast addressing of summary data in KM3NETDAQ::JDAQSummaryslice data structure as a functio...
double getRate(const JDAQPMTIdentifier &id) const
Get rate.
const JDAQSummaryFrame & getSummaryFrame(const JDAQModuleIdentifier &module) const
Get summary frame.
Template L0 hit builder.
Definition JBuildL0.hh:38
Data storage class for rate measurements of all PMTs in one module.
size_t getCount(const array_type< T > &buffer, const JCompare_t &compare)
Count number of unique values.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double getQuality(const double chi2, const int N, const int NDF)
Get quality of fit.
JFIT::JHistory JHistory
Definition JHistory.hh:455
JFit getFit(const JHistory &history, const JTrack3D &track, const double Q, const int NDF, const double energy=0.0, const int status=SINGLE_STAGE)
Get fit.
JShower3E getShower(const JFit &fit)
Get shower.
bool is_valid(const json &js)
Check validity of JSon data.
return result
Definition JPolint.hh:862
bool getDAQStatus(const JDAQFrameStatus &frame, const JStatus &status)
Test status of DAQ.
bool getPMTStatus(const JStatus &status)
Test status of PMT.
static const int PMT_DISABLE
ile KM3NeT Data Definitions v3.6.2-4-g8b3df20 https://git.km3net.de/common/km3net-dataformat
Definition pmt_status.hh:13
Detector file.
Definition JHead.hh:227
Model for fit to acoustics data.
JHistory & add(const int type)
Add event to history.
Definition JHistory.hh:396
Auxiliary class for handling PMT geometry, rate and response.
Definition JPMTW0.hh:24
Template definition of a data regressor of given model.
Definition JRegressor.hh:70
double TMax_ns
maximum time for local coincidences [ns]
double VMax_npe
maximum number of of photo-electrons
int mestimator
M-estimator (see JFIT::JMEstimator_t)
double TMin_ns
minimum time for local coincidences [ns]