From 1d9f35b87707299bb65b872462bab98f066fb246 Mon Sep 17 00:00:00 2001 From: marcellocosti Date: Sat, 4 Jan 2025 17:06:16 +0100 Subject: [PATCH] Removed leftovers --- run3/flow/WriteTF1.root | Bin 3929 -> 0 bytes run3/flow/flow_analysis_utils.py | 9 +-- run3/flow/get_vn_vs_mass.py | 82 +++++++++------------ run3/flow/invmassfitter/InvMassFitter.cxx | 18 ----- run3/flow/invmassfitter/VnVsMassFitter.cxx | 79 ++------------------ run3/flow/invmassfitter/VnVsMassFitter.h | 5 +- run3/flow/kde_producer.py | 44 ++++------- run3/flow/project_thnsparse.py | 20 ++--- run3/flow/run_full_flow_analysis.py | 1 - 9 files changed, 66 insertions(+), 192 deletions(-) delete mode 100644 run3/flow/WriteTF1.root diff --git a/run3/flow/WriteTF1.root b/run3/flow/WriteTF1.root deleted file mode 100644 index 8725abbe2ae867a619155d58b51df8535591ff4f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3929 zcma)9cQ72@{$0IBCy3syx_T!;bV7*U%WARFMU5^*jowQ_MAT)~)uM-psEbvivxv5d z_~LE+{`k$jc{A_bna?eA?>V3Q*O_yCAP_$Q0KE+W0Gt2-a&t_vVfM0^!orjiE@pBD z0B|u6h>!rR5uG%PF(~D68m-u)iN5Y*%}}c$pdK`96>i~!T8frTAa5TRBL94rhF7eFH!g+ndnry9Vs}nY9QB0c2sd<| z?ESoFjWp{7!zld^Ltu!ox@#dSvmwXH7nSopD~D~023t*dTXh+In|8I+ zM=QeeA=mVs>hr1Njje4h*E-`2jv+e>i3Dh@ZFILlz`HRU??!TxwvSLY?p38Sm`VBL z+)1VDWdA>1^-Ad2PxsM^^ZZRBtI7{wm-$A8MbrNBAN}KcH7A6a1f$x)t8Y6Ry}hrw zuC(&wLb8WX5C%*C)T6eo#IFz`IoA41wH`fo-y@@Un(G!s^iii*i;{!kdDWAlTZ_JE zfp9D27Qc~wPq0gmPT&E~l|NHWfRcr^ThBu@+r0Z*nych;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ns#!4v?C_7Wuegn$Yfg0A=R%{tJxbXcE_*l9sVm6gu%{Qr3 z#b7IOF6aQMlHp4L#-en zdE-Xdyv-%OoTl^f@?Hai*wLUJ@g=VR;;VTr|RjAKN_jnG;Q-?yQ5V zRQKNPhY6B|8`i+ulJx<+3klg971@h`^WmXL3-xo`V;gl*BJ}Mb5c_R`qqlb06F!~m z_oQ9ZMQD(s97`?YWnGy%5E^?_| zr~kQDz4QH6@p;abXO18dvvi|IP{rhH6^llDKSZ_8eYmPp z`hAfq5Ni0(K|?`gjpy(E7H6V;&PHroE3&7aWgM_1-LC!8awD!BiZ#yh$`RiNP2=YC z?RrA(EN%HEo=aYW_c(amgpVqOhLdzz<<(2N=JMl%XfGq;$tjC=&yIGT%A$$W7Z!dT zUYt3tyTwf)TgFbx&1%J^T0A1OLZ)P!JTFvLmFtRZ9}-&fHV%C9DxEC|I%1&J zJPJBfb{wI&Co7BAuf8>GIWi!NjXbzK z{eZC5VpNWFa6#TCXi>iFPF3O^xCT8uhmhvtv}0_X^Integral(fHistoInvMass->FindBin(fMinMass),fHistoInvMass->FindBin(fMaxMass),"width"); fOnlySideBands = kTRUE; @@ -327,14 +320,10 @@ Int_t InvMassFitter::MassFitter(Bool_t draw){ fRflFunc = CreateReflectionFunction("freflect"); fBkRFunc = CreateBackgroundPlusReflectionFunction("fbkgrfl"); } - // cout << "sfTemplates: " << fTemplates << endl; if(fTemplates){ printf(" ---> Final fit includes templates\n"); fTemplFunc = CreateTemplatesFunction("ftempl"); } - // for(int iFunc=0; iFuncGetNpar() << endl; for(Int_t ipar=0; iparGetParLimits(ipar,parmin,parmax); ftot->SetParLimits(ipar+fNParsBkg+fNParsSig+fNParsSec+fNParsRfl,parmin,parmax); - cout << "Setting iPar" << ipar << " to " << fTemplFunc->GetParameter(ipar) - << ", parname: " << fTemplFunc->GetParName(ipar) << ", parlimits: [" - << parmin << "," << parmax << "]" << endl; ftot->SetParameter(ipar+fNParsBkg+fNParsSig+fNParsSec+fNParsRfl,fTemplFunc->GetParameter(ipar)); ftot->SetParName(ipar+fNParsBkg+fNParsSig+fNParsSec+fNParsRfl,fTemplFunc->GetParName(ipar)); } } - cout << "Returning fTot" << endl; return ftot; } //__________________________________________________________________________ diff --git a/run3/flow/invmassfitter/VnVsMassFitter.cxx b/run3/flow/invmassfitter/VnVsMassFitter.cxx index 67261b08..cd87108b 100755 --- a/run3/flow/invmassfitter/VnVsMassFitter.cxx +++ b/run3/flow/invmassfitter/VnVsMassFitter.cxx @@ -225,55 +225,35 @@ VnVsMassFitter::~VnVsMassFitter() { //________________________________________________________________ Bool_t VnVsMassFitter::SimultaneousFit(Bool_t drawFit) { - cout << "PERFORMING SIMULTANEOUS FIT" << endl; if(!fMassHisto || !fVnVsMassHisto) {printf("Histograms not set! Exit."); return kFALSE;} DefineNumberOfParameters(); const Int_t nparsmass = fNParsMassSgn+fNParsMassBkg+fNParsSec+fNParsRfl+fNParsTempls; - cout << "nParsMass " << nparsmass << endl; Int_t NvnParsSgn = 1; if(fSecondPeak && fDoSecondPeakVn) {NvnParsSgn+=1;} if(fReflections && fVnRflOpt==kFreePar) {NvnParsSgn+=1;} - // if(fTemplates) {NvnParsSgn+=fNParsTempls;} - cout << "Added " << fNParsTempls << " to vn sgn pars" << endl; const Int_t nparsvn = nparsmass+fNParsVnBkg+NvnParsSgn; - cout << "nparsvn " << nparsvn << endl; - cout << "Starting PREFITS" << endl; Bool_t massprefit=MassPrefit(); if(!massprefit) {printf("Impossible to perform the mass prefit"); return kFALSE;} - cout << "Mass PREFIT" << endl; Bool_t vnprefit=VnSBPrefit(); - cout << "vnprefit: " << vnprefit << endl; if(!vnprefit) {printf("Impossible to perform the bkg vn prefit"); return kFALSE;} - cout << "Vn PREFIT" << endl; - cout << "PREFITS DONE" << endl; - - cout << "Mass function obtained from the prefit" << endl; - cout << "Npar: " << fMassFuncFromPrefit->GetNpar() << endl; std::vector initpars; for(Int_t iBkgPar=0; iBkgParGetParName(iBkgPar) << ", value: " << fMassFuncFromPrefit->GetParameter(iBkgPar) << endl; initpars.push_back(fMassFuncFromPrefit->GetParameter(iBkgPar)); } for(Int_t iSgnPar=0; iSgnParGetParName(iSgnPar+fNParsMassBkg) << ", value: " << fMassFuncFromPrefit->GetParameter(iSgnPar+fNParsMassBkg) << endl; initpars.push_back(fMassFuncFromPrefit->GetParameter(iSgnPar+fNParsMassBkg)); } for(Int_t iSecPeakPar=0; iSecPeakParGetParName(iSecPeakPar+fNParsMassBkg+fNParsMassSgn) << ", value: " << fMassFuncFromPrefit->GetParameter(iSecPeakPar+fNParsMassBkg+fNParsMassSgn) << endl; initpars.push_back(fMassFuncFromPrefit->GetParameter(iSecPeakPar+fNParsMassBkg+fNParsMassSgn)); } for(Int_t iReflPar=0; iReflParGetParName(iReflPar+fNParsMassBkg+fNParsMassSgn+fNParsSec) << ", value: " << fMassFuncFromPrefit->GetParameter(iReflPar+fNParsMassBkg+fNParsMassSgn+fNParsSec) << endl; initpars.push_back(fMassFuncFromPrefit->GetParameter(iReflPar+fNParsMassBkg+fNParsMassSgn+fNParsSec)); } for(Int_t iTemplPar=0; iTemplParGetParName(iTemplPar+fNParsMassBkg+fNParsMassSgn+fNParsSec+fNParsRfl) << ", value: " << fMassFuncFromPrefit->GetParameter(iTemplPar+fNParsMassBkg+fNParsMassSgn+fNParsSec+fNParsRfl) << endl; initpars.push_back(fMassFuncFromPrefit->GetParameter(iTemplPar+fNParsMassBkg+fNParsMassSgn+fNParsSec+fNParsRfl)); } - cout << "------------" << endl; - cout << "Background parameters for the VnBkgFunc: " << fNParsVnBkg << endl; for(Int_t iVnBkgPar=0; iVnBkgParGetParameter(iVnBkgPar));} else {initpars.push_back(0.05);} @@ -282,16 +262,9 @@ Bool_t VnVsMassFitter::SimultaneousFit(Bool_t drawFit) { if(fSecondPeak && fDoSecondPeakVn) {initpars.push_back(0.10);} //initial parameter for second peak vn fMassTotFunc = new TF1("fMassTotFunc",this,&VnVsMassFitter::MassFunc,fMassMin,fMassMax,nparsmass,"VnVsMassFitter","MassFunc"); - cout << "Number of parameters for vn function: " << nparsvn << endl; fVnTotFunc = new TF1("fVnTotFunc",this,&VnVsMassFitter::vnFunc,fMassMin,fMassMax,nparsvn,"VnVsMassFitter","vnFunc"); SetParNames(); - for(int iMassPar=0; iMassParGetNpar(); iMassPar++) { - cout << "[Mass] iPar" << iMassPar << ", name: " << fMassTotFunc->GetParName(iMassPar) << endl; - } - for(int iVnPar=0; iVnParGetNpar(); iVnPar++) { - cout << "[Vn] iPar" << iVnPar << ", name: " << fVnTotFunc->GetParName(iVnPar) << endl; - } ROOT::Math::WrappedMultiTF1 wfTotMass(*fMassTotFunc,1); ROOT::Math::WrappedMultiTF1 wfTotVn(*fVnTotFunc,1); @@ -332,33 +305,22 @@ Bool_t VnVsMassFitter::SimultaneousFit(Bool_t drawFit) { } if(fTemplates) { for(int iTemplPar=0; iTemplParfInitWeights.size(); iTemplPar++) { - cout << "Setting template parameter " << iTemplPar << endl; - cout << "Mass func parameter " << iTemplPar+fNParsMassBkg+fNParsMassSgn+fNParsSec+fNParsRfl << endl; - cout << fitter.Config().ParSettings(iTemplPar+fNParsMassBkg+fNParsMassSgn+fNParsSec+fNParsRfl).Name() << endl; - cout << "[" << fInitWeights[iTemplPar] << ", " << fWeightsLowerLims[iTemplPar] - << ", " << fWeightsUpperLims[iTemplPar] << "]" << endl; - if(this->fWeightsLowerLims[iTemplPar] > this->fWeightsUpperLims[iTemplPar]) { - cout << "Fix mass" << endl; fitter.Config().ParSettings(iTemplPar+fNParsMassBkg+fNParsMassSgn+fNParsSec+fNParsRfl).SetValue(fInitWeights[iTemplPar]); fitter.Config().ParSettings(iTemplPar+fNParsMassBkg+fNParsMassSgn+fNParsSec+fNParsRfl).Fix(); } else { - cout << "Vary mass" << endl; fitter.Config().ParSettings(iTemplPar+fNParsMassBkg+fNParsMassSgn+fNParsSec+fNParsRfl).SetValue(fInitWeights[iTemplPar]); fitter.Config().ParSettings(iTemplPar+fNParsMassBkg+fNParsMassSgn+fNParsSec+fNParsRfl).SetLimits(fWeightsLowerLims[iTemplPar],fWeightsUpperLims[iTemplPar]); } - cout << "---" << endl; } } fitter.Config().MinimizerOptions().SetPrintLevel(0); fitter.Config().SetMinimizer("Minuit2","Migrad"); for(Int_t iPar=0; iParGetParName(iPar));} - cout << "nparsvn: " << nparsvn << endl; // fit FCN function directly // (specify optionally data size and flag to indicate that is a chi2 fit Bool_t isFitOk = fitter.FitFCN(nparsvn,globalChi2,0,dataMass.Size()+dataVn.Size(),kFALSE); - cout << "isFitOk: " << isFitOk << endl; if(!isFitOk) return kFALSE; ROOT::Fit::FitResult result = fitter.Result(); @@ -379,7 +341,6 @@ Bool_t VnVsMassFitter::SimultaneousFit(Bool_t drawFit) { fMassTotFunc->SetParError(iPar,result.ParError(iPar)); } if(iPar>=nparsmass && iParSetParameter(iPar-nparsmass,result.Parameter(iPar)); fVnBkgFunc->SetParError(iPar-nparsmass,result.ParError(iPar)); } @@ -418,18 +379,18 @@ Bool_t VnVsMassFitter::SimultaneousFit(Bool_t drawFit) { }, fMassMin, fMassMax, 0)); fKDEVnTemplatesDraw.push_back(new TF1(Form("vnTempl_%s", fKDETemplates[iTempl].GetName()), - [&, this, iTempl, result, vnSgn] (double *x, double *par) { + [&, this, iTempl, vnSgn] (double *x, double *par) { return (vnSgn * this->fKDEMassTemplatesDraw[iTempl]->Eval(x[0])) / (this->fMassTotFunc->Eval(x[0])); }, fMassMin, fMassMax, 0)); } fKDEVnTemplatesDraw.push_back(new TF1("vnBkg", - [&, this, result, vnSgn] (double *x, double *par) { + [&, this, vnSgn] (double *x, double *par) { return (this->fVnBkgFunc->Eval(x[0]) * this->fMassBkgFunc->Eval(x[0])) / (this->fMassTotFunc->Eval(x[0])); }, fMassMin, fMassMax, 0)); fKDEVnTemplatesDraw.push_back(new TF1("vnSgn", - [&, this, result, vnSgn] (double *x, double *par) { + [&, this, vnSgn] (double *x, double *par) { return (vnSgn * this->fMassSgnFunc->Eval(x[0])) / (this->fMassTotFunc->Eval(x[0])); }, fMassMin, fMassMax, 0)); } @@ -451,7 +412,6 @@ Bool_t VnVsMassFitter::SimultaneousFit(Bool_t drawFit) { fChiSquare = result.MinFcnValue(); fNDF = result.Ndf(); fProb = result.Prob(); - cout << "Combined fit completed" << endl; return kTRUE; } @@ -459,7 +419,6 @@ Bool_t VnVsMassFitter::SimultaneousFit(Bool_t drawFit) { void VnVsMassFitter::DrawHere(TVirtualPad* c){ /// Core method to draw the fit output - cout << "[VnVsMassFitter] DrawHere" << endl; gStyle->SetOptStat(0); gStyle->SetCanvasColor(0); gStyle->SetFrameFillColor(0); @@ -508,8 +467,7 @@ void VnVsMassFitter::DrawHere(TVirtualPad* c){ fMassTotFunc->Draw("same"); } if(fTemplates) { - cout << "Drawing templates for mass spectrum" << endl; - for(int iMassTempl=0; iMassTemplfKDETemplates.size()/2; iMassTempl++) { + for(int iMassTempl=0; iMassTemplfKDEMassTemplatesDraw.size(); iMassTempl++) { fKDEMassTemplatesDraw[iMassTempl]->SetLineColor(kMagenta); fKDEMassTemplatesDraw[iMassTempl]->SetRange(fMassMin,fMassMax); fKDEMassTemplatesDraw[iMassTempl]->Draw("same"); @@ -555,8 +513,7 @@ void VnVsMassFitter::DrawHere(TVirtualPad* c){ fVnTotFunc->Draw("same"); } if(fTemplates) { - cout << "Drawing templates for vn" << endl; - for(int iVnTempl=this->fKDETemplates.size()/2; iVnTemplfKDETemplates.size(); iVnTempl++) { + for(int iVnTempl=0; iVnTemplfKDEVnTemplatesDraw.size(); iVnTempl++) { fKDEVnTemplatesDraw[iVnTempl]->SetLineColor(kMagenta); fKDEVnTemplatesDraw[iVnTempl]->SetRange(fMassMin,fMassMax); fKDEVnTemplatesDraw[iVnTempl]->Draw("same"); @@ -608,9 +565,7 @@ Bool_t VnVsMassFitter::MassPrefit() { if(fFixRflOverSig) {fMassFitter->SetFixReflOverS(fRflOverSig);} } if(fTemplates) {fMassFitter->SetTemplates(fKDETemplates, fInitWeights, fWeightsLowerLims, fWeightsUpperLims);} - cout << "Fitting" << endl; Bool_t status = fMassFitter->MassFitter(kFALSE); - cout << "Status " << status << endl; if(status) { fMassFuncFromPrefit = (TF1*)fMassFitter->GetMassFunc(); @@ -647,7 +602,6 @@ Bool_t VnVsMassFitter::VnSBPrefit() { TGraphErrors* gVnVsMassSB = new TGraphErrors(nSBbins); for(Int_t iBin=0; iBinGetBinContent(iBin+1) << endl; gVnVsMassSB->SetPoint(iBin,fVnVsMassHisto->GetBinCenter(iBin+1),fVnVsMassHisto->GetBinContent(iBin+1)); gVnVsMassSB->SetPointError(iBin,fVnVsMassHisto->GetBinWidth(iBin+1)/2,fVnVsMassHisto->GetBinError(iBin+1)); } @@ -827,11 +781,8 @@ void VnVsMassFitter::SetParNames() { if(fReflections) {fVnTotFunc->SetParName(fNParsMassBkg+fNParsMassSgn+fNParsSec,"ReflOverS");} if(fTemplates) { - cout << "Setting names of template parameters" << endl; for(int iTempl=0; iTemplfNParsTempls; iTempl++) { - cout << "iPar" << iTempl+fNParsMassSgn+fNParsMassBkg+fNParsSec+fNParsRfl+fNParsVnBkg+fNParsVnSgn << ", name:" << Form("w_%s", fKDETemplates[iTempl].GetName()) << endl; fVnTotFunc->SetParName(iTempl+fNParsMassSgn+fNParsMassBkg+fNParsSec+fNParsRfl,Form("wm_%s", fKDETemplates[iTempl].GetName())); - fVnTotFunc->SetParName(iTempl+fNParsMassSgn+fNParsMassBkg+fNParsSec+fNParsRfl+fNParsTempls+fNParsVnBkg+fNParsVnSgn,Form("wf_%s", fKDETemplates[iTempl].GetName())); } } @@ -1075,17 +1026,6 @@ Double_t VnVsMassFitter::MassTemplates(Double_t *m,Double_t *pars){ return totalTemplates; } -//_________________________________________________________________________ -Double_t VnVsMassFitter::VnTemplates(Double_t *m,Double_t *pars){ - // Add the contributions of the templates loaded in fKDETemplates, each - // scaled by a multiplicative constant, left as free fit parameter - Double_t totalTemplates = 0.; - for(int iTempl=0; iTempl