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

Last change on this file since 2128 was 2128, checked in by wittek, 23 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 //*fLog << "numBlind = " << numBlind << endl;
355 }
356 delete nblind;
357
358
359 // throw the Id of numBlind different pixels in this event
360 TH1D *hblind;
361 UInt_t idBlind;
362 UInt_t listId[npix];
363 UInt_t nlist = 0;
364 Bool_t equal;
365
366 hblind = fHBlindPixIdTheta->ProjectionY("", binPix, binPix, "");
367 if ( hblind->GetEntries() > 0.0 )
368 for (UInt_t i=0; i<numBlind; i++)
369 {
370 while(1)
371 {
372 idBlind = (Int_t) (hblind->GetRandom()+0.5);
373 equal = kFALSE;
374 for (UInt_t j=0; j<nlist; j++)
375 if (idBlind == listId[j])
376 {
377 equal = kTRUE;
378 break;
379 }
380 if (!equal) break;
381 }
382 listId[nlist] = idBlind;
383 nlist++;
384
385 fBlinds->SetPixelBlind(idBlind);
386 //*fLog << "idBlind = " << idBlind << endl;
387 }
388 delete hblind;
389
390
391 //-------------------------------------------
392 // for the current theta,
393 // generate a sigmabar according to the histogram fHSigmaTheta
394 //
395 Double_t sigmabar=0;
396 Int_t binNumber = fHSigmaTheta->GetXaxis()->FindBin(theta);
397
398 if (binPix != binNumber)
399 {
400 cout << "The binnings of the 2 histograms are not identical; aborting"
401 << endl;
402 return kERROR;
403 }
404
405 TH1D *hsigma;
406
407 hsigma = fHSigmaTheta->ProjectionY("", binNumber, binNumber, "");
408 if ( hsigma->GetEntries() == 0.0 )
409 {
410 *fLog << "MPadSchweizer::Process(); projection for Theta bin "
411 << binNumber << " has no entries; Skip event " << endl;
412 // event cannot be padded; skip event
413 delete hsigma;
414
415 rc = 3;
416 fErrors[rc]++;
417 return kCONTINUE;
418 }
419 else
420 {
421 sigmabar = hsigma->GetRandom();
422 //*fLog << "Theta, bin number = " << theta << ", " << binNumber // << ", sigmabar = " << sigmabar << endl
423 }
424 delete hsigma;
425
426 const Double_t sigmabar2 = sigmabar*sigmabar;
427
428 //-------------------------------------------
429
430 //*fLog << "MPadSchweizer::Process(); sigbarold, sigmabar = "
431 // << sigbarold << ", "<< sigmabar << endl;
432
433 // Skip event if target sigmabar is <= sigbarold
434 if (sigmabar <= sigbarold)
435 {
436 *fLog << "MPadSchweizer::Process(); target sigmabar is less than sigbarold : "
437 << sigmabar << ", " << sigbarold << ", Skip event" << endl;
438
439 rc = 4;
440 fErrors[rc]++;
441 return kCONTINUE;
442 }
443
444
445 //-------------------------------------------
446 //
447 // Calculate average number of NSB photons to be added (lambdabar)
448 // from the value of sigmabar,
449 // - making assumptions about the average electronic noise (elNoise2) and
450 // - using a fixed value (F2excess) for the excess noise factor
451
452 Double_t elNoise2; // [photons]
453 Double_t F2excess = 1.3;
454 Double_t lambdabar; // [photons]
455
456
457
458 Int_t binTheta = fHDiffPixTheta->GetXaxis()->FindBin(theta);
459 if (binTheta != binNumber)
460 {
461 cout << "The binnings of the 2 histograms are not identical; aborting"
462 << endl;
463 return kERROR;
464 }
465
466 // Get RMS of (Sigma^2-sigmabar^2) in this Theta bin.
467 // The average electronic noise (to be added) has to be well above this RMS,
468 // otherwise the electronic noise of an individual pixel (elNoise2Pix)
469 // may become negative
470
471 TH1D *hnoise = fHDiffPixTheta->ProjectionZ("", binTheta, binTheta,
472 0, 9999, "");
473 Double_t RMS = hnoise->GetRMS(1);
474 delete hnoise;
475
476 elNoise2 = TMath::Min(RMS, sigmabar2 - sigbarold2);
477 //*fLog << "elNoise2 = " << elNoise2 << endl;
478
479 lambdabar = (sigmabar2 - sigbarold2 - elNoise2) / F2excess; // [photons]
480
481 // This value of lambdabar is the same for all pixels;
482 // note that lambdabar is normalized to the area of pixel 0
483
484 //---------- start loop over pixels ---------------------------------
485 // do the padding for each pixel
486 //
487 // pad only pixels - which are used (before image cleaning)
488 //
489 Double_t sig = 0;
490 Double_t sigma2 = 0;
491 Double_t diff = 0;
492 Double_t addSig2 = 0;
493 Double_t elNoise2Pix = 0;
494
495
496 for (UInt_t i=0; i<npix; i++)
497 {
498 MCerPhotPix &pix = (*fEvt)[i];
499 if ( !pix.IsPixelUsed() )
500 continue;
501
502 //if ( pix.GetNumPhotons() == 0.0)
503 //{
504 // *fLog << "MPadSchweizer::Process(); no.of photons is 0 for used pixel"
505 // << endl;
506 // continue;
507 //}
508
509 Int_t j = pix.GetPixId();
510
511 Double_t ratioArea = fCam->GetPixRatio(j);
512
513 MPedestalPix &ppix = (*fPed)[j];
514 Double_t oldsigma = ppix.GetMeanRms();
515 Double_t oldsigma2 = oldsigma*oldsigma;
516
517 //---------------------------------
518 // throw the Sigma for this pixel
519 //
520 Int_t binPixel = fHDiffPixTheta->GetYaxis()->FindBin( (Double_t)j );
521
522 Int_t count;
523 Bool_t ok;
524
525 TH1D *hdiff;
526 TH1D *hsig;
527
528 switch (fPadFlag)
529 {
530 case 1 :
531 // throw the Sigma for this pixel from the distribution fHDiffPixTheta
532
533 hdiff = fHDiffPixTheta->ProjectionZ("", binTheta, binTheta,
534 binPixel, binPixel, "");
535 if ( hdiff->GetEntries() == 0 )
536 {
537 *fLog << "MPadSchweizer::Process(); projection for Theta bin "
538 << binTheta << " and pixel bin " << binPixel
539 << " has no entries; aborting " << endl;
540 delete hdiff;
541
542 rc = 5;
543 fErrors[rc]++;
544 return kCONTINUE;
545 }
546
547 count = 0;
548 ok = kFALSE;
549 for (Int_t m=0; m<20; m++)
550 {
551 count += 1;
552 diff = hdiff->GetRandom();
553 // the following condition ensures that elNoise2Pix > 0.0
554
555 if ( (diff + sigmabar2 - oldsigma2/ratioArea
556 - lambdabar*F2excess) > 0.0 )
557 {
558 ok = kTRUE;
559 break;
560 }
561 }
562 if (!ok)
563 {
564
565 *fLog << "theta, j, count, sigmabar, diff = " << theta << ", "
566 << j << ", " << count << ", " << sigmabar << ", "
567 << diff << endl;
568 diff = lambdabar*F2excess + oldsigma2/ratioArea - sigmabar2;
569 }
570 delete hdiff;
571 sigma2 = diff + sigmabar2;
572 break;
573
574 case 2 :
575 // throw the Sigma for this pixel from the distribution fHSigmaPixTheta
576
577 hsig = fHSigmaPixTheta->ProjectionZ("", binTheta, binTheta,
578 binPixel, binPixel, "");
579 if ( hsig->GetEntries() == 0 )
580 {
581 *fLog << "MPadSchweizer::Process(); projection for Theta bin "
582 << binTheta << " and pixel bin " << binPixel
583 << " has no entries; aborting " << endl;
584 delete hsig;
585
586 rc = 6;
587 fErrors[rc]++;
588 return kCONTINUE;
589 }
590
591 count = 0;
592 ok = kFALSE;
593 for (Int_t m=0; m<20; m++)
594 {
595 count += 1;
596
597 sig = hsig->GetRandom();
598 sigma2 = sig*sig/ratioArea;
599 // the following condition ensures that elNoise2Pix > 0.0
600
601 if ( (sigma2-oldsigma2/ratioArea-lambdabar*F2excess) > 0.0 )
602 {
603 ok = kTRUE;
604 break;
605 }
606 }
607 if (!ok)
608 {
609
610 *fLog << "theta, j, count, sigmabar, sig = " << theta << ", "
611 << j << ", " << count << ", " << sigmabar << ", "
612 << sig << endl;
613 sigma2 = lambdabar*F2excess + oldsigma2/ratioArea;
614 }
615 delete hsig;
616 break;
617 }
618
619 //---------------------------------
620 // get the additional sigma^2 for this pixel (due to the padding)
621
622 addSig2 = sigma2*ratioArea - oldsigma2;
623
624
625 //---------------------------------
626 // get the additional electronic noise for this pixel
627
628 elNoise2Pix = addSig2 - lambdabar*F2excess*ratioArea;
629
630
631 //---------------------------------
632 // throw actual number of additional NSB photons (NSB)
633 // and its RMS (sigmaNSB)
634
635 Double_t NSB0 = gRandom->Poisson(lambdabar*ratioArea);
636 Double_t arg = NSB0*(F2excess-1.0) + elNoise2Pix;
637 Double_t sigmaNSB0;
638
639 if (arg >= 0)
640 {
641 sigmaNSB0 = sqrt( arg );
642 }
643 else
644 {
645 *fLog << "MPadSchweizer::Process(); argument of sqrt < 0 : "
646 << arg << endl;
647 sigmaNSB0 = 0.0000001;
648 }
649
650
651 //---------------------------------
652 // smear NSB0 according to sigmaNSB0
653 // and subtract lambdabar because of AC coupling
654
655 Double_t NSB = gRandom->Gaus(NSB0, sigmaNSB0) - lambdabar*ratioArea;
656
657 //---------------------------------
658
659 // add additional NSB to the number of photons
660 Double_t oldphotons = pix.GetNumPhotons();
661 Double_t newphotons = oldphotons + NSB;
662 pix.SetNumPhotons( newphotons );
663
664
665 fHNSB->Fill( NSB/sqrt(ratioArea) );
666 fHPhotons->Fill( oldphotons/sqrt(ratioArea), newphotons/sqrt(ratioArea) );
667
668
669 // error: add sigma of padded noise quadratically
670 Double_t olderror = pix.GetErrorPhot();
671 Double_t newerror = sqrt( olderror*olderror + addSig2 );
672 pix.SetErrorPhot( newerror );
673
674
675 Double_t newsigma = sqrt( oldsigma2 + addSig2 );
676 ppix.SetMeanRms( newsigma );
677
678 fHSigmaPedestal->Fill( oldsigma, newsigma );
679 }
680 //---------- end of loop over pixels ---------------------------------
681
682 // Calculate sigmabar again and crosscheck
683
684
685 //fSigmabar->Calc(*fCam, *fPed, *fEvt);
686 //*fLog << "after padding : " << endl;
687 //fSigmabar->Print("");
688
689
690 //*fLog << "Exit MPadSchweizer::Process();" << endl;
691
692 rc = 0;
693 fErrors[rc]++;
694
695 return kTRUE;
696
697}
698
699// --------------------------------------------------------------------------
700//
701//
702Bool_t MPadSchweizer::PostProcess()
703{
704 if (GetNumExecutions() != 0)
705 {
706
707 *fLog << inf << endl;
708 *fLog << GetDescriptor() << " execution statistics:" << endl;
709 *fLog << dec << setfill(' ');
710 *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3)
711 << (int)(fErrors[1]*100/GetNumExecutions())
712 << "%) Evts skipped due to: Sigmabar_old > 0" << endl;
713
714 *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3)
715 << (int)(fErrors[2]*100/GetNumExecutions())
716 << "%) Evts skipped due to: Zenith angle out of range" << endl;
717
718 *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3)
719 << (int)(fErrors[3]*100/GetNumExecutions())
720 << "%) Evts skipped due to: No data for generating Sigmabar" << endl;
721
722 *fLog << " " << setw(7) << fErrors[4] << " (" << setw(3)
723 << (int)(fErrors[4]*100/GetNumExecutions())
724 << "%) Evts skipped due to: Target sigma <= Sigmabar_old" << endl;
725
726 *fLog << " " << setw(7) << fErrors[5] << " (" << setw(3)
727 << (int)(fErrors[5]*100/GetNumExecutions())
728 << "%) Evts skipped due to: No data for generating Sigma^2-Sigmabar^2" << endl;
729
730 *fLog << " " << setw(7) << fErrors[6] << " (" << setw(3)
731 << (int)(fErrors[6]*100/GetNumExecutions())
732 << "%) Evts skipped due to: No data for generating Sigma" << endl;
733
734 *fLog << " " << setw(7) << fErrors[7] << " (" << setw(3)
735 << (int)(fErrors[7]*100/GetNumExecutions())
736 << "%) Evts skipped due to: No data for generating Blind pixels" << endl;
737
738 *fLog << " " << fErrors[0] << " ("
739 << (int)(fErrors[0]*100/GetNumExecutions())
740 << "%) Evts survived the padding!" << endl;
741 *fLog << endl;
742
743 }
744
745 //---------------------------------------------------------------
746 TCanvas &c = *(MH::MakeDefCanvas("PadSchweizer", "", 900, 900));
747 c.Divide(3, 3);
748 gROOT->SetSelectedPad(NULL);
749
750 c.cd(1);
751 fHNSB->SetDirectory(NULL);
752 fHNSB->DrawCopy();
753 fHNSB->SetBit(kCanDelete);
754
755 c.cd(2);
756 fHSigmaPedestal->SetDirectory(NULL);
757 fHSigmaPedestal->DrawCopy();
758 fHSigmaPedestal->SetBit(kCanDelete);
759
760 c.cd(3);
761 fHPhotons->SetDirectory(NULL);
762 fHPhotons->DrawCopy();
763 fHPhotons->SetBit(kCanDelete);
764
765 //--------------------------------------------------------------------
766
767
768 c.cd(4);
769 fHSigmaTheta->SetDirectory(NULL);
770 fHSigmaTheta->SetTitle("(Input) 2D : Sigmabar, \\Theta");
771 fHSigmaTheta->DrawCopy();
772 fHSigmaTheta->SetBit(kCanDelete);
773
774
775 //--------------------------------------------------------------------
776 // draw the 3D histogram (input): Theta, pixel, Sigma^2-Sigmabar^2
777
778 c.cd(5);
779 TH2D *l1;
780 l1 = (TH2D*) ((TH3*)fHDiffPixTheta)->Project3D("zx");
781 l1->SetDirectory(NULL);
782 l1->SetTitle("(Input) Sigma^2-Sigmabar^2 vs. \\Theta (all pixels)");
783 l1->SetXTitle("\\Theta [\\circ]");
784 l1->SetYTitle("Sigma^2-Sigmabar^2");
785
786 l1->DrawCopy("box");
787 l1->SetBit(kCanDelete);;
788
789 c.cd(8);
790 TH2D *l2;
791 l2 = (TH2D*) ((TH3*)fHDiffPixTheta)->Project3D("zy");
792 l2->SetDirectory(NULL);
793 l2->SetTitle("(Input) Sigma^2-Sigmabar^2 vs. pixel number (all \\Theta)");
794 l2->SetXTitle("pixel");
795 l2->SetYTitle("Sigma^2-Sigmabar^2");
796
797 l2->DrawCopy("box");
798 l2->SetBit(kCanDelete);;
799
800 //--------------------------------------------------------------------
801 // draw the 3D histogram (input): Theta, pixel, Sigma
802
803 c.cd(6);
804 TH2D *k1;
805 k1 = (TH2D*) ((TH3*)fHSigmaPixTheta)->Project3D("zx");
806 k1->SetDirectory(NULL);
807 k1->SetTitle("(Input) Sigma vs. \\Theta (all pixels)");
808 k1->SetXTitle("\\Theta [\\circ]");
809 k1->SetYTitle("Sigma");
810
811 k1->DrawCopy("box");
812 k1->SetBit(kCanDelete);
813
814 c.cd(9);
815 TH2D *k2;
816 k2 = (TH2D*) ((TH3*)fHSigmaPixTheta)->Project3D("zy");
817 k2->SetDirectory(NULL);
818 k2->SetTitle("(Input) Sigma vs. pixel number (all \\Theta)");
819 k2->SetXTitle("pixel");
820 k2->SetYTitle("Sigma");
821
822 k2->DrawCopy("box");
823 k2->SetBit(kCanDelete);;
824
825
826 //--------------------------------------------------------------------
827
828
829 return kTRUE;
830}
831
832// --------------------------------------------------------------------------
833
834
835
836
837
838
839
840
841
842
843
844
845
846
Note: See TracBrowser for help on using the repository browser.