67 using namespace KM3NETDAQ;
70 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
73 JParallelFileScanner_t inputFile;
79 histogram_type calibrate;
86 JParser<> zap(
"Program to perform detector calibration using reconstructed muon trajectories.");
91 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
93 zap[
'c'] =
make_field(calibrate,
"Histogram for time calibration per optical module.");
99 catch(
const exception& error) {
100 FATAL(error.what() << endl);
105 if (!calibrate.is_valid()) {
106 FATAL(
"Invalid calibration data " << calibrate << endl);
110 WARNING(
"Number of prefits " <<
parameters.numberOfPrefits <<
" != " << 1 << endl);
136 TH2D ha(
"ha", NULL, 256, -0.5, 255.5,
137 calibrate.getNumberOfBins(), calibrate.getLowerLimit(), calibrate.getUpperLimit());
139 TProfile hb(
"hb", NULL, 256, -0.5, 255.5);
142 calibrate.getNumberOfBins(), calibrate.getLowerLimit(), calibrate.getUpperLimit());
144 JManager_t
g1(
new TProfile(
"%", NULL,
detector.size(), -0.5,
detector.size() - 0.5, -1.0, +1.0));
147 while (inputFile.hasNext()) {
149 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
151 multi_pointer_type ps = inputFile.next();
156 summary.update(*tev);
162 buildL0(*tev, router,
true, back_inserter(dataL0));
164 for (JEvt::const_iterator track = in->begin(); track != in->end(); ++track) {
180 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
182 double rate_Hz = summary.getRate(*i);
184 if (rate_Hz <= 0.0) {
185 rate_Hz = summary.getRate();
199 sort(data.begin(), data.end(), JMuonGandalf::compare);
201 JDataW0_t::iterator __end = unique(data.begin(), data.end(), equal_to<JDAQPMTIdentifier>());
206 if (track->getE() > 0.1)
207 fit.JRegressor_t::E_GeV = track->getE();
213 for (JDataW0_t::const_iterator hit = data.begin(); hit != __end; ++hit) {
214 buffer.insert(hit->getModuleID());
223 if (
distance(data.begin(), q) - fit.parameters.size() > 0) {
225 fit(ta, data.begin(), q);
227 sort(q, __end, JMuonGandalf::compare);
229 const int index = router.getIndex(*
id);
230 const double t1 = fit.value.getT(q->getPosition());
231 JTrack3D gradient = fit(fit.value, *q).gradient;
235 ha.Fill(q->getToT(), q->getT1() - t1);
236 hb.Fill(q->getToT(), gradient.
getT());
238 h2.Fill(index, q->getT() - t1);
240 g1[
"T"]->Fill(index, gradient.
getT());
241 g1[
"X"]->Fill(index, gradient.
getX());
242 g1[
"Y"]->Fill(index, gradient.
getY());
243 g1[
"Z"]->Fill(index, gradient.
getZ());
Utility class to parse command line options.
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Template specialisation of L0 builder for JHitL0 data type.
Router for direct addressing of module data in detector data structure.
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
General purpose class for parallel reading of objects from a single file or multiple files...
Template specialisation of class JModel to match hit with muon trajectory along z-axis.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Data structure for fit of straight line in positive z-direction.
Wrapper class to make final fit of muon trajectory.
Auxiliary class to manage set of compatible ROOT objects (e.g.
Auxiliary class for defining the range of iterations of objects.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary class for a hit with background rate value.
JAxis3D & rotate_back(const JRotation3D &R)
Rotate back axis.
File router for fast addressing of summary data.
double getY() const
Get y position.
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
Data structure for fit parameters.
then usage $script[distance] fi case set_variable R
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
static const int JSTART_LENGTH_METRES
distance between first and last hits in metres from JStart.cc
Data structure for set of track fit results.
Data structure for fit of straight line paralel to z-axis.
double getX() const
Get x position.
JDirection3D getDirection(const Vec &v)
Get direction.
const JLimit & getLimit() const
Get limit.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
void select(const JSelector_t &selector)
Select fits.
double getZ() const
Get z position.
JTOOLS::JRange< double > JZRange
bool qualitySorter(const JRECONSTRUCTION::JFit &first, const JRECONSTRUCTION::JFit &second)
Comparison of fit results.
#define DEBUG(A)
Message macros.
JPosition3D getPosition(const Vec &v)
Get position.
bool putObject(TDirectory *dir, const T &object)
Write object to ROOT directory.
Double_t g1(const Double_t x)
Function.