Difference between revisions of "PhotoFis.C (ROOT program to analyse data)"

From New IAC Wiki
Jump to navigation Jump to search
 
(One intermediate revision 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;
Line 32: Line 31:
 
  delete f;
 
  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;
}


Go Back