38int main(
int argc,
char **argv) {
39 const unsigned int max_multiplicity = 31 ;
62 catch(
const exception &error) {
63 cerr << error.what() << endl ;
64 cout <<
"Use option -h! to display command line options." << endl ;
76 cerr <<
"FATAL ERROR. Could not open detector file '" << detectorFile <<
"'." << endl ;
84 const int ncolors = 5 ;
85 const int nice_colors[ncolors] = { kRed, kBlue, kBlack, kViolet, kCyan } ;
90 for(
unsigned int m=0; m<max_multiplicity+1; ++m ) {
92 sprintf( hname,
"hToT_m%u", m ) ;
94 sprintf( htitle,
"Exclusive %u-fold coincidence clusters;ToT [ns];a.u. (normalized)", m ) ;
95 hToT[m] =
new TH1D( hname, htitle, 256, -0.5, 255.5 ) ;
96 hToT[m]->SetLineColor( nice_colors[m%ncolors] ) ;
97 hToT[m]->SetLineWidth(2) ;
102 for(
unsigned int m=0; m<max_multiplicity+1; ++m ) {
104 sprintf( hname,
"ht_m%u", m ) ;
106 sprintf( htitle,
"Exclusive %u-fold coincidence clusters;Time after first hits [ns];a.u. (normalized)", m ) ;
107 const int margin = 5 ;
108 double xmin = -margin ;
109 double xmax = ceil(window) + margin ;
110 int nbins = (int) round(xmax-xmin) ;
111 ht[m] =
new TH1D( hname, htitle, nbins, xmin, xmax ) ;
112 ht[m]->SetLineColor( nice_colors[m%ncolors] ) ;
113 ht[m]->SetLineWidth(2) ;
119 TH2D hSizeVsMultiplicity(
"hSizeVsMultiplicity",
";cluster size;cluster multiplicity",
122 hSizeVsMultiplicity.SetOption(
"colz") ;
128 cout <<
"---------- Reading file(s) ----------" << endl ;
134 unsigned int nTS = 0 ;
137 if( (
int)nTS == maxnslices ) break ;
141 cout <<
"------ Frame index = " << ts->
getFrameIndex() << endl ;
145 for(JDAQTimeslice::const_iterator sf = ts->begin() ; sf!=ts->end() ; ++sf ) {
147 if( sf->size() == 0 ) continue ;
149 int moduleID = sf->getModuleID() ;
154 cluster_builder.
reset(*sf,module) ;
158 cout <<
"--- " <<
"S" << module.
getString() <<
"F" <<
module.getFloor() << endl ;
159 cout << setw(10) <<
"multiplicity"
160 << setw(20) <<
"excl. nclusters"
161 << setw(20) <<
"incl. nclusters"
163 for(
unsigned int m=2; m<=max_multiplicity; ++m) {
165 cout << setw(10) << m
179 hSizeVsMultiplicity.Fill( it->size(), it->getMultiplicity() ) ;
187 for(
unsigned int m=0; m<=max_multiplicity; ++m) {
188 for( vector<JCluster>::const_iterator it=cluster_builder.
begin_m(m); it!=cluster_builder.
end_m(m); ++it ) {
190 for( JHitL1::const_iterator hit=it->begin(); hit!=it->end(); ++hit ) {
191 hToT[m]->Fill( hit->getToT() ) ;
194 if( it->size() > 1 ) {
195 JHitL1::const_iterator first_hit = it->begin() ;
196 JHitL1::const_iterator hit(first_hit) ;
197 for( ++hit; hit!=it->end(); ++hit ) {
198 ht[m]->Fill( hit->getT() - first_hit->getT() ) ;
210 cout <<
"Read " << nTS <<
" time slices." << endl ;
212 TFile* f =
new TFile( ofname.c_str(),
"recreate" ) ;
214 hSizeVsMultiplicity.Write() ;
216 for(
unsigned int m=0; m<=max_multiplicity; ++m) {
217 if( hToT[m]->GetEntries()>0 ) {
219 hToT[m]->Scale( 1.0/hToT[m]->Integral() ) ;
223 if( ht[m]->GetEntries()>0 ) {
225 ht[m]->Scale( 1.0/ht[m]->Integral() ) ;
233 cout <<
"Output in '" << ofname <<
"'." << endl ;