alpha.root
mwpc.root
TFile *fds=new TFile("alpha.root");
TTree *tree=(TTree*)fds->Get("tree");
TCanvas *c1=new TCanvas("c1","c1");
Double_t energy;
ULong64_t timestamp;
Int_t side,strip;
tree->SetBranchAddress("energy",&energy);
tree->SetBranchAddress("timestamp",×tamp);
tree->SetBranchAddress("side",&side);
tree->SetBranchAddress("strip",&strip);
tree->Print();
tree->Draw("energy>>(3000,0,30000)","side==0");
c1->Draw();
tree->Draw("energy>>(3000,0,30000)","side==1");
c1->Draw();
tree->Scan("side:strip:timestamp:int(energy)","","colsize=15",10,1);
//get timestamp table for front(side=0) and back(side=1) side
struct dssd
{
Double_t energy;
Int_t strip;
};
multimap<ULong64_t, dssd> mapf1, mapb;//map for front and back side
dssd ds;
Long64_t nentries = tree->GetEntriesFast();
for (Long64_t jentry=0; jentry<nentries;jentry++) {
tree->GetEntry(jentry);
ds.energy = energy;
ds.strip = strip;
if(side==0) mapf1.insert(make_pair(timestamp,ds));//key:timestamp, value: ds
if(side==1) mapb.insert(make_pair(timestamp,ds));
if(nentries%100000==0) cout<<jentry<<endl;
}
cout<<"Total number of frontside/backside events = "<<mapf1.size()<<" / "<<mapb.size()<<endl;
fds->Close();
TString sout;
auto ifts=mapf1.begin();//map<ULong64_t, dssd>::iterator ifts=;
auto ibts=mapb.begin();
TH2F *hxyraw=new TH2F("hxyraw","front-back correlation for unmatched data",3000,0,30000,3000,0,30000);
sout.Form("%4s%15s%15s%5s%5s%5s%5s"
, "i","front-ts","back-ts"," front-strip", " back-strip", " front-energy", " back-energy");
cout<<sout<<endl;
for(int i=0; i<TMath::Min(mapf1.size(),mapb.size()); i++) {
if(i<20) {
sout.Form("%2d %15llu %15llu %10d %10d %10.1f %10.1f"
, i, ifts->first, ibts->first, ifts->second.strip, ibts->second.strip, ifts->second.energy, ibts->second.energy);
cout<<sout<<endl;
}
hxyraw->Fill(ifts->second.energy,ibts->second.energy);//front-back energy correlation.
ifts++;
ibts++;
}
hxyraw->Draw("colz");
c1->Draw();
当多个探测器或一个探测器的不同信号是由一个事件(如某一入射粒子)引发时,它们之间就会有稳定的时间关系(称为关联事件)。
而对于不关联事件,探测器之间的时间差是任意的,因此时间差的分布是均匀分布。
map的lower_bound(),upper_bound()方法
ULong64_t twindow=100000;//ns
TH1I *hdt=new TH1I("hdt","fts-bts distribution(ns)",20000,-100000,100000);
//time window: [ts-twindow, ts+twindow]
for(auto ifts=mapf1.begin(); ifts!=mapf1.end();ifts++) {
auto ibts1 = mapb.lower_bound(ifts->first-twindow);//left boundary
auto ibts2 = mapb.upper_bound(ifts->first+twindow);//right boundary
for ( ; ibts1 != ibts2; ++ibts1) {
int dt=ifts->first-ibts1->first;
hdt->Fill(dt);
}
}
hdt->Draw();
c1->SetLogy();
c1->Draw();
hdt->GetXaxis()->SetRangeUser(-1000,500);
hdt->Draw();
c1->Draw();
ULong64_t toffset = -550;
multimap<ULong64_t,dssd> mapf;
for(auto ifts=mapf1.begin(); ifts!=mapf1.end();ifts++)
mapf.insert(pair<ULong64_t,dssd>(ifts->first -toffset, ifts->second));
cout<<mapf.size()<<endl;
TH2F *hxyc=new TH2F("hxyc","front-back correlation within coincidence window",3000,0,30000,3000,0,30000);
twindow=100;//ns
for(auto ifts=mapf.begin(); ifts!=mapf.end();ifts++) {
auto ibts1=mapb.lower_bound(ifts->first - twindow);
auto ibts2=mapb.upper_bound(ifts->first + twindow);
for ( ; ibts1 != ibts2; ++ibts1) {
int dt=ifts->first - ibts1->first;
hxyc->Fill(ifts->second.energy,ibts1->second.energy);
}
}
hxyc->Draw("colz");
c1->SetLogy(0);
c1->SetLogz();
c1->Draw();
Int_t nhit;
TH1I *hnhit=new TH1I("hnhit"," nhit ",5,0,5);
twindow=200;//ns
ifts=mapb.begin();
while(ifts!=mapb.end() ) {
nhit=0;
ULong64_t t0=ifts->first;
while (ifts!=mapb.end() ) {
if(ifts->first > t0+twindow) break;
nhit++;
ifts++;
}
hnhit->Fill(nhit);
}
hnhit->Draw("colz");
gPad->SetLogy();
c1->Draw();
Int_t xhit,yhit;
Int_t xstrip[2],ystrip[2];
ULong64_t xtimestamp[2],ytimestamp[2];
Float_t xenergy[2],yenergy[2];
TH2F *hx2=new TH2F("hx2"," x0-x1 energy correlation",500,0,10000,500,0,10000);
TH1I *hdtx=new TH1I("hdtx"," tx0-tx1 ",20,-150,50);
ifts=mapb.begin();
while(ifts!=mapb.end() ) {
xhit=0;
ULong64_t t0=ifts->first;
while (ifts!=mapb.end() && xhit<2) {
if(ifts->first > t0+twindow) break;
xtimestamp[xhit]= ifts->first;
xstrip[xhit]= ifts->second.strip;
xenergy[xhit]=ifts->second.energy;
xhit++;
ifts++;
}
if(xhit==2) {
hx2->Fill(xenergy[0],xenergy[1]);
Int_t dt=xtimestamp[0]-xtimestamp[1];
hdtx->Fill(dt);
}
}
hx2->Draw("colz");
c1->SetLogz(0);
c1->SetLogy(0);
c1->Draw();
hdtx->Draw();
c1->SetLogy();
c1->Draw();//同一面,不同条之间的时间晃动在 +100-100 范围内
multimap<ULong64_t,dssd> mapfn,mapbn;
ULong64_t t0;
int mby[5],mfx[5];
twindow=200;//ns
ibts=mapb.begin();
while(ibts!=mapb.end() ) {
yhit=0;
t0=ibts->first;
while (ibts!=mapb.end() && yhit<2) {
if(ibts->first > t0+twindow) break;
ytimestamp[yhit]= ibts->first;
ystrip[yhit]= ibts->second.strip;
yenergy[yhit]=ibts->second.energy;
yhit++;
ibts++;
}
if(yhit==1) {
ds.strip=ystrip[0];
ds.energy=yenergy[0];
mapbn.insert(pair<ULong64_t,dssd>(ytimestamp[0],ds));
mby[1]++;
}
if(yhit==2 && abs(ystrip[0]-ystrip[1])==1) {
ds.energy=yenergy[0]+yenergy[1];
ds.strip=ystrip[1];
t0=ytimestamp[1];
if(yenergy[0]>yenergy[1]) {
ds.strip=ystrip[0];
t0=ytimestamp[0];
}
mapbn.insert(pair<ULong64_t,dssd>(t0,ds));
mby[2]++;
}
if(yhit==2 && abs(ystrip[0]-ystrip[1])>1) {//skip
ds.strip=ystrip[0];
ds.energy=yenergy[0];
//mapbn.insert(pair<ULong64_t,dssd>(ytimestamp[0],ds));
ds.strip=ystrip[1];
ds.energy=yenergy[1];
//mapbn.insert(pair<ULong64_t,dssd>(ytimestamp[1],ds));
mby[3]++;
}
}
mby
twindow=200;//ns
ifts=mapf.begin();
while(ifts!=mapf.end() ) {
xhit=0;
t0=ifts->first;
while (ifts!=mapf.end() && xhit<2) {
if(ifts->first > t0+twindow) break;
xtimestamp[xhit]= ifts->first;
xstrip[xhit]= ifts->second.strip;
xenergy[xhit]=ifts->second.energy;
xhit++;
ifts++;
}
if(xhit==1) {
ds.strip=xstrip[0];
ds.energy=xenergy[0];
mapfn.insert(pair<ULong64_t,dssd>(xtimestamp[0],ds));
mfx[1]++;
}
if(xhit==2 && abs(xstrip[0]-xstrip[1])==1) {
ds.energy=xenergy[0]+xenergy[1];
ds.strip=xstrip[1];
t0=xtimestamp[1];
if(xenergy[0]>xenergy[1]) {
ds.strip=xstrip[0];
t0=xtimestamp[0];
}
mapfn.insert(pair<ULong64_t,dssd>(t0,ds));
mfx[2]++;
}
if(xhit==2 && abs(xstrip[0]-xstrip[1])>1) {
ds.strip=xstrip[0];
ds.energy=xenergy[0];
//mapfn.insert(pair<ULong64_t,dssd>(xtimestamp[0],ds));
ds.strip=xstrip[1];
ds.energy=xenergy[1];
//mapfn.insert(pair<ULong64_t,dssd>(xtimestamp[1],ds));
mfx[3]++;
}
}
mfx
TH2F *hxy=new TH2F("hxy","front-back correlation for corrected data",3000,0,30000,3000,0,30000);
TH2F *hxyfbc=new TH2F("hxyfbc","front-back correlation for corrected data with f-b correlation",3000,0,30000,3000,0,30000);
TH2I *hxystrip=new TH2I("hxystrip","front-back position",128,0,128,48,0,48);
struct dssdxy
{
int xstrip;
int ystrip;
Float_t energy;
};
dssdxy xy;
multimap<ULong64_t, dssdxy> mapdssd;
twindow=200;//ns
for(ifts=mapfn.begin(); ifts!=mapfn.end();ifts++) {
auto ibts1 = mapbn.lower_bound(ifts->first-twindow);//left boundary
auto ibts2 = mapbn.upper_bound(ifts->first+twindow);//right boundary
for ( ; ibts1 != ibts2; ++ibts1) {
int dt=ifts->first-ibts1->first;
hxy->Fill(ifts->second.energy,ibts1->second.energy);//no f-b correlation cut
if(abs(ifts->second.energy-ibts1->second.energy)<500) {
hxyfbc->Fill(ifts->second.energy,ibts1->second.energy);//with f-b correlation cut
xy.xstrip=ifts->second.strip;
xy.ystrip=ibts1->second.strip;
xy.energy=ibts1->second.energy;
mapdssd.insert(pair<ULong64_t, dssdxy>(ibts1->first, xy));
hxystrip->Fill(xy.ystrip,xy.xstrip);
}
}
}
hxy->Draw("colz");
c1->SetLogy(0);
c1->SetLogz();
c1->Draw();
//hxy->GetXaxis()->SetRangeUser(6000,8000);
//hxy->GetYaxis()->SetRangeUser(6000,8000);
hxyfbc->Draw("colz");
c1->Draw();
TH1F *hfe=(TH1F*) hxyfbc->ProjectionX("hfe");
hfe->Draw();
c1->Draw();
//hxystrip->Draw("colz");
//c1->Draw();
TFile *fmw=new TFile("mwpc.root");
TTree *tmw=(TTree*)fmw->Get("tree");
tmw->SetBranchAddress("energy",&energy);
tmw->SetBranchAddress("timestamp",×tamp);
tmw->Print();
tmw->Scan("timestamp:energy","","colsize=15",10,1);
multimap<ULong64_t, Float_t> mapmw1;//map for mwpc
nentries = tmw->GetEntriesFast();
for (Long64_t jentry=0; jentry<nentries;jentry++) {
tmw->GetEntry(jentry);
mapmw1.insert(pair<ULong64_t,Float_t>(timestamp,energy));
if(nentries%100000==0) cout<<jentry<<endl;
}
cout<<"Total number of mwpc events = "<<mapmw1.size()<<endl;
fmw->Close();
auto imw=mapmw1.begin();//
TH1F *hmwe=new TH1F("hmwe","energy of mwpc",3500,0,35000);
for(int i=0; i<mapmw1.size(); i++) {
if(i<10) {
sout.Form("%2d %15llu %5.1f" , i, imw->first, imw->second);
cout<<sout<<endl;
}
hmwe->Fill(imw->second);
imw++;
}
hmwe->Draw();
c1->SetLogy();
c1->Draw();//trheshold:1000
twindow=5000;//ns
TH1I *hmdt=new TH1I("hmdt","mts-fts distribution(ns)",1000,-5000,5000);
for(auto idts=mapdssd.begin(); idts!=mapdssd.end();idts++) {
auto imts1=mapmw1.lower_bound(idts->first-twindow);
auto imts2=mapmw1.upper_bound(idts->first+twindow);
for ( ; imts1 != imts2; ++imts1) {
int dt=imts1->first-idts->first;
hmdt->Fill(dt);
}
}
hmdt->Draw();
c1->SetLogy();
c1->Draw();
hmdt->GetXaxis()->SetRangeUser(400,1000);
hmdt->Draw();
c1->Draw();
toffset=650;
multimap<ULong64_t, Float_t> mapmw;
for(auto imts=mapmw1.begin(); imts!=mapmw1.end();imts++)
mapmw.insert(pair<ULong64_t,Float_t>(imts->first - toffset, imts->second));
TH1F *hmwec=new TH1F("hmwec","energy of mwpc coincided with DSSD ",3500,0,35000);
TH1F *hdsec=new TH1F("hdsec","energy of DSSD coincided with MWPC ",3500,0,30500);
TH1F *hdsenc=new TH1F("hdsenc","energy of DSSD no coincided with MWPC ",3500,0,30500);
TFile *ff=new TFile("sort1.root","recreate");
TTree *t1=new TTree("tree","sorted events");
Float_t de,me;
Int_t x,y;
ULong64_t tt;
t1->Branch("timestamp",&tt,"timestamp/l");
t1->Branch("me",&me,"me/F");
t1->Branch("de",&de,"de/F");
t1->Branch("xstrip",&x,"xstrip/I");
t1->Branch("ystrip",&y,"ystrip/I");
twindow=200;//ns
for(auto idts=mapdssd.begin(); idts!=mapdssd.end();idts++) {
tt=idts->first;
x=idts->second.xstrip;
y=idts->second.ystrip;
de=idts->second.energy;
me=-1;
auto imts1=mapmw.lower_bound(idts->first-twindow);
auto imts2=mapmw.upper_bound(idts->first+twindow);
for( ; imts1!=imts2; imts1++) {
me=imts1->second;
hmwec->Fill(imts1->second);
hdsec->Fill(idts->second.energy);
}
if(me<0) hdsenc->Fill(idts->second.energy);
t1->Fill();
}
hmwec->Draw();
c1->SetLogy();
c1->Draw();
t1->Write();
ff->Close();
MWPC能谱中超界部分在DSSD符合能谱中消失,意味着这部分是由很重的余核引起的,没有穿出MPWC,直接阻停在内部。
hmwe->Draw();
hmwec->SetLineColor(kRed);
hmwec->Draw("same");
c1->SetLogy();
c1->Draw();
从下面图的特征看,alpha峰即熔合蒸发余核的衰变产物只在无MWPC符合时出现。即alpha衰变的产生事件与束流注入事件不同步,衰变事件的时间应在粒子注入之后。将mwpc作为veto,可选出无入射粒子干扰的衰变谱。 0-2000范围内的DSSD能谱是由低能衰变产物和入射轻粒子(p,d等),引起的。入射轻粒子在MWPC上能量沉积太小,不产生信号,但一般都有足够的能量穿透注入探测器。这部分由注入探测器后的其他Si探测器进行测量,从DSSD谱中将其veto掉(这部分没有包含在当前的数据中)。
hfe->Draw();//dssd only
hdsec->SetLineColor(kGreen);
hdsec->Draw("same");//coincide with MWPC
c1->SetLogy(0);
c1->Draw();
c1->Clear();
hdsenc->Draw();
c1->Draw();
!jupyter nbconvert 5.1_decay_analysis_I.ipynb --to html