Changeset 13656
- Timestamp:
- 05/11/12 23:10:52 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/PulseTemplates/FCalcPulseTemplate.C
r13641 r13656 40 40 #include "rootfilehandler.h" 41 41 #include "pixel.h" 42 #include "pixelsum.h" 42 43 #include "templateextractors.h" 43 44 … … 83 84 //---------------------------------------------------------------------------- 84 85 int FCalcPulseTemplate( 85 TString InRootFileName = " 20111109_006.pulses.root",86 TString InputPath = " ../analysis/FPulseTemplate/20111109_006/",86 TString InRootFileName = "pulseoverlay.root", 87 TString InputPath = "/home_nfs/isdc/jbbuss/analysis/FPulseTemplate/20111109_006/Overlay/", 87 88 TString OutputRootFileName = "20111109_006.pulses.root", 88 TString OutPutPath = " ../analysis/FPulseTemplate/20111109_006/Templates/",89 TString OutPutPath = "/home_nfs/isdc/jbbuss/analysis/FPulseTemplate/20111109_006/Template/", 89 90 bool ProduceGraphic = false, 90 bool fitdata = false,91 // bool fitdata = false, 91 92 bool stats = false, 92 93 bool debugPixel = false, 93 94 int pixelSetSize = 40, 94 95 int maxPulseOrder = 3, 95 int refresh_rate = 500, //refresh rate for canvases96 int verbosityLevel = 0, // different verbosity levels can be implemented here96 // int refresh_rate = 500, //refresh rate for canvases 97 int verbosityLevel = 4, // different verbosity levels can be implemented here 97 98 int firstpixel = 0, 98 99 int npixel = -1 … … 103 104 // Open-Root-File Settings 104 105 //---------------------------------------------------------------------------- 105 TFile * inputRootFile = OpenRootFile( InputPath, InRootFileName, verbosityLevel ); 106 106 if (verbosityLevel > 0) 107 { 108 cout << endl << "...load root file" << endl; 109 } 110 111 TFile * inputRootFile = OpenRootFile( InputPath, InRootFileName, verbosityLevel ); 112 TFile * outputRootFile = OpenRootFile( OutPutPath, OutputRootFileName, verbosityLevel ); 107 113 //---------------------------------------------------------------------------- 108 114 // global variable Settings … … 124 130 // root global Settings 125 131 //---------------------------------------------------------------------------- 132 if (verbosityLevel > 0) 133 { 134 cout << endl << "...setting up root environment" ; 135 } 136 126 137 gStyle->SetPalette(1,0); 127 138 gROOT->SetStyle("Plain"); 128 gPad->SetGrid();139 // gPad->SetGrid(); 129 140 130 141 … … 133 144 // root Canvas Settings 134 145 //---------------------------------------------------------------------------- 146 if (verbosityLevel > 0) 147 { 148 cout << endl << "...preparing canvases" << endl; 149 } 135 150 136 151 //Canvas Pad numbering 137 int pulsesCanvasFrameNrs[4] = {152 int PixelCanvasFrameNrs[4] = { 138 153 1, // Top left 139 154 2, // Top right … … 143 158 144 159 //Canvas Pad numbering 145 int distributionCanvasFrameNrs[4] = {160 int AllpixelCanvasFrameNrs[4] = { 146 161 1, // Top left 147 162 2, // Top right … … 208 223 // Initialize Pixel 209 224 //---------------------------------------------------------------------------- 225 if (verbosityLevel > 0) 226 { 227 cout << endl << "...preparing pixels" << endl; 228 } 229 210 230 Pixel** pixel = new Pixel*[NPIX]; 211 231 … … 215 235 } 216 236 237 PixelSum* wholeCamera = NULL; 238 239 bool first_pass = true; 217 240 //------------------------------------- 218 241 // Loop over Pixel Sets … … 227 250 << "...processing Pixel: " 228 251 << firstPixelOfSet 229 << " to Pixel: "252 << " to Pixel: " 230 253 << firstPixelOfSet+pixelSetSize-1 << endl; 231 254 } … … 254 277 // Create individual Pixel 255 278 //------------------------------------- 279 if (verbosityLevel > 3) 280 { 281 cout << "...creating pixel: " << pixelID << endl; 282 } 256 283 pixel[pixelID] = new Pixel( 257 284 pixelID, … … 264 291 if (breakout) break; 265 292 293 //Preparing Camera 294 if (first_pass) 295 { 296 if (verbosityLevel > 0) 297 { 298 cout << endl << "...preparing camera" << endl; 299 } 300 wholeCamera = new PixelSum( 301 "AllPixel", 302 1440, 303 maxPulseOrder, 304 verbosityLevel, 305 stats, 306 outputRootFile, 307 pixel[pixelID]->mPixelOverlayXaxisLeft, 308 pixel[pixelID]->mPixelOverlayXaxisRight , 309 pixel[pixelID]->mBSLMean , 310 pixel[pixelID]->mGainMean , 311 pixel[pixelID]->mOptions 312 ); 313 first_pass = false; 314 } 266 315 //------------------------------------- 267 316 // Histogramms of Maximas in Overlay Spectra … … 280 329 << firstPixelOfSet+pixelSetSize-1 281 330 << " Pixel: " << pixelID 282 << "/" << firstpixel + npixel -1 << endl283 << " Pulse-Order: " << pulse_order ;331 << "/" << firstpixel + npixel -1 332 << " Pulse-Order: " << pulse_order << endl; 284 333 } 285 334 286 335 // Calculate Max Prop. Value of each slice 287 336 //------------------------------------- 288 337 if (verbosityLevel > 2) 338 { 339 cout << "...extracting templates from Maximum Overlay " << endl; 340 } 289 341 //from Maximum Overlay 290 342 ExtractPulseTemplate( … … 295 347 ); 296 348 349 if (verbosityLevel > 2) 350 { 351 cout << "...extracting templates from Edge Overlay " << endl; 352 } 297 353 //from Edge Overlay 298 354 ExtractPulseTemplate( … … 321 377 pixel[pixelID]->DrawTemplateHistograms( 322 378 cgpPixelPulses, 323 pulsesCanvasFrameNrs379 PixelCanvasFrameNrs 324 380 ); 325 381 326 382 pixel[pixelID]->DrawEdgeTemplateHistograms( 327 383 cgpPixelPulses, 328 pulsesCanvasFrameNrs 329 ); 330 384 PixelCanvasFrameNrs 385 ); 386 387 //------------------------------------- 388 // Fill Histogramms of Camera 389 //------------------------------------- 390 391 wholeCamera->hMaxOverlay[pulse_order]->Add( 392 pixel[pixelID]->hMaxOverlay[pulse_order] 393 ); 394 395 wholeCamera->hMaxProfile[pulse_order]->Add( 396 pixel[pixelID]->hMaxProfile[pulse_order] 397 ); 398 399 wholeCamera->hEdgeOverlay[pulse_order]->Add( 400 pixel[pixelID]->hEdgeOverlay[pulse_order] 401 ); 402 403 wholeCamera->hEdgeProfile[pulse_order]->Add( 404 pixel[pixelID]->hEdgeProfile[pulse_order] 405 ); 331 406 332 407 … … 357 432 } 358 433 434 435 436 //deleteCurrent Pixel from Heap 437 delete pixel[pixelID]; 438 359 439 if (verbosityLevel > 2) 360 440 { … … 386 466 //------------------------------------- 387 467 468 for ( int pulse_order = 0 ; 469 pulse_order < wholeCamera->mMaxPulseOrder ; 470 pulse_order ++) 471 { 472 if (verbosityLevel > 2) 473 { 474 cout << "-------------------------------------" << endl 475 << "...processing Pulse-Order: " << pulse_order; 476 } 477 478 // Calculate Max Prop. Value of each slice 479 //------------------------------------- 480 481 //from Maximum Overlay 482 ExtractPulseTemplate( 483 wholeCamera, 484 "Maximum", 485 pulse_order, 486 verbosityLevel 487 ); 488 489 //from Edge Overlay 490 ExtractPulseTemplate( 491 wholeCamera, 492 "Edge", 493 pulse_order, 494 verbosityLevel 495 ); 496 497 WritePixelTemplateToCsv( 498 wholeCamera, 499 OutPutPath, 500 "Maximum", 501 pulse_order, 502 verbosityLevel 503 ); 504 505 WritePixelTemplateToCsv( 506 wholeCamera, 507 OutPutPath, 508 "Edge", 509 pulse_order, 510 verbosityLevel 511 ); 512 513 wholeCamera->DrawTemplateHistograms( 514 cgpPixelPulses, 515 PixelCanvasFrameNrs 516 ); 517 518 wholeCamera->DrawEdgeTemplateHistograms( 519 cgpPixelPulses, 520 PixelCanvasFrameNrs 521 ); 522 } 388 523 // SaveHistograms( //save histograms of all pixel into output root file 389 524 // OutInRootFileName, … … 417 552 // ); 418 553 554 delete pixel; 555 delete wholeCamera; 419 556 DeletePixelCanvases( maxPulseOrder ,verbosityLevel ); 557 delete inputRootFile; 558 delete outputRootFile; 420 559 return( 0 ); 421 560 }
Note:
See TracChangeset
for help on using the changeset viewer.