@@ -568,30 +568,30 @@ results fitOneGauss(TH1D* hist, bool fitTwice, bool debug) {
568568 return results (value , error , width , werror );
569569}
570570
571- double DoubleSidedCrystalballFunction (double * x , double * par ) {
572- double alpha_l = par [0 ];
573- double alpha_h = par [1 ];
574- double n_l = par [2 ];
575- double n_h = par [3 ];
576- double mean = par [4 ];
577- double sigma = par [5 ];
578- double N = par [6 ];
579- float t = (x [0 ]- mean )/ sigma ;
571+ double DoubleSidedCrystalballFunction (double * x , double * par ) {
572+ double alpha_l = par [0 ];
573+ double alpha_h = par [1 ];
574+ double n_l = par [2 ];
575+ double n_h = par [3 ];
576+ double mean = par [4 ];
577+ double sigma = par [5 ];
578+ double N = par [6 ];
579+ float t = (x [0 ] - mean ) / sigma ;
580580 double result ;
581- double fact1TLessMinosAlphaL = alpha_l / n_l ;
582- double fact2TLessMinosAlphaL = (n_l / alpha_l ) - alpha_l - t ;
583- double fact1THihgerAlphaH = alpha_h / n_h ;
581+ double fact1TLessMinosAlphaL = alpha_l / n_l ;
582+ double fact2TLessMinosAlphaL = (n_l / alpha_l ) - alpha_l - t ;
583+ double fact1THihgerAlphaH = alpha_h / n_h ;
584584 // double fact2THigherAlphaH = (n_h/alpha_h) - alpha_h + t;
585-
585+
586586 if (- alpha_l <= t && alpha_h >= t ) {
587587 result = exp (-0.5 * t * t );
588588 } else if (t < - alpha_l ) {
589- result = exp (-0.5 * alpha_l * alpha_l ) * pow (fact1TLessMinosAlphaL * fact2TLessMinosAlphaL , - n_l );
589+ result = exp (-0.5 * alpha_l * alpha_l ) * pow (fact1TLessMinosAlphaL * fact2TLessMinosAlphaL , - n_l );
590590 } else if (t > alpha_h ) {
591- result = exp (-0.5 * alpha_l * alpha_l ) * pow (fact1THihgerAlphaH * fact1THihgerAlphaH , - n_h );
591+ result = exp (-0.5 * alpha_l * alpha_l ) * pow (fact1THihgerAlphaH * fact1THihgerAlphaH , - n_h );
592592 }
593593 return N * result ;
594- }
594+ }
595595
596596results fitDoubleSidedCrystalball (TH1D * hist , bool /* fitTwice */ , bool debug ) {
597597 double rms ;
@@ -619,17 +619,18 @@ results fitDoubleSidedCrystalball(TH1D* hist, bool /* fitTwice */, bool debug) {
619619 if (LowEdge < 0.5 )
620620 LowEdge = 0.5 ;
621621 diff = Fit1 -> Value (1 ) - LowEdge ;
622- HighEdge = (diff > fitrangeFactor1 * rms ) ? (Fit1 -> Value (1 ) + fitrangeFactor1 * Fit1 -> Value (2 )) : (Fit1 -> Value (1 ) + 1.5 * diff );
622+ HighEdge = (diff > fitrangeFactor1 * rms ) ? (Fit1 -> Value (1 ) + fitrangeFactor1 * Fit1 -> Value (2 ))
623+ : (Fit1 -> Value (1 ) + 1.5 * diff );
623624 if (HighEdge > 5.0 )
624625 HighEdge = 5.0 ;
625626 if (debug )
626627 std ::cout << " Range for second Fit " << LowEdge << ":" << HighEdge << std ::endl ;
627628 TObject * ob2 = gROOT -> FindObject ("fitDSCB" );
628629 if (ob2 != nullptr )
629630 ob2 -> Delete ();
630- TF1 * fitDSCB = new TF1 ("fitDSCB" , DoubleSidedCrystalballFunction , LowEdge , HighEdge , 7 );
631+ TF1 * fitDSCB = new TF1 ("fitDSCB" , DoubleSidedCrystalballFunction , LowEdge , HighEdge , 7 );
631632 fitDSCB -> SetParameters (1 , 2 , 2 , 1 , value , width , hist -> Integral (LowEdge , HighEdge ));
632- fitDSCB -> SetParNames ("alpha_{low}" ,"alpha_{high}" ,"n_{low}" , "n_{high}" , "mean" , "sigma" , "Norm" );
633+ fitDSCB -> SetParNames ("alpha_{low}" , "alpha_{high}" , "n_{low}" , "n_{high}" , "mean" , "sigma" , "Norm" );
633634 TFitResultPtr Fit = hist -> Fit (fitDSCB , option .c_str (), "" , LowEdge , HighEdge );
634635 value = Fit -> Value (4 );
635636 error = Fit -> FitResult ::Error (4 );
@@ -770,7 +771,8 @@ void FitHistStandard(std::string infile,
770771 }
771772 if (hist -> GetEntries () > 4 ) {
772773 bool flag = (j == 0 ) ? true : false;
773- results meaner = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist , flag , debug ) : fitDoubleSidedCrystalball (hist , flag , debug );
774+ results meaner = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist , flag , debug )
775+ : fitDoubleSidedCrystalball (hist , flag , debug );
774776 value = meaner .mean ;
775777 error = meaner .errmean ;
776778 width = meaner .width ;
@@ -889,7 +891,8 @@ void FitHistExtended(const char* infile,
889891 }
890892 if (hist0 -> GetEntries () > 10 ) {
891893 double rms ;
892- results meaner0 = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist0 , true, debug ) : fitDoubleSidedCrystalball (hist0 , true, debug );
894+ results meaner0 =
895+ (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist0 , true, debug ) : fitDoubleSidedCrystalball (hist0 , true, debug );
893896 std ::pair < double , double > meaner1 = GetMean (hist0 , 0.2 , 2.0 , rms );
894897 std ::pair < double , double > meaner2 = GetWidth (hist0 , 0.2 , 2.0 );
895898 if (debug ) {
@@ -931,15 +934,17 @@ void FitHistExtended(const char* infile,
931934 if (j == 0 ) {
932935 sprintf (name , "%sOne" , hist1 -> GetName ());
933936 TH1D * hist2 = (TH1D * )hist1 -> Clone (name );
934- fitOneGauss (hist2 , true, debug );
937+ fitOneGauss (hist2 , true, debug );
935938 hists .push_back (hist2 );
936- results meaner = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist , true, debug ) : fitDoubleSidedCrystalball (hist , true, debug );
939+ results meaner = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist , true, debug )
940+ : fitDoubleSidedCrystalball (hist , true, debug );
937941 value = meaner .mean ;
938942 error = meaner .errmean ;
939943 width = meaner .width ;
940944 werror = meaner .errwidth ;
941945 } else {
942- results meaner = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist , true, debug ) : fitDoubleSidedCrystalball (hist , true, debug );
946+ results meaner = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist , true, debug )
947+ : fitDoubleSidedCrystalball (hist , true, debug );
943948 value = meaner .mean ;
944949 error = meaner .errmean ;
945950 width = meaner .width ;
@@ -1010,7 +1015,8 @@ void FitHistExtended(const char* infile,
10101015 if (total > 4 ) {
10111016 sprintf (name , "%sOne" , hist1 -> GetName ());
10121017 TH1D * hist2 = (TH1D * )hist1 -> Clone (name );
1013- results meanerr = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist2 , true, debug ) : fitDoubleSidedCrystalball (hist2 , true, debug );
1018+ results meanerr = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist2 , true, debug )
1019+ : fitDoubleSidedCrystalball (hist2 , true, debug );
10141020 value = meanerr .mean ;
10151021 error = meanerr .errmean ;
10161022 width = meanerr .width ;
@@ -1027,7 +1033,8 @@ void FitHistExtended(const char* infile,
10271033 hists .push_back (hist3 );
10281034 }
10291035 // results meaner0 = fitTwoGauss(hist, debug);
1030- results meaner0 = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist , true, debug ) : fitDoubleSidedCrystalball (hist , true, debug );
1036+ results meaner0 = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist , true, debug )
1037+ : fitDoubleSidedCrystalball (hist , true, debug );
10311038 value = meaner0 .mean ;
10321039 error = meaner0 .errmean ;
10331040 double rms ;
@@ -1071,7 +1078,7 @@ void FitHistExtended2(const char* infile,
10711078 const char * outfile ,
10721079 std ::string prefix ,
10731080 int numb = 50 ,
1074- int type = 0 ,
1081+ int type = 0 ,
10751082 bool append = true,
10761083 int iname = 3 ,
10771084 bool debug = false) {
@@ -1143,15 +1150,17 @@ void FitHistExtended2(const char* infile,
11431150 if (j == 0 ) {
11441151 sprintf (name , "%sOne" , hist1 -> GetName ());
11451152 TH1D * hist2 = (TH1D * )hist1 -> Clone (name );
1146- fitOneGauss (hist2 , true, debug );
1153+ fitOneGauss (hist2 , true, debug );
11471154 hists .push_back (hist2 );
1148- results meaner = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist , true, debug ) : fitDoubleSidedCrystalball (hist , true, debug );
1155+ results meaner = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist , true, debug )
1156+ : fitDoubleSidedCrystalball (hist , true, debug );
11491157 value = meaner .mean ;
11501158 error = meaner .errmean ;
11511159 width = meaner .width ;
11521160 werror = meaner .errwidth ;
11531161 } else {
1154- results meaner = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist , true, debug ) : fitDoubleSidedCrystalball (hist , true, debug );
1162+ results meaner = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist , true, debug )
1163+ : fitDoubleSidedCrystalball (hist , true, debug );
11551164 value = meaner .mean ;
11561165 error = meaner .errmean ;
11571166 width = meaner .width ;
@@ -1227,7 +1236,8 @@ void FitHistExtended2(const char* infile,
12271236 if (total > 4 ) {
12281237 sprintf (name , "%sOne" , hist1 -> GetName ());
12291238 TH1D * hist2 = (TH1D * )hist1 -> Clone (name );
1230- results meanerr = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist2 , true, debug ) : fitDoubleSidedCrystalball (hist2 , true, debug );
1239+ results meanerr = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist2 , true, debug )
1240+ : fitDoubleSidedCrystalball (hist2 , true, debug );
12311241 value = meanerr .mean ;
12321242 error = meanerr .errmean ;
12331243 width = meanerr .width ;
@@ -1237,7 +1247,8 @@ void FitHistExtended2(const char* infile,
12371247 std ::cout << hist2 -> GetName () << " MPV " << value << " +- " << error << " Width " << width << " +- "
12381248 << werror << " W/M " << wbyv << " +- " << wverr << std ::endl ;
12391249 hists .push_back (hist2 );
1240- results meaner0 = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist , true, debug ) : fitDoubleSidedCrystalball (hist , true, debug );
1250+ results meaner0 = (((type / 10 ) % 10 ) == 0 ) ? fitOneGauss (hist , true, debug )
1251+ : fitDoubleSidedCrystalball (hist , true, debug );
12411252 value = meaner0 .mean ;
12421253 error = meaner0 .errmean ;
12431254 double rms ;
0 commit comments