31 using namespace KM3NETDAQ ;
33 using namespace JDETECTOR ;
34 using namespace JTRIGGER ;
35 using namespace JMONITOR ;
37 int main(
int argc,
char **argv) {
38 const unsigned int max_multiplicity = 31 ;
61 catch(
const exception &error) {
62 cerr << error.what() << endl ;
63 cout <<
"Use option -h! to display command line options." << endl ;
72 load(detectorFile, detector);
75 cerr <<
"FATAL ERROR. Could not open detector file '" << detectorFile <<
"'." << endl ;
83 const int ncolors = 5 ;
84 const int nice_colors[ncolors] = { kRed, kBlue, kBlack, kViolet, kCyan } ;
89 for(
unsigned int m=0; m<max_multiplicity+1; ++m ) {
91 sprintf( hname,
"hToT_m%u", m ) ;
93 sprintf( htitle,
"Exclusive %u-fold coincidence clusters;ToT [ns];a.u. (normalized)", m ) ;
94 hToT[m] =
new TH1D( hname, htitle, 256, -0.5, 255.5 ) ;
95 hToT[m]->SetLineColor( nice_colors[m%ncolors] ) ;
96 hToT[m]->SetLineWidth(2) ;
101 for(
unsigned int m=0; m<max_multiplicity+1; ++m ) {
103 sprintf( hname,
"ht_m%u", m ) ;
105 sprintf( htitle,
"Exclusive %u-fold coincidence clusters;Time after first hits [ns];a.u. (normalized)", m ) ;
106 const int margin = 5 ;
107 double xmin = -margin ;
108 double xmax = ceil(window) + margin ;
109 int nbins = (int) round(xmax-xmin) ;
110 ht[m] =
new TH1D( hname, htitle, nbins, xmin, xmax ) ;
111 ht[m]->SetLineColor( nice_colors[m%ncolors] ) ;
112 ht[m]->SetLineWidth(2) ;
118 TH2D hSizeVsMultiplicity(
"hSizeVsMultiplicity",
";cluster size;cluster multiplicity",
121 hSizeVsMultiplicity.SetOption(
"colz") ;
127 cout <<
"---------- Reading file(s) ----------" << endl ;
133 unsigned int nTS = 0 ;
136 if( (
int)nTS == maxnslices ) break ;
140 cout <<
"------ Frame index = " << ts->
getFrameIndex() << endl ;
144 for(JDAQTimeslice::const_iterator sf = ts->begin() ; sf!=ts->end() ; ++sf ) {
146 if( sf->size() == 0 )
continue ;
148 int moduleID = sf->getModuleID() ;
150 JModule module = detector[localID] ;
153 cluster_builder.
reset(*sf,module) ;
157 cout <<
"--- " <<
"S" << module.
getString() <<
"F" << module.
getFloor() << endl ;
158 cout << setw(10) <<
"multiplicity"
159 << setw(20) <<
"excl. nclusters"
160 << setw(20) <<
"incl. nclusters"
162 for(
unsigned int m=2; m<=max_multiplicity; ++m) {
164 cout << setw(10) << m
178 hSizeVsMultiplicity.Fill( it->size(), it->getMultiplicity() ) ;
186 for(
unsigned int m=0; m<=max_multiplicity; ++m) {
189 for( JHitL1::const_iterator hit=it->begin(); hit!=it->end(); ++hit ) {
190 hToT[m]->Fill( hit->getToT() ) ;
193 if( it->size() > 1 ) {
194 JHitL1::const_iterator first_hit = it->begin() ;
195 JHitL1::const_iterator hit(first_hit) ;
196 for( ++hit; hit!=it->end(); ++hit ) {
197 ht[m]->Fill( hit->getT() - first_hit->getT() ) ;
205 if( verbose ) cout << endl ;
209 cout <<
"Read " << nTS <<
" time slices." << endl ;
211 TFile* f =
new TFile( ofname.c_str(),
"recreate" ) ;
213 hSizeVsMultiplicity.Write() ;
215 for(
unsigned int m=0; m<=max_multiplicity; ++m) {
216 if( hToT[m]->GetEntries()>0 ) {
218 hToT[m]->Scale( 1.0/hToT[m]->Integral() ) ;
222 if( ht[m]->GetEntries()>0 ) {
224 ht[m]->Scale( 1.0/ht[m]->Integral() ) ;
232 cout <<
"Output in '" << ofname <<
"'." << endl ;
Utility class to parse command line options.
virtual const pointer_type & next()
Get next element.
Data structure for a composite optical module.
unsigned int getInclusiveNclusters(const unsigned int multiplicity) const
return the number of clusters with at least the given multiplicity
Router for direct addressing of module data in detector data structure.
void reset(const JDAQSuperFrame &frame, const JModule &module)
This is a way to re-use the allocated memory.
Data structure for detector geometry and calibration.
vector< JCluster >::const_iterator end_m(unsigned int multiplicity) const
returns end iterator for clusters with exactly the given multiplicity
int getFrameIndex() const
Get frame index.
int first
index of module in detector data structure
int getFloor() const
Get floor number.
int getString() const
Get string number.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
vector< JCluster >::const_iterator end_inclusive_m(unsigned int multiplicity) const
returns end iterator for clusters with at least the given multiplicity
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.
virtual bool hasNext()
Check availability of next element.
Utility class to parse command line options.
unsigned int getNclusters(const unsigned int multiplicity) const
return the number of clusters with exactly the given multiplicity
const JModuleAddress & getAddress(const JObjectID &id) const
Get address of module.
ROOT TTree parameter settings.
vector< JCluster >::const_iterator begin_inclusive_m(unsigned int multiplicity) const
returns begin iterator for clusters with at least the given multiplicity
KM3NeT DAQ constants, bit handling, etc.
Local coincidence cluster builder.
vector< JCluster >::const_iterator begin_m(unsigned int multiplicity) const
returns begin iterator for clusters with exactly the given multiplicity
int main(int argc, char *argv[])