void compareInDir(TFile* f1, TFile* f2, std::string dirName,unsigned int logmod=0, unsigned int dOpt=1){ TCanvas* cv = 0; TPad* pH = 0; TPad* pD = 0; TPaveText* pt = 0; // std::cout<<"Start with "<<dirName.c_str()<<std::endl; // cv->Print("diff.ps["); TDirectory* d1 = f1->GetDirectory(dirName.c_str()); TDirectory* d2 = f2->GetDirectory(dirName.c_str()); if (d1==0 || d2 == 0){ std::cout<<"ERROR: "<<dirName.c_str()<<" not found"<<std::endl; return; } // std::cout<<"\t\t "<<d1->GetName()<<std::endl; TList* list1 = d1->GetListOfKeys(); TIterator* keyIt1 = list1->MakeIterator(); TObject* obj; while ((obj = keyIt1->Next())){ TObject* obj1 = d1->Get(obj->GetName()); if(obj1 == 0){ // std::cout<<"ERROR: failed to read in "<<d1->GetName()<<" / "<<obj->GetName()<<std::endl; continue; } // std::cout<<d1->GetName()<<"/"<<obj->GetName()<<std::endl; if (! obj1->InheritsFrom(TH1::Class())) continue; TObject* obj2 = d2->Get(obj1->GetName()); if (obj2 == 0){ // std::cout<<"WARNING: failed to get"<<d1->GetName()<<"/"<<obj1->GetName()<<std::endl; continue; } TH1* h1 = (TH1*)obj1; TH1* h2 = (TH1*)obj2; // std::cout<<"Will check "<<dirName.c_str()<<"/"<<h1->GetName()<<" dOpt "<<dOpt<<std::endl; if(h1->Integral() == 0 && h2->Integral() == 0){ // std::cout<<"Integral is 0: "<<d1->GetName()<<"/"<<obj1->GetName()<<std::endl; continue; } // if (TString(h1->GetTitle()).Index("ffic")<0) continue; bool isProf = obj1->InheritsFrom(TProfile::Class()); bool isH2 = obj1->InheritsFrom(TH2::Class()); double bDiff = 0; if(!isH2){ unsigned int nX1 = h1->GetNbinsX(); // std::cout<<"\t is 1D with nBins "<<nX1<<std::endl; for(unsigned int iB=0; iB<=nX1+1; ++iB){ if(h1->GetBinError(iB)==0 && h1->GetBinContent(iB)!=0) h1->SetBinError(iB,1e-3*fabs(h1->GetBinContent(iB))); if(h2->GetBinError(iB)==0 && h2->GetBinContent(iB)!=0) h2->SetBinError(iB,1e-3*fabs(h2->GetBinContent(iB))); bDiff +=fabs(h1->GetBinContent(iB) - h2->GetBinContent(iB)); } } else { unsigned int nX1 = h1->GetNbinsX(); unsigned int nY1 = h1->GetNbinsY(); // std::cout<<"\t is 2D with nBins "<<nX1<<" : "<<nY1<<std::endl; for(unsigned int iB=0; iB<=nX1+1; ++iB){ for(unsigned int jB=0; jB<=nY1+1; ++jB){ if(h1->GetBinError(iB,jB)==0 && h1->GetBinContent(iB,jB)!=0) h1->SetBinError(iB,jB,1e-3*fabs(h1->GetBinContent(iB,jB))); if(h2->GetBinError(iB,jB)==0 && h2->GetBinContent(iB,jB)!=0) h2->SetBinError(iB,jB,1e-3*fabs(h2->GetBinContent(iB,jB))); bDiff +=fabs(h1->GetBinContent(iB,jB) - h2->GetBinContent(iB,jB)); } } } double ksProb = 0; if (bDiff == 0) ksProb = 1; else ksProb = h1->KolmogorovTest(h2); if (dOpt%10 == 0 && bDiff ==0 ) continue; if (dOpt%10 == 1 && (bDiff ==0 || 1.-ksProb <1e-12) ) continue; if (dOpt%10 == 2 && (bDiff ==0 || ksProb >0.1 )) continue; if (dOpt%10 == 3 && (bDiff ==0 || 1.-ksProb < 0.001 )) continue; if (dOpt%10 == 4 && (bDiff ==0 || ksProb >0.9 )) continue; if (dOpt%10 == 5 && (bDiff ==0 || ksProb >0.5 )) continue; if (cv == 0){ cv = new TCanvas(dirName.c_str(),dirName.c_str()); cv->cd(); pH = new TPad("head","head", 0, 0.93, 1, 1); pH->Draw(); pH->cd(); pt = new TPaveText(0,0,1,1); pt->SetFillColor(0); pt->AddText(dirName.c_str()); pt->Draw(); cv->cd(); pD = new TPad("dis","dis", 0, 0.0, 1, 0.93); pD->Draw(); pD->cd(); } pD->Clear(); pD->cd(); std::cout<<"Save : "<<dirName.c_str()<<"/"<<h1->GetName()<<std::endl; if (! isH2){ h1->SetLineWidth(2); h1->SetLineColor(1); h1->SetMarkerColor(1); h2->SetLineColor(2); h2->SetMarkerColor(2); // if (h1->GetNbinsX() > 25) h1 = h1->Rebin(); // if (h2->GetNbinsX() > 25) h2 = h2->Rebin(); // if (h1->GetNbinsX() > 50) h1 = h1->Rebin(5); // if (h2->GetNbinsX() > 50) h2 = h2->Rebin(5); double max1 = h1->GetMaximum(); double max2 = h2->GetMaximum(); double min1 = h1->GetMinimum(); double min2 = h2->GetMinimum(); if (max2> max1) h1->SetMaximum(max2+0.15*fabs(max2)); if (min2 < min1) h1->SetMinimum(min2-0.15*fabs(min2)); // pD->SetLogy(); if ((logmod&1)) pD->SetLogx(); if ((logmod&2)) pD->SetLogy(); h1->Draw(); h2->Draw("sames"); if (std::string(h1->GetName())==std::string("reconstruction_step_module_total") || std::string(h1->GetName())==std::string("validation_step_module_total")){ TPaveText ksPt(0,0, 0.35, 0.04, "NDC"); ksPt.SetBorderSize(0); ksPt.SetFillColor(0); ksPt.AddText(Form("P(KS)=%g, diffBins=%g, eblk %g ered %g",ksProb, bDiff, h1->GetEntries(), h2->GetEntries())); // ksPt.AddText(h1->GetName()); ksPt.Draw(); cv->Print("diff.ps"); int nX = h1->GetNbinsX(); TAxis* h1Ax = h1->GetXaxis(); int nRanges = nX/20 + 1; double h1Int = h1->Integral(); float curBMargin = pD->GetBottomMargin(); pD->SetBottomMargin(0.3); for (int iR = 0; iR < nRanges; iR++){ h1Ax->SetRange(iR*20+1, iR*20+20); double bDiffL = 0; double max1L = -1; double max2L = -1; double min1L = h1->GetMaximum(); double min2L = h2->GetMaximum(); for (int iBL = iR*20+1; iBL<= iR*20+20; ++iBL){ double h1L = h1->GetBinContent(iBL); double h2L = h2->GetBinContent(iBL); bDiffL += std::abs(h1L-h2L); if (max1L < h1L) max1L = h1L; if (max2L < h2L) max2L = h2L; if (min1L > h1L) min1L = h1L; if (min2L > h2L) min2L = h2L; } if (max2L> max1L) h1->SetMaximum(max2L+0.15*std::abs(max2L)); else h1->SetMaximum(max1L+0.15*std::abs(max1L)); if (min2L < min1L) h1->SetMinimum(min2L-0.15*std::abs(min2L)); else h1->SetMinimum(min1L-0.15*std::abs(min1L)); h1->Draw(); h2->Draw("sames"); TPaveText ksPtL(0,0, 0.35, 0.04, "NDC"); ksPtL.SetBorderSize(0); ksPtL.SetFillColor(0); ksPtL.AddText(Form("P(KS)=%g, diffBinsL=%g(%g), eblk %g ered %g",ksProb, bDiffL, bDiffL/h1Int, h1->GetEntries(), h2->GetEntries())); ksPtL.Draw(); cv->Print("diff.ps"); } pD->SetBottomMargin(curBMargin); } } if (isH2){ pD->Divide(2); pD->cd(1); h1->Draw("colz"); pD->cd(2); h2->Draw("colz"); } TPaveText ksPt(0,0, 0.55, 0.06, "NDC"); ksPt.SetBorderSize(0); ksPt.SetFillColor(0); ksPt.AddText(Form("P(KS)=%g, diffBins=%g, eblk %g ered %g",ksProb, bDiff, h1->GetEntries(), h2->GetEntries())); ksPt.AddText(h1->GetName()); ksPt.Draw(); cv->Print("diff.ps"); cv->Print("diff.pdf"); } // std::cout<<"Done in "<<dirName.c_str()<<std::endl; // delete pH; delete pD; if (cv) delete cv; // cv->Print("diff.ps]"); }
void composeTrackAnalysisbyAssociator(string FileListName, int FileNumber) { if(debug) cout << FileListName << endl; string theFileName; ifstream composeFileList; composeFileList.open(FileListName.c_str()); string OutputPlotNamepreFix = FileListName + "_"; string OutputPlotNameFix = ".png"; unsigned int EventNumber; unsigned int trackingParticleMatch; double recTrackPurity; double recTrackrefMomentum; double recTrackrefPhi; double recTrackrefEta; double recTrackinnerMomentum; double recTrackinnerPhi; double recTrackinnerEta; unsigned int recTrackinnerValid; double recTrackouterMomentum; double recTrackouterPhi; double recTrackouterEta; unsigned int recTrackouterValid; double simTrackinnerMomentum; double simTrackinnerPhi; double simTrackinnerEta; unsigned int simTrackinnerMatch; double simTrackouterMomentum; double simTrackouterPhi; double simTrackouterEta; unsigned int simTrackouterMatch; double recTrackinnerMomentumofTSOS; double recTrackinnerPhiofTSOS; double recTrackinnerEtaofTSOS; unsigned int recTrackinnerValidofTSOS; double recTrackouterMomentumofTSOS; double recTrackouterPhiofTSOS; double recTrackouterEtaofTSOS; unsigned int recTrackouterValidofTSOS; double recTrackimpactMomentumofTSOS; double recTrackimpactPhiofTSOS; double recTrackimpactEtaofTSOS; unsigned int recTrackimpactValidofTSOS; int recTrackCharge; double simTrackMomentumPt; double simTrackPhi; double simTrackEta; int simTrackCharge; TObjArray* myEfficiencyHist = new TObjArray(); TObjArray* myParticleHist = new TObjArray(); TObjArray* mySTAHist = new TObjArray(); TObjArray* myChargeCheckHist = new TObjArray(); TObjArray* myDeltaPtHist = new TObjArray(); TObjArray* myDeltaPhiHist = new TObjArray(); TObjArray* myDeltaEtaHist = new TObjArray(); vector<string> TypeName; TypeName.clear(); for(int Index = 0; Index < FileNumber; Index++) { getline(composeFileList, theFileName); TypeName.push_back(theFileName); string fullFileName = "data/"+ theFileName + ".root"; if(debug) cout << theFileName << endl; TFile* RootFile = TFile::Open(fullFileName.c_str()); TTree* T1 = (TTree*)RootFile->Get("ExTree"); T1->SetBranchAddress("EventNumber", &EventNumber); T1->SetBranchAddress("trackingParticleMatch", &trackingParticleMatch); T1->SetBranchAddress("recTrackPurity", &recTrackPurity); T1->SetBranchAddress("recTrackrefMomentum", &recTrackrefMomentum); T1->SetBranchAddress("recTrackrefPhi", &recTrackrefPhi); T1->SetBranchAddress("recTrackrefEta", &recTrackrefEta); T1->SetBranchAddress("recTrackinnerMomentum", &recTrackinnerMomentum); T1->SetBranchAddress("recTrackinnerPhi", &recTrackinnerPhi); T1->SetBranchAddress("recTrackinnerEta", &recTrackinnerEta); T1->SetBranchAddress("recTrackinnerValid", &recTrackinnerValid); T1->SetBranchAddress("recTrackouterMomentum", &recTrackouterMomentum); T1->SetBranchAddress("recTrackouterPhi", &recTrackouterPhi); T1->SetBranchAddress("recTrackouterEta", &recTrackouterEta); T1->SetBranchAddress("recTrackouterValid", &recTrackouterValid); T1->SetBranchAddress("simTrackinnerMomentum", &simTrackinnerMomentum); T1->SetBranchAddress("simTrackinnerPhi", &simTrackinnerPhi); T1->SetBranchAddress("simTrackinnerEta", &simTrackinnerEta); T1->SetBranchAddress("simTrackinnerMatch", &simTrackinnerMatch); T1->SetBranchAddress("simTrackouterMomentum", &simTrackouterMomentum); T1->SetBranchAddress("simTrackouterPhi", &simTrackouterPhi); T1->SetBranchAddress("simTrackouterEta", &simTrackouterEta); T1->SetBranchAddress("simTrackouterMatch", &simTrackouterMatch); T1->SetBranchAddress("recTrackinnerMomentumofTSOS", &recTrackinnerMomentumofTSOS); T1->SetBranchAddress("recTrackinnerPhiofTSOS", &recTrackinnerPhiofTSOS); T1->SetBranchAddress("recTrackinnerEtaofTSOS", &recTrackinnerEtaofTSOS); T1->SetBranchAddress("recTrackinnerValidofTSOS", &recTrackinnerValidofTSOS); T1->SetBranchAddress("recTrackouterMomentumofTSOS", &recTrackouterMomentumofTSOS); T1->SetBranchAddress("recTrackouterPhiofTSOS", &recTrackouterPhiofTSOS); T1->SetBranchAddress("recTrackouterEtaofTSOS", &recTrackouterEtaofTSOS); T1->SetBranchAddress("recTrackouterValidofTSOS", &recTrackouterValidofTSOS); T1->SetBranchAddress("recTrackimpactMomentumofTSOS", &recTrackimpactMomentumofTSOS); T1->SetBranchAddress("recTrackimpactPhiofTSOS", &recTrackimpactPhiofTSOS); T1->SetBranchAddress("recTrackimpactEtaofTSOS", &recTrackimpactEtaofTSOS); T1->SetBranchAddress("recTrackimpactValidofTSOS", &recTrackimpactValidofTSOS); T1->SetBranchAddress("recTrackCharge", &recTrackCharge); T1->SetBranchAddress("simTrackMomentumPt", &simTrackMomentumPt); T1->SetBranchAddress("simTrackPhi", &simTrackPhi); T1->SetBranchAddress("simTrackEta", &simTrackEta); T1->SetBranchAddress("simTrackCharge", &simTrackCharge); string TempHistName; TempHistName = theFileName + "_Efficiency2simPt"; TH1D* Efficiency2simPtHist = new TH1D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale); TempHistName = theFileName + "_Particle2simPt"; TH1D* Particle2simPtHist = new TH1D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale); TempHistName = theFileName + "_STA2simPt"; TH1D* STA2simPtHist = new TH1D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale); TempHistName = theFileName + "_InverseChargeRato2simPt"; TH1D* InverseChargeRato2simPtHist = new TH1D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale); TempHistName = theFileName + "_DeltaPt2simPt"; TH1D* DeltaPt2simPtHist = new TH1D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale); TempHistName = theFileName + "_DeltaPhi2simPt"; TH1D* DeltaPhi2simPtHist = new TH1D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale); TempHistName = theFileName + "_DeltaEta2simPt"; TH1D* DeltaEta2simPtHist = new TH1D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale); TempHistName = theFileName + "_MaxPurity2simPt"; TH2D* MaxPurity2simPtHist = new TH2D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale, 6, 0., 1.2); TempHistName = theFileName + "_Multiplicity2simPt"; TH2D* Multiplicity2simPtHist = new TH2D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale, 10, 0., 10.); TempHistName = theFileName + "_ChargeCheck2simPt"; TH2D* ChargeCheck2simPtHist = new TH2D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale, 5, -2.5, 2.5); TempHistName = theFileName + "_simTrackMomentumPtmaxPurity2simPt"; TH2D* simTrackMomentumPtmaxPurity2simPtHist = new TH2D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale, (int)5*PtScale, 0, PtScale); TempHistName = theFileName + "_simTrackPhimaxPurity2simPt"; TH2D* simTrackPhimaxPurity2simPtHist = new TH2D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale, 314, -PI, PI); TempHistName = theFileName + "_simTrackEtamaxPurity2simPt"; TH2D* simTrackEtamaxPurity2simPtHist = new TH2D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale, 400, -2.0, 2.0); TempHistName = theFileName + "_recTrackimpactMomentumofTSOSmaxPurity2simPt"; TH2D* recTrackimpactMomentumofTSOSmaxPurity2simPtHist = new TH2D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale, (int)5*PtScale, 0, PtScale); TempHistName = theFileName + "_recTrackimpactPhiofTSOSmaxPurity2simPt"; TH2D* recTrackimpactPhiofTSOSmaxPurity2simPtHist = new TH2D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale, 314, -PI, PI); TempHistName = theFileName + "_recTrackimpactEtaofTSOSmaxPurity2simPt"; TH2D* recTrackimpactEtaofTSOSmaxPurity2simPtHist = new TH2D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale, 600, -3.0, 3.0); TempHistName = theFileName + "_recTrackimpactValidofTSOSmaxPurity2simPt"; TH2D* recTrackimpactValidofTSOSmaxPurity2simPtHist = new TH2D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale, 2, 0., 2.); TempHistName = theFileName + "_DeltaPtmaxPurity2simPt"; TH2D* DeltaPtmaxPurity2simPtHist = new TH2D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale, (int)5*PtScale, -1.*PtScale, PtScale); TempHistName = theFileName + "_DeltaPhimaxPurity2simPt"; TH2D* DeltaPhimaxPurity2simPtHist = new TH2D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale, 314, -PI, PI); TempHistName = theFileName + "_DeltaEtamaxPurity2simPt"; TH2D* DeltaEtamaxPurity2simPtHist = new TH2D(TempHistName.c_str(), TempHistName.c_str(), (int)(PtScale/2), 0, PtScale, 400, -2.0, 2.0); unsigned int trackingParticleMatch_temp; unsigned int efficiency_temp; double recTrackPurity_temp; double recTrackrefMomentum_temp; double recTrackrefPhi_temp; double recTrackrefEta_temp; double recTrackinnerMomentum_temp; double recTrackinnerPhi_temp; double recTrackinnerEta_temp; unsigned int recTrackinnerValid_temp; double recTrackouterMomentum_temp; double recTrackouterPhi_temp; double recTrackouterEta_temp; unsigned int recTrackouterValid_temp; double simTrackinnerMomentum_temp; double simTrackinnerPhi_temp; double simTrackinnerEta_temp; unsigned int simTrackinnerMatch_temp; double simTrackouterMomentum_temp; double simTrackouterPhi_temp; double simTrackouterEta_temp; unsigned int simTrackouterMatch_temp; double recTrackinnerMomentumofTSOS_temp; double recTrackinnerPhiofTSOS_temp; double recTrackinnerEtaofTSOS_temp; unsigned int recTrackinnerValidofTSOS_temp; double recTrackouterMomentumofTSOS_temp; double recTrackouterPhiofTSOS_temp; double recTrackouterEtaofTSOS_temp; unsigned int recTrackouterValidofTSOS_temp; double recTrackimpactMomentumofTSOS_temp; double recTrackimpactPhiofTSOS_temp; double recTrackimpactEtaofTSOS_temp; unsigned int recTrackimpactValidofTSOS_temp; int recTrackCharge_temp; double simTrackMomentumPt_temp; double simTrackPhi_temp; double simTrackEta_temp; int simTrackCharge_temp; int Nentries = T1->GetEntries(); for(int i = 0; i < Nentries; i++) { T1->GetEntry(i); if(trackingParticleMatch == 0) { MaxPurity2simPtHist->Fill(simTrackMomentumPt, 0); Multiplicity2simPtHist->Fill(simTrackMomentumPt, 0); int tempParticleBinNumber = Particle2simPtHist->FindBin(simTrackMomentumPt); double tempParticleBinValue = Particle2simPtHist->GetBinContent(tempParticleBinNumber); tempParticleBinValue += 1.; Particle2simPtHist->SetBinContent(tempParticleBinNumber, tempParticleBinValue); } else { efficiency_temp = 1; trackingParticleMatch_temp = trackingParticleMatch; recTrackPurity_temp = recTrackPurity; recTrackrefMomentum_temp = recTrackrefMomentum; recTrackrefPhi_temp = recTrackrefPhi; recTrackrefEta_temp = recTrackrefEta; recTrackinnerMomentum_temp = recTrackinnerMomentum; recTrackinnerPhi_temp = recTrackinnerPhi; recTrackinnerEta_temp = recTrackinnerEta; recTrackinnerValid_temp = recTrackinnerValid; recTrackouterMomentum_temp = recTrackouterMomentum; recTrackouterPhi_temp = recTrackouterPhi; recTrackouterEta_temp = recTrackouterEta; recTrackouterValid_temp = recTrackouterValid; simTrackinnerMomentum_temp = simTrackinnerMomentum; simTrackinnerPhi_temp = simTrackinnerPhi; simTrackinnerEta_temp = simTrackinnerEta; simTrackinnerMatch_temp = simTrackinnerMatch; simTrackouterMomentum_temp = simTrackouterMomentum; simTrackouterPhi_temp = simTrackouterPhi; simTrackouterEta_temp = simTrackouterEta; simTrackouterMatch_temp = simTrackouterMatch; recTrackinnerMomentumofTSOS_temp = recTrackinnerMomentumofTSOS; recTrackinnerPhiofTSOS_temp = recTrackinnerPhiofTSOS; recTrackinnerEtaofTSOS_temp = recTrackinnerEtaofTSOS; recTrackinnerValidofTSOS_temp = recTrackinnerValidofTSOS; recTrackouterMomentumofTSOS_temp = recTrackouterMomentumofTSOS; recTrackouterPhiofTSOS_temp = recTrackouterPhiofTSOS; recTrackouterEtaofTSOS_temp = recTrackouterEtaofTSOS; recTrackouterValidofTSOS_temp = recTrackouterValidofTSOS; recTrackimpactMomentumofTSOS_temp = recTrackimpactMomentumofTSOS; recTrackimpactPhiofTSOS_temp = recTrackimpactPhiofTSOS; recTrackimpactEtaofTSOS_temp = recTrackimpactEtaofTSOS; recTrackimpactValidofTSOS_temp = recTrackimpactValidofTSOS; recTrackCharge_temp = recTrackCharge; simTrackMomentumPt_temp = simTrackMomentumPt; simTrackPhi_temp = simTrackPhi; simTrackEta_temp = simTrackEta; simTrackCharge_temp = simTrackCharge; bool nextStep = true; while(nextStep) { i++; T1->GetEntry(i); if(trackingParticleMatch <= trackingParticleMatch_temp) nextStep = false; else trackingParticleMatch_temp = trackingParticleMatch; if(nextStep == true && recTrackPurity_temp < recTrackPurity) { if(debug) cout << "step another match, trackingParticleMatch_temp: " << trackingParticleMatch_temp << endl; //trackingParticleMatch_temp = trackingParticleMatch; recTrackPurity_temp = recTrackPurity; recTrackrefMomentum_temp = recTrackrefMomentum; recTrackrefPhi_temp = recTrackrefPhi; recTrackrefEta_temp = recTrackrefEta; recTrackinnerMomentum_temp = recTrackinnerMomentum; recTrackinnerPhi_temp = recTrackinnerPhi; recTrackinnerEta_temp = recTrackinnerEta; recTrackinnerValid_temp = recTrackinnerValid; recTrackouterMomentum_temp = recTrackouterMomentum; recTrackouterPhi_temp = recTrackouterPhi; recTrackouterEta_temp = recTrackouterEta; recTrackouterValid_temp = recTrackouterValid; simTrackinnerMomentum_temp = simTrackinnerMomentum; simTrackinnerPhi_temp = simTrackinnerPhi; simTrackinnerEta_temp = simTrackinnerEta; simTrackinnerMatch_temp = simTrackinnerMatch; simTrackouterMomentum_temp = simTrackouterMomentum; simTrackouterPhi_temp = simTrackouterPhi; simTrackouterEta_temp = simTrackouterEta; simTrackouterMatch_temp = simTrackouterMatch; recTrackinnerMomentumofTSOS_temp = recTrackinnerMomentumofTSOS; recTrackinnerPhiofTSOS_temp = recTrackinnerPhiofTSOS; recTrackinnerEtaofTSOS_temp = recTrackinnerEtaofTSOS; recTrackinnerValidofTSOS_temp = recTrackinnerValidofTSOS; recTrackouterMomentumofTSOS_temp = recTrackouterMomentumofTSOS; recTrackouterPhiofTSOS_temp = recTrackouterPhiofTSOS; recTrackouterEtaofTSOS_temp = recTrackouterEtaofTSOS; recTrackouterValidofTSOS_temp = recTrackouterValidofTSOS; recTrackimpactMomentumofTSOS_temp = recTrackimpactMomentumofTSOS; recTrackimpactPhiofTSOS_temp = recTrackimpactPhiofTSOS; recTrackimpactEtaofTSOS_temp = recTrackimpactEtaofTSOS; recTrackimpactValidofTSOS_temp = recTrackimpactValidofTSOS; recTrackCharge_temp = recTrackCharge; simTrackMomentumPt_temp = simTrackMomentumPt; simTrackPhi_temp = simTrackPhi; simTrackEta_temp = simTrackEta; simTrackCharge_temp = simTrackCharge; } } i--; //if(debug) cout << "Filling Multiplicity " << trackingParticleMatch_temp << endl; MaxPurity2simPtHist->Fill(simTrackMomentumPt_temp, recTrackPurity_temp); Multiplicity2simPtHist->Fill(simTrackMomentumPt_temp, trackingParticleMatch_temp); ChargeCheck2simPtHist->Fill(simTrackMomentumPt_temp, simTrackCharge_temp*recTrackCharge_temp); simTrackMomentumPtmaxPurity2simPtHist->Fill(simTrackMomentumPt_temp, simTrackMomentumPt_temp); simTrackPhimaxPurity2simPtHist->Fill(simTrackMomentumPt_temp, simTrackPhi_temp); simTrackEtamaxPurity2simPtHist->Fill(simTrackMomentumPt_temp, simTrackEta_temp); recTrackimpactMomentumofTSOSmaxPurity2simPtHist->Fill(simTrackMomentumPt_temp, recTrackimpactMomentumofTSOS_temp); recTrackimpactPhiofTSOSmaxPurity2simPtHist->Fill(simTrackMomentumPt_temp, recTrackimpactPhiofTSOS_temp); recTrackimpactEtaofTSOSmaxPurity2simPtHist->Fill(simTrackMomentumPt_temp, recTrackimpactEtaofTSOS_temp); recTrackimpactValidofTSOSmaxPurity2simPtHist->Fill(simTrackMomentumPt_temp, recTrackimpactValidofTSOS_temp); DeltaPtmaxPurity2simPtHist->Fill(simTrackMomentumPt_temp, (recTrackimpactMomentumofTSOS_temp-simTrackMomentumPt_temp)/simTrackMomentumPt_temp); DeltaPhimaxPurity2simPtHist->Fill(simTrackMomentumPt_temp, recTrackimpactPhiofTSOS_temp-simTrackPhi_temp); DeltaEtamaxPurity2simPtHist->Fill(simTrackMomentumPt_temp, recTrackimpactEtaofTSOS_temp-simTrackEta_temp); int tempParticleBinNumber = STA2simPtHist->FindBin(simTrackMomentumPt_temp); double tempParticleBinValue = Particle2simPtHist->GetBinContent(tempParticleBinNumber); tempParticleBinValue += 1.; Particle2simPtHist->SetBinContent(tempParticleBinNumber, tempParticleBinValue); double tempSTABinValue = STA2simPtHist->GetBinContent(tempParticleBinNumber); tempSTABinValue += 1.; STA2simPtHist->SetBinContent(tempParticleBinNumber, tempSTABinValue); } } for(int PtIndex = 1; PtIndex <= (int)(PtScale/2); PtIndex++) { double ParticleBinValue = Particle2simPtHist->GetBinContent(PtIndex); double STABinValue = STA2simPtHist->GetBinContent(PtIndex); if(ParticleBinValue == 0.) ParticleBinValue += 1.; double EfficiencyBinValue = STABinValue / ParticleBinValue * 100.; double EfficiencyBinError = sqrt(EfficiencyBinValue * (100. - EfficiencyBinValue) / ParticleBinValue); cout << ParticleBinValue << ", " << STABinValue << ", " << EfficiencyBinValue << endl; Efficiency2simPtHist->SetBinContent(PtIndex, EfficiencyBinValue); Efficiency2simPtHist->SetBinError(PtIndex, EfficiencyBinError); TH1D* ChargeCheckHist = ChargeCheck2simPtHist->ProjectionY("ChargeCheck", PtIndex, PtIndex, "o"); double ReverseChargeBinValue = ChargeCheckHist->GetBinContent(2); double CoverseChargeBinValue = ChargeCheckHist->GetBinContent(4); double TotalChargeBinValue = ReverseChargeBinValue + CoverseChargeBinValue; if(TotalChargeBinValue == 0.); TotalChargeBinValue += 1.; double ReverseChargeRato = ReverseChargeBinValue / TotalChargeBinValue; InverseChargeRato2simPtHist->SetBinContent(PtIndex, ReverseChargeRato); TH1D* DeltaPtHist = DeltaPtmaxPurity2simPtHist->ProjectionY("DeltaPt", PtIndex, PtIndex, "o"); double DeltaPtMean = DeltaPtHist->GetMean(); double DeltaPtRMS = DeltaPtHist->GetRMS(); DeltaPt2simPtHist->SetBinContent(PtIndex, DeltaPtMean); DeltaPt2simPtHist->SetBinError(PtIndex, DeltaPtRMS); TH1D* DeltaPhiHist = DeltaPhimaxPurity2simPtHist->ProjectionY("DeltaPhi", PtIndex, PtIndex, "o"); double DeltaPhiMean = DeltaPhiHist->GetMean(); double DeltaPhiRMS = DeltaPhiHist->GetRMS(); DeltaPhi2simPtHist->SetBinContent(PtIndex, DeltaPhiMean); DeltaPhi2simPtHist->SetBinError(PtIndex, DeltaPhiRMS); TH1D* DeltaEtaHist = DeltaEtamaxPurity2simPtHist->ProjectionY("DeltaEta", PtIndex, PtIndex, "o"); double DeltaEtaMean = DeltaEtaHist->GetMean(); double DeltaEtaRMS = DeltaEtaHist->GetRMS(); DeltaEta2simPtHist->SetBinContent(PtIndex, DeltaEtaMean); DeltaEta2simPtHist->SetBinError(PtIndex, DeltaEtaRMS); } myEfficiencyHist->AddLast(Efficiency2simPtHist); myParticleHist->AddLast(Particle2simPtHist); mySTAHist->AddLast(STA2simPtHist); myChargeCheckHist->AddLast(InverseChargeRato2simPtHist); myDeltaPtHist->AddLast(DeltaPt2simPtHist); } double minX = 0; double minY = 0; double maxX = 110; double maxY = 40; TCanvas* myCanvas = new TCanvas("Canvas", "Canvas", 800, 600); myCanvas->cd(); TPad* myPad = new TPad("Pad", "Pad", 0, 0, 1, 1); myPad->Draw(); myPad->cd(); ((TH1D*)(myParticleHist->At(0)))->SetStats(0); ((TH1D*)(myParticleHist->At(0)))->GetXaxis()->SetTitle("simPt/Gev"); ((TH1D*)(myParticleHist->At(0)))->GetXaxis()->CenterTitle(1); ((TH1D*)(myParticleHist->At(0)))->Draw(); for(int Index = 0; Index < FileNumber; Index++) { ((TH1D*)(mySTAHist->At(Index)))->SetStats(0); ((TH1D*)(mySTAHist->At(Index)))->SetLineColor(kRed+Index); ((TH1D*)(mySTAHist->At(Index)))->Draw("same"); } TLegend *STALeg = new TLegend(0.6,0.1,0.9,0.3); STALeg->SetBorderSize(1); TString LegKey = "ParticleTrack"; STALeg->AddEntry(myParticleHist->At(0), LegKey, "lpf"); for(int Index = 0; Index < FileNumber; Index++) { LegKey = TypeName[Index]; STALeg->AddEntry(mySTAHist->At(Index), LegKey, "lpf"); } STALeg->Draw(); string SaveName = OutputPlotNamepreFix + "_STA2simPt" + OutputPlotNameFix; myCanvas->SaveAs(SaveName.c_str()); myPad->Clear(); myPad->Update(); double YScale = myPad->GetUymax() / 110.; ((TH1D*)(myEfficiencyHist->At(0)))->GetXaxis()->SetTitle("simPt/Gev"); ((TH1D*)(myEfficiencyHist->At(0)))->GetXaxis()->CenterTitle(1); ((TH1D*)(myEfficiencyHist->At(0)))->SetStats(0); ((TH1D*)(myEfficiencyHist->At(0)))->Scale(YScale); ((TH1D*)(myEfficiencyHist->At(0)))->SetLineColor(kRed); ((TH1D*)(myEfficiencyHist->At(0)))->Draw("same,ah"); for(int Index = 1; Index < FileNumber; Index++) { ((TH1D*)(myEfficiencyHist->At(Index)))->SetStats(0); ((TH1D*)(myEfficiencyHist->At(Index)))->Scale(YScale); ((TH1D*)(myEfficiencyHist->At(Index)))->SetLineColor(kRed+Index); ((TH1D*)(myEfficiencyHist->At(Index)))->Draw("same,ah"); } myPad->Update(); if(debug) cout << "Y: " << myPad->GetUymax() << endl; double YAxisMinValue=((TH1D*)(myEfficiencyHist->At(0)))->GetYaxis()->GetXmin(); double YAxisMaxValue=((TH1D*)(myEfficiencyHist->At(0)))->GetYaxis()->GetXmax(); int YAxisNBins=((TH1D*)(myEfficiencyHist->At(0)))->GetYaxis()->GetNbins(); TGaxis* YAxis = new TGaxis(myPad->GetUxmin(), myPad->GetUymin(), myPad->GetUxmin(), myPad->GetUymax(), 0, 110, 510, "-R"); YAxis->SetLineColor(kGreen); YAxis->SetLabelColor(kGreen); YAxis->SetTitle("Efficiency of STA for simPts"); YAxis->CenterTitle(1); YAxis->Draw(); double XAxisMinValue=((TH1D*)(myEfficiencyHist->At(0)))->GetXaxis()->GetXmin(); double XAxisMaxValue=((TH1D*)(myEfficiencyHist->At(0)))->GetXaxis()->GetXmax(); int XAxisNBins=((TH1D*)(myEfficiencyHist->At(0)))->GetXaxis()->GetNbins(); TGaxis* XAxis = new TGaxis(myPad->GetUxmin(), myPad->GetUymin(), myPad->GetUxmax(), myPad->GetUymin(), XAxisMinValue, XAxisMaxValue, 510, "+L"); XAxis->SetTitle("simPt/Gev"); XAxis->CenterTitle(1); XAxis->Draw(); TLegend *EffLeg = new TLegend(0.1,0.9,0.4,1.0); EffLeg->SetBorderSize(1); for(int Index = 0; Index < FileNumber; Index++) { TString LegKey = TypeName[Index]; EffLeg->AddEntry(myEfficiencyHist->At(Index), LegKey, "lpf"); } EffLeg->Draw(); string SaveName = OutputPlotNamepreFix + "_Eff2simPt" + OutputPlotNameFix; myCanvas->SaveAs(SaveName.c_str()); ((TH1D*)(myDeltaPtHist->At(0)))->SetStats(0); ((TH1D*)(myDeltaPtHist->At(0)))->GetXaxis()->SetTitle("simPt/Gev"); ((TH1D*)(myDeltaPtHist->At(0)))->GetXaxis()->CenterTitle(1); ((TH1D*)(myDeltaPtHist->At(0)))->GetYaxis()->SetTitle("deltPt/simPt"); ((TH1D*)(myDeltaPtHist->At(0)))->GetYaxis()->CenterTitle(1); ((TH1D*)(myDeltaPtHist->At(0)))->SetLineColor(kRed); ((TH1D*)(myDeltaPtHist->At(0)))->Draw(""); for(int Index = 1; Index < FileNumber; Index++) { ((TH1D*)(myDeltaPtHist->At(Index)))->SetStats(0); //((TH1D*)(myDeltaPtHist->At(Index)))->GetXaxis()->SetTitle("simPt/Gev"); //((TH1D*)(myDeltaPtHist->At(Index)))->GetXaxis()->CenterTitle(1); //((TH1D*)(myDeltaPtHist->At(Index)))->GetYaxis()->SetTitle("deltPt/simPt"); //((TH1D*)(myDeltaPtHist->At(Index)))->GetYaxis()->CenterTitle(1); ((TH1D*)(myDeltaPtHist->At(Index)))->SetLineColor(kRed+Index); ((TH1D*)(myDeltaPtHist->At(Index)))->Draw("same"); //SaveName = OutputPlotNamepreFix + TypeName[Index] + "DeltaPt" + OutputPlotNameFix; //myCanvas->SaveAs(SaveName.c_str()); } TLegend *PtLeg = new TLegend(0.6,0.8,0.9,0.9); PtLeg->SetBorderSize(1); for(int Index = 0; Index < FileNumber; Index++) { TString LegKey = TypeName[Index]; PtLeg->AddEntry(myDeltaPtHist->At(Index), LegKey, "lpf"); } PtLeg->Draw(); SaveName = OutputPlotNamepreFix + "_DeltaPt" + OutputPlotNameFix; myCanvas->SaveAs(SaveName.c_str()); }