source: trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc@ 2135

Last change on this file since 2135 was 2129, checked in by wittek, 22 years ago
*** empty log message ***
File size: 23.8 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Robert Wagner <mailto:magicsoft@rwagner.de> 10/2002
19! Author(s): Wolfgang Wittek <mailto:wittek@mppmu.mpg.de> 02/2003
20!
21! Copyright: MAGIC Software Development, 2000-2003
22!
23!
24\* ======================================================================== */
25
26/////////////////////////////////////////////////////////////////////////////
27//
28// MPadSchweizer
29//
30// This task applies padding such that for a given pixel and for a given
31// Theta bin the resulting distribution of the pedestal sigma is identical
32// to the distributions given by fHSigmaPixTheta and fHDiffPixTheta.
33//
34// The number of photons, its error and the pedestal sigmas are altered.
35// On average, the number of photons added is zero.
36//
37// The formulas used can be found in Thomas Schweizer's Thesis,
38// Section 2.2.1
39//
40// There are 2 options for the padding :
41//
42// 1) fPadFlag = 1 :
43// Generate first a Sigmabar using the 2D-histogram Sigmabar vs. Theta
44// (fHSigmaTheta). Then generate a pedestal sigma for each pixel using
45// the 3D-histogram Theta, pixel no., Sigma^2-Sigmabar^2
46// (fHDiffPixTheta).
47//
48// This is the preferred option as it takes into account the
49// correlations between the Sigma of a pixel and Sigmabar.
50//
51// 2) fPadFlag = 2 :
52// Generate a pedestal sigma for each pixel using the 3D-histogram
53// Theta, pixel no., Sigma (fHSigmaPixTheta).
54//
55//
56// The padding has to be done before the image cleaning because the
57// image cleaning depends on the pedestal sigmas.
58//
59// For random numbers gRandom is used.
60//
61// This implementation has been tested for CT1 data. For MAGIC some
62// modifications are necessary.
63//
64/////////////////////////////////////////////////////////////////////////////
65#include "MPadSchweizer.h"
66
67#include <stdio.h>
68
69#include <TH1.h>
70#include <TH2.h>
71#include <TH3.h>
72#include <TRandom.h>
73#include <TCanvas.h>
74
75#include "MBinning.h"
76#include "MSigmabar.h"
77#include "MMcEvt.hxx"
78#include "MLog.h"
79#include "MLogManip.h"
80#include "MParList.h"
81#include "MGeomCam.h"
82
83#include "MCerPhotPix.h"
84#include "MCerPhotEvt.h"
85
86#include "MPedestalCam.h"
87#include "MPedestalPix.h"
88#include "MBlindPixels.h"
89
90ClassImp(MPadSchweizer);
91
92// --------------------------------------------------------------------------
93//
94// Default constructor.
95//
96MPadSchweizer::MPadSchweizer(const char *name, const char *title)
97{
98 fName = name ? name : "MPadSchweizer";
99 fTitle = title ? title : "Task for the padding (Schweizer)";
100
101 fHSigmaTheta = NULL;
102 fHSigmaPixTheta = NULL;
103 fHDiffPixTheta = NULL;
104 fHBlindPixIdTheta = NULL;
105 fHBlindPixNTheta = NULL;
106
107 fHSigmaPedestal = NULL;
108 fHPhotons = NULL;
109 fHNSB = NULL;
110}
111
112// --------------------------------------------------------------------------
113//
114// Destructor.
115//
116MPadSchweizer::~MPadSchweizer()
117{
118 if (fHSigmaPedestal != NULL) delete fHSigmaPedestal;
119 if (fHPhotons != NULL) delete fHPhotons;
120 if (fHNSB != NULL) delete fHNSB;
121}
122
123// --------------------------------------------------------------------------
124//
125// Set the references to the histograms to be used in the padding
126//
127// fHSigmaTheta 2D-histogram (Theta, sigmabar)
128// fHSigmaPixTheta 3D-hiostogram (Theta, pixel, sigma)
129// fHDiffPixTheta 3D-histogram (Theta, pixel, sigma^2-sigmabar^2)
130// fHBlindPixIdTheta 2D-histogram (Theta, blind pixel Id)
131// fHBlindPixNTheta 2D-histogram (Theta, no.of blind pixels )
132//
133//
134void MPadSchweizer::SetHistograms(TH2D *hist2, TH3D *hist3, TH3D *hist3Diff,
135 TH2D *hist2Pix, TH2D *hist2PixN)
136{
137 fHSigmaTheta = hist2;
138 fHSigmaPixTheta = hist3;
139 fHDiffPixTheta = hist3Diff;
140 fHBlindPixIdTheta = hist2Pix;
141 fHBlindPixNTheta = hist2PixN;
142
143 fHSigmaTheta->SetDirectory(NULL);
144 fHSigmaPixTheta->SetDirectory(NULL);
145 fHDiffPixTheta->SetDirectory(NULL);
146 fHBlindPixIdTheta->SetDirectory(NULL);
147 fHBlindPixNTheta->SetDirectory(NULL);
148
149 Print();
150}
151
152// --------------------------------------------------------------------------
153//
154// Set the option for the padding
155//
156// There are 2 options for the padding :
157//
158// 1) fPadFlag = 1 :
159// Generate first a Sigmabar using the 2D-histogram Sigmabar vs. Theta
160// (fHSigmaTheta). Then generate a pedestal sigma for each pixel using
161// the 3D-histogram Theta, pixel no., Sigma^2-Sigmabar^2
162// (fHDiffPixTheta).
163//
164// This is the preferred option as it takes into account the
165// correlations between the Sigma of a pixel and Sigmabar.
166//
167// 2) fPadFlag = 2 :
168// Generate a pedestal sigma for each pixel using the 3D-histogram
169// Theta, pixel no., Sigma (fHSigmaPixTheta).
170//
171void MPadSchweizer::SetPadFlag(Int_t padflag)
172{
173 fPadFlag = padflag;
174 *fLog << "MPadSchweizer::SetPadFlag(); choose option " << fPadFlag << endl;
175}
176
177// --------------------------------------------------------------------------
178//
179// Set the pointers and prepare the histograms
180//
181Bool_t MPadSchweizer::PreProcess(MParList *pList)
182{
183 if ( !fHSigmaTheta || !fHSigmaPixTheta || !fHDiffPixTheta ||
184 !fHBlindPixIdTheta || !fHBlindPixNTheta)
185 {
186 *fLog << err << "At least one of the histograms needed for the padding is not defined ... aborting." << endl;
187 return kFALSE;
188 }
189
190 fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
191 if (!fMcEvt)
192 {
193 *fLog << err << dbginf << "MMcEvt not found... aborting." << endl;
194 return kFALSE;
195 }
196
197 fPed = (MPedestalCam*)pList->FindObject("MPedestalCam");
198 if (!fPed)
199 {
200 *fLog << err << "MPedestalCam not found... aborting." << endl;
201 return kFALSE;
202 }
203
204 fCam = (MGeomCam*)pList->FindObject("MGeomCam");
205 if (!fCam)
206 {
207 *fLog << err << "MGeomCam not found (no geometry information available)... aborting." << endl;
208 return kFALSE;
209 }
210
211 fEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
212 if (!fEvt)
213 {
214 *fLog << err << "MCerPhotEvt not found... aborting." << endl;
215 return kFALSE;
216 }
217
218 fSigmabar = (MSigmabar*)pList->FindCreateObj("MSigmabar");
219 if (!fSigmabar)
220 {
221 *fLog << err << "MSigmabar not found... aborting." << endl;
222 return kFALSE;
223 }
224
225 fBlinds = (MBlindPixels*)pList->FindCreateObj("MBlindPixels");
226 if (!fBlinds)
227 {
228 *fLog << err << "MBlindPixels not found... aborting." << endl;
229 return kFALSE;
230 }
231
232
233 //--------------------------------------------------------------------
234 // histograms for checking the padding
235 //
236 // plot pedestal sigmas
237 fHSigmaPedestal = new TH2D("SigPed","Sigma: after vs. before padding",
238 100, 0.0, 5.0, 100, 0.0, 5.0);
239 fHSigmaPedestal->SetXTitle("Pedestal sigma before padding");
240 fHSigmaPedestal->SetYTitle("Pedestal sigma after padding");
241
242 // plot no.of photons (before vs. after padding)
243 fHPhotons = new TH2D("Photons","Photons: after vs.before padding",
244 100, -10.0, 90.0, 100, -10, 90);
245 fHPhotons->SetXTitle("no.of photons before padding");
246 fHPhotons->SetYTitle("no.of photons after padding");
247
248 // plot of added NSB
249 fHNSB = new TH1D("NSB","Distribution of added NSB", 100, -10.0, 10.0);
250 fHNSB->SetXTitle("no.of added NSB photons");
251 fHNSB->SetYTitle("no.of pixels");
252
253
254 //--------------------------------------------------------------------
255
256 memset(fErrors, 0, sizeof(fErrors));
257
258 return kTRUE;
259}
260
261// --------------------------------------------------------------------------
262//
263// Do the Padding
264// idealy the events to be padded should have been generated without NSB
265//
266Bool_t MPadSchweizer::Process()
267{
268 //*fLog << "Entry MPadSchweizer::Process();" << endl;
269
270 Int_t rc=0;
271
272 const UInt_t npix = fEvt->GetNumPixels();
273
274 //fSigmabar->Calc(*fCam, *fPed, *fEvt);
275 //*fLog << "before padding : " << endl;
276 //fSigmabar->Print("");
277
278
279 //$$$$$$$$$$$$$$$$$$$$$$$$$$
280 // to simulate the situation that before the padding the NSB and
281 // electronic noise are zero : set Sigma = 0 for all pixels
282 //for (UInt_t i=0; i<npix; i++)
283 //{
284 // MCerPhotPix &pix = fEvt->operator[](i);
285 // Int_t j = pix.GetPixId();
286
287 // MPedestalPix &ppix = fPed->operator[](j);
288 // ppix.SetMeanRms(0.0);
289 //}
290 //$$$$$$$$$$$$$$$$$$$$$$$$$$
291
292 //-------------------------------------------
293 // Calculate average sigma of the event
294 //
295 Double_t sigbarold = fSigmabar->Calc(*fCam, *fPed, *fEvt);
296 Double_t sigbarold2 = sigbarold*sigbarold;
297 //fSigmabar->Print("");
298
299 if (sigbarold > 0)
300 {
301 //*fLog << "MPadSchweizer::Process(); sigmabar of event to be padded is > 0 : "
302 // << sigbarold << ". Stop event loop " << endl;
303 // input data should have sigmabar = 0; stop event loop
304
305 rc = 1;
306 fErrors[rc]++;
307 return kCONTINUE;
308 }
309
310 const Double_t theta = kRad2Deg*fMcEvt->GetTelescopeTheta();
311 // *fLog << "theta = " << theta << endl;
312
313
314 //-------------------------------------------
315 // for the current theta,
316 // generate blind pixels according to the histograms
317 // fHBlindPixNTheta and fHBlindPixIDTheta
318 //
319
320
321 Int_t binPix = fHBlindPixNTheta->GetXaxis()->FindBin(theta);
322
323 if ( binPix < 1 || binPix > fHBlindPixNTheta->GetNbinsX() )
324 {
325 //*fLog << "MPadSchweizer::Process(); binNumber out of range : theta, binPix = "
326 // << theta << ", " << binPix << "; Skip event " << endl;
327 // event cannot be padded; skip event
328
329 rc = 2;
330 fErrors[rc]++;
331 return kCONTINUE;
332 }
333
334 // numBlind is the number of blind pixels in this event
335 TH1D *nblind;
336 UInt_t numBlind;
337
338 nblind = fHBlindPixNTheta->ProjectionY("", binPix, binPix, "");
339 if ( nblind->GetEntries() == 0.0 )
340 {
341 *fLog << "MPadSchweizer::Process(); projection for Theta bin "
342 << binPix << " has no entries; Skip event " << endl;
343 // event cannot be padded; skip event
344 delete nblind;
345
346 rc = 7;
347 fErrors[rc]++;
348 return kCONTINUE;
349 }
350 else
351 {
352 numBlind = (Int_t) (nblind->GetRandom()+0.5);
353 }
354 delete nblind;
355
356
357 // throw the Id of numBlind different pixels in this event
358 TH1D *hblind;
359 UInt_t idBlind;
360 UInt_t listId[npix];
361 UInt_t nlist = 0;
362 Bool_t equal;
363
364 hblind = fHBlindPixIdTheta->ProjectionY("", binPix, binPix, "");
365 fBlinds->Clear();
366 if ( hblind->GetEntries() > 0.0 )
367 for (UInt_t i=0; i<numBlind; i++)
368 {
369 while(1)
370 {
371 idBlind = (Int_t) (hblind->GetRandom()+0.5);
372 equal = kFALSE;
373 for (UInt_t j=0; j<nlist; j++)
374 if (idBlind == listId[j])
375 {
376 equal = kTRUE;
377 break;
378 }
379 if (!equal) break;
380 }
381 listId[nlist] = idBlind;
382 nlist++;
383
384 fBlinds->SetPixelBlind(idBlind);
385 //*fLog << "idBlind = " << idBlind << endl;
386 }
387 fBlinds->SetReadyToSave();
388
389 delete hblind;
390
391
392 //-------------------------------------------
393 // for the current theta,
394 // generate a sigmabar according to the histogram fHSigmaTheta
395 //
396 Double_t sigmabar=0;
397 Int_t binNumber = fHSigmaTheta->GetXaxis()->FindBin(theta);
398
399 if (binPix != binNumber)
400 {
401 cout << "The binnings of the 2 histograms are not identical; aborting"
402 << endl;
403 return kERROR;
404 }
405
406 TH1D *hsigma;
407
408 hsigma = fHSigmaTheta->ProjectionY("", binNumber, binNumber, "");
409 if ( hsigma->GetEntries() == 0.0 )
410 {
411 *fLog << "MPadSchweizer::Process(); projection for Theta bin "
412 << binNumber << " has no entries; Skip event " << endl;
413 // event cannot be padded; skip event
414 delete hsigma;
415
416 rc = 3;
417 fErrors[rc]++;
418 return kCONTINUE;
419 }
420 else
421 {
422 sigmabar = hsigma->GetRandom();
423 //*fLog << "Theta, bin number = " << theta << ", " << binNumber // << ", sigmabar = " << sigmabar << endl
424 }
425 delete hsigma;
426
427 const Double_t sigmabar2 = sigmabar*sigmabar;
428
429 //-------------------------------------------
430
431 //*fLog << "MPadSchweizer::Process(); sigbarold, sigmabar = "
432 // << sigbarold << ", "<< sigmabar << endl;
433
434 // Skip event if target sigmabar is <= sigbarold
435 if (sigmabar <= sigbarold)
436 {
437 *fLog << "MPadSchweizer::Process(); target sigmabar is less than sigbarold : "
438 << sigmabar << ", " << sigbarold << ", Skip event" << endl;
439
440 rc = 4;
441 fErrors[rc]++;
442 return kCONTINUE;
443 }
444
445
446 //-------------------------------------------
447 //
448 // Calculate average number of NSB photons to be added (lambdabar)
449 // from the value of sigmabar,
450 // - making assumptions about the average electronic noise (elNoise2) and
451 // - using a fixed value (F2excess) for the excess noise factor
452
453 Double_t elNoise2; // [photons]
454 Double_t F2excess = 1.3;
455 Double_t lambdabar; // [photons]
456
457
458
459 Int_t binTheta = fHDiffPixTheta->GetXaxis()->FindBin(theta);
460 if (binTheta != binNumber)
461 {
462 cout << "The binnings of the 2 histograms are not identical; aborting"
463 << endl;
464 return kERROR;
465 }
466
467 // Get RMS of (Sigma^2-sigmabar^2) in this Theta bin.
468 // The average electronic noise (to be added) has to be well above this RMS,
469 // otherwise the electronic noise of an individual pixel (elNoise2Pix)
470 // may become negative
471
472 TH1D *hnoise = fHDiffPixTheta->ProjectionZ("", binTheta, binTheta,
473 0, 9999, "");
474 Double_t RMS = hnoise->GetRMS(1);
475 delete hnoise;
476
477 elNoise2 = TMath::Min(RMS, sigmabar2 - sigbarold2);
478 //*fLog << "elNoise2 = " << elNoise2 << endl;
479
480 lambdabar = (sigmabar2 - sigbarold2 - elNoise2) / F2excess; // [photons]
481
482 // This value of lambdabar is the same for all pixels;
483 // note that lambdabar is normalized to the area of pixel 0
484
485 //---------- start loop over pixels ---------------------------------
486 // do the padding for each pixel
487 //
488 // pad only pixels - which are used (before image cleaning)
489 //
490 Double_t sig = 0;
491 Double_t sigma2 = 0;
492 Double_t diff = 0;
493 Double_t addSig2 = 0;
494 Double_t elNoise2Pix = 0;
495
496
497 for (UInt_t i=0; i<npix; i++)
498 {
499 MCerPhotPix &pix = (*fEvt)[i];
500 if ( !pix.IsPixelUsed() )
501 continue;
502
503 //if ( pix.GetNumPhotons() == 0.0)
504 //{
505 // *fLog << "MPadSchweizer::Process(); no.of photons is 0 for used pixel"
506 // << endl;
507 // continue;
508 //}
509
510 Int_t j = pix.GetPixId();
511
512 Double_t ratioArea = fCam->GetPixRatio(j);
513
514 MPedestalPix &ppix = (*fPed)[j];
515 Double_t oldsigma = ppix.GetMeanRms();
516 Double_t oldsigma2 = oldsigma*oldsigma;
517
518 //---------------------------------
519 // throw the Sigma for this pixel
520 //
521 Int_t binPixel = fHDiffPixTheta->GetYaxis()->FindBin( (Double_t)j );
522
523 Int_t count;
524 Bool_t ok;
525
526 TH1D *hdiff;
527 TH1D *hsig;
528
529 switch (fPadFlag)
530 {
531 case 1 :
532 // throw the Sigma for this pixel from the distribution fHDiffPixTheta
533
534 hdiff = fHDiffPixTheta->ProjectionZ("", binTheta, binTheta,
535 binPixel, binPixel, "");
536 if ( hdiff->GetEntries() == 0 )
537 {
538 *fLog << "MPadSchweizer::Process(); projection for Theta bin "
539 << binTheta << " and pixel bin " << binPixel
540 << " has no entries; aborting " << endl;
541 delete hdiff;
542
543 rc = 5;
544 fErrors[rc]++;
545 return kCONTINUE;
546 }
547
548 count = 0;
549 ok = kFALSE;
550 for (Int_t m=0; m<20; m++)
551 {
552 count += 1;
553 diff = hdiff->GetRandom();
554 // the following condition ensures that elNoise2Pix > 0.0
555
556 if ( (diff + sigmabar2 - oldsigma2/ratioArea
557 - lambdabar*F2excess) > 0.0 )
558 {
559 ok = kTRUE;
560 break;
561 }
562 }
563 if (!ok)
564 {
565
566 *fLog << "theta, j, count, sigmabar, diff = " << theta << ", "
567 << j << ", " << count << ", " << sigmabar << ", "
568 << diff << endl;
569 diff = lambdabar*F2excess + oldsigma2/ratioArea - sigmabar2;
570 }
571 delete hdiff;
572 sigma2 = diff + sigmabar2;
573 break;
574
575 case 2 :
576 // throw the Sigma for this pixel from the distribution fHSigmaPixTheta
577
578 hsig = fHSigmaPixTheta->ProjectionZ("", binTheta, binTheta,
579 binPixel, binPixel, "");
580 if ( hsig->GetEntries() == 0 )
581 {
582 *fLog << "MPadSchweizer::Process(); projection for Theta bin "
583 << binTheta << " and pixel bin " << binPixel
584 << " has no entries; aborting " << endl;
585 delete hsig;
586
587 rc = 6;
588 fErrors[rc]++;
589 return kCONTINUE;
590 }
591
592 count = 0;
593 ok = kFALSE;
594 for (Int_t m=0; m<20; m++)
595 {
596 count += 1;
597
598 sig = hsig->GetRandom();
599 sigma2 = sig*sig/ratioArea;
600 // the following condition ensures that elNoise2Pix > 0.0
601
602 if ( (sigma2-oldsigma2/ratioArea-lambdabar*F2excess) > 0.0 )
603 {
604 ok = kTRUE;
605 break;
606 }
607 }
608 if (!ok)
609 {
610
611 *fLog << "theta, j, count, sigmabar, sig = " << theta << ", "
612 << j << ", " << count << ", " << sigmabar << ", "
613 << sig << endl;
614 sigma2 = lambdabar*F2excess + oldsigma2/ratioArea;
615 }
616 delete hsig;
617 break;
618 }
619
620 //---------------------------------
621 // get the additional sigma^2 for this pixel (due to the padding)
622
623 addSig2 = sigma2*ratioArea - oldsigma2;
624
625
626 //---------------------------------
627 // get the additional electronic noise for this pixel
628
629 elNoise2Pix = addSig2 - lambdabar*F2excess*ratioArea;
630
631
632 //---------------------------------
633 // throw actual number of additional NSB photons (NSB)
634 // and its RMS (sigmaNSB)
635
636 Double_t NSB0 = gRandom->Poisson(lambdabar*ratioArea);
637 Double_t arg = NSB0*(F2excess-1.0) + elNoise2Pix;
638 Double_t sigmaNSB0;
639
640 if (arg >= 0)
641 {
642 sigmaNSB0 = sqrt( arg );
643 }
644 else
645 {
646 *fLog << "MPadSchweizer::Process(); argument of sqrt < 0 : "
647 << arg << endl;
648 sigmaNSB0 = 0.0000001;
649 }
650
651
652 //---------------------------------
653 // smear NSB0 according to sigmaNSB0
654 // and subtract lambdabar because of AC coupling
655
656 Double_t NSB = gRandom->Gaus(NSB0, sigmaNSB0) - lambdabar*ratioArea;
657
658 //---------------------------------
659
660 // add additional NSB to the number of photons
661 Double_t oldphotons = pix.GetNumPhotons();
662 Double_t newphotons = oldphotons + NSB;
663 pix.SetNumPhotons( newphotons );
664
665
666 fHNSB->Fill( NSB/sqrt(ratioArea) );
667 fHPhotons->Fill( oldphotons/sqrt(ratioArea), newphotons/sqrt(ratioArea) );
668
669
670 // error: add sigma of padded noise quadratically
671 Double_t olderror = pix.GetErrorPhot();
672 Double_t newerror = sqrt( olderror*olderror + addSig2 );
673 pix.SetErrorPhot( newerror );
674
675
676 Double_t newsigma = sqrt( oldsigma2 + addSig2 );
677 ppix.SetMeanRms( newsigma );
678
679 fHSigmaPedestal->Fill( oldsigma, newsigma );
680 }
681 //---------- end of loop over pixels ---------------------------------
682
683 // Calculate sigmabar again and crosscheck
684
685
686 //fSigmabar->Calc(*fCam, *fPed, *fEvt);
687 //*fLog << "after padding : " << endl;
688 //fSigmabar->Print("");
689
690
691 //*fLog << "Exit MPadSchweizer::Process();" << endl;
692
693 rc = 0;
694 fErrors[rc]++;
695
696 return kTRUE;
697
698}
699
700// --------------------------------------------------------------------------
701//
702//
703Bool_t MPadSchweizer::PostProcess()
704{
705 if (GetNumExecutions() != 0)
706 {
707
708 *fLog << inf << endl;
709 *fLog << GetDescriptor() << " execution statistics:" << endl;
710 *fLog << dec << setfill(' ');
711 *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3)
712 << (int)(fErrors[1]*100/GetNumExecutions())
713 << "%) Evts skipped due to: Sigmabar_old > 0" << endl;
714
715 *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3)
716 << (int)(fErrors[2]*100/GetNumExecutions())
717 << "%) Evts skipped due to: Zenith angle out of range" << endl;
718
719 *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3)
720 << (int)(fErrors[3]*100/GetNumExecutions())
721 << "%) Evts skipped due to: No data for generating Sigmabar" << endl;
722
723 *fLog << " " << setw(7) << fErrors[4] << " (" << setw(3)
724 << (int)(fErrors[4]*100/GetNumExecutions())
725 << "%) Evts skipped due to: Target sigma <= Sigmabar_old" << endl;
726
727 *fLog << " " << setw(7) << fErrors[5] << " (" << setw(3)
728 << (int)(fErrors[5]*100/GetNumExecutions())
729 << "%) Evts skipped due to: No data for generating Sigma^2-Sigmabar^2" << endl;
730
731 *fLog << " " << setw(7) << fErrors[6] << " (" << setw(3)
732 << (int)(fErrors[6]*100/GetNumExecutions())
733 << "%) Evts skipped due to: No data for generating Sigma" << endl;
734
735 *fLog << " " << setw(7) << fErrors[7] << " (" << setw(3)
736 << (int)(fErrors[7]*100/GetNumExecutions())
737 << "%) Evts skipped due to: No data for generating Blind pixels" << endl;
738
739 *fLog << " " << fErrors[0] << " ("
740 << (int)(fErrors[0]*100/GetNumExecutions())
741 << "%) Evts survived the padding!" << endl;
742 *fLog << endl;
743
744 }
745
746 //---------------------------------------------------------------
747 TCanvas &c = *(MH::MakeDefCanvas("PadSchweizer", "", 900, 900));
748 c.Divide(3, 3);
749 gROOT->SetSelectedPad(NULL);
750
751 c.cd(1);
752 fHNSB->SetDirectory(NULL);
753 fHNSB->DrawCopy();
754 fHNSB->SetBit(kCanDelete);
755
756 c.cd(2);
757 fHSigmaPedestal->SetDirectory(NULL);
758 fHSigmaPedestal->DrawCopy();
759 fHSigmaPedestal->SetBit(kCanDelete);
760
761 c.cd(3);
762 fHPhotons->SetDirectory(NULL);
763 fHPhotons->DrawCopy();
764 fHPhotons->SetBit(kCanDelete);
765
766 //--------------------------------------------------------------------
767
768
769 c.cd(4);
770 fHSigmaTheta->SetDirectory(NULL);
771 fHSigmaTheta->SetTitle("(Input) 2D : Sigmabar, \\Theta");
772 fHSigmaTheta->DrawCopy();
773 fHSigmaTheta->SetBit(kCanDelete);
774
775
776 //--------------------------------------------------------------------
777 // draw the 3D histogram (input): Theta, pixel, Sigma^2-Sigmabar^2
778
779 c.cd(5);
780 TH2D *l1;
781 l1 = (TH2D*) ((TH3*)fHDiffPixTheta)->Project3D("zx");
782 l1->SetDirectory(NULL);
783 l1->SetTitle("(Input) Sigma^2-Sigmabar^2 vs. \\Theta (all pixels)");
784 l1->SetXTitle("\\Theta [\\circ]");
785 l1->SetYTitle("Sigma^2-Sigmabar^2");
786
787 l1->DrawCopy("box");
788 l1->SetBit(kCanDelete);;
789
790 c.cd(8);
791 TH2D *l2;
792 l2 = (TH2D*) ((TH3*)fHDiffPixTheta)->Project3D("zy");
793 l2->SetDirectory(NULL);
794 l2->SetTitle("(Input) Sigma^2-Sigmabar^2 vs. pixel number (all \\Theta)");
795 l2->SetXTitle("pixel");
796 l2->SetYTitle("Sigma^2-Sigmabar^2");
797
798 l2->DrawCopy("box");
799 l2->SetBit(kCanDelete);;
800
801 //--------------------------------------------------------------------
802 // draw the 3D histogram (input): Theta, pixel, Sigma
803
804 c.cd(6);
805 TH2D *k1;
806 k1 = (TH2D*) ((TH3*)fHSigmaPixTheta)->Project3D("zx");
807 k1->SetDirectory(NULL);
808 k1->SetTitle("(Input) Sigma vs. \\Theta (all pixels)");
809 k1->SetXTitle("\\Theta [\\circ]");
810 k1->SetYTitle("Sigma");
811
812 k1->DrawCopy("box");
813 k1->SetBit(kCanDelete);
814
815 c.cd(9);
816 TH2D *k2;
817 k2 = (TH2D*) ((TH3*)fHSigmaPixTheta)->Project3D("zy");
818 k2->SetDirectory(NULL);
819 k2->SetTitle("(Input) Sigma vs. pixel number (all \\Theta)");
820 k2->SetXTitle("pixel");
821 k2->SetYTitle("Sigma");
822
823 k2->DrawCopy("box");
824 k2->SetBit(kCanDelete);;
825
826
827 //--------------------------------------------------------------------
828
829
830 return kTRUE;
831}
832
833// --------------------------------------------------------------------------
834
835
836
837
838
839
840
841
842
843
844
845
846
847
Note: See TracBrowser for help on using the repository browser.