示例#1
0
void exportHistograms(){
	TreeReader reader;
	reader.openSeries(257,"D");
	reader.openSeries(258,"D");
	reader.openSeries(260,"D");
	reader.openSeries(261,"D");
	reader.openSeries(262,"D");
	TH1F hist1("hist1","hist1",100,0,30000);
	TH1F hist2("hist2","hist2",100,0,30000);
	TH1F hist3("hist3","hist3",100,0,30000);
	for(Long64_t i=0;i<reader.tree->GetEntries();i++){
		reader.tree->GetEntry(i);
		if(fabs(reader.recon.t_gamma[2]-600)<10){
			hist1.Fill(reader.recon.E_gamma[2]);
		}
		if(fabs(reader.recon.t_gamma[6]-600)<10){
			hist2.Fill(reader.recon.E_gamma[6]);
		}
		if(fabs(reader.recon.t_gamma[13]-600)<10){
			hist3.Fill(reader.recon.E_gamma[13]);
		}
	}
	ofstream output(Form("%s/output.csv",RDKANAL));
	output<<"bin center,det02,det06,det16"<<endl;
	for(Long64_t i=1;i<=100;i++){
		output<<hist1.GetBinCenter(i)<<","<<hist1.GetBinContent(i)<<",";
		output<<hist2.GetBinContent(i)<<","<<hist3.GetBinContent(i)<<endl;
	}
	output.close();
}
示例#2
0
void listEvents(){
	Recon recon;
	//TFile f(Form("%s/cal.root",RDKANAL));
	//CalibrationList *list=(CalibrationList*)f.Get("CalibrationList");
	TString path=Form("%s/calibration/TCfit_511keV_calibration_21Feb11.dat",RDKANAL);
	CalibrationList *list=new CalibrationList(path);
	TreeReader reader;
	reader.reset(kTRUE);
	//NData ndata=reader.openList(Form("%s/runlist.csv",RDKANAL));
	NData ndata=reader.openSeries(256,"S");
	//NData ndata=reader.openSeries(TreeReader::n1400,TreeReader::all1400,"S");
	logNdat(ndata);
	ofstream log(Form("%s/eventLists/list.csv",RDKANAL));
	log<<"Series,Run,EventNum,PeakHeight,Energy,DeltaTime"<<endl;
	Int_t series=0,run=0,evnt=0;
	for(Long64_t i=0;i<reader.tree->GetEntries();i++){
		if(i%10000==0){
			cout<<i<<endl;
		}
		reader.tree->GetEntry(i);
		//if(series==reader.entry.nseries && run==reader.entry.nrun){
		//	reader.entry.nevent=++evnt;
		//}else{
		//	series=reader.entry.nseries;
		//	run=reader.entry.nrun;
		//	evnt=0;
		//}
		recon=list->calibrate(reader.entry,reader.recon);
		Int_t delta_t=recon.t_gamma[CH]-recon.t_e-PEAK;
		if(recon.E_gamma[CH]>=MIN && recon.E_gamma[CH]<=MAX && recon.t_p-recon.t_e<650
			&& delta_t>-ONPEAK && delta_t<=ONPEAK && recon.E_e<30000 && recon.E_p>300 && recon.E_p<1000){
			log<<reader.entry.nseries<<","<<reader.entry.nrun<<","<<reader.entry.nevent<<",";
			log<<reader.recon.E_gamma[CH]<<","<<recon.E_gamma[CH]<<",";
			log<<(recon.t_gamma[CH]-recon.t_e)<<endl;
		}
	}
	log.close();
	delete list;
	//f.close();
	gSystem->ChangeDirectory(WORKDIR);
}
示例#3
0
void secondPass(){
	TreeReader reader;
	reader.openSeries(256,"S");
	Int_t i=1,r0,r1;
	Long64_t t0,t1;
	reader.tree->GetEntry(0);
	r0=reader.entry.nrun;
	t0=150*reader.entry.timestamp[0];
	reader.tree->GetEntry(i);
	r1=reader.entry.nrun;
	t1=150*reader.entry.timestamp[1];
	while(r0==r1){
		if(t1-t0<bitError && t0-t1<bitError){
			g.SetPoint(i-1,i-1,t1-t0);
		}else{
			g.SetPoint(i-1,i-1,0);
		}
		reader.tree->GetEntry(++i);
		r0=r1;
		t0=t1;
		r1=reader.entry.nrun;
		t1=150*reader.entry.timestamp[0];
	}
}