//std libs: #include #include //#include //!!! VIP this is the one we need!!! #include #include #include #include "math.h" #include //#include #include #include //ROOT #include "TH1F.h" #include "TH2F.h" #include "TFile.h" #include "TTree.h" #include "TCanvas.h" #include "TKey.h" #include "TCollection.h" #include "TVectorT.h" #include "TString.h" #include "TSystemDirectory.h" #include "TSystemFile.h" #include "TSystem.h" //#include "TIter.h" //Unfolding: #include "TRandom.h" #include "TH1D.h" #include "RooUnfoldResponse.h" #include "RooUnfoldBayes.h" //preventing quitting: #include "TApplication.h" #include "TH1D.h" //poisson: #include "TRandom.h" #include "TStyle.h" #include "TMatrix.h" #include "TMatrixD.h" void PutDirContentinVector(TString Directory, std::vector& FileNameVector); TString* GenerateTreeNames(TFile* f, int& nkeys); //void InitializeParameters(int argc,char **argv, int & DataorMonteCarlo, int & dopAorAp, int & CastorPosition, int & SelectedTriggerBit,int & TriggerBitForEfficiency, double & CastorRecoJetEnergyCutoff,int & BinningKinematicScenario, int & lowerbound,int & upperbound,int & NBins, double & CastorGenJetEnergyCutoff, int & UnfoldingScenario, double & genjetetalow, double & genjetetahigh, double & deltaphicut, int & NumberFilesToRead, int & nev); //init in order given in argv void InitializeParameters(int argc,char **argv, int & DataorMonteCarlo, int & dopAorAp, int & SelectedTriggerBit,int & TriggerBitForEfficiency, double & CastorRecoJetEnergyCutoff, int & CastorPosition, int & UnfoldingScenario, int & BinningKinematicScenario, int & NumberFilesToRead, int & nev, int & lowerbound,int & upperbound,int & NBins, double & CastorGenJetEnergyCutoff, double & genjetetalow, double & genjetetahigh, double & deltaphicut); TString BuildNTupleDescriptor(int DataorMonteCarlo, int dopAorAp, int CastorPosition); //TString BuildAnalysisDescriptor(int SelectedTriggerBit, int CastorRecoJetEnergyCutoff, int lowerbound,int NBins, int CastorGenJetEnergyCutoff, int genjetetalow,int genjetetahigh, int deltaphicut, int DataorMonteCarlo); TString BuildAnalysisDescriptor(int SelectedTriggerBit, double CastorRecoJetEnergyCutoff, int lowerbound,int NBins, double CastorGenJetEnergyCutoff, double genjetetalow, double genjetetahigh, double deltaphicut, int DataorMonteCarlo); void PerturbResponseHisto(TH2F* ResponseHisto); void Perturb1DHisto(TH1* ResponseHisto); void FillMatrixV(TMatrixD & V, TH1* mean , TH1* Perturbed); using namespace std; //int main(int argc, char **argv){ //int UnfoldMC_RedChiBackSmeared(int argc, char **argv){ int UnfoldMC_RedChiBackSmeared(){ int argc=1; char **argv; //argv[0]=""; int NBayesIts=11; int NPerturbIterations=10; // int NPerturbIterations=1; int NumberGoodEventsSpectrum; int NumberGoodEventsResponseObject; double RatioGoodEvtsResponseObjectandSpectrum; gStyle->SetOptStat(0); cout<<"start UnfoldMC"< FileNameVectorCastorJetSpectrum; // PutDirContentinVector(DirectoryStringCastorJetSpectrum,FileNameVectorCastorJetSpectrum); cout<<"dir for spectrum to be unfolded: "< FileNameVectorResponseObject; // PutDirContentinVector(DirectoryStringResponseObject,FileNameVectorResponseObject); cout<<"dir for response object: "<mkdir(OutputDirectoryString,kTRUE); //create the directory; kTRUE do recursively if needed TString outputdirstring=OutputDirectoryString; outputdirstring+="/UnfoldedDistribution.root"; TFile f2(outputdirstring.Data(),"RECREATE"); f2.Close(); cout<<"dir for output files: "<GetBinContent(1) "<GetBinContent(1)<GetBinContent(1) "<GetBinContent(1)<GetEntries(); // CCPlot_ChannelsperEvent NumberGoodEventsResponseObject=((TH1F*)ResponseObjectFile.Get("CCPlot_ChannelsperEvent"))->GetEntries(); // CCPlot_ChannelsperEvent RatioGoodEvtsResponseObjectandSpectrum=float(NumberGoodEventsResponseObject)/float(NumberGoodEventsSpectrum); cout<<"NumberGoodEventsSpectrum "<SetTitle("NumberGoodEvents"); //Merijn 2016 Jan 26: we're going to loop over the number of bayesian iterations. TH1F* RedChiHisto=new TH1F("RedChiHisto","RedChiHisto",NBayesIts+1,-0.5,NBayesIts+0.5); vector RooUnfoldResponsevector; TH1* scaledfakes=ResponseMatrix->Hfakes(); cout<<"before scaling: scaledfakes->GetBinContent(1) "<GetBinContent(1)<Scale(1./(RatioGoodEvtsResponseObjectandSpectrum)); //scaledfakes->Scale(RatioGoodEvtsResponseObjectandSpectrum); cout<<"after scaling: scaledfakes->GetBinContent(1) "<GetBinContent(1)<Copy(*fakecheck); //(RooUnfoldResponse*)CastorJetSpectrumFile.Get("response")->Hfakes(); TH1F* fakecheck=scaledfakes->Clone("fakecheck"); fakecheck->Divide(((RooUnfoldResponse*)CastorJetSpectrumFile.Get("response"))->Hfakes()); fakecheck->SetName("RatioScaledfakeResponseFakeSpectrum"); //~2016 march 1: for(int BayesianIterationIndex=1;BayesianIterationIndexApplyToTruth(hReco); //original UnperturbedBacksmeared->Sumw2(); UnperturbedBacksmeared->Add(scaledfakes); //get fakes to add to backsmeared data. Could scale if samples have different sizes. TH1* fakes=ResponseMatrix->Hfakes(); //add the fakes //try something with strange histo's and normal response.. // RooUnfoldResponse* PerturbedResponsecheck=new RooUnfoldResponse(fakes,fakes,ResponseMatrix->Hresponse()); //check: does anything except the input spectrum matter? // RooUnfoldResponse* PerturbedResponsecheck=new RooUnfoldResponse(ResponseMatrix->Hmeasured(),ResponseMatrix->Htruth(),ResponseMatrix->Hresponse()); //they do.. // UnperturbedBacksmeared->Sumw2(); // UnperturbedBacksmeared->Add(scaledfakes); //~these are the original histograms vector PerturbedHistoPtrVec; TH1F* MeanPerturbedHisto=new TH1F(); //should perhaps properly initialise here? -> YES! or things go crazy. init properly done below //only input used in this loop: ResponseHistogram, scaledfakes, hMeas,hReco TH2* ResponseHistogram=ResponseMatrix->Hresponse(); // Response matrix as a 2D-histogram: (x,y)=(measured,truth) for(int pertIndex=0;pertIndexCopy(*ResponseHistogramS); //must copy it otherwise we'll perturb one histo twice PerturbResponseHisto(ResponseHistogramS); //perturbed fakes: TH1F* FakeS=new TH1F(); scaledfakes->Copy(*FakeS); Perturb1DHisto(FakeS); // Klundert V1 method to get perturbed data: //init perturbed response object: smeared matrix, unfolded gen level and measured reco level /* RooUnfoldResponse* PerturbedResponse=new RooUnfoldResponse(hMeas,hReco,ResponseHistogramS); //note we initialise with the unfolded spectrum // RooUnfoldResponse* PerturbedResponse=new RooUnfoldResponse(FakeS,FakeS,ResponseHistogramS); //check: does anything except the input spectrum matter? TH1* DataS=PerturbedResponse->ApplyToTruth(hReco); //backsmear unfolded data with smeared matrix: DataS->Add(FakeS);//add unpertubred fares */ //Merijn here starts new calculation (anticipate same result): //misses: TH1F* UnscaledPerturbedFakeS=new TH1F(); fakes->Copy(*UnscaledPerturbedFakeS); Perturb1DHisto(UnscaledPerturbedFakeS); TH1F* MisS=new TH1F(); mis->Copy(*MisS); Perturb1DHisto(MisS); TH1D* PerturbedMatchedData=ResponseHistogramS->ProjectionX(); //anticipate this is correct, i.e. y is gen level, x data level Perturb1DHisto(PerturbedMatchedData); TH1D* PerturbedMatchedGen=ResponseHistogramS->ProjectionY(); Perturb1DHisto(PerturbedMatchedGen); /* cout<<"ResponseHistogramS->GetNbinsX() "<GetNbinsX() <<" ResponseHistogramS->GetNbinsY() "<GetNbinsY() <GetNbinsX() "<GetNbinsX() <<" PerturbedMatchedGen->GetNbinsX() "<GetNbinsX() <GetNbinsX() "<GetNbinsX() <<" PerturbedMatchedData->GetNbinsX() "<GetNbinsX() <Copy(*TotalPerturbedData); TotalPerturbedData->Add(PerturbedMatchedData); // cout<<"make TotalPerturbedTruth"<Copy(*TotalPerturbedTruth); TotalPerturbedTruth->Add(PerturbedMatchedData); //Alex Method: now can make our response object: RooUnfoldResponse* PerturbedResponse=new RooUnfoldResponse(TotalPerturbedData,TotalPerturbedTruth,ResponseHistogramS); //note we initialise with the unfolded spectrum TH1* DataS=PerturbedResponse->ApplyToTruth(hReco); //backsmear unfolded data with smeared matrix: //for now add unscaled DataS->Add(UnscaledPerturbedFakeS); DataS->Add(FakeS);//this are the scaled perturbed fakes.. //here we have our backfolded, perturbed distribution. store it and add to a mean matrix PerturbedHistoPtrVec.push_back(DataS); if(pertIndex==0){DataS->Copy(*MeanPerturbedHisto); MeanPerturbedHisto->SetName("MeanPerturbedHisto"); } //this makes sure bins etc are properly initialised of histogram for mean else{MeanPerturbedHisto->Add(DataS);} //display plot histogram and entries in terminal // uncomment to plots: /* TCanvas* aap1=new TCanvas("aap1","testcanvas1",500,500); hMeas->SetMarkerStyle(8); hMeas->SetMarkerColor(1); hMeas->SetDirectory(0); hMeas->DrawClone("p"); DataS->SetMarkerStyle(8); DataS->SetMarkerColor(2); DataS->DrawClone("p same"); TCanvas* aap2=new TCanvas("aap2","testcanvas2",500,500); TH1F* hMeasCopy=new TH1F(); hMeas->Copy(*hMeasCopy); hMeasCopy->Divide(DataS); hMeasCopy->DrawClone("p"); */ delete PerturbedResponse; // RooUnfoldResponsevector.push_back(PerturbedResponse); // delete PerturbedResponse; delete ResponseHistogramS; delete FakeS; //added histo's to delete: delete PerturbedMatchedData; delete PerturbedMatchedGen; delete TotalPerturbedData; delete TotalPerturbedTruth; delete MisS; delete UnscaledPerturbedFakeS; } MeanPerturbedHisto->Scale(1./float(NPerturbIterations)); //scale the mean histogram appropriately: cout<<" after filling perturbed and calculating mean histogram"<GetXaxis()->GetNbins()); vector VectorMatrices(NPerturbIterations,TMatrixD(NBinsMatrixV,NBinsMatrixV)); // http://stackoverflow.com/questions/6142830/how-do-i-initialize-a-stl-vector-of-objects-who-themselves-have-non-trivial-cons for(int pertIndex=0;pertIndexGetBinContent(binindex);} /*cout<<"mean matrix after adding data: "<300 int MatrixBin300=hMeas->FindBin(300)-1; int NBinsRedChi=NBinsMatrixV-MatrixBin300; double redchiStatingBin300=0; for(int i=MatrixBin300;iGetBinContent(j+1)-UnperturbedBacksmeared->GetBinContent(j+1));} redchiStatingBin300+=ctr*(hMeas->GetBinContent(i+1)-UnperturbedBacksmeared->GetBinContent(i+1));} cout<<"self calculated rec chi E>300 "<Fill(BayesianIterationIndex,redchiStatingBin300/NBinsRedChi); cout<<"before filling:: hTrue->GetBinContent(1) "<GetBinContent(1)<GetBinContent(1) "<GetBinContent(1)<SetName("UnperturbedUnfolded"); hReco->Write(); TH1F* UnperturbedUnfoldedScaledtoGoodEvts=new TH1F(); hReco->Copy(*UnperturbedUnfoldedScaledtoGoodEvts); UnperturbedUnfoldedScaledtoGoodEvts->Sumw2(); UnperturbedUnfoldedScaledtoGoodEvts->Scale(1./float(NumberGoodEventsSpectrum)); UnperturbedUnfoldedScaledtoGoodEvts->SetName("UnperturbedUnfoldedScaledtoGoodEvts"); UnperturbedUnfoldedScaledtoGoodEvts->Write(); UnperturbedBacksmeared->SetName("UnPerturbedBackSmeared"); UnperturbedBacksmeared->Write(); //last unperturbed backsmeared distribution. is dependent on nr iterations so must write it here TH1F* UnperturbedBackSmearedScaledtoGoodEvts=new TH1F(); UnperturbedBacksmeared->Copy(*UnperturbedBackSmearedScaledtoGoodEvts); UnperturbedBackSmearedScaledtoGoodEvts->Sumw2(); UnperturbedBackSmearedScaledtoGoodEvts->Scale(1./float(NumberGoodEventsSpectrum)); UnperturbedBackSmearedScaledtoGoodEvts->SetName("UnperturbedBackSmearedScaledtoGoodEvts"); UnperturbedBackSmearedScaledtoGoodEvts->Write(); //smeared distributions: PerturbedHistoPtrVec[PerturbedHistoPtrVec.size()-1]->SetName("PerturbedBackSmeared"); PerturbedHistoPtrVec[PerturbedHistoPtrVec.size()-1]->Write();//write one perturbed backsmeared histogram for last iteration before it gets deleted TH1F* PerturbedBackSmearedScaledtoGoodEvts=new TH1F(); PerturbedHistoPtrVec[PerturbedHistoPtrVec.size()-1]->Copy(*PerturbedBackSmearedScaledtoGoodEvts); PerturbedBackSmearedScaledtoGoodEvts->Sumw2(); PerturbedBackSmearedScaledtoGoodEvts->Scale(1./float(NumberGoodEventsSpectrum)); PerturbedBackSmearedScaledtoGoodEvts->SetName("PerturbedBackSmearedScaledtoGoodEvts"); PerturbedBackSmearedScaledtoGoodEvts->Write(); TH1F* RatioPerturbedBackSmearedvsData=new TH1F(); hMeas->Copy(*RatioPerturbedBackSmearedvsData); RatioPerturbedBackSmearedvsData->Sumw2(); RatioPerturbedBackSmearedvsData->Divide(PerturbedHistoPtrVec[PerturbedHistoPtrVec.size()-1]); RatioPerturbedBackSmearedvsData->SetName("RatioPerturbedBackSmearedvsData"); RatioPerturbedBackSmearedvsData->Write();//ratio plot last perturbed backsmeared w.r.t. real data TH1F* RatioUnPerturbedBackSmearedvsData=new TH1F(); hMeas->Copy(*RatioUnPerturbedBackSmearedvsData); RatioUnPerturbedBackSmearedvsData->Sumw2(); RatioUnPerturbedBackSmearedvsData->Divide(UnperturbedBacksmeared); RatioUnPerturbedBackSmearedvsData->SetName("RatioUnPerturbedBackSmearedvsData"); RatioUnPerturbedBackSmearedvsData->Write();//ratio plot last perturbed backsmeared w.r.t. real data MeanPerturbedHisto->SetName("MeanPerturbedBacksmeared"); MeanPerturbedHisto->Write(); //average backsmeared histogram TH1F* MeanPerturbedBacksmearedScaledtoGoodEvts=new TH1F(); MeanPerturbedHisto->Copy(*MeanPerturbedBacksmearedScaledtoGoodEvts); MeanPerturbedBacksmearedScaledtoGoodEvts->Sumw2(); MeanPerturbedBacksmearedScaledtoGoodEvts->Scale(1./float(NumberGoodEventsSpectrum)); MeanPerturbedBacksmearedScaledtoGoodEvts->SetName("MeanPerturbedBacksmearedScaledtoGoodEvts"); MeanPerturbedBacksmearedScaledtoGoodEvts->Write(); TH1F* RatioMeanPerturbedBacksmearedvsData=new TH1F(); hMeas->Copy(*RatioMeanPerturbedBacksmearedvsData); RatioMeanPerturbedBacksmearedvsData->Sumw2(); RatioMeanPerturbedBacksmearedvsData->Divide(MeanPerturbedHisto); RatioMeanPerturbedBacksmearedvsData->SetName("RatioMeanPerturbedBackSmearedvsData"); RatioMeanPerturbedBacksmearedvsData->Write();//ratio plot last perturbed backsmeared w.r.t. real dat TH1F* RatioUnfoldedvsTruth=new TH1F(); hReco->Copy(*RatioUnfoldedvsTruth); RatioUnfoldedvsTruth->Sumw2(); RatioUnfoldedvsTruth->Divide(hTrue); RatioUnfoldedvsTruth->SetName("RatioUnfoldedvsTruth"); RatioUnfoldedvsTruth->Write();//ratio plot last perturbed backsmeared w.r.t. real dat fakecheck->Write(); f69.Close(); //~~ Fill some histograms for fast cross checks.. } //cleanup: cout<<"start deletion"<Write();//measure distri TH1F* hMeasScaledtoGoodEvts=new TH1F(); //hMeasScaledtoGoodEvts->Sumw2(); hMeas->Copy(*hMeasScaledtoGoodEvts); hMeasScaledtoGoodEvts->Sumw2(); hMeasScaledtoGoodEvts->Scale(1./float(NumberGoodEventsSpectrum)); hMeasScaledtoGoodEvts->SetName("EnergySpectrumCalibratedCastorJetsResponseObjectScaledtoGoodEvts"); hMeasScaledtoGoodEvts->Write(); RedChiHisto->Write(); //write copy of particle level distri and scaled copy to nr events as reference: hTrue->Write(); TH1F* hTrueScaledtoGoodEvts=new TH1F(); hTrue->Copy(*hTrueScaledtoGoodEvts); hTrueScaledtoGoodEvts->Sumw2(); hTrueScaledtoGoodEvts->Scale(1./float(NumberGoodEventsSpectrum)); hTrueScaledtoGoodEvts->SetName("hTrueScaledtoGoodEvts"); hTrueScaledtoGoodEvts->Write(); f69.Close(); cout<<" output writte to "<> c; return 0; } //closes macro TString* GenerateTreeNames(TFile* f, int& nkeys){ nkeys=f->GetListOfKeys()->GetSize(); // int* CycleNumber[nkeys]; TString* TTreenames=new TString[nkeys]; for(int i=0;iGetListOfKeys()->At(i))->GetName(); TTreenames[i]+=";"; TTreenames[i]+=((TKey*)f->GetListOfKeys()->At(i))->GetCycle();} cout<<"nkeys"<& FileNameVector){ cout<<"PutDirContentinVector "<GetName(); //cout<<"files contains "<< fname<IsDirectory() && fname.EndsWith(ext)) { TString DUmmyFileName=Directory; DUmmyFileName+=fname.Data(); FileNameVector.push_back(DUmmyFileName); cout << fname.Data() << endl; } } } //try to clean up if (files) { TSystemFile *file; TString fname; TIter next(files); while ((file=(TSystemFile*)next())) { fname = file->GetName(); //cout<<"about to delete "<< fname<Clear(); delete files; } void PerturbResponseHisto(TH2F* ResponseHisto){ for(int nbx=1;nbxGetXaxis()->GetNbins()+1;nbx++){ for(int nby=1;nbyGetYaxis()->GetNbins()+1;nby++){ // for(int nbx=10;nbx<12;nbx++){ //for(int nby=10;nby<12;nby++){ // for(int nb=0;nbyGetYaxis()->GetNbins();nby++){ double response=ResponseHisto->GetBinContent(nbx,nby); TRandom* random1 = new TRandom; random1->SetSeed(0); //results will differ per iteration double newresponse=random1->Poisson(response); // cout<<"response "<GetBin(nbx,nby); ResponseHisto->SetBinContent(bin,newresponse); // cout<<"matrix: response "<GetBinContent(nbx,nby); //cout<<"check "<GetXaxis()->GetNbins();nbx++){ for(int nbx=1;nbxGetXaxis()->GetNbins()+1;nbx++){ // for(int nbx=10;nbx<12;nbx++){ double response=ResponseHisto->GetBinContent(nbx); //cout<<"response "<SetSeed(0); double newresponse=random1->Poisson(response); //cout<<"response "<GetBin(nbx); ResponseHisto->SetBinContent(bin,newresponse); //double check=ResponseHisto->GetBinContent(nbx); //cout<<"check "<GetXaxis()->GetNbins();nbx++){//Merijn 2016 Jan 19 go from [1,NBins] instead. //cout<<"nbx "<GetXaxis()->GetNbins();nby++){ for(int nbx=1;nbxGetXaxis()->GetNbins()+1;nbx++){ for(int nby=1;nbyGetXaxis()->GetNbins()+1;nby++){ // cout<<"nby "<GetBinContent(nbx) - mean->GetBinContent(nbx)) * (Perturbed->GetBinContent(nby) - mean->GetBinContent(nby)); //we loop over histograms starting at 1 but fill matrix at 0. Careful with this..! V[nbx-1][nby-1]=(Perturbed->GetBinContent(nbx) - mean->GetBinContent(nbx)) * (Perturbed->GetBinContent(nby) - mean->GetBinContent(nby)); //cout<<"V[nbx][nby]" <GetBinContent(nbx) "<GetBinContent(nbx)<<"mean->GetBinContent(nbx) "<GetBinContent(nbx)<GetBinContent(nby) "<GetBinContent(nby)<<"mean->GetBinContent(nby) "<GetBinContent(nby)<0&&CastorPosition==0)NTupleDescriptor+="NominalCastor/"; if(DataorMonteCarlo>0&&CastorPosition==1)NTupleDescriptor+="DisplacedCastor/"; return NTupleDescriptor; } //TString BuildAnalysisDescriptor(int SelectedTriggerBit, int CastorRecoJetEnergyCutoff, int lowerbound,int NBins, int CastorGenJetEnergyCutoff, int genjetetalow,int genjetetahigh, int deltaphicut, int DataorMonteCarlo){ TString BuildAnalysisDescriptor(int SelectedTriggerBit, double CastorRecoJetEnergyCutoff, int lowerbound,int NBins, double CastorGenJetEnergyCutoff, double genjetetalow, double genjetetahigh, double deltaphicut, int DataorMonteCarlo){ TString AnalysisDescriptor=""; AnalysisDescriptor+="TriggerBit"; //data and MC: AnalysisDescriptor+=SelectedTriggerBit; AnalysisDescriptor+="/CastorRecoJetEnergyCutoff"; AnalysisDescriptor+=CastorRecoJetEnergyCutoff; AnalysisDescriptor+="/lowerRECObound"; AnalysisDescriptor+=lowerbound; AnalysisDescriptor+="_NBins"; AnalysisDescriptor+=NBins; if(DataorMonteCarlo>0){ //MC specific AnalysisDescriptor+="/CastorGenJetEnergyCutoff"; AnalysisDescriptor+=CastorGenJetEnergyCutoff; AnalysisDescriptor+="_genjetetalow"; AnalysisDescriptor+=int(10*genjetetalow); AnalysisDescriptor+="_genjetetahigh"; AnalysisDescriptor+=int(10*genjetetahigh); AnalysisDescriptor+="_deltaphicut"; AnalysisDescriptor+=int(10*deltaphicut); cout<<"deltaphicut "<0) and RG (==1) for (int i = 0; i < argc; ++i) std::cout << argv[i]<<" "<0) and RG (==1). dopAorAp=0;//def=pA, proton to Castor. 1 is for Ap. SelectedTriggerBit=35; TriggerBitForEfficiency=0; CastorRecoJetEnergyCutoff=150; //defs for set 2: CastorGenJetEnergyCutoff=CastorRecoJetEnergyCutoff; CastorPosition=1; //def for MC is displaced UnfoldingScenario=0;//this are the best values according to Alex.. BinningKinematicScenario=0; //defs for set 3: NumberFilesToRead=1;// -1 means take all files nev=10000; //-1 takes all events } //these get specified if default is set. if(UnfoldingScenario==0){ genjetetalow=-5.2; //only used in CutEnergyOrderedGenJetVectoronEta genjetetahigh=-6.6; deltaphicut=0.5;} //take hardest genjet in deltaphicut around Castor Jet else{ genjetetalow=-5.2; //only used in CutEnergyOrderedGenJetVectoronEta genjetetahigh=-6.6; deltaphicut=0.5; } if(BinningKinematicScenario==0&&CastorRecoJetEnergyCutoff==150){ //binning, ranges could be extended with 2 bins and 150 GeV perhaps for larger statistics. lowerbound=CastorRecoJetEnergyCutoff; upperbound=2475; NBins=31;} if(BinningKinematicScenario==0&&CastorRecoJetEnergyCutoff==0){ lowerbound=CastorRecoJetEnergyCutoff; upperbound=2475; NBins=33;} if(BinningKinematicScenario==1&&CastorRecoJetEnergyCutoff==150){ //binning, ranges could be extended with 2 bins and 150 GeV perhaps for larger statistics. lowerbound=CastorRecoJetEnergyCutoff; upperbound=2100; NBins=26;} if(BinningKinematicScenario==1&&CastorRecoJetEnergyCutoff==0){ lowerbound=CastorRecoJetEnergyCutoff; upperbound=2100; NBins=28;} return; } //thgis are old matrix cross check calculations //here scale the matrix first! /* //~ TMatrixD DeltaColVect(NBinsMatrixV,1); //column vector TMatrixD DeltaRowVect(1,NBinsMatrixV); //row vector for(int binindex=1;binindexGetBinContent(binindex)-UnperturbedBacksmeared->GetBinContent(binindex)); DeltaRowVect[0][binindex-1]=(hMeas->GetBinContent(binindex)-UnperturbedBacksmeared->GetBinContent(binindex));} // TMatrixD Step1(NBinsMatrixV,1); TMatrixD Step1(NBinsMatrixV,1); Step1.Mult(MatrixV,DeltaColVect); //for(int binindex=1;binindexGetBinContent(j+1)-UnperturbedBacksmeared->GetBinContent(j+1));} totalredchi+=ctr*(hMeas->GetBinContent(i+1)-UnperturbedBacksmeared->GetBinContent(i+1));} // cout<<"self calculated rec chi "<