67 int main(
int argc,
char** argv){
71 using namespace JSUPPORT;
72 using namespace KM3NETDAQ;
73 using namespace JAANET;
76 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
79 JParallelFileScanner_t inputFile;
87 size_t numberOfPrefits;
98 zap[
'F'] =
make_field(pdfFile) =
"quickPDF_elec-CC.root";
99 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
108 catch(
const exception& error) {
109 FATAL(error.what() << endl);
112 using namespace JTRIGGER;
113 using namespace JDETECTOR;
114 using namespace JGEOMETRY3D;
115 using namespace JTOOLS;
122 catch(
const JException& error) {
135 JRegressor_t::T_ns.setRange(-Tmax_ns, Tmax_ns);
136 JRegressor_t::Vmax_npe = 20.0;
137 JRegressor_t::MAXIMUM_ITERATIONS = 1000;
138 JRegressor_t fit(pdfFile);
145 while (inputFile.hasNext()) {
147 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
149 multi_pointer_type ps = inputFile.next();
157 JEvt::iterator __end = evt->end();
159 copy(evt->begin(), __end, back_inserter(out));
161 if (numberOfPrefits > 0) {
162 advance(__end = evt->begin(), min(numberOfPrefits, evt->size()));
165 partial_sort(evt->begin(), __end, evt->end(),
qualitySorter);
170 buildL0(*tev, moduleRouter,
true, back_inserter(dataL0));
172 for (JEvt::const_iterator shower = evt->begin(); shower != __end; ++shower) {
186 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
191 double t_res = hit.
getT() - pt.getT(hit_pos);
195 if(D < Dmax_m && (t_res >= -25 && t_res <= 25) && (cosT >= -1 && cosT <= 0.1)){
197 JVector3D d(photonDir.getDX(), photonDir.getDY(), photonDir.getDZ());
200 if(D < Dmax_m && (t_res > -30 && t_res < 20)){
205 double start_E = exp((Nhits + 26)/26);
206 if(start_E > 100) start_E = 100;
212 double max_theta = 0, max_phi = 0, scan_step = 0;
215 if(start_E > 10 && radius < 100){
227 JAngle3D start_dir_angles(start_dir.getX(), start_dir.getY(), start_dir.getZ());
229 for(
double E = -15; E <= 5; E += 7.5){
230 for(
double th = -max_theta; th <= max_theta; th += scan_step){
231 for(
double ph = -max_phi; ph <= max_phi; ph += scan_step){
236 double theta = th * 3.14 / 180;
237 double phi = ph * 3.14 / 180;
238 double scan_E = start_E + E;
240 JAngle3D dir_shifted_angles(start_dir_angles.getTheta() + theta, start_dir_angles.getPhi() + phi);
241 JVector3D dir_shifted(dir_shifted_angles.getDX(), dir_shifted_angles.getDY(), dir_shifted_angles.getDZ());
242 JDirection3D conversion(dir_shifted.getX(), dir_shifted.getY(), dir_shifted.getZ());
246 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
249 if (pt.getDistance(pos) < Dmax_m) {
250 for (
unsigned int i = 0; i != module->size(); ++i) {
252 JPMT pmt(module->getPMT(i));
254 buffer.push_back(
JPMTW0(pmt, R_Hz, top.count(
id)));
259 for(JPMTW0_t::iterator pmt = buffer.begin(); pmt != buffer.end(); ++pmt ){
263 LogLik.push_back(chi2);
264 start_directions.push_back(dir_shifted);
265 Energies.push_back(scan_E);
272 while(LogLik.size() > Nmin){
275 it = max_element(LogLik.begin(), LogLik.end());
276 int pos = it - LogLik.begin();
277 LogLik.erase(LogLik.begin() + pos);
278 start_directions.erase(start_directions.begin() + pos);
279 Energies.erase(Energies.begin() + pos);
287 double dir_step = 0.05;
292 double scan_E = Energies[n];
296 JVersor3D startVersor(dir->getX(), dir->getY(), dir->getZ());
298 JDirection3D conversion(startVersor.getDX(), startVersor.getDY(), startVersor.getDZ());
302 for(JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
305 if (pt.getDistance(pos) < Dmax_m) {
306 for (
unsigned int i = 0; i != module->size(); ++i) {
308 JPMT pmt(module->getPMT(i));
310 buffer.push_back(
JPMTW0(pmt, R_Hz, top.count(
id)));
315 int NDF = buffer.size() - fit.step.size();
322 JVersor3D resDir(fit.value.getDX(), fit.value.getDY(), fit.value.getDZ());
324 JTrack3D td(resPos, resDir, shower->getT());
325 double E_reco_corrected = fit.value.getE() - 4;
330 out.rbegin()->setE(E_reco_corrected);
Data structure for angles in three dimensions.
double getT() const
Get calibrated time of hit.
Utility class to parse command line options.
General purpose data regression method.
Data structure for direction in three dimensions.
Template specialisation of L0 builder for JHitL0 data type.
const JDAQPMTIdentifier & getPMTIdentifier() const
Get PMT identifier.
Auxiliary class for handling PMT geometry, rate and response.
Data structure for vertex fit.
const JDirection3D & getDirection() const
Get direction.
Recording of objects on file according a format that follows from the file name extension.
Router for direct addressing of module data in detector data structure.
General purpose class for parallel reading of objects from a single file or multiple files...
Container for historical events.
double getDistance(const JVector3D &pos) const
Get distance to point.
Data structure for detector geometry and calibration.
double getDot(const JAngle3D &angle) const
Get dot product.
Various implementations of functional maps.
JFit getFit(const JHistory &history, const JTrack3D &track, const double Q, const int NDF, const double energy=0.0, const int status=0)
Get fit.
Basic data structure for L0 hit.
Definition of fit parameters from various applications.
Basic data structure for time and time over threshold information of hit.
Auxiliary class for defining the range of iterations of objects.
Data structure for fit of straight line in positive z-direction with energy.
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
Data structure for vector in three dimensions.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
Data structure for PMT geometry and calibration.
Auxiliary class for a hit with background rate value.
JAxis3D & rotate_back(const JRotation3D &R)
Rotate back axis.
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
const JPosition3D & getPosition() const
Get position.
Regressor function object for JShower3EZ fit using JSimplex minimiser.
General purpose messaging.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Direct access to module in detector data structure.
Data structure for set of track fit results.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
ROOT TTree parameter settings.
bool qualitySorter(const JFIT::JFit &first, const JFIT::JFit &second)
Comparison of fit results.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Data regression method for JFIT::JShower3Z.
Data structure for fit of energy.
Data structure for position in three dimensions.
const JLimit & getLimit() const
Get limit.
Data structure for normalised vector in three dimensions.
Data structure for normalised vector in positive z-direction.
JVector3D & add(const JVector3D &vector)
Add vector.
#define DEBUG(A)
Message macros.
JPosition3D getPosition(const Vec &v)
Get position.
int main(int argc, char *argv[])