void corrhp(const Int_t year, const Int_t iweek, string *week, const Int_t iconfig, const Int_t nbinxbj, Double_t *x, Double_t *err_x, Double_t *A1p, Double_t *err_A1p, Double_t *CorrAV, Double_t *err_CorrAV, Int_t *HADP, Int_t *HADN, Int_t *pRun, Int_t *nRun, Int_t &RunMin, Int_t &RunMax){ ofstream hout(Form("A1_contas_%i_%s_%i.out", year, week[iweek].c_str(),iconfig)); // output file for configuration i FILE *hadout; hadout = fopen("hadron.out","a"); // output file for configuration i FILE *A1out; A1out= fopen(Form("A1_histo_%i_%s_%i.out", year, week[iweek].c_str(),iconfig),"w"); const int nbinxbj1=12; Float_t wxbj[nbinxbj1+1] = {0.003, 0.006, 0.010, 0.020, 0.030, 0.040, 0.060, 0.100, 0.150, 0.200, 0.300, 0.400, 0.700}; // x_Bj window //creates the histograms - array allocation Double_t xbinsXBj[101]; for(Int_t i=0; i<101; i++ ) xbinsXBj[i] = 1e-3 * pow(10,0.03*i); TH1D** histoUPP = new TH1D*[nbinxbj]; // Sum of weights in target U, field positive, positive hadrons TH1D** histoDPP = new TH1D*[nbinxbj]; // Sum of weights in target D, field positive, positive hadrons TH1D** histoUNP = new TH1D*[nbinxbj]; // Sum of weights in target U, field negative, positive hadrons TH1D** histoDNP = new TH1D*[nbinxbj]; // Sum of weights in target D, field negative, positive hadrons TH1D** histoUPN = new TH1D*[nbinxbj]; // Sum of weights in target U, field positive, negative hadrons TH1D** histoDPN = new TH1D*[nbinxbj]; // Sum of weights in target D, field positive, negative hadrons TH1D** histoUNN = new TH1D*[nbinxbj]; // Sum of weights in target U, field negative, negative hadrons TH1D** histoDNN = new TH1D*[nbinxbj]; // Sum of weights in target D, field negative, negative hadrons TH1D** histoBetaUPP = new TH1D*[nbinxbj]; // Sum of weights^{2}*Beta in target U, field positive, positive hadrons TH1D** histoBetaDPP = new TH1D*[nbinxbj]; // Sum of weights^{2}*Beta in target D, field positive, positive hadrons TH1D** histoBetaUNP = new TH1D*[nbinxbj]; // Sum of weights^{2}*Beta in target U, field negative, positive hadrons TH1D** histoBetaDNP = new TH1D*[nbinxbj]; // Sum of weights^{2}*Beta in target D, field negative, positive hadrons TH1D** histoBetaUPN = new TH1D*[nbinxbj]; // Sum of weights^{2}*Beta in target U, field positive, negative hadrons TH1D** histoBetaDPN = new TH1D*[nbinxbj]; // Sum of weights^{2}*Beta in target D, field positive, negative hadrons TH1D** histoBetaUNN = new TH1D*[nbinxbj]; // Sum of weights^{2}*Beta in target U, field negative, negative hadrons TH1D** histoBetaDNN = new TH1D*[nbinxbj]; // Sum of weights^{2}*Beta in target D, field negative, negative hadrons for(int i=0; iExec(Form("awk '/%i / {print substr($0,5,300)}' /comp02/comp/helena/DB/Grouping_%i_%s.list > mytree_%i_%s_%i.list",pRun[iconfig],year,week[iweek].c_str(),year,week[iweek].c_str(),pRun[iconfig])); // pFile = fopen (Form("mytree_%i_%s_%i.list",year,week[iweek].c_str(),pRun[iconfig]), "r"); // while (!feof(pFile)) { // fgetc (pFile); // n++; // } // rewind (pFile); // stpor=fgets (pLine , 10000 , pFile); // posp = stpor.find(" "); // for (int i=0; iAdd("his_35259-2-7.root.03"); // } // fclose (pFile); int Run; int Nout; int Hcharge; long long EvN; int minRp = 0; int maxRp = 0; int minRn = 0; int maxRn = 0; float Xbj, Q2; Float_t like[6]; Int_t TM; Double_t P_UP, P_CENTER, P_DOWN, weight, z; bool inTargetD; bool inTargetU; bool inTargetC; bool LastHadron, Muon, TI; int UPEP[nbinxbj], UPEN[nbinxbj], DPEP[nbinxbj], DPEN[nbinxbj]; int UNEP[nbinxbj], UNEN[nbinxbj], DNEP[nbinxbj], DNEN[nbinxbj]; double rfactor[nbinxbj], err_rfactor[nbinxbj]; double EvUPP[nbinxbj],EvDPP[nbinxbj],EvUNP[nbinxbj],EvDNP[nbinxbj], EvUPN[nbinxbj],EvDPN[nbinxbj],EvUNN[nbinxbj],EvDNN[nbinxbj];// Ev:= event; UP,DP := Upstream, Downstream (field Positive); UN,DN := Upstream, Downstream (field Negative); last P or N:= hadron Positive or Negative double CovUP[nbinxbj],CovDP[nbinxbj],CovUN[nbinxbj],CovDN[nbinxbj]; double CorrUP[nbinxbj],CorrDP[nbinxbj],CorrUN[nbinxbj],CorrDN[nbinxbj]; double GetAcceptance[nbinxbj]; float aA = 0.967, bA = 0.256; //parameters of ratio of acceptances int hadp=0; int hadn=0; int hadp_z2=0; int hadn_z2=0; for (Int_t i = 0; i < nbinxbj; i++){ HADP[i] = 0; HADN[i] = 0; EvUPP[i]=0; EvDPP[i]=0; EvUPN[i]=0; EvDPN[i]=0; CovUP[i]=0; CovDP[i]=0; CorrUP[i]=0; CorrDP[i]=0; UPEP[i]=0; UPEN[i]=0; DPEP[i]=0; DPEN[i]=0, rfactor[i]=0, err_rfactor[i]=0; } Int_t PrEvN = -1; t_p->SetBranchAddress("weight",&weight); t_p->SetBranchAddress("Xbj",&Xbj); t_p->SetBranchAddress("Q2",&Q2); t_p->SetBranchAddress("P_UP",&P_UP); t_p->SetBranchAddress("P_DOWN",&P_DOWN); t_p->SetBranchAddress("P_CENTER",&P_CENTER); t_p->SetBranchAddress("inTargetU",&inTargetU); t_p->SetBranchAddress("inTargetC",&inTargetC); t_p->SetBranchAddress("inTargetD",&inTargetD); t_p->SetBranchAddress("Run",&Run); t_p->SetBranchAddress("EvN",&EvN); t_p->SetBranchAddress("Nout",&Nout); t_p->SetBranchAddress("LastHadron",&LastHadron); t_p->SetBranchAddress("Muon",&Muon); t_p->SetBranchAddress("Hcharge",&Hcharge); t_p->SetBranchAddress("z",&z); t_p->SetBranchAddress("like",&like); t_p->SetBranchAddress("TM",&TM); //reads all entries and fills the histograms Int_t nentries = (Int_t)t_p->GetEntries(); for (Int_t j=0; jGetEntry(j); if( (TM&8) || (TM&256) || (TM&1024) ) TI = true; // O, M, J/psi else TI = false; cout< 0) { hadp++; }else if(Hcharge > 0) { hadn++; } // if (Nout > 1){ if (z > 0.2 && z < 1 && !Muon){ if(Hcharge > 0) { for (Int_t i=0; i < nbinxbj; i++){ if (Xbj >= wxbj[i] && Xbj < wxbj[i+1]){ if (Run < 41399) { if(inTargetU){ histoUPP[i] ->Fill(Xbj,weight); histoBetaUPP[i]->Fill(Xbj,P_UP*weight*weight); } else if(inTargetD){ histoDPP[i] ->Fill(Xbj,weight); histoBetaDPP[i]->Fill(Xbj,P_DOWN*weight*weight); } } else { if(inTargetU){ histoUPP[i] ->Fill(Xbj,weight); histoBetaUPP[i]->Fill(Xbj,P_UP*weight*weight); }else if(inTargetD){ histoUPP[i] ->Fill(Xbj,weight); histoBetaUPP[i]->Fill(Xbj,P_DOWN*weight*weight); }else if (inTargetC){ histoDPP[i] ->Fill(Xbj,weight); histoBetaDPP[i]->Fill(Xbj,P_CENTER*weight*weight); } } } } } else { for (Int_t i=0; i < nbinxbj; i++){ if (Xbj >= wxbj[i] && Xbj < wxbj[i+1]){ if (Run < 41399) { if(inTargetU){ histoUPN[i] ->Fill(Xbj,weight); histoBetaUPN[i]->Fill(Xbj,P_UP*weight*weight); }else if(inTargetD){ histoDPN[i] ->Fill(Xbj,weight); histoBetaDPN[i]->Fill(Xbj,P_DOWN*weight*weight); } } else { if(inTargetU){ histoUPN[i] ->Fill(Xbj,weight); histoBetaUPN[i]->Fill(Xbj,P_UP*weight*weight); }else if(inTargetD){ histoUPN[i] ->Fill(Xbj,weight); histoBetaUPN[i]->Fill(Xbj,P_DOWN*weight*weight); }else if (inTargetC){ histoDPN[i] ->Fill(Xbj,weight); histoBetaDPN[i]->Fill(Xbj,P_CENTER*weight*weight); } } } } } }// if (z > 0.2 && z < 1){ //}// if (Nout > 1){ if (Run < 41399) { if(inTargetU){//for the correlation matrices for (Int_t i=0; i < nbinxbj; i++){ if(EvN != PrEvN) { UPEP[i]=0; UPEN[i]=0; } if (Xbj >= wxbj[i] && Xbj < wxbj[i+1]){ if(Hcharge < 0 && z > 0.2 && z < 1 && !Muon) { //and not a muon UPEP[i]++; }else if((Muon && (TI || (!TI && Nout > 1)))){//else if is muon UPEN[i]=1; } if(LastHadron){ EvUPP[i] += UPEP[i]*weight*UPEP[i]*weight; EvUPN[i] += UPEN[i]*weight*UPEN[i]*weight; CovUP[i] += UPEP[i]*weight*UPEN[i]*weight; } } } }else if(inTargetD){ for (Int_t i=0; i < nbinxbj; i++){ if(EvN != PrEvN) { DPEP[i]=0; DPEN[i]=0; } if (Xbj >= wxbj[i] && Xbj < wxbj[i+1]){ if(Hcharge < 0 && z > 0.2 && z < 1 && !Muon) { DPEP[i]++; //cout<<"h+"< 1)))){//else if is muon //cout<<"h-"<= wxbj[i] && Xbj < wxbj[i+1]){ if(Hcharge < 0 && z > 0.2 && z < 1 && !Muon) { hadp_z2++; UPEP[i]++; }else if((Muon && (TI || (!TI && Nout > 1)))){//else if is muon // }else if(Muon){ hadn_z2++; UPEN[i]=1; } if(LastHadron){ EvUPP[i] += UPEP[i]*weight*UPEP[i]*weight; EvUPN[i] += UPEN[i]*weight*UPEN[i]*weight; CovUP[i] += UPEP[i]*weight*UPEN[i]*weight; } } } }else if(inTargetD){ for (Int_t i=0; i < nbinxbj; i++){ if(EvN != PrEvN) { UPEP[i]=0; UPEN[i]=0; } if (Xbj >= wxbj[i] && Xbj < wxbj[i+1]){ if(Hcharge < 0 && z > 0.2 && z < 1 && !Muon) { hadp_z2++; UPEP[i]++; }else if((Muon && (TI || (!TI && Nout > 1)))){//else if is muon // }else if(Muon){ hadn_z2++; UPEN[i]=1; } if(LastHadron){ EvUPP[i] += UPEP[i]*weight*UPEP[i]*weight; EvUPN[i] += UPEN[i]*weight*UPEN[i]*weight; CovUP[i] += UPEP[i]*weight*UPEN[i]*weight; } } } }else if(inTargetC){ for (Int_t i=0; i < nbinxbj; i++){ if(EvN != PrEvN) { DPEP[i]=0; DPEN[i]=0; } if (Xbj >= wxbj[i] && Xbj < wxbj[i+1]){ if(Hcharge < 0 && z > 0.2 && z < 1 && !Muon) { hadp_z2++; DPEP[i]++; }else if((Muon && (TI || (!TI && Nout > 1)))){//else if is muon // }else if(Muon){ hadn_z2++; DPEN[i]=1; } if(LastHadron){ EvDPP[i] += DPEP[i]*weight*DPEP[i]*weight; EvDPN[i] += DPEN[i]*weight*DPEN[i]*weight; CovDP[i] += DPEP[i]*weight*DPEN[i]*weight; } } } } } // for next hadron PrEvN = EvN; ///////////////end of filling the correlation matrix if(j == 1) { // search min. run number minRp = Run; }else if(j==nentries-1){ // search max. run number maxRp = Run; } }// for (Int_t j=0; jDivide(3,4); // for (Int_t i = 0; i < nbinxbj; i++){ // c1->cd(i+1); // histoUP[i]->Draw(); // gPad->SetLogx(); // c1->Update(); // } // c1->Print(Form("/comp01/na50/helena/compass/%i/A1/%s/2ndorder/consecutive/semi-inclusive/WUP_%i_%s.ps", year, week, config)); // TCanvas* c3 = new TCanvas("c3",Form("Sum of weights in target D, B +, configuration %i", config),500,0, 900, 638 ); // c3->Divide(3,4); // for (Int_t i = 0; i < nbinxbj; i++){ // c3->cd(i+1); // histoDP[i]->Draw(); // gPad->SetLogx(); // c3->Update(); // } // c3->Print(Form("/comp01/na50/helena/compass/%i/A1/%s/2ndorder/consecutive/semi-inclusive/WDP_%i_%s.ps", year, week, config)); // TCanvas* c5 = new TCanvas("c5",Form("Sum of weights*Beta in target U, B +, configuration %i", config),500,0, 900, 638 ); // c5->Divide(3,4); // for (Int_t i = 0; i < nbinxbj; i++){ // c5->cd(i+1); // histoBetaUP[i]->Draw(); // gPad->SetLogx(); // c5->Update(); // } // c5->Print(Form("/comp01/na50/helena/compass/%i/A1/%s/2ndorder/consecutive/semi-inclusive/WUPBeta_%i_%s.ps", year, week, config)); // TCanvas* c6 = new TCanvas("c6",Form("Sum of weights*Beta in target D, B +, configuration %i", config),500,0, 900, 638 ); // c6->Divide(3,4); // for (Int_t i = 0; i < nbinxbj; i++){ // c6->cd(i+1); // histoBetaDP[i]->Draw(); // gPad->SetLogx(); // c6->Update(); // } // c6->Print(Form("/comp01/na50/helena/compass/%i/A1/%s/2ndorder/consecutive/semi-inclusive/WDPBeta_%i_%s.ps", year, week, config)); Double_t sumUPP[nbinxbj], sumDPP[nbinxbj]; Double_t sumUPN[nbinxbj], sumDPN[nbinxbj]; Double_t sumBetaUPP[nbinxbj], sumBetaDPP[nbinxbj]; Double_t sumBetaUPN[nbinxbj], sumBetaDPN[nbinxbj]; for(Int_t i=0; i < nbinxbj; i++ ) { sumUPP[i] = 0.0; sumDPP[i] = 0.0; sumUPN[i] = 0.0; sumDPN[i] = 0.0; sumBetaUPP[i] = 0.0; sumBetaDPP[i] = 0.0; sumBetaUPN[i] = 0.0; sumBetaDPN[i] = 0.0; } for(Int_t i = 0; i < nbinxbj; i++){ for(Int_t j=0; j<101; j++ ) { sumUPP[i] += histoUPP[i]->GetBinContent(j); sumDPP[i] += histoDPP[i]->GetBinContent(j); sumUPN[i] += histoUPN[i]->GetBinContent(j); sumDPN[i] += histoDPN[i]->GetBinContent(j); sumBetaUPP[i] += histoBetaUPP[i]->GetBinContent(j); sumBetaDPP[i] += histoBetaDPP[i]->GetBinContent(j); sumBetaUPN[i] += histoBetaUPN[i]->GetBinContent(j); sumBetaDPN[i] += histoBetaDPN[i]->GetBinContent(j); } } ////////////////////////////////// End of field positive /////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////// Begining of field negative ////////////////////////////////////////////// for (Int_t i=0; i < nbinxbj; i++){ EvUNP[i]=0; EvDNP[i]=0; EvUNN[i]=0; EvDNN[i]=0; CovUN[i]=0; CovDN[i]=0; CorrUN[i]=0; CorrDN[i]=0; UNEP[i]=0; UNEN[i]=0; DNEP[i]=0; DNEN[i]=0; } Int_t hadp1=0; Int_t hadn1=0; PrEvN = -1; // n = 0; TChain * t_n= new TChain ("USRSI"); // gSystem->Exec(Form("awk '/%i / {print substr($0,5,300)}' /comp02/comp/helena/DB/Grouping_%i_%s.list > mytree_%i_%s_%i.list",nRun[iconfig],year,week[iweek].c_str(),year,week[iweek].c_str(),nRun[iconfig])); // nFile = fopen (Form("mytree_%i_%s_%i.list",year,week[iweek].c_str(),nRun[iconfig]), "r"); // while (!feof(nFile)) { // fgetc (nFile); // n++; // } // rewind (nFile); // stnpor=fgets (nLine , 10000 , nFile); // posn = stnpor.find(" "); // for (int i=0; iAdd(Form("/hometmp/comp/helena/%i/%s/histo/his_%i*.root*",year,week[iweek].c_str(),runn[i])); t_n->Add("his_35259-2-7.root.02"); // } // fclose (nFile); t_n->SetBranchAddress("inTargetD",&inTargetD); t_n->SetBranchAddress("Run",&Run); t_n->SetBranchAddress("EvN",&EvN); t_n->SetBranchAddress("Nout",&Nout); t_n->SetBranchAddress("LastHadron",&LastHadron); t_n->SetBranchAddress("Muon",&Muon); t_n->SetBranchAddress("Hcharge",&Hcharge); t_n->SetBranchAddress("z",&z); t_n->SetBranchAddress("like",&like); t_n->SetBranchAddress("weight",&weight); t_n->SetBranchAddress("Xbj",&Xbj); t_n->SetBranchAddress("Q2",&Q2); t_n->SetBranchAddress("P_UP",&P_UP); t_n->SetBranchAddress("P_DOWN",&P_DOWN); t_n->SetBranchAddress("P_CENTER",&P_CENTER); t_n->SetBranchAddress("inTargetU",&inTargetU); t_n->SetBranchAddress("inTargetC",&inTargetC); t_n->SetBranchAddress("TM",&TM); //read all entries and fill the histograms nentries = (Int_t)t_n->GetEntries(); for (Int_t j=0; jGetEntry(j); if( (TM&8) || (TM&256) || (TM&1024) ) TI = true; // O, M, J/psi else TI = false; if(Hcharge > 0) { hadp1++; }else if(Hcharge > 0) { hadn1++; } // if (Nout > 1){ if (z > 0.2 && z < 1 && !Muon){ if(Hcharge > 0) { hadp_z2++; for (Int_t i=0; i < nbinxbj; i++){ if (Xbj >= wxbj[i] && Xbj < wxbj[i+1]){ if (Run < 41399) { if(inTargetU){ histoUNP[i] ->Fill(Xbj,weight); histoBetaUNP[i]->Fill(Xbj,(P_UP)*weight*weight); }else if (inTargetD){ histoDNP[i] ->Fill(Xbj,weight); histoBetaDNP[i]->Fill(Xbj,(P_DOWN)*weight*weight); } } else { if(inTargetU){ histoUNP[i] ->Fill(Xbj,weight); histoBetaUNP[i]->Fill(Xbj,(P_UP)*weight*weight); }else if(inTargetD){ histoUNP[i] ->Fill(Xbj,weight); histoBetaUNP[i]->Fill(Xbj,(P_DOWN)*weight*weight); }else if (inTargetC){ histoDNP[i] ->Fill(Xbj,weight); histoBetaDNP[i]->Fill(Xbj,(P_CENTER)*weight*weight); } } } } } if(Hcharge > 0) { hadn_z2++; for (Int_t i=0; i < nbinxbj; i++){ if (Xbj >= wxbj[i] && Xbj < wxbj[i+1]){ if (Run < 41399) { if(inTargetU){ histoUNN[i] ->Fill(Xbj,weight); histoBetaUNN[i]->Fill(Xbj,(P_UP)*weight*weight); }else if (inTargetD){ histoDNN[i] ->Fill(Xbj,weight); histoBetaDNN[i]->Fill(Xbj,(P_DOWN)*weight*weight); } } else { if(inTargetU){ histoUNN[i] ->Fill(Xbj,weight); histoBetaUNN[i]->Fill(Xbj,(P_UP)*weight*weight); }else if(inTargetD){ histoUNN[i] ->Fill(Xbj,weight); histoBetaUNN[i]->Fill(Xbj,(P_DOWN)*weight*weight); }else if (inTargetC){ histoDNN[i] ->Fill(Xbj,weight); histoBetaDNN[i]->Fill(Xbj,(P_CENTER)*weight*weight); } } } } } }// if (z > 0.2 && z < 1){ // }// if (Nout > 1){ if (Run < 41399) { if(inTargetU){//for the correlation matrices for (Int_t i=0; i < nbinxbj; i++){ if(EvN != PrEvN) { UNEP[i]=0; UNEN[i]=0; } if (Xbj >= wxbj[i] && Xbj < wxbj[i+1]){ if(Hcharge < 0 && z > 0.2 && z < 1 && !Muon) { hadp_z2++; UNEP[i]++; }else if((Muon && (TI || (!TI && Nout > 1)))){//else if is muon // }else if(Muon){ hadn_z2++; UNEN[i]=1; } if(LastHadron){ EvUNP[i] += UNEP[i]*weight*UNEP[i]*weight; EvUNN[i] += UNEN[i]*weight*UNEN[i]*weight; CovUN[i] += UNEP[i]*weight*UNEN[i]*weight; } } } }else if(inTargetD){ for (Int_t i=0; i < nbinxbj; i++){ if(EvN != PrEvN) { DNEP[i]=0; DNEN[i]=0; } if (Xbj >= wxbj[i] && Xbj < wxbj[i+1]){ if(Hcharge < 0 && z > 0.2 && z < 1 && !Muon) { hadp_z2++; DNEP[i]++; }else if((Muon && (TI || (!TI && Nout > 1)))){//else if is muon // }else if(Muon){ hadn_z2++; DNEN[i]=1; } if(LastHadron){ EvDNP[i] += DNEP[i]*weight*DNEP[i]*weight; EvDNN[i] += DNEN[i]*weight*DNEN[i]*weight; CovDN[i] += DNEP[i]*weight*DNEN[i]*weight; } } } } }else { if(inTargetU){//for the correlation matrices for (Int_t i=0; i < nbinxbj; i++){ if(EvN != PrEvN) { UNEP[i]=0; UNEN[i]=0; } if (Xbj >= wxbj[i] && Xbj < wxbj[i+1]){ if(Hcharge < 0 && z > 0.2 && z < 1 && !Muon) { hadp_z2++; UNEP[i]++; }else if((Muon && (TI || (!TI && Nout > 1)))){//else if is muon // }else if(Muon){ hadn_z2++; UNEN[i]=1; } if(LastHadron){ EvUNP[i] += UNEP[i]*weight*UNEP[i]*weight; EvUNN[i] += UNEN[i]*weight*UNEN[i]*weight; CovUN[i] += UNEP[i]*weight*UNEN[i]*weight; } } } }else if(inTargetD){///// for (Int_t i=0; i < nbinxbj; i++){ if(EvN != PrEvN) { UNEP[i]=0; UNEN[i]=0; } if (Xbj >= wxbj[i] && Xbj < wxbj[i+1]){ if(Hcharge < 0 && z > 0.2 && z < 1 && !Muon) { hadp_z2++; UNEP[i]++; }else if((Muon && (TI || (!TI && Nout > 1)))){//else if is muon // }else if(Muon){ hadn_z2++; UNEN[i]=1; } if(LastHadron){ EvUNP[i] += UNEP[i]*weight*UNEP[i]*weight; EvUNN[i] += UNEN[i]*weight*UNEN[i]*weight; CovUN[i] += UNEP[i]*weight*UNEN[i]*weight; } } } }else if(inTargetC){ for (Int_t i=0; i < nbinxbj; i++){ if(EvN != PrEvN) { DNEP[i]=0; DNEN[i]=0; } if (Xbj >= wxbj[i] && Xbj < wxbj[i+1]){ if(Hcharge < 0 && z > 0.2 && z < 1 && !Muon) { hadp_z2++; DNEP[i]++; }else if((Muon && (TI || (!TI && Nout > 1)))){//else if is muon // }else if(Muon){ hadn_z2++; DNEN[i]=1; } if(LastHadron){ EvDNP[i] += DNEP[i]*weight*DNEP[i]*weight; EvDNN[i] += DNEN[i]*weight*DNEN[i]*weight; CovDN[i] += DNEP[i]*weight*DNEN[i]*weight; } } } } } // for next hadron PrEvN = EvN; if(j == 1) { // search min. run number minRn = Run; }else if(j==nentries-1){ // search max. run number maxRn = Run; } } fprintf (A1out, "hadp1 = %i \t hadn1 = %i \n", hadp1, hadn1); // // Draw the histograms and get bin contents // TCanvas* c7 = new TCanvas("c7",Form("Sum of weights in target U, B -, configuration %i", config),500,0, 900, 638 ); // c7->Divide(3,4); // for (Int_t i = 0; i < nbinxbj; i++){ // c7->cd(i+1); // histoUN[i]->Draw(); // gPad->SetLogx(); // c7->Update(); // } // c7->Print(Form("/comp01/na50/helena/compass/%i/A1/%s/2ndorder/consecutive/semi-inclusive/WUN_%i_%s.ps", year, week, config)); // TCanvas* c9 = new TCanvas(Form("c9_%i",config),Form("Sum of weights in target D, B -, configuration %i", config),500,0, 900, 638 ); // c9->Divide(3,4); // for (Int_t i = 0; i < nbinxbj; i++){ // c9->cd(i+1); // histoDN[i]->Draw(); // gPad->SetLogx(); // c9->Update(); // } // c9->Print(Form("/comp01/na50/helena/compass/%i/A1/%s/2ndorder/consecutive/semi-inclusive/WDN_%i_%s.ps", year, week, config)); // TCanvas* c11 = new TCanvas("c11",Form("Sum of weights*Beta in target U, B -, configuration %i", config),500,0, 900, 638 ); // c11->Divide(3,4); // for (Int_t i = 0; i < nbinxbj; i++){ // c11->cd(i+1); // histoBetaUN[i]->Draw(); // gPad->SetLogx(); // c11->Update(); // } // c11->Print(Form("/comp01/na50/helena/compass/%i/A1/%s/2ndorder/consecutive/semi-inclusive/WUNBeta_%i_%s.ps", year, week, config)); // TCanvas* c12 = new TCanvas("c12",Form("Sum of weights*Beta in target D, B -, configuration %i", config),500,0, 900, 638 ); // c12->Divide(3,4); // for (Int_t i = 0; i < nbinxbj; i++){ // c12->cd(i+1); // histoBetaDN[i]->Draw(); // gPad->SetLogx(); // c12->Update(); // } // c12->Print(Form("/comp01/na50/helena/compass/%i/A1/%s/2ndorder/consecutive/semi-inclusive/WDNBeta_%i_%s.ps", year, week, config)); Double_t sumUNP[nbinxbj], sumDNP[nbinxbj]; Double_t sumUNN[nbinxbj], sumDNN[nbinxbj]; Double_t sumBetaUNP[nbinxbj], sumBetaDNP[nbinxbj]; Double_t sumBetaUNN[nbinxbj], sumBetaDNN[nbinxbj]; for(Int_t i=0; i < nbinxbj; i++ ) { sumUNP[i] = 0.0; sumDNP[i] = 0.0; sumUNN[i] = 0.0; sumDNN[i] = 0.0; sumBetaUNP[i] = 0.0; sumBetaDNP[i] = 0.0; sumBetaUNN[i] = 0.0; sumBetaDNN[i] = 0.0; } for (Int_t i = 0; i < nbinxbj; i++){ for(int j=0; j<101; j++ ) { sumUNP[i] += histoUNP[i]->GetBinContent(j); sumDNP[i] += histoDNP[i]->GetBinContent(j); sumUNN[i] += histoUNN[i]->GetBinContent(j); sumDNN[i] += histoDNN[i]->GetBinContent(j); sumBetaUNP[i] += histoBetaUNP[i]->GetBinContent(j); sumBetaDNP[i] += histoBetaDNP[i]->GetBinContent(j); sumBetaUNN[i] += histoBetaUNN[i]->GetBinContent(j); sumBetaDNN[i] += histoBetaDNN[i]->GetBinContent(j); } } ////////////////////////////////// End of field negative /////////////////////////////////////////////////// if (minRp < minRn) { RunMin = minRp; } else { RunMin = minRn; } if (maxRp > maxRn) { RunMax = maxRp; } else { RunMax = maxRn; } Double_t UPP[nbinxbj], DPP[nbinxbj], UNP[nbinxbj], DNP[nbinxbj]; Double_t UPN[nbinxbj], DPN[nbinxbj], UNN[nbinxbj], DNN[nbinxbj]; for (Int_t i = 0; i < nbinxbj; i++){ UPP[i]=histoUPP[i]->GetEntries(); DPP[i]=histoDPP[i]->GetEntries(); UNP[i]=histoUNP[i]->GetEntries(); DNP[i]=histoDNP[i]->GetEntries(); UPN[i]=histoUPN[i]->GetEntries(); DPN[i]=histoDPN[i]->GetEntries(); UNN[i]=histoUNN[i]->GetEntries(); DNN[i]=histoDNN[i]->GetEntries(); fprintf (A1out, "UPP[%i]\t= %i \t\t DPP[%i]\t= %i \t\t UNP[%i]\t= %i \t\t DNP[%i]\t= %i \n", i, int(UPP[i]), i, int(DPP[i]), i, int(UNP[i]), i, int(DNP[i])); } fprintf (A1out,"\n"); fprintf (A1out,"\n"); for (Int_t i = 0; i < nbinxbj; i++){ fprintf (A1out,"UPN[%i]\t= %i \t\t DPN[%i]\t= %i \t\t UNN[%i]\t= %i \t\t DNN[%i]\t= %i \n", i, int(UPN[i]), i, int(DPN[i]), i, int(UNN[i]), i, int(DNN[i])); } fprintf (A1out,"\n"); fprintf (A1out,"\n"); for (Int_t i = 0; i < nbinxbj; i++){ fprintf (A1out, "sumUPP[%i]\t= %f \t sumDPP[%i]\t= %f \t sumUNP[%i]\t= %f \t sumDNP[%i]\t= %f \n", i, sumUPP[i], i, sumDPP[i], i, sumUNP[i], i, sumDNP[i]); } fprintf (A1out,"\n"); fprintf (A1out,"\n"); for (Int_t i = 0; i < nbinxbj; i++){ fprintf (A1out, "sumUPN[%i]\t= %f \t sumDPN[%i]\t= %f \t sumUNN[%i]\t= %f \t sumDNN[%i]\t= %f \n", i, sumUPN[i], i, sumDPN[i], i, sumUNN[i], i, sumDNN[i]); } fprintf (A1out,"\n"); fprintf (A1out,"\n"); for (Int_t i = 0; i < nbinxbj; i++){ fprintf (A1out, "sumBetaUPP[%i] = %f \t sumBetaDPP[%i] = %f \t\t sumBetaUNP[%i] = %f \t sumBetaDNP[%i] = %f \n", i, sumBetaUPP[i], i, sumBetaDPP[i], i, sumBetaUNP[i], i, sumBetaDNP[i]); } fprintf (A1out,"\n"); fprintf (A1out,"\n"); for (Int_t i = 0; i < nbinxbj; i++){ fprintf (A1out, "sumBetaUPN[%i] = %f \t sumBetaDPN[%i] = %f \t\t sumBetaUNN[%i] = %f \t sumBetaDNN[%i] = %f \n", i, sumBetaUPN[i], i, sumBetaDPN[i], i, sumBetaUNN[i], i, sumBetaDNN[i]); } fprintf (A1out,"\n"); fprintf (A1out,"\n"); fprintf (hadout,"\n"); for(int i=0; iGetMean(1); err_x[i] = histoUPP[i]->GetMeanError(1); hout <<"x["<Delete(); histoDPP[i]->Delete(); histoUNN[i]->Delete(); histoDNN[i]->Delete(); histoUNP[i]->Delete(); histoDNP[i]->Delete(); histoUPN[i]->Delete(); histoDPN[i]->Delete(); histoBetaUPP[i]->Delete(); histoBetaDPP[i]->Delete(); histoBetaUNP[i]->Delete(); histoBetaDNP[i]->Delete(); histoBetaUPN[i]->Delete(); histoBetaDPN[i]->Delete(); histoBetaUNN[i]->Delete(); histoBetaDNN[i]->Delete(); } }