This is my root file;
link [REDACTED by Axel - possibly malware]
password:work
you can upload this app to download root file(because the file is too large to upload here)
or you can give me your email and i send it to you.
and now I found that out of the for loop,dsca[1]-dsca[3] is also not right, so it has nothing to do with the for loop;this is my new code(I delete some “cut”) and root file, you can help me find where is the matter.
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <cmath>
#include <stdlib.h>
#include <fstream>
#include "TCanvas.h"
#include "TMath.h"
#include "TH1.h"
#include "TF1.h"
#include "TRandom.h"
#include "TSpectrum.h"
#include "TVirtualFitter.h"
#include "THStack.h"
#include "cut.h"
using namespace std;
int test()
{
TChain *cccs=new TChain("cccs","");
cccs->Add("/mnt/data500/CCCS2018/zhangmx/15C/ET/workz011.root");
cccs->Add("/mnt/data500/CCCS2018/zhangmx/15C/ET/workz012.root");
float adc[32],qdc[32],tof1,xp[2],yp[2],th[2],ph[2],xb[10],yb[10],xa[10],ya[10],dene,decor;
float gdrft[16],dedx[16],prax[16],chibest[4],dxx[16],chimax,infdxx[4],infdyy[4],chiinf[4];
int events,dsca[16],mhit[16],hitnumber[4];
cccs->SetBranchAddress("tof1",&tof1,0);
cccs->SetBranchAddress("adc[32]",&adc,0);
cccs->SetBranchAddress("qdc[32]",&qdc,0);
cccs->SetBranchAddress("dsca[16]",&dsca,0);
cccs->SetBranchAddress("xb",&xb,0);
cccs->SetBranchAddress("yb",&yb,0);
cccs->SetBranchAddress("xa",&xa,0);
cccs->SetBranchAddress("ya",&ya,0);
cccs->SetBranchAddress("xp",&xp,0);
cccs->SetBranchAddress("yp",&yp,0);
cccs->SetBranchAddress("th",&th,0);
cccs->SetBranchAddress("ph",&ph,0);
cccs->SetBranchAddress("gdrft",&gdrft,0);
cccs->SetBranchAddress("dedx",&dedx,0);
cccs->SetBranchAddress("prax",&prax,0);
cccs->SetBranchAddress("mhit",&mhit,0);
cccs->SetBranchAddress("dxx",&dxx,0);
cccs->SetBranchAddress("chimax",&chimax,0);
cccs->SetBranchAddress("hitnumber",&hitnumber,0);
TCut first="adc[0]<3500&&adc[0]>400&&adc[1]<3500&&adc[1]>400&&adc[2]<2500&&adc[2]>1400&&qdc[3]<2200&&qdc[3]>500&&qdc[5]<4000&&qdc[5]>140&&qdc[7]<4000&&qdc[7]>140&&adc[16]<3840&&adc[16]>200&&adc[17]<3840&&adc[17]>200&&adc[3]<10&&adc[3]>0&&dsca[10]==1&&tof1<125&&tof1>110&&dsca[1]<=2";
TCanvas *can5=new TCanvas("can5","hh",0,0,800,800);can5->Divide(2,1);
can5->cd(1);cccs->Draw("(adc[16]+adc[17])/2+73*yb[1]:tof1>>hhhh(400,110,124,500,0,4000)",first,"col");
can5->cd(2);cccs->Draw("dsca[1]>>hh(100,0,100");
cccs->GetEntry(11);
cout<<dsca[1]<<" "<<dsca[2]<<" "<<dsca[3]<<" "<<dsca[4]<<" "<<dsca[5]<<" "<<dsca[10]<<endl;
TCanvas *can1=new TCa
nvas("can1","",0,0,900,900);//can1->Divide(2,2);
TCanvas *can2=new TCanvas("can2","",0,0,900,900);//can2->Divide(2,1);
/*
TH2F *h2001=new TH2F("h2001","",400,-5,5,1000,0,3000);
TH2F *h2002=new TH2F("h2002","",400,-5,5,500,0,3000);
int ninf,noutf;
float gamma;
int n1=0,n2=0;
// events=cccs->GetEntries();
events=100;
//printf("%d\n",events);
for(int i=0;i<events;i++)
{
cccs->GetEntry(i);
dene=(adc[16]+adc[17])/2;
// printf("%d %d %d %d %d %d %d\n",i,dsca[1],dsca[2],dsca[3],dsca[4],dsca[5],dsca[10]);
// &&dsca[1]<=2
if(adc[0]<3500&&adc[0]>400&&adc[1]<3500&&adc[1]>400&&adc[2]<2500&&adc[2]>1400&&qdc[3]<2200&&qdc[3]>500&&qdc[5]<4000&&qdc[5]>140&&qdc[7]<4000&&qdc[7]>140&&adc[16]<3840&&adc[16]>200&&adc[17]<3840&&adc[17]>200&&adc[3]<10&&adc[3]>0&&dsca[10]==1&&tof1<125&&tof1>110)
{
n1++;
h2001->Fill(yb[1],dene);
if(dsca[1]<=2)
{
n2++;
//===energy loss correction
h2002->Fill(yb[1],dene);
}
}
}
printf("%d %d %d\n",n1,n2,ninf);
can1->cd();h2001->Draw("col");
can2->cd();h2002->Draw("col");
*/
}