54 int main(
int argc,
char **argv)
63 JLimit_t& numberOfEvents = inputFile.getLimit();
75 JParser<> zap(
"Example program to determine N-fold coincidence rates.");
79 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
82 zap[
'C'] =
make_field(selector) = getROOTClassSelection<JDAQTimesliceTypes_t>();
84 zap[
's'] =
make_field(summaryFile) =
"halibut.txt";
90 catch(
const exception &error) {
91 FATAL(error.what() << endl);
121 JManager_t H1(
new TH1D(
"H1[%]", NULL, 100, -TMax_ns, +TMax_ns));
122 JManager_t T1(
new TH1D(
"T1[%]", NULL, 100, 0.0, TMax_s[M.
getLowerLimit()]));
139 STATUS(
"Processing " << *i << endl);
145 for ( ; ps->hasNext() && counter != inputFile.getLimit(); ++counter) {
147 STATUS(
"event: " << setw(10) << counter <<
'\r');
DEBUG(endl);
151 for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
153 JSuperFrame2D_t& buffer = JSuperFrame2D_t::demultiplex(*frame, router.
getModule(frame->getModuleID()));
155 for (JSuperFrame2D_t::iterator i = buffer.begin(); i != buffer.end(); ++i) {
159 JSuperFrame1D_t&
data = JSuperFrame1D_t::multiplex(buffer);
161 if (
data.size() > 1) {
163 TH1D* h1 = H1[frame->getModuleID()];
164 TH1D* t1 = T1[frame->getModuleID()];
170 while (++q !=
data.end() && q->getT() - p->getT() <= TMax_ns ) {}
176 const int i = router.
getIndex(frame->getModuleID());
177 const double ts =
getTimeOfRTS(frame->getFrameIndex()) + p->getT();
179 t1->Fill((ts - t0[i]) * 1.0e-9);
187 h1->Fill(JCombinatorics::getSign(__p->getPMT(),__q->getPMT()) * (__q->getT() - __p->getT()), 1.0/W);
202 const double V = (H1->GetXaxis()->GetXmax() - H1->GetXaxis()->GetXmin()) / (
double) H1->GetXaxis()->GetNbins();
205 for (JManager_t::iterator i = H1.begin(); i != H1.end(); ++i) {
206 i->second->Scale(1.0/(V*W));
209 for (JManager_t::iterator i = T1.begin(); i != T1.end(); ++i) {
210 i->second->Scale(1.0/i->second->GetMaximum());
214 if (summaryFile !=
"") {
216 const double V = (H1->GetXaxis()->GetXmax() - H1->GetXaxis()->GetXmin()) / (
double) H1->GetXaxis()->GetNbins();
222 ofstream out(summaryFile.c_str());
224 out <<
"Multiplicity " << M << endl;
225 out <<
"-------------------------------------------------------" << endl;
226 out <<
" location | Gauss | S - B | Total | slope " << endl;
227 out <<
" | [Hz] | [Hz] | [Hz] | [Hz] " << endl;
228 out <<
"-------------------------------------------------------" << endl;
232 for (
int string = 1;
string <= number_of_strings; ++string) {
233 for (
int floor = number_of_floors; floor >= 1; --floor) {
237 out <<
" " << setw(3) <<
string <<
' ' << setw(2) << floor <<
" ";
239 TH1D* h1 = (H1.find(
id) != H1.end() ? H1[id] : NULL);
240 TH1D* t1 = (T1.find(
id) != T1.end() ? T1[id] : NULL);
244 TF1
f1(
"f1",
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))/(TMath::Sqrt(2*TMath::Pi())*[2]) + [3]");
246 f1.SetParameter(0, h1->GetMaximum());
247 f1.SetParameter(1, 0.0);
248 f1.SetParameter(2, h1->GetRMS() * 0.25);
249 f1.SetParameter(3, h1->GetMinimum());
251 h1->Fit(&
f1, option.c_str(),
"same");
253 out <<
" | " <<
FIXED(8,PRECISION) <<
f1.GetParameter(0);
254 out <<
" | " <<
FIXED(8,PRECISION) << (h1->GetSumOfWeights() -
f1.GetParameter(3) * h1->GetNbinsX()) * V;
255 out <<
" | " <<
FIXED(8,PRECISION) << h1->GetSumOfWeights() * V;
257 Q[0].
put(
f1.GetParameter(0));
258 Q[1].
put((h1->GetSumOfWeights() -
f1.GetParameter(3) * h1->GetNbinsX()) * V);
259 Q[2].
put( h1->GetSumOfWeights() * V);
264 TF1
f1(
"f1",
"[0]*exp(-[1]*x)");
266 f1.SetParameter(0, t1->GetMaximum());
267 f1.SetParameter(1, 1.0 / t1->GetRMS());
269 t1->Fit(&
f1, option.c_str(),
"same");
271 out <<
" | " <<
FIXED(8,PRECISION) <<
f1.GetParameter(1);
273 Q[3].
put(
f1.GetParameter(1));
284 out <<
"-------------------------------------------------------" << endl;
285 out << setw(10) << left <<
" average";
287 for (
int i = 0; i !=
sizeof(Q)/
sizeof(Q[0]); ++i) {
Data structure for detector geometry and calibration.
int main(int argc, char **argv)
Basic data structure for L0 hit.
Dynamic ROOT object management.
Match operator for consecutive hits.
General purpose messaging.
#define DEBUG(A)
Message macros.
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...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
I/O formatting auxiliaries.
Auxiliary class to define a range between two values.
ROOT TTree parameter settings of various packages.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Logical location of module.
Router for direct addressing of module data in detector data structure.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
const int getIndex(const JObjectID &id) const
Get index of module.
Utility class to parse command line options.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
Auxiliary interface for direct access of elements in ROOT TChain.
Template definition for direct access of elements in ROOT TChain.
1-dimensional frame with time calibrated data from one optical module.
2-dimensional frame with time calibrated data from one optical module.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
int getNumberOfFloors(const JDetector &detector)
Get number of floors.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
static const JStringCounter getNumberOfStrings
Function object to count unique strings.
size_t getCount(const array_type< T > &buffer, const JCompare_t &compare)
Count number of unique values.
long long int factorial(const long long int n)
Determine factorial.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Long64_t counter_type
Type definition for counter.
KM3NeT DAQ data structures and auxiliaries.
double getFrameTime()
Get frame time duration.
double getTimeOfRTS(const JDAQChronometer &chronometer)
Get time of last RTS in ns since start of run for a given chronometer.
Auxiliary data structure for floating point format specification.
Type definition of range.
Auxiliary class for a type holder.
Auxiliary class to select ROOT class based on class name.
Auxiliary class to select JTreeScanner based on ROOT class name.
Auxiliary class for defining the range of iterations of objects.