Changeset 13790 for fact/tools/rootmacros/PulseTemplates
- Timestamp:
- 05/18/12 23:35:09 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/PulseTemplates/FCalcPulseTemplate.C
r13780 r13790 101 101 { 102 102 103 104 InputPath = SetHostsPaths(true, InputPath ); 105 OutPutPath = SetHostsPaths(true, OutPutPath ); 106 103 InputPath = SetHostsPaths(true, InputPath ); 104 OutPutPath = SetHostsPaths(true, OutPutPath ); 107 105 108 106 //---------------------------------------------------------------------------- … … 114 112 } 115 113 116 TFile * inputRootFile = OpenRootFile( InputPath, InRootFileName, verbosityLevel ); 117 TFile * outputRootFile = OpenRootFile( OutPutPath, OutputRootFileName, verbosityLevel ); 118 //---------------------------------------------------------------------------- 119 // global variable Settings 114 TFile * inputRootFile 115 = OpenRootFile( InputPath, InRootFileName, verbosityLevel ); 116 117 TFile * outputRootFile 118 = OpenRootFile( OutPutPath, OutputRootFileName, verbosityLevel ); 119 //---------------------------------------------------------------------------- 120 // Define operation range 120 121 //---------------------------------------------------------------------------- 121 122 if ( npixel == -1 ) … … 129 130 pixelSetSize = firstpixel +npixel; 130 131 } 132 131 133 // float GainMean = GainMean; // this has to be extracted from root files 132 134 // float BSLMean = BSLMean; // this has to be extracted from root files … … 155 157 156 158 //Canvas Pad numbering 157 int PixelCanvasFrameNrs[4] = {159 int PixelCanvasFrameNrs[4] = { 158 160 1, // Top left 159 161 2, // Top right … … 163 165 164 166 //Canvas Pad numbering 165 int AllpixelCanvasFrameNrs[4] = {167 int AllpixelCanvasFrameNrs[4] = { 166 168 1, // Top left 167 169 2, // Top right … … 174 176 175 177 //Canvases 176 cgpPixelPulses = new TCanvas*[maxPulseOrder];177 cgpDistributions = new TCanvas*[maxPulseOrder];178 cgpPixelPulses = new TCanvas*[maxPulseOrder]; 179 cgpDistributions = new TCanvas*[maxPulseOrder]; 178 180 179 181 //TCanvas* gpcDevelopment = NULL; 180 TString cName = "";181 TString cTitle = "";182 TString cName = ""; 183 TString cTitle = ""; 182 184 183 185 //naming of pulse canvases … … 189 191 { 190 192 cName ="cgpDistributions"; 191 cName += pulse_order; 192 cTitle ="Distributions of Pulses with Order of: "; 193 cTitle += pulse_order; 194 cgpDistributions[pulse_order] = new TCanvas(cName,cTitle, 720,pulse_order*20,720,720); 193 cName += pulse_order; 194 195 cTitle ="Distributions of Pulses with Order of: "; 196 cTitle += pulse_order; 197 198 cgpDistributions[pulse_order] 199 = new TCanvas(cName,cTitle, 720,pulse_order*20,720,720); 195 200 cgpDistributions[pulse_order]->Divide(2, 2); 201 196 202 cName ="cgpPixelPulses"; 197 cName += pulse_order; 198 cTitle ="Overlays of Pulses with Order of: "; 199 cTitle += pulse_order; 200 cgpPixelPulses[pulse_order] = new TCanvas(cName,cTitle, 0,pulse_order*20,720,720); 203 cName += pulse_order; 204 205 cTitle ="Overlays of Pulses with Order of: "; 206 cTitle += pulse_order; 207 208 cgpPixelPulses[pulse_order] 209 = new TCanvas(cName,cTitle, 0,pulse_order*20,720,720); 201 210 cgpPixelPulses[pulse_order]->Divide(2, 2); 202 211 } 203 204 205 // Create (pointer to) Canvases, which are used in every run,206 // also in 'non-debug' runs207 // Canvases only need if spike Debug, but I want to deklare208 // the pointers anyway ...209 210 // if (testmode)211 // {212 // //additional Test histograms213 // cgpTestHistos = new TCanvas( "cgpTestHistos", "Test Histograms", 360, 420, 360, 360 );214 // cgpTestHistos->Divide(2,0);215 // }216 212 } 217 213 … … 226 222 227 223 //---------------------------------------------------------------------------- 228 // Initialize Pixel 224 // Initialize Pixels 229 225 //---------------------------------------------------------------------------- 230 226 if (verbosityLevel > 0) … … 233 229 } 234 230 235 Pixel** pixel= new Pixel*[NPIX];231 Pixel** pixel = new Pixel*[NPIX]; 236 232 237 233 for (int i = 0 ; i < NPIX; i++) … … 240 236 } 241 237 242 PixelSum* wholeCamera = NULL; 243 244 bool first_pass = true; 238 PixelSum* wholeCamera = NULL; 239 240 bool first_pass = true; 241 245 242 //------------------------------------- 246 243 // Loop over Pixel Sets … … 252 249 if (verbosityLevel >= 0) 253 250 { 254 cout << "------------------------------------------------" << endl 251 cout << "------------------------------------------------" 252 << endl 255 253 << "...processing Pixel: " 256 254 << firstPixelOfSet 257 255 << " to Pixel: " 258 << firstPixelOfSet+pixelSetSize-1 << endl; 256 << firstPixelOfSet+pixelSetSize-1 257 << endl; 259 258 } 260 259 … … 263 262 //-------------------------------------------------------------------- 264 263 for ( int pixelID = firstPixelOfSet; 265 266 267 264 pixelID < firstPixelOfSet + pixelSetSize 265 && pixelID < firstpixel + npixel; 266 pixelID++ ) 268 267 { 269 268 270 269 if (verbosityLevel > 1) 271 270 { 272 cout << "-------------------------------------" << endl 273 << "...processing Set from Pixel " 274 << firstPixelOfSet 275 << " to Pixel " 276 << firstPixelOfSet+pixelSetSize-1 277 << " Pixel: " << pixelID 278 << "/" << firstpixel + npixel -1 << endl; 271 cout << "-------------------------------------" 272 << endl 273 << "...processing Set from Pixel " 274 << firstPixelOfSet 275 << " to Pixel " 276 << firstPixelOfSet+pixelSetSize-1 277 << " Pixel: " << pixelID 278 << "/" << firstpixel + npixel -1 279 << endl; 279 280 } 280 281 … … 286 287 cout << "...creating pixel: " << pixelID << endl; 287 288 } 289 288 290 pixel[pixelID] = new Pixel( 289 291 pixelID, … … 308 310 cout << endl << "...preparing camera" << endl; 309 311 } 312 310 313 wholeCamera = new PixelSum( 311 314 "AllPixel", … … 321 324 outputRootFile 322 325 ); 326 323 327 first_pass = false; 324 328 } … … 333 337 if (verbosityLevel > 2) 334 338 { 335 cout << "-------------------------------------" << endl 339 cout << "-------------------------------------" 340 << endl 336 341 << "...processing Set from Pixel " 337 342 << firstPixelOfSet … … 340 345 << " Pixel: " << pixelID 341 346 << "/" << firstpixel + npixel -1 342 << " Pulse-Order: " << pulse_order << endl; 347 << " Pulse-Order: " << pulse_order 348 << endl; 343 349 } 344 350 345 351 // Calculate Max Prop. Value of each slice 346 352 //------------------------------------- 353 354 //from Maximum Overlay 347 355 if (verbosityLevel > 2) 348 356 { 349 cout << "...extracting templates from Maximum Overlay " << endl; 357 cout << "...extracting templates from Maximum Overlay " 358 << endl; 350 359 } 351 //from Maximum Overlay 360 352 361 ExtractPulseTemplate( 353 362 pixel[pixelID], … … 357 366 ); 358 367 368 //from Edge Overlay 359 369 if (verbosityLevel > 2) 360 370 { 361 cout << "...extracting templates from Edge Overlay " << endl; 371 cout << "...extracting templates from Edge Overlay " 372 << endl; 362 373 } 363 //from Edge Overlay364 374 ExtractPulseTemplate( 365 375 pixel[pixelID], … … 384 394 verbosityLevel 385 395 ); 396 386 397 if (ProduceGraphic) 387 398 { 388 pixel[pixelID]->DrawTemplateHistograms(389 cgpPixelPulses,390 PixelCanvasFrameNrs391 );392 393 pixel[pixelID]->DrawEdgeTemplateHistograms(394 cgpPixelPulses,395 PixelCanvasFrameNrs396 );399 pixel[pixelID]->DrawTemplateHistograms( 400 cgpPixelPulses, 401 PixelCanvasFrameNrs 402 ); 403 404 pixel[pixelID]->DrawEdgeTemplateHistograms( 405 cgpPixelPulses, 406 PixelCanvasFrameNrs 407 ); 397 408 } 398 409 //------------------------------------- 399 410 // Fill Histogramms of Camera 400 411 //------------------------------------- 401 cout << "1" << endl; 412 402 413 wholeCamera->hMaxOverlay[pulse_order]->Add( 403 414 pixel[pixelID]->hMaxOverlay[pulse_order] 404 415 ); 405 cout << wholeCamera->hMaxOverlay[pulse_order]->GetName() << endl; 406 cout << "2" << endl; 416 407 417 wholeCamera->hMaxProfile[pulse_order]->Add( 408 418 pixel[pixelID]->hMaxProfile[pulse_order] 409 419 ); 410 cout << "3" << endl; 420 411 421 wholeCamera->hEdgeOverlay[pulse_order]->Add( 412 422 pixel[pixelID]->hEdgeOverlay[pulse_order] 413 423 ); 414 cout << "4" << endl; 424 415 425 wholeCamera->hEdgeProfile[pulse_order]->Add( 416 426 pixel[pixelID]->hEdgeProfile[pulse_order] 417 427 ); 418 cout << "5" << endl; 428 419 429 420 430 if (verbosityLevel > 2) 421 431 { 422 cout << endl << "...End of pulseorder " 423 << pulse_order 424 << endl; 432 cout << endl 433 << "...End of pulseorder " 434 << pulse_order 435 << endl; 425 436 } 426 437 … … 430 441 if (ProduceGraphic) 431 442 { 432 UpdateCanvases(433 verbosityLevel,434 MAX_PULS_ORDER,435 false436 );443 UpdateCanvases( 444 verbosityLevel, 445 MAX_PULS_ORDER, 446 false 447 ); 437 448 } 438 449 … … 454 465 455 466 //deleteCurrent Pixel from Heap 456 delete pixel[pixelID]; 457 pixel[pixelID] = NULL; 467 delete pixel[pixelID]; 468 pixel[pixelID] = NULL; 469 458 470 if (verbosityLevel > 2) 459 471 { 460 cout << endl << "...End of Pixel" 461 << endl << "------------------------------------------------" 462 << endl; 472 cout << endl 473 << "...End of Pixel" 474 << endl 475 << "------------------------------------------------" 476 << endl; 463 477 } 464 478 } … … 467 481 if (verbosityLevel > 1) 468 482 { 469 cout << endl << "...End of Loop over all Pixels of set" 470 << endl << "------------------------------------------------" 471 << endl; 483 cout << endl 484 << "...End of Loop over all Pixels of set" 485 << endl 486 << "------------------------------------------------" 487 << endl; 472 488 } 473 489 } … … 476 492 if (verbosityLevel > 0) 477 493 { 478 cout << endl << "...End of Loop over all Pixelsets" 479 << endl << "------------------------------------------------" 480 << endl; 494 cout << endl 495 << "...End of Loop over all Pixelsets" 496 << endl 497 << "------------------------------------------------" 498 << endl; 481 499 } 482 500 483 501 delete[] pixel; 484 502 pixel = NULL; 503 485 504 //------------------------------------- 486 505 // Draw All Pixel Histograms … … 493 512 if (verbosityLevel > 2) 494 513 { 495 cout << "-------------------------------------" << endl 496 << "...processing Pulse-Order: " << pulse_order; 514 cout << "-------------------------------------" 515 << endl 516 << "...processing Pulse-Order: " 517 << pulse_order; 497 518 } 498 519 499 // 500 // 520 // Calculate Max Prop. Value of each slice 521 //------------------------------------- 501 522 502 523 //from Maximum Overlay … … 507 528 verbosityLevel 508 529 ); 530 WritePixelTemplateToCsv( 531 wholeCamera, 532 OutPutPath, 533 "Maximum", 534 pulse_order, 535 verbosityLevel 536 ); 509 537 510 538 //from Edge Overlay … … 515 543 verbosityLevel 516 544 ); 517 518 WritePixelTemplateToCsv(519 wholeCamera,520 OutPutPath,521 "Maximum",522 pulse_order,523 verbosityLevel524 );525 526 545 WritePixelTemplateToCsv( 527 546 wholeCamera, … … 543 562 } //EOF: Draw All Pixel Histograms 544 563 564 545 565 //------------------------------------- 546 566 // Save All Pixel Histograms … … 560 580 // verbosityLevel 561 581 // ); 562 563 564 582 565 583 // if (ProduceGraphic) … … 572 590 // } 573 591 592 //------------------------------------- 593 // Delete Objects on Heap 594 //------------------------------------- 574 595 delete wholeCamera; 575 596 if (ProduceGraphic) … … 579 600 delete inputRootFile; 580 601 delete outputRootFile; 602 581 603 return( 0 ); 582 604 } … … 593 615 void 594 616 DeletePixelCanvases( 595 int maxPulseOrder,596 int verbosityLevel617 int maxPulseOrder, 618 int verbosityLevel 597 619 ) 598 620 { 599 621 if (verbosityLevel > 2) 600 622 { 601 cout << endl << "...delete pixel Canvases" << endl; 602 } 603 for (int pulse_order = 0; pulse_order < maxPulseOrder; pulse_order++ ) 623 cout << endl 624 << "...delete pixel Canvases" 625 << endl; 626 } 627 628 for ( int pulse_order = 0; pulse_order < maxPulseOrder; pulse_order++ ) 604 629 { 605 630 delete cgpPixelPulses[pulse_order]; 606 cgpPixelPulses[pulse_order] = NULL; 631 cgpPixelPulses[pulse_order] = NULL; 632 607 633 delete cgpDistributions[pulse_order]; 608 cgpDistributions[pulse_order] = NULL; 609 } 634 cgpDistributions[pulse_order] = NULL; 635 } 636 610 637 delete[] cgpPixelPulses; 611 cgpPixelPulses = NULL; 638 cgpPixelPulses = NULL; 639 612 640 delete[] cgpDistributions; 613 cgpDistributions = NULL;641 cgpDistributions = NULL; 614 642 } 615 643 616 644 void 617 645 UpdateCanvases( 618 int verbosityLevel,619 int max_pulse_order,620 bool testmode646 int verbosityLevel, 647 int max_pulse_order, 648 bool testmode 621 649 ) 622 650 { 623 if (verbosityLevel > 3) cout << endl << "...updating canvases" ; 651 if (verbosityLevel > 3) 652 { 653 cout << endl << "...updating canvases" << endl; 654 } 624 655 for (int pulse_order = 0; pulse_order < max_pulse_order; pulse_order++) 625 656 { 626 657 cgpPixelPulses[pulse_order]->Modified(); 627 658 cgpPixelPulses[pulse_order]->Update(); 659 628 660 cgpDistributions[pulse_order]->Modified(); 629 661 cgpDistributions[pulse_order]->Update(); … … 641 673 int main() 642 674 { 643 644 FCalcPulseTemplate(); 645 return 0; 646 675 FCalcPulseTemplate(); 676 return 0; 647 677 }
Note:
See TracChangeset
for help on using the changeset viewer.