Difference between revisions of "PhotoFis.C (ROOT program to analyse data)"
Jump to navigation
Jump to search
| (4 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | void PhotoFis() { | + | void PhotoFis() { |
| − | |||
struct evt_t { | struct evt_t { | ||
| − | |||
Int_t event, ADCnum, ADCval, Lastevent, LastADCnum,LastADCval; | Int_t event, ADCnum, ADCval, Lastevent, LastADCnum,LastADCval; | ||
| − | |||
}; | }; | ||
| − | |||
ifstream in; | ifstream in; | ||
| − | |||
in.open("189.txt"); | in.open("189.txt"); | ||
| − | |||
evt_t evt; | evt_t evt; | ||
| − | |||
Int_t nlines=0; | Int_t nlines=0; | ||
| − | |||
TFile *f = new TFile("PhotoFis.root","RECREATE"); | TFile *f = new TFile("PhotoFis.root","RECREATE"); | ||
| − | |||
TTree *tree = new TTree("PhotoFis","PhototFis data from ascii file"); | TTree *tree = new TTree("PhotoFis","PhototFis data from ascii file"); | ||
| − | |||
tree->Branch("evt",&evt.event,"event/I:ADCnum/I:ADCval/I:Lastevent/I:LastADCnum/I:LastADCval"); | tree->Branch("evt",&evt.event,"event/I:ADCnum/I:ADCval/I:Lastevent/I:LastADCnum/I:LastADCval"); | ||
| − | |||
evt.LastADCnum=0; | evt.LastADCnum=0; | ||
| − | |||
evt.LastADCval=0; | evt.LastADCval=0; | ||
| − | |||
evt.Lastevent=0; | evt.Lastevent=0; | ||
| − | |||
while(in.good()){ | while(in.good()){ | ||
| − | |||
//evt.event=nlines; | //evt.event=nlines; | ||
| − | |||
in >> evt.ADCnum >> evt.ADCval >> evt.event ; | in >> evt.ADCnum >> evt.ADCval >> evt.event ; | ||
| − | + | if(evt.event < 10) printf( " %0d %d %d \n", evt.event, evt.ADCnum, evt.ADCval ); | |
| − | if(evt.event < 10) printf( " %0d %d %d \n", evt.event, evt.ADCnum, evt.ADCval ); | ||
| − | |||
| − | |||
| − | |||
nlines++; | nlines++; | ||
| − | |||
tree->Fill(); | tree->Fill(); | ||
| − | |||
evt.LastADCnum=evt.ADCnum; | evt.LastADCnum=evt.ADCnum; | ||
| − | |||
evt.LastADCval=evt.ADCval; | evt.LastADCval=evt.ADCval; | ||
| − | |||
evt.Lastevent=evt.event; | evt.Lastevent=evt.event; | ||
| − | |||
in >> evt.LastADCnum >> evt.LastADCval >> evt.Lastevent ; | in >> evt.LastADCnum >> evt.LastADCval >> evt.Lastevent ; | ||
| − | + | // printf( " %0d %d %d \n", evt.LastADCnum, evt.LastADCval, evt.Lastevent ); | |
| − | // printf( " %0d %d %d \n", evt.LastADCnum, evt.LastADCval, evt.Lastevent ); | ||
| − | |||
| − | |||
| − | |||
} | } | ||
| − | |||
tree->Print(); | tree->Print(); | ||
| − | |||
tree->Write(); | tree->Write(); | ||
| − | |||
in.close(); | in.close(); | ||
| − | |||
delete tree; | delete tree; | ||
| + | delete f; | ||
| + | } | ||
| − | |||
| − | + | [http://wiki.iac.isu.edu/index.php/PhotoFission_with_Polarized_Photons_from_HRRL Go Back] | |
Latest revision as of 06:22, 5 February 2009
void PhotoFis() {
struct evt_t {
Int_t event, ADCnum, ADCval, Lastevent, LastADCnum,LastADCval;
};
ifstream in;
in.open("189.txt");
evt_t evt;
Int_t nlines=0;
TFile *f = new TFile("PhotoFis.root","RECREATE");
TTree *tree = new TTree("PhotoFis","PhototFis data from ascii file");
tree->Branch("evt",&evt.event,"event/I:ADCnum/I:ADCval/I:Lastevent/I:LastADCnum/I:LastADCval");
evt.LastADCnum=0;
evt.LastADCval=0;
evt.Lastevent=0;
while(in.good()){
//evt.event=nlines;
in >> evt.ADCnum >> evt.ADCval >> evt.event ;
if(evt.event < 10) printf( " %0d %d %d \n", evt.event, evt.ADCnum, evt.ADCval );
nlines++;
tree->Fill();
evt.LastADCnum=evt.ADCnum;
evt.LastADCval=evt.ADCval;
evt.Lastevent=evt.event;
in >> evt.LastADCnum >> evt.LastADCval >> evt.Lastevent ;
// printf( " %0d %d %d \n", evt.LastADCnum, evt.LastADCval, evt.Lastevent );
}
tree->Print();
tree->Write();
in.close();
delete tree;
delete f;
}