Changeset 547
- Timestamp:
- 01/18/01 09:36:12 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/readraw.cc
r463 r547 68 68 // open the file 69 69 // 70 71 cout << " Open the file " << endl ; 72 70 73 TFile input(argv[1], "READ"); 71 74 … … 74 77 // 75 78 79 cout << " Check the RunHeader " << endl ; 76 80 TTree *runtree = (TTree*) input.Get("RunHeaders") ; 77 81 78 cout << " Entries in Tree RunHeaders: " << dec << runtree->GetEntries() << endl ; 79 80 runtree->GetBranch("MRawRunHeader")->SetAddress(&runheader); 81 runtree->GetEvent(0); 82 83 runheader->Print(); 84 82 if (!runtree) 83 { 84 cout << endl 85 << " WARNING: This file has NO RunHeader " 86 << endl << endl ; 87 } 88 else 89 { 90 cout << " Entries in Tree RunHeaders: " << dec << runtree->GetEntries() << endl ; 91 92 runtree->GetBranch("MRawRunHeader")->SetAddress(&runheader); 93 runtree->GetEvent(0); 94 95 runheader->Print(); 96 } 85 97 86 98 // 87 99 // open the DataTree and read in 88 100 // 89 TTree *evttree = (TTree*) input.Get("Data") ;90 101 91 // 92 // connnect the branches in that tree 93 // 94 evttree->GetBranch("MRawEvtHeader")->SetAddress(&evtheader); 95 evttree->GetBranch("MTime")->SetAddress(&evttime); 96 evttree->GetBranch("MRawEvtData")->SetAddress(&evtdata); 97 evttree->GetBranch("MRawCrateArray")->SetAddress(&evtcrate); 102 cout << " Check the Event Tree " << endl ; 103 104 TTree *evttree = (TTree*) input.Get("Events") ; 98 105 106 cout << " Check all the Branches in the Tree " << endl ; 107 108 109 // check the branches in the Tree 110 111 TIter Next(evttree->GetListOfBranches()); 112 TBranch *branch=NULL; 113 114 while ( (branch=(TBranch*)Next()) ) 115 { 116 // 117 // Get Name of Branch 118 // 119 const char *name = branch->GetName(); 120 121 // cout << name << endl ; 122 123 if ( ! strcmp(name, "MRawEvtHeader") ) 124 evttree->GetBranch("MRawEvtHeader")->SetAddress(&evtheader); 125 126 if ( ! strcmp(name, "MTime") ) 127 evttree->GetBranch("MTime")->SetAddress(&evttime); 128 129 if ( ! strcmp(name, "MRawEvtData") ) 130 evttree->GetBranch("MRawEvtData")->SetAddress(&evtdata); 131 132 if ( ! strcmp(name, "MRawCrateArray") ) 133 evttree->GetBranch("MRawCrateArray")->SetAddress(&evtcrate); 134 135 if ( ! strcmp(name, "MMcEvt") ) 136 cout << " Not able to connect to class MMcEvt yet " << endl ; 137 138 if ( ! strcmp(name, "MMcTrig") ) 139 cout << " Not able to connect to class MMcTrig yet " << endl ; 140 141 142 } 143 144 // loop over all entries 145 99 146 Int_t nent = (Int_t)evttree->GetEntries(); 100 cout << " Entries in Tree Data: " << dec << nent << endl; 147 148 cout << endl << endl 149 << " Entries in Tree Data: " << dec << nent << endl; 101 150 102 151 for (Int_t i = 0; i<nent; i++)
Note:
See TracChangeset
for help on using the changeset viewer.