//--------------------------------------------------------------------- void MMMLoadCuts(SiliconData *si) { printf("Load MMM Front-Back Energy cut\n"); TCutG *cutg = new TCutG("FrontBackEnergyCut",8); cutg->SetVarX("EnergyBack"); cutg->SetVarY("EnergyFront"); cutg->SetTitle("Graph"); cutg->SetFillColor(1); /* cutg->SetPoint(0,8625.54,9448.89); cutg->SetPoint(1,9436.42,9393.27); cutg->SetPoint(2,9398.71,8336.6); cutg->SetPoint(3,8512.39,8253.18); cutg->SetPoint(4,610.991,300.318); cutg->SetPoint(5,516.703,912.076); cutg->SetPoint(6,8625.54,9143.01); cutg->SetPoint(7,8625.54,9448.89); */ cutg->SetPoint(0,500.,0.); cutg->SetPoint(1,0.,500.); cutg->SetPoint(2,14500.,15000.); cutg->SetPoint(3,15000.,14500.); cutg->SetPoint(4,500.,0.); MMMFrontBackEnergyCut = cutg; }
void rotate2DN(const char* filename,int detNum){ TFile *f = new TFile(filename); TCanvas* cnew= new TCanvas("cnew","",800.,500.); cnew->cd(); stringstream sss; sss<<"Transposed-"<<filename; TFile f1(sss.str().c_str(),"RECREATE"); for (int i=0;i<detNum;i++){ stringstream orig ; orig<<"hNc"<<i ; TH2D* h1=(TH2D*)f->Get(orig.str().c_str()); string gname = h1->GetTitle(); stringstream hname ; hname<<"hN"<<i; TH2D* Hnew = new TH2D(hname.str().c_str(),gname.c_str(),1700.,0.,1700.,8000.,0.,8000.); for (int x=0;x<8000;x++){ for (int y=0;y<1600;y++){ int bin = h1->GetBinContent(x,y); Hnew->Fill(y,x,bin); } } cout<<"Histogram Number "<<i<<" transpose completed"<<endl; cnew->cd(); Hnew->SetMinimum(7); Hnew->GetYaxis()->SetRangeUser(1300,1600); Hnew->GetYaxis()->SetTitle("Energy (keV)"); Hnew->GetXaxis()->SetTitle("Cycle Number"); Hnew->Draw("COLZ"); TCutG *cutg = new TCutG("NaIcut1",5); cutg->SetVarX("y"); cutg->SetVarY("x"); cutg->SetPoint(0,0,1350); cutg->SetPoint(1,1500,1350); cutg->SetPoint(2,1500,1500); cutg->SetPoint(3,0,1500); cutg->SetPoint(4,0,1350); TProfile *profx = Hnew->ProfileX(Form("profx_%d",i),1,-1,"[NaIcut1]"); profx->SetLineColor(kRed); profx->Draw("same"); cnew->Update(); gname = gname + ".pdf"; cnew->SaveAs(gname.c_str()); } f1.Write(); }
void run_plot(TString FileNameHead = "output_proto",TString fileKine="../Kinematics/Decay_kinematics/10Be_4He_19MeV.txt",TString fileKine2="../Kinematics/Decay_kinematics/10Be_12C_19MeV.txt") { TString workdir = getenv("VMCWORKDIR"); TString FilePath = workdir + "/macro/Unpack_GETDecoder2/"; TString FileNameTail = ".root"; TString FileName = FilePath + FileNameHead + FileNameTail; std::cout<<" Opening File : "<<FileName.Data()<<std::endl; TFile* file = new TFile(FileName.Data(),"READ"); //TFile* file = new TFile(FileNameHead_chain.Data(),"READ"); TTree* tree = (TTree*) file -> Get("cbmsim"); Int_t nEvents = tree -> GetEntriesFast(); std::cout<<" Number of events : "<<nEvents<<std::endl; TCanvas *c2 = new TCanvas("c2","c2",200,10,700,700); c2->Divide(2,1); TCanvas *c3 = new TCanvas("c3","c3",200,10,700,700); //c3->Divide(2,1); TH2D* Q02_Kine = new TH2D("Q02_Kine","Q02_Kine",1000,0,180,1000,0,180); Q02_Kine->SetMarkerColor(2); Q02_Kine->SetMarkerStyle(20); Q02_Kine->SetMarkerSize(0.7); TH2D* Q13_Kine = new TH2D("Q13_Kine","Q13_Kine",1000,0,180,1000,0,180); Q13_Kine->SetMarkerColor(2); Q13_Kine->SetMarkerStyle(20); Q13_Kine->SetMarkerSize(0.7); TH1D* Vertex = new TH1D("Vertex","Vertex",100,0,1000); TH2D* Vertex_vs_Angle = new TH2D("Vertex_vs_Angle","Vertex_vs_Angle",1000,0,1000,200,0,180); TCutG *cutg = new TCutG("CUTG",27); cutg->SetVarX("Q02_Kine"); cutg->SetVarY(""); cutg->SetTitle("Graph"); cutg->SetFillColor(1); cutg->SetPoint(0,13.91253,83.41335); cutg->SetPoint(1,16.43826,70.76698); cutg->SetPoint(2,29.69832,47.3185); cutg->SetPoint(3,32.22404,36.51639); cutg->SetPoint(4,49.90412,29.13934); cutg->SetPoint(5,68.21562,18.86417); cutg->SetPoint(6,79.79186,15.70258); cutg->SetPoint(7,86.73761,10.96019); cutg->SetPoint(8,86.52713,6.217797); cutg->SetPoint(9,77.05566,5.427399); cutg->SetPoint(10,69.26801,8.325526); cutg->SetPoint(11,55.79747,15.17564); cutg->SetPoint(12,50.53555,20.9719); cutg->SetPoint(13,35.80215,25.97775); cutg->SetPoint(14,31.17165,21.23536); cutg->SetPoint(15,24.43639,19.3911); cutg->SetPoint(16,19.80589,24.39695); cutg->SetPoint(17,20.01637,30.98361); cutg->SetPoint(18,22.75257,36.25293); cutg->SetPoint(19,21.91066,46.79157); cutg->SetPoint(20,16.0173,54.16862); cutg->SetPoint(21,8.229653,66.02459); cutg->SetPoint(22,6.545836,73.13817); cutg->SetPoint(23,7.177267,86.04801); cutg->SetPoint(24,11.59729,88.15574); cutg->SetPoint(25,13.70206,83.41335); cutg->SetPoint(26,13.91253,83.41335); TCutG *cutg2 = new TCutG("CUTG2",6); cutg2->SetVarX("Q02_Kine"); cutg2->SetVarY(""); cutg2->SetTitle("Graph"); cutg2->SetFillColor(1); cutg2->SetPoint(0,54.85507,28.95589); cutg2->SetPoint(1,64.59005,23.76482); cutg2->SetPoint(2,64.52764,10.0358); cutg2->SetPoint(3,54.81763,12.22152); cutg2->SetPoint(4,54.86755,29.0242); cutg2->SetPoint(5,54.85507,28.95589); TCutG *cutg3 = new TCutG("CUTG2",6); cutg3->SetVarX("Q02_Kine"); cutg3->SetVarY(""); cutg3->SetTitle("Graph"); cutg3->SetFillColor(1); cutg3->SetPoint(0,27.46418,21.43491); cutg3->SetPoint(1,37.45702,16.44231); cutg3->SetPoint(2,37.13467,2.463016); cutg3->SetPoint(3,27.46418,4.792898); cutg3->SetPoint(4,27.78653,21.43491); cutg3->SetPoint(5,27.46418,21.43491); TTreeReader Reader1("cbmsim", file); TTreeReaderValue<TClonesArray> analysisArray(Reader1, "ATProtoEventAna"); Int_t evnt = 0; while (Reader1.Next()) { if(evnt%1000==0) std::cout<<" Event : "<<evnt<<std::endl; evnt++; ATProtoEventAna* analysis = (ATProtoEventAna*) analysisArray->At(0); //Double_t ATProtoAnalysis::*HoughDist = &ATProtoAnalysis::fHoughDist; std::vector<Double_t> *AngleFit = analysis->GetAngleFit(); std::vector<Double_t> *Par0 = analysis->GetPar0(); std::vector<Double_t> *vertex = analysis->GetVertex(); std::vector<Double_t> *Chi2 = analysis->GetChi2(); std::vector<Int_t> *NDF = analysis->GetNDF(); if( TMath::Abs(vertex->at(0) - vertex->at(2))<20 && (vertex->at(0)>0 && vertex->at(2)>0)) if( Chi2->at(0)/NDF->at(0)<10.0 && Chi2->at(2)/NDF->at(2)<10.0 ) Q02_Kine->Fill(AngleFit->at(0),AngleFit->at(2)); if( TMath::Abs(vertex->at(1) - vertex->at(3))<20 && (vertex->at(1)>0 && vertex->at(3)>0)) if( Chi2->at(1)/NDF->at(1)<10.0 && Chi2->at(3)/NDF->at(3)<10.0 ) Q02_Kine->Fill(AngleFit->at(1),AngleFit->at(3)); if(cutg->IsInside(AngleFit->at(0),AngleFit->at(2)) ) { Vertex->Fill(Par0->at(0)); Vertex_vs_Angle->Fill(Par0->at(0),AngleFit->at(0)); } if(cutg->IsInside(AngleFit->at(1),AngleFit->at(3)) ) { Vertex->Fill(Par0->at(1)); Vertex_vs_Angle->Fill(Par0->at(1),AngleFit->at(1)); } //if(cutg3->IsInside(AngleFit->at(0),AngleFit->at(2)) ) std::cout<<evnt<<std::endl; } Double_t *ThetaCMS = new Double_t[20000]; Double_t *ThetaLabRec = new Double_t[20000]; Double_t *EnerLabRec = new Double_t[20000]; Double_t *ThetaLabSca = new Double_t[20000]; Double_t *EnerLabSca = new Double_t[20000]; Double_t *ThetaCMS2 = new Double_t[20000]; Double_t *ThetaLabRec2 = new Double_t[20000]; Double_t *EnerLabRec2 = new Double_t[20000]; Double_t *ThetaLabSca2 = new Double_t[20000]; Double_t *EnerLabSca2 = new Double_t[20000]; std::ifstream *kineStr = new std::ifstream(fileKine.Data()); Int_t numKin=0; if(!kineStr->fail()) { while(!kineStr->eof()) { *kineStr>>ThetaCMS[numKin]>>ThetaLabRec[numKin]>>EnerLabRec[numKin]>>ThetaLabSca[numKin]>>EnerLabSca[numKin]; numKin++; } } else if(kineStr->fail()) std::cout<<" Warning : No Kinematics file found for this reaction! Please run the macro on $SIMPATH/macro/Kinematics/Decay_kinematics/Mainrel.cxx"<<std::endl;
//Definitions of graphical cuts for all pp energies and 20/158 energies of PbPb TCutG* initialise_dedx_cutg(TString system, Int_t energy) { TCutG *cutg = new TCutG(); if(!(system.CompareTo("pp"))) { switch(energy) { case 158: { std::cout << "Using p+p@158 cut (12E002)" << std::endl; cutg = new TCutG("dedx_cut",10); cutg->SetTitle("e^{-} dE/dx cut for 12E002 p+p @ 158 GeV/c"); cutg->SetFillColor(1); cutg->SetPoint(0,0.344283,1.90); cutg->SetPoint(1,0.344283,1.20); cutg->SetPoint(2,1.58,1.35); cutg->SetPoint(3,3.4829,1.40727); cutg->SetPoint(4,10.50171,1.45138); cutg->SetPoint(5,20,1.49148); cutg->SetPoint(6,20,1.65589); cutg->SetPoint(7,2.57344,1.90); cutg->SetPoint(8,0.396975,1.90); cutg->SetPoint(9,0.3442825,1.90); break; } case 80: { std::cout << "Using p+p@80 cut (12E002)" << std::endl; cutg = new TCutG("dedx_cut",13); cutg->SetTitle("e^{-} dE/dx cut for 12E002 p+p @ 80 GeV/c"); cutg->SetFillColor(1); cutg->SetPoint(0,0.284871,1.84884); cutg->SetPoint(1,0.369055,1.36919); cutg->SetPoint(2,0.705019,1.33804); cutg->SetPoint(3,2.03808,1.38164); cutg->SetPoint(4,5.38127,1.43148); cutg->SetPoint(5,12.3227,1.46885); cutg->SetPoint(6,24.1579,1.52492); cutg->SetPoint(7,23.5404,1.62458); cutg->SetPoint(8,8.14319,1.76786); cutg->SetPoint(9,2.67477,1.89867); cutg->SetPoint(10,0.974441,1.95473); cutg->SetPoint(11,0.404061,1.96096); cutg->SetPoint(12,0.284871,1.84884); break; } case 40: { std::cout << "Using p+p@40 cut (12E002)" << std::endl; cutg = new TCutG("dedx_cut",12); cutg->SetTitle("e^{-} dE/dx cut for 12E002 p+p @ 40 GeV/c"); cutg->SetFillColor(1); cutg->SetPoint(0,0.171942,1.26952); cutg->SetPoint(1,0.761963,1.33804); cutg->SetPoint(2,2.11879,1.38164); cutg->SetPoint(3,9.6357,1.48754); cutg->SetPoint(4,13.4915,1.51246); cutg->SetPoint(5,10.8264,1.72425); cutg->SetPoint(6,1.47457,1.87998); cutg->SetPoint(7,0.580588,1.91736); cutg->SetPoint(8,0.153032,1.86752); cutg->SetPoint(9,0.0843649,1.72425); cutg->SetPoint(10,0.0960249,1.61836); cutg->SetPoint(11,0.171942,1.26952); break; } case 31: { std::cout << "Using p+p@31 cut (12E002)" << std::endl; cutg = new TCutG("dedx_cut",13); cutg->SetTitle("e^{-} dE/dx cut for 12E002 p+p @ 31 GeV/c"); cutg->SetFillColor(1); cutg->SetPoint(0,0.127665,1.26329); cutg->SetPoint(1,0.420062,1.30689); cutg->SetPoint(2,1.06687,1.3505); cutg->SetPoint(3,2.78069,1.40656); cutg->SetPoint(4,10.1478,1.46262); cutg->SetPoint(5,12.6459,1.51869); cutg->SetPoint(6,12.1642,1.6495); cutg->SetPoint(7,2.74493,1.74917); cutg->SetPoint(8,0.611444,1.81146); cutg->SetPoint(9,0.267016,1.83638); cutg->SetPoint(10,0.101128,1.73671); cutg->SetPoint(11,0.0877058,1.56229); cutg->SetPoint(12,0.127665,1.26329); break; } case 20: { std::cout << "Using p+p@20 cut (12E002)" << std::endl; cutg = new TCutG("dedx_cut",11); cutg->SetTitle("e^{-} dE/dx cut for 12E002 p+p @ 20 GeV/c"); cutg->SetFillColor(1); cutg->SetPoint(0,0.0459112,1.62458); cutg->SetPoint(1,0.627482,1.78654); cutg->SetPoint(2,3.20625,1.7554); cutg->SetPoint(3,9.38942,1.61836); cutg->SetPoint(4,9.14944,1.48131); cutg->SetPoint(5,3.46521,1.42525); cutg->SetPoint(6,1.0396,1.38787); cutg->SetPoint(7,0.465898,1.31312); cutg->SetPoint(8,0.193189,1.27575); cutg->SetPoint(9,0.0843649,1.14493); cutg->SetPoint(10,0.0459112,1.62458); break; } } } else if(!(system.CompareTo("PbPb"))) { switch(energy) { case 160: case 158: { std::cout << "Using Pb+Pb@158 cut (00B)" << std::endl; cutg = new TCutG("dedx_cut",18); cutg->SetTitle("e^{-} dE/dx cut for 00B Pb+Pb @ 160 GeV/c"); cutg->SetPoint(0,0.425317,1.89959); cutg->SetPoint(1,2.7223,1.89959); cutg->SetPoint(2,4.71651,1.86649); cutg->SetPoint(3,7.05759,1.83339); cutg->SetPoint(4,10.8218,1.7861); cutg->SetPoint(5,19.449,1.66315); cutg->SetPoint(6,19.2129,1.5733); cutg->SetPoint(7,12.0792,1.53074); cutg->SetPoint(8,6.02148,1.48818); cutg->SetPoint(9,3.78571,1.43143); cutg->SetPoint(10,2.59251,1.38887); cutg->SetPoint(11,1.5522,1.35577); cutg->SetPoint(12,1.02473,1.28484); cutg->SetPoint(13,0.701748,1.25646); cutg->SetPoint(14,0.529891,1.21863); cutg->SetPoint(15,0.376419,1.2139); cutg->SetPoint(16,0.376419,1.89959); cutg->SetPoint(17,0.425317,1.89959); break; } case 20: { std::cout << "Using Pb+Pb@20 cut (03A)" << std::endl; cutg = new TCutG("dedx_cut",15); cutg->SetTitle("e^{-} dE/dx cut for 03A Pb+Pb @ 20 GeV/c"); cutg->SetFillColor(1); cutg->SetPoint(0,0.0606792,1.7197); cutg->SetPoint(1,1.02568,1.83407); cutg->SetPoint(2,2.90105,1.80999); cutg->SetPoint(3,6.87075,1.70766); cutg->SetPoint(4,6.87075,1.60534); cutg->SetPoint(5,2.90105,1.52709); cutg->SetPoint(6,1.59862,1.44282); cutg->SetPoint(7,0.837351,1.37059); cutg->SetPoint(8,0.523797,1.34651); cutg->SetPoint(9,0.260795,1.31641); cutg->SetPoint(10,0.192372,1.2803); cutg->SetPoint(11,0.157049,1.21409); cutg->SetPoint(12,0.0630318,1.25622); cutg->SetPoint(13,0.0599146,1.5933); cutg->SetPoint(14,0.0606792,1.7197); break; } } } else std::cout << "Unknown system" << std::endl << "Type \"pp\" or \"PbPb\"" << std::endl; cutg->SetVarX("TMath::Log10(p)"); cutg->SetVarY("dedx"); return cutg; }