11 #include "TFitResult.h"
51 int main(
int argc,
char **argv)
70 disable_container disable;
73 int numberOfEntries = 21;
78 JParser<> zap(
"Example program to plot acoustic fit results.");
84 zap[
'f'] =
make_field(inputFile,
"input file (output of JKatoomba[.sh])");
85 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
93 zap[
'E'] =
make_field(
id,
"emitter identifier (-1 = all)") = -1;
95 zap[
'r'] =
make_field(revert,
"revert disabling of transmissions");
96 zap[
'O'] =
make_field(option,
"ROOT fit option, see TH1::Fit.") =
"LS";
102 catch(
const exception &error) {
103 FATAL(error.what() << endl);
122 receivers[
i->getID()] =
i->getLocation();
125 for (tripods_container::const_iterator
i =
tripods.begin();
i !=
tripods.end(); ++
i) {
127 i->getUTMPosition() -
detector.getUTMPosition());
130 for (transmitters_container::const_iterator
i = transmitters.begin();
i != transmitters.end(); ++
i) {
134 catch(
const exception&) {}
144 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
146 if (
id ==
i->first ||
id == -1) {
156 JTreeScanner_t::iterator p = in.begin();
158 while (inputFile.hasNext()) {
160 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
162 const JEvt* evt = inputFile.next();
165 DEBUG(
"model" << endl << model << endl);
167 for ( ; p != in.end() && p-> begin()->getToA() < evt->
UNIXTimeStart - 0.5; ++p) {}
169 JTreeScanner_t::iterator q = p;
171 for ( ; q != in.end() && q->rbegin()->getToA() <= evt->
UNIXTimeStop + 0.5; ++q) {}
175 for (JTreeScanner_t::iterator
i = p;
i != q; ++
i) {
177 if (
id ==
i->getID() ||
id == -1) {
179 if (emitters.has(
i->getID())) {
181 const JEmitter& emitter = emitters[
i->getID()];
183 for (JEvent::const_iterator hit =
i->begin(); hit !=
i->end(); ++hit) {
185 if (receivers.has(hit->getID()) && geometry.
hasLocation(receivers[hit->getID()])) {
190 const JLocation& location = receivers[hit->getID()];
192 if (geometry .has(location.
getString()) &&
200 const double Vi =
V.getInverseVelocity(D, emitter.
getZ(), position.
getZ());
201 const double toa = hit->getToE() + D * Vi;
221 range.getLength() + 1,
range.getLowerLimit() - 0.5,
range.getUpperLimit() + 0.5));
225 range.getLength() + 1,
range.getLowerLimit() - 0.5,
range.getUpperLimit() + 0.5));
227 for (Int_t
i = 1;
i <= HA->GetXaxis()->GetNbins(); ++
i) {
228 HA->GetXaxis()->SetBinLabel(
i,
MAKE_CSTRING(geometry.at(
i-1).first));
229 HB->GetXaxis()->SetBinLabel(
i,
MAKE_CSTRING(geometry.at(
i-1).first));
234 TF1
f1(
"f1",
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))");
244 if (h1->GetEntries() >= numberOfEntries) {
248 h1->GetQuantiles(
Q.size(), X.data(),
Q.data());
250 f1.SetParameter(0, h1->GetMaximum());
251 f1.SetParameter(1, X[1]);
252 f1.SetParameter(2, 0.5*(X[2] - X[0]));
254 TFitResultPtr
result = h1->Fit(&f1, option.c_str(),
"same", X[1] - 5.0 * (X[2] - X[0]), X[1] + 5.0 * (X[2] - X[0]));
256 if (result.Get() == NULL) {
258 ERROR(
"Invalid TFitResultPtr " << h1->GetName() << endl);
275 out << H2 << HA << HB;
JModel getModel(const JEvt &evt)
Get model.
Utility class to parse command line options.
Q(UTCMax_s-UTCMin_s)-livetime_s
int main(int argc, char *argv[])
int getFloor() const
Get floor number.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
JContainer< std::vector< JTransmitter > > transmitters_container
static JDetectorMechanics getMechanics
Function object to get string mechanics.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
ROOT TTree parameter settings.
Router for direct addressing of module data in detector data structure.
Utility class to parse parameter values.
*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
#define MAKE_CSTRING(A)
Make C-string.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Dynamic ROOT object management.
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
double getDistance(const JVector3D &pos) const
Get distance to point.
floor_range getRangeOfFloors(const JDetector &detector)
Get range of floors.
Template definition for direct access of elements in ROOT TChain.
Data structure for detector geometry and calibration.
Utility class to parse parameter values.
Data structure for hydrophone.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
Model for fit to acoustics data.
double UNIXTimeStop
stop time
Auxiliary class for defining the range of iterations of objects.
static const JSoundVelocity getSoundVelocity(1541.0,-17.0e-3,-2000.0)
Function object for velocity of sound.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
I/O formatting auxiliaries.
JContainer< std::vector< JHydrophone > > hydrophones_container
Data structure for transmitter.
Logical location of module.
const JLocation & getLocation() const
Get location.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
JPosition3D getPosition(const Vec &pos)
Get position.
void Write(TDirectory &out, const bool wm=false)
Write objects to file.
const JPosition3D & getPosition() const
Get position.
JContainer< std::vector< JTripod > > tripods_container
General purpose messaging.
static const JStringCounter getNumberOfStrings
Function object to count unique strings.
Implementation for depth dependend velocity of sound.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Base class for JTreeScanner.
Direct access to module in detector data structure.
JACOUSTICS::JModel::string_type string
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
int getString() const
Get string number.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
double UNIXTimeStart
start time
General purpose class for object reading from a list of file names.
then fatal The output file must have the wildcard in the e g root fi 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.
Acoustic transmission identifier.
bool hasLocation(const JLocation &location) const
Check if this detector has given location.
no fit printf nominal n $STRING awk v X
Data structure for position in three dimensions.
const JLimit & getLimit() const
Get limit.
do set_variable DETECTOR_TXT $WORKDIR detector
Data structure for tripod.
Acoustic transmission identifier.
do echo Generating $dir eval D
double getZ() const
Get z position.
#define DEBUG(A)
Message macros.
Data structure for optical module.