45 fNbinX(0), fNbinY(0),
fSize(0), fInitStat(0), fScalar(0), fEye(0),
46 fEyeOffset(0), fXlo(0.), fXhi(0.), fYlo(0.), fYhi(0.),
47 fFirst(true), fProc(true), fFormX(nullptr), fFormY(nullptr), fCut(nullptr),
48 fMyFormX(false), fMyFormY(false), fMyCut(false), fDebug(0)
60 for(
auto& ith :
fH1 )
delete ith;
71 cerr <<
"THaVhist:ERROR:: Inconsistent sizes."<<endl;
76 cerr <<
"THaVhist:ERROR:: No X axis defined."<<endl;
81 cerr <<
"THaVhist:ERROR:: Improperly initialized."<<endl;
99 for(
auto& ith :
fH1 )
delete ith;
104 if (
fDebug) cout <<
"THaVhist :: init " <<
fName << endl;
107 cerr <<
"THaVhist:ERROR:: Histogram "<<
fName<<
" has no bins."<<endl;
112 if(
fVarX.empty() ) {
113 cerr <<
"THaVhist:WARNING:: Empty X formula." << endl;
115 string sname =
fName+
"X";
116 if (
fDebug) cout <<
"THaVhist :: X var " << sname << endl;
134 if (
fDebug) cout <<
"THaVhist :: Y bins " <<
fNbinY << endl;
138 cerr <<
"THaVhist:WARNING:: Empty Y formula."<<endl;
140 string sname =
fName+
"Y";
157 string sname =
fName+
"Cut";
172 if (
fDebug) cout <<
"THaVhist :: fSize = " <<
fSize << endl;
216 const string eye =
"[I]";
217 if(
fDebug ) cout <<
"FindEye for var = " << var << endl;
218 auto pos1 = var.find(
ToUpper(eye), 0);
219 auto pos2 = var.find(
ToLower(eye), 0);
220 auto pos = string::npos;
221 if( pos1 != string::npos ) pos = pos1;
222 if( pos2 != string::npos ) pos = pos2;
223 if( pos != string::npos ) {
224 if( var.length() == eye.length() ) {
225 if(
fDebug ) cout <<
"Is an Eye var [I]" << endl;
230 if(
fDebug ) cout <<
"Checking for Eye offset " << endl;
241 const string eyestart =
"[I+";
242 const string eyeend =
"]";
243 auto pos1 = var.find(
ToUpper(eyestart), 0);
244 auto pos2 = var.find(
ToLower(eyestart), 0);
245 auto pos = string::npos;
246 if( pos1 != string::npos ) pos = pos1;
247 if( pos2 != string::npos ) pos = pos2;
248 if( pos != string::npos ) {
249 auto pos3 = var.find(eyeend, pos);
250 if( pos3 != string::npos ) {
251 pos3 = var.find(eyeend, pos);
252 if( pos3 != string::npos ) {
253 string cnum = var.substr(pos + 3, var.length() - 4);
256 cout <<
"FindEyeOffset: substring with number " << pos <<
" "
257 << pos3 <<
" " << cnum <<
" " <<
fEyeOffset << endl;
262 if(
fDebug ) cout <<
"Not an Eye variable! " << endl;
308 Int_t sizex = 0, sizey = 0, sizec = 0;
314 if (
fDebug) cout <<
"THaVhist:: is scalar , sizex = " << sizex
315 <<
" sizec " << sizec <<
" fFormY " <<
fFormY << endl;
318 if (
fDebug) cout <<
"THaVhist:: sizey = " << sizey << endl;
319 if (sizey != sizex) {
320 cerr <<
"Scalar histogram, but inconsistent sizes of X and Y"<<endl;
325 if (sizec != sizex) {
326 cerr <<
"Scalar histogram, but cut size inconsistent"<<endl;
349 if ( (sizex != 0 && sizey != 0) && (sizex != sizey) ) {
350 cerr<<
"THaVhist::ERROR: inconsistent axis sizes"<<endl;
353 if ( (sizex != 0 && sizec > 1) && (sizex != sizec) ) {
354 cerr<<
"THaVhist::ERROR: inconsistent cut size"<<endl;
357 if ( (sizey != 0 && sizec > 1) && (sizey != sizec) ) {
358 cerr<<
"THaVhist::ERROR: inconsistent cut size"<<endl;
361 if ( (sizec <= 1) && (sizex <=1 || sizey <= 1) ) {
377 if(
fDebug) cout <<
"BookHisto:: " << hfirst <<
" " << hlast << endl;
378 if (hfirst > hlast)
return -1;
382 cerr <<
"THaVhist::WARNING: Asking for a too-huge";
383 cerr <<
" number of histograms !!" << endl;
388 if (
fNbinX == 0) cerr <<
"THaVhist:WARNING: fNbinX = 0."<<endl;
390 string sname =
fName;
392 bool doing_array = (
fSize>1);
394 if (
fDebug) cout <<
"BookHisto " << i <<
" " <<
fType << endl;
395 if (
fEye == 0 && doing_array) {
399 if (
fEye == 1 && i > hfirst)
continue;
401 fH1.push_back(
new TH1F(sname.c_str(),
405 fH1.push_back(
new TH1D(sname.c_str(),
409 fH1.push_back(
new TH2F(sname.c_str(), stitle.c_str(),
413 cerr <<
"THaVhist:WARNING:: ";
414 cerr <<
"2D histo with fNbiny = 0 ?"<<endl;
418 fH1.push_back(
new TH2D(sname.c_str(), stitle.c_str(),
421 cerr <<
"THaVhist:WARNING:: ";
422 cerr <<
"2D histo with fNbiny = 0 ?"<<endl;
444 if (
fDebug) cout <<
"---------------- THaVhist :: Process " <<
fName <<
" // " <<
fTitle << endl << flush;
463 if(
fDebug) cout <<
"THaVhist :: Process sizex " << sizex << endl << flush;
467 if(
fDebug) cout <<
"THaVhist :: Process sizey " << sizey << endl << flush;
473 Int_t zero = 0, i = 0;
475 Int_t *ix = (sizex == 0) ? &zero : &i;
476 Int_t *iy = (sizey == 0) ? &zero : &i;
478 Int_t *ic = (sizec <= 1) ? &zero : &i;
480 if(
fDebug) cout <<
"THaVhist :: Process ix, iy, ic "
481 << *ix <<
" " << *iy <<
" " << *ic << endl;
488 Int_t n = (sizex == 0 || sizey == 0) ?
max(sizex,sizey) :
min(sizex,sizey);
489 if(
fDebug) cout <<
"THaVhist :: Process n " <<
n << endl;
490 for ( ; i <
n; ++i) {
499 for (
Int_t i = 0; i < sizex; ++i) {
500 if(
fDebug) cout <<
"THaVhist :: 1D histo " << i <<
" " << sizec << endl;
501 if (sizec == sizex) {
514 if (
size < 0)
return -1;
521 Int_t zero = 0, i = 0;
524 for( ; i <
fSize; ++i ) {
529 for( ; i <
fSize; ++i ) {
542 for(
auto& ith :
fH1 ) ith->Write();
550 cerr <<
"THaVhist::ERROR:: Invalid histogram."<<endl;
551 cerr <<
"Offending line:"<<endl;
563 cerr <<
"Number of bins in X is zero."<<endl;
564 cerr <<
"This must be a typo error."<<endl;
567 cerr <<
"Illegal formula on X axis."<<endl;
571 cerr <<
"Illegal formula on Y axis."<<endl;
575 cerr <<
"Illegal formula for Cut."<<endl;
579 cerr <<
"No X axis defined. Must at least have an X."<<endl;
582 cerr <<
"Inconsistent size of X and Y axes."<<endl;
585 cerr <<
"Size of Cut inconsistent with size of X."<<endl;
588 cerr <<
"Size of Cut inconsistent with size of Y."<<endl;
593 cerr <<
"Unknown error."<<endl;
602 cout <<
" Size : "<<
fSize;
603 cout <<
" Title : '"<<
fTitle<<
"' "<<endl;
605 cout <<
" xlo "<<
fXlo<<
" xhi "<<
fXhi<<endl;
608 cout <<
" ylo "<<
fYlo<<
" yhi "<<
fYhi<<endl;
size_t size(const MatrixT &matrix)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
TString ToUpper(const TString &s)
TString ToLower(const TString &s)
char * Form(const char *fmt,...)
Int_t CheckCut(Int_t index=0)
static const int fgVHIST_HUGE
Bool_t FindEye(const string &var)
Bool_t FindEyeOffset(const string &var)
const string & GetVarX() const
const string & GetVarY() const
Int_t BookHisto(Int_t hfirst, Int_t hlast)
THaVhist(string type, string name, string title)
static Bool_t Initialized()
double min(double x, double y)
double max(double x, double y)
int CmpNoCase(const string &r, const string &s)