Changeset 168
- Timestamp:
- Jun 16, 2006, 4:44:20 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MEMPHYS/HEAD/applications/MEMPHYS_analysis.cxx
r166 r168 102 102 } 103 103 ////////////////////////////////////////////////////////////////////////////// 104 bool process_hits_times( 105 AIDA::ITuple& aParent 106 ,AIDA::IHistogram1D& aHisto 107 ) 108 ////////////////////////////////////////////////////////////////////////////// 109 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 110 { 111 AIDA::ITupleEntry* entry = (AIDA::ITupleEntry*)aParent.getObject(2); 112 if(!entry) return false; 113 114 AIDA::ITuple* tuple = dynamic_cast<AIDA::ITuple*>(entry); 115 if(!tuple) return false; 116 117 tuple->start(); 118 while(tuple->next()) { 119 120 float time = tuple->getFloat(0); 121 122 aHisto.fill(time); 123 } 124 return true; 125 } 126 ////////////////////////////////////////////////////////////////////////////// 127 bool process_hits( 128 AIDA::ITuple& aParent 129 ,AIDA::IHistogram1D& aHisto 130 ) 131 ////////////////////////////////////////////////////////////////////////////// 132 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 133 { 134 AIDA::ITupleEntry* entry = (AIDA::ITupleEntry*)aParent.getObject(10); 135 if(!entry) return false; 136 137 AIDA::ITuple* tuple = dynamic_cast<AIDA::ITuple*>(entry); 138 if(!tuple) return false; 139 140 tuple->start(); 141 while(tuple->next()) { 142 143 //int tubeId = tuple->getInt(0); 144 //int totalPE = tuple->getInt(1); 145 146 if(!process_hits_times(*tuple,aHisto)) return false; 147 } 148 return true; 149 } 150 ////////////////////////////////////////////////////////////////////////////// 151 bool process_digits( 152 AIDA::ITuple& aParent 153 ,AIDA::IHistogram2D& aHisto 154 ) 155 ////////////////////////////////////////////////////////////////////////////// 156 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 157 { 158 AIDA::ITupleEntry* entry = (AIDA::ITupleEntry*)aParent.getObject(13); 159 if(!entry) return false; 160 161 AIDA::ITuple* tuple = dynamic_cast<AIDA::ITuple*>(entry); 162 if(!tuple) return false; 163 164 tuple->start(); 165 while(tuple->next()) { 166 167 //int tubeId = tuple->getInt(0); 168 double pe = tuple->getDouble(1); 169 double time = tuple->getDouble(2); 170 //printf("debug : ++++ : %g %g\n",time,pe); 171 172 aHisto.fill(time,pe); 173 } 174 return true; 175 } 176 ////////////////////////////////////////////////////////////////////////////// 177 bool plot( 178 AIDA::IAnalysisFactory& aAIDA 179 ,AIDA::IHistogram1D& aHisto1D 180 ,AIDA::IHistogram2D& aHisto2D 181 ) 182 ////////////////////////////////////////////////////////////////////////////// 183 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 184 { 185 std::string header = "MEMPHYS_analysis : "; 186 187 AIDA::IPlotterFactory* plotterFactory = 188 aAIDA.createPlotterFactory(0,0); 189 if(!plotterFactory) { 190 std::cout << header << "can't get a PlotterFactory." << std::endl; 191 return false; 192 } 193 194 AIDA::IPlotter* plotter = plotterFactory->create(); 195 if(!plotter) { 196 std::cout << header << "can't get a plotter." << std::endl; 197 return false; 198 } 199 200 plotter->clearRegions(); 201 plotter->createRegions(1,2,0); 202 203 plotter->setCurrentRegionNumber(0); 204 plotter->currentRegion().plot(aHisto1D); 205 206 plotter->setCurrentRegionNumber(1); 207 plotter->currentRegion().plot(aHisto2D); 208 209 210 plotter->show(); 211 plotter->interact(); 212 213 delete plotter; 214 delete plotterFactory; 215 216 return true; 217 } 218 ////////////////////////////////////////////////////////////////////////////// 219 ////////////////////////////////////////////////////////////////////////////// 220 ////////////////////////////////////////////////////////////////////////////// 104 221 int main( 105 222 int //aArgc … … 125 242 return 1; 126 243 } 244 245 //////////////////////////////////////////////////////// 246 // Create histograms in memory tree //////////////////// 247 //////////////////////////////////////////////////////// 248 AIDA::ITree* memory = treeFactory->create(); 249 if(!memory) { 250 std::cout << header << "can't get memory tree." << std::endl; 251 return 1; 252 } 253 AIDA::IHistogramFactory* histogramFactory = 254 aida->createHistogramFactory(*memory); 255 if(!histogramFactory) { 256 std::cout << header << "can't get an histogram factory." << std::endl; 257 return 1; 258 } 259 260 AIDA::IHistogram1D* hits_times = 261 histogramFactory->createHistogram1D("hits_times","Hits times",100,0,3000); 262 if(!hits_times) { 263 std::cout << header 264 << "can't create histogram : time." 265 << std::endl; 266 return 1; 267 } 268 269 AIDA::IHistogram2D* digits_time_pe = 270 histogramFactory->createHistogram2D("digits_pe_time","Digits PE time", 271 100,0,3000,100,0,10); 272 if(!digits_time_pe) { 273 std::cout << header 274 << "can't create histogram : digits_time_pe." 275 << std::endl; 276 return 1; 277 } 278 279 delete histogramFactory; 280 281 //////////////////////////////////////////////////////// 282 /// Read data ////////////////////////////////////////// 283 //////////////////////////////////////////////////////// 127 284 128 285 AIDA::ITree* tree = treeFactory->create("MEMPHYS.root","root",true,false); … … 167 324 while(tuple->next() && (irow<nentries)) { 168 325 326 /* 169 327 int eventId = tuple->getInt(0); 170 328 //int inputEvtId = tuple->getInt(1); … … 190 348 <<" sumPE " << sumPE 191 349 << std::endl; 192 193 if(!dump_tracks(*tuple)) return false; 350 */ 351 352 //if(!dump_tracks(*tuple)) return 1; 353 354 if(!process_hits(*tuple,*hits_times)) return 1; 355 if(!process_digits(*tuple,*digits_time_pe)) return 1; 194 356 195 357 irow++; … … 198 360 delete treeFactory; 199 361 delete tree; 362 363 plot(*aida,*hits_times,*digits_time_pe); 364 200 365 delete aida; 201 366
Note:
See TracChangeset
for help on using the changeset viewer.