analyse.C 1 KB
Newer Older
1 2 3 4 5 6 7
void analyse()
{
	gSystem->Load("../libData.so");

	TFile *f = new TFile("../data/rawDataDSR4/NeuRad_test_07_1.root");
	TTree *tr = (TTree*)f->Get("rtree");

8 9 10 11 12 13 14 15 16
	const Int_t noBranches = 4;

	TString bName;
	RawEvent *revent[noBranches];
	for (Int_t j = 0; j<noBranches; j++) {
		revent[j] = new RawEvent();
		bName.Form("ch%d", j);
		tr->SetBranchAddress(bName.Data(), &revent[j]);
	}
17 18 19 20

//	tr->SetMakeClass(1);

	TFile *fw = new TFile("../data/dataDSR4/analysis_07_1.root", "RECREATE");
21 22 23 24 25 26 27 28 29
	TTree *tw = new TTree("atree", "title of drs4 analysis tree");

	AEvent *wevent[noBranches];
	for (Int_t j = 0; j<noBranches; j++) {
		wevent[j] = new AEvent();
		bName.Form("Ach%d.", j);
		wevent[j]->SetInputEvent(&revent[j]);
		tw->Bronch(bName.Data(), "AEvent", &wevent[j]);
	}
30 31 32 33 34

	Long64_t nentries = tr->GetEntries();
	for(Long64_t i = 0; i < nentries; i++) {
		tr->GetEntry(i);

35 36 37 38
		for (Int_t j = 0; j<noBranches; j++) {
			wevent[j]->Reset();
			wevent[j]->ProcessEvent();
		}
39 40 41 42 43 44 45 46 47 48

		tw->Fill();
	}


	tw->Write();
	fw->Close();

	return;
}