只考虑x/y侧不大于4重的事件; xx和yy互换的事件计入同一类。即将如下两类事件视为一类2.b
(xe[0]+xe[1]=ye[0] && |xx[0]-xx[1]|=1); xe[2]=ye[1]
(ye[0]+ye[1]=xe[0] && |yy[0]-yy[1]|=1); ye[2]=xe[1]
2.a: xe[0]=ye[0]; xe[1]=ye[1]
2.b: (xe[0]+xe[1]=ye[0] && |xx[0]-xx[1]|=1); xe[2]=ye[1]
2.c: (xe[0]+xe[1]=ye[0] && |xx[0]-xx[1]|$\neq$1)
2.d: (xe[0]+xe[1]=ye[0] && |xx[0]-xx[1]|=1); (xe[2]+xe[3]=ye[1] && |xx[2]-xx[3]|=1)
2.e: (xe[0]+xe[1]=ye[0]+ye[1] && |xx[0]-xx[1]|$\neq$1 && |yy[0]-yy[1]|=1)
3.a: xe[0]=ye[0]; xe[1]=ye[1]; xe[2]=ye[2]
3.b: xe[0]=ye[0]; xe[1]=ye[1]; (xe[2]+xe[3]=ye[2] && |xx[2]-xx[3]|=1)
4.a: xe[0]=ye[0]; xe[1]=ye[1]; xe[2]=ye[2]; xe[3]=ye[3]
优先将x-y两侧能量匹配的位置考虑为一个粒子入射。
处理剩余事件
输入文件事件结构
Int_t dx1hit; //multiplicity
Int_t dx1[dx1hit]; //Strip
Double_t dx1e[x1hit]; //energy
Int_t dy1hit;
Int_t dy1[dy1hit];
Double_t dy1e[dy1hit];
处理代码
...
//variables for TTree Branch
Int_t hit1;
Double_t e1[hit1];
Double_t x1[hit1];
Double_t y1[hit1];
Long64_t entry; //for consistency check.
//new root file & new tree
TFile *fout = new TFile("event_DSSD.root","recreate");
TTree *tout = new TTree("tree","tree");
...
//event loops in input tree.
for(Long64_t jentry=0; jentry<nentries; jentry++) {
tree->GetEntry(jentry);
if(d1xhit>4 || d1yhit>4) continue;
entry = jentry;
//unmatched events
map<int,double> mxe, mye; //strip, energy
//matched events
vector<double> vx,vy;
vector<double> ve;
//dssd1
for(int i=0; i<d1xhit; i++) {
for(int j=0; j<d1yhit; j++) {
double de = (dx1e[i]-dy1e[j]);
//unmatched events
if( de < -20 || de > 22+0.004*dx1e[i]) {
mxe.insert(make_pair(dx1[i],dx1e[i]));
mye.insert(make_pair(dy1[j],dy1e[j]));
}
//mathed events
else {
vx.push_back(dx1[i]);
vy.push_back(dy1[i]);
ve.push_back(dx1e[i]);
break;
}
}
}
// Handle events that have not been matched yet
// mxe,mye -> vx,vy,ve
...
hit1 = vx.size();
for(int i=0; i<hit1; i++) {
x1[i] = vx[i];
y1[i] = vy[i];
e1[i] = ve[i];
}
//dssd2
...
//dssd3
...
tout->Fill();
}
tout->Write();
fout->Close();