Changeset 4397
- Timestamp:
- 07/15/04 18:04:40 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mtemp/mifae
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mifae/Changelog
r4396 r4397 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2004/07/15 Javier Lopez 22 * macros/ligthcurve.C 23 - Macro to compute a light curve from hillas files. 20 24 21 25 2004/07/04 Oscar Blanch Bigas -
trunk/MagicSoft/Mars/mtemp/mifae/macros/lightcurve.C
r4387 r4397 22 22 } 23 23 24 return chiq/nbinsnozero;24 return (nbinsnozero>0?chiq/nbinsnozero:0); 25 25 } 26 26 … … 59 59 60 60 gROOT->Reset(); 61 gStyle->SetCanvasColor(0); 62 gStyle->SetCanvasBorderMode(0); 63 gStyle->SetPadBorderMode(0); 64 gStyle->SetFrameBorderMode(0); 61 65 gStyle->SetTimeOffset(-3600); 62 66 … … 64 68 const Bool_t debug = kFALSE; 65 69 const Double_t timebin = 480.; //[sec] 66 TString psname = "./20040422_Mrk421." + timebin + "s.ps"; 67 cout << psname << endl; 68 return; 70 TString psname = "./20040420_Mrk421.480s.ps"; 69 71 70 72 //Constanst 71 const Double_t kConvDegToRad = TMath:: ACos(-1)/180.;73 const Double_t kConvDegToRad = TMath::Pi()/180.; 72 74 const Double_t kSec = 1e6; //[sec/microsec] 73 75 const Double_t kDay = 24.*60.*60.; //[Day/sec] … … 89 91 90 92 91 //none cuts92 // Double_t sizemin = 2000.; //[Photons]93 // Double_t sizemax = 10000000000.; //[Photons]94 // Double_t widthmin = 0.;95 // Double_t widthmax = 2.0;96 // Double_t lengthmin = 0.;97 // Double_t lengthmax = 2.0;98 // Double_t distmin = 0.;99 // Double_t distmax = 4.0;100 // Double_t alphamin = 0.;101 // Double_t alphamax = 90.;102 103 93 104 94 const Int_t numberSizeBins = 4; … … 106 96 107 97 //cuts 108 Double_t sizemin = 2000.; //[Photons]109 Double_t sizemax = 10E9.; //[Photons]110 98 111 99 Double_t widthmin[numberSizeBins] = { 0.06, 0.06, 0.06, 0.06 }; … … 135 123 // ON containers 136 124 MGeomCamMagic geomcam; 137 MSrcPosCam source_on; 138 MHillas hillas; 139 MHillasSrc hillasscr; 140 125 MRawRunHeader runheader_on; 126 MRawEvtHeader evtheader_on; 127 MTime time_on; 128 MHillas hillas_on; 129 MHillasSrc hillassrc_on; 130 MSrcPosCam srcpos_on; 131 MReportDrive drive_on; 132 141 133 plist_on.AddToList(&geomcam); 142 plist_on.AddToList(&source_on); 143 plist_on.AddToList(&hillas); 144 plist_on.AddToList(&hillasscr); 145 146 //create some 1-dim histo to test only for the ON distribution of dist, width , length, size... 147 MH3 hDist_on("MHillasSrc.fDist/MGeomCam.fConvMm2Deg"); 148 hDist_on.SetName("Dist_on"); 149 plist_on.AddToList(&hDist_on); 150 MBinning binsDist_on("BinningDist_on"); 134 plist_on.AddToList(&runheader_on); 135 plist_on.AddToList(&evtheader_on); 136 plist_on.AddToList(&time_on); 137 plist_on.AddToList(&hillas_on); 138 plist_on.AddToList(&hillassrc_on); 139 plist_on.AddToList(&srcpos_on); 140 plist_on.AddToList(&drive_on); 141 142 Int_t nbins_Size = 60; 143 Double_t min_Size = log10(sizeBins[0])*0.8; 144 Double_t max_Size = log10(1000000)*1.2; 145 TH1F *hSize_on = new TH1F ("hSizeOn","",nbins_Size,min_Size,max_Size); 146 147 Int_t nbins_Width = 20; 148 Double_t min_Width = 0.; 149 Double_t max_Width = widthmax[numberSizeBins-1]*1.2; 150 TH1F *hWidth_on = new TH1F ("hWidthOn","",nbins_Width,min_Width,max_Width); 151 152 Int_t nbins_Length = 20; 153 Double_t min_Length = 0.; 154 Double_t max_Length = lengthmax[numberSizeBins-1]*1.2; 155 TH1F *hLength_on = new TH1F ("hLengthOn","",nbins_Length,min_Length,max_Length); 156 151 157 Int_t nbins_Dist = 20; 152 158 Double_t min_Dist = 0.; 153 Double_t max_Dist = distmax[0]*1.2; 154 binsDist_on.SetEdges(nbins_Dist, min_Dist, max_Dist); 155 plist_on.AddToList(&binsDist_on); 156 157 MH3 hWidth_on("MHillas.fWidth/MGeomCam.fConvMm2Deg"); 158 hWidth_on.SetName("Width_on"); 159 plist_on.AddToList(&hWidth_on); 160 MBinning binsWidth_on("BinningWidth_on"); 161 Int_t nbins_Width = 20; 162 Double_t min_Width = 0.; 163 Double_t max_Width = widthmax[0]*1.2; 164 binsWidth_on.SetEdges(nbins_Width, min_Width, max_Width); 165 plist_on.AddToList(&binsWidth_on); 166 167 MH3 hLength_on("MHillas.fLength/MGeomCam.fConvMm2Deg"); 168 hLength_on.SetName("Length_on"); 169 plist_on.AddToList(&hLength_on); 170 MBinning binsLength_on("BinningLength_on"); 171 Int_t nbins_Length = 20; 172 Double_t min_Length = 0.; 173 Double_t max_Length = lengthmax[0]*1.2; 174 binsLength_on.SetEdges(nbins_Length, min_Length, max_Length); 175 plist_on.AddToList(&binsLength_on); 176 177 MH3 hSize_on("log10(MHillas.fSize)"); 178 hSize_on.SetName("Size_on"); 179 plist_on.AddToList(&hSize_on); 180 MBinning binsSize_on("BinningSize_on"); 181 Int_t nbins_Size = 60; 182 Double_t min_Size = log10(sizemin)*0.8; 183 Double_t max_Size = log10(1000000)*1.2; 184 binsSize_on.SetEdges(nbins_Size, min_Size, max_Size); 185 plist_on.AddToList(&binsSize_on); 186 187 //create a histo to fill the alpha values: one alpha plot form 0 to +90 deg in abs value 188 MH3 hAlpha_on_abs("abs(MHillasSrc.fAlpha)"); 189 hAlpha_on_abs.SetName("Alpha_on_abs"); 190 plist_on.AddToList(&hAlpha_on_abs); 191 MBinning binsAlpha_on_abs("BinningAlpha_on_abs"); 159 Double_t max_Dist = distmax[numberSizeBins-1]*1.2; 160 TH1F *hDist_on = new TH1F ("hDistOn","",nbins_Dist,min_Dist,max_Dist); 161 192 162 Int_t nbins_abs = 18; 193 163 Double_t minalpha_abs = 0.; 194 164 Double_t maxalpha_abs =90.; 195 binsAlpha_on_abs.SetEdges(nbins_abs, minalpha_abs, maxalpha_abs); 196 plist_on.AddToList(&binsAlpha_on_abs); 197 198 //create a histo to fill the alpha values: one alpha plot form -90 to +90 deg. 199 MH3 hAlpha_on("MHillasSrc.fAlpha"); 200 hAlpha_on.SetName("Alpha_on"); 201 plist_on.AddToList(&hAlpha_on); 202 MBinning binsAlpha_on("BinningAlpha_on"); 165 TH1F *hAlpha_on_abs = new TH1F ("hAbsAlphaOn","",nbins_abs,minalpha_abs,maxalpha_abs); 166 203 167 Int_t nbins = nbins_abs*2; 204 168 Double_t minalpha = -90.; 205 169 Double_t maxalpha = 90.; 206 binsAlpha_on.SetEdges(nbins, minalpha, maxalpha); 207 plist_on.AddToList(&binsAlpha_on); 208 209 210 //create a histo to fill the source position 211 MH3 hSrcPos_on("MSrcPosCam.fX","MSrcPosCam.fY"); 212 hSrcPos_on.SetName("SrcPos_on"); 213 plist_on.AddToList(&hSrcPos_on); 214 MBinning binsSrcPos_onX("BinningSrcPos_onX"); 215 MBinning binsSrcPos_onY("BinningSrcPos_onY"); 170 TH1F *hAlpha_on = new TH1F ("hAlphaOn","",nbins,minalpha,maxalpha); 171 216 172 Int_t nbins_srcpos = 400; 217 173 Double_t minsrcpos = -600.; 218 Double_t maxsrcpos = 600.; 219 binsSrcPos_onX.SetEdges(nbins_srcpos, minsrcpos, maxsrcpos); 220 binsSrcPos_onY.SetEdges(nbins_srcpos, minsrcpos, maxsrcpos); 221 plist_on.AddToList(&binsSrcPos_onX); 222 plist_on.AddToList(&binsSrcPos_onY); 223 224 MH3 hDAQEvtNumber_on("MRawEvtHeader.fDAQEvtNumber"); 225 hDAQEvtNumber_on.SetName("DAQEvtNumber_on"); 226 plist_on.AddToList(&hDAQEvtNumber_on); 227 MBinning binsDAQEvtNumber_onX("BinningDAQEvtNumber_onX"); 228 Int_t nbins_evtnum = 1000; 229 Double_t minevtnum = 0.; 230 Double_t maxevtnum = 1000.; 231 binsDAQEvtNumber_onX.SetEdges(nbins_evtnum,minevtnum,maxevtnum); 232 plist_on.AddToList(&binsDAQEvtNumber_onX); 233 174 Double_t maxsrcpos = 600.; //[mm] //!!! position precition 3mm ~ 0.01 deg 175 TH2F *hSrcPos_on = new TH2F ("hSrcPosOn","",nbins_srcpos,minsrcpos,maxsrcpos,nbins_srcpos,minsrcpos,maxsrcpos); 234 176 235 177 // … … 241 183 242 184 MSrcPlace srcplace; 243 244 //cuts245 TString sizestr = "(MHillas.fSize < ";246 sizestr += sizemin;247 sizestr += ") || (";248 sizestr += "MHillas.fSize > ";249 sizestr += sizemax;250 sizestr += ")";251 MF sizefilter(sizestr);252 253 TString widthstr = "({MHillas.fWidth/MGeomCam.fConvMm2Deg} < ";254 widthstr += widthmin[0];255 widthstr += ") || (";256 widthstr += "{MHillas.fWidth/MGeomCam.fConvMm2Deg} > ";257 widthstr += widthmax[0];258 widthstr += ")";259 MF widthfilter(widthstr);260 261 TString lengthstr = "({MHillas.fLength/MGeomCam.fConvMm2Deg} < ";262 lengthstr += lengthmin[0];263 lengthstr += ") || (";264 lengthstr += "{MHillas.fLength/MGeomCam.fConvMm2Deg} > ";265 lengthstr += lengthmax[0];266 lengthstr += ")";267 MF lengthfilter(lengthstr);268 269 TString diststr = "({MHillasSrc.fDist/MGeomCam.fConvMm2Deg} < ";270 diststr += distmin[0];271 diststr += ") || (";272 diststr += "{MHillasSrc.fDist/MGeomCam.fConvMm2Deg} > ";273 diststr += distmax[0];274 diststr += ")";275 MF distfilter(diststr);276 277 MF evenfilter("{MRawEvtHeader.fDAQEvtNumber%3}<0.5");278 MF oddfilter("{MRawEvtHeader.fDAQEvtNumber%3}>0.5");279 280 MContinue cont_size(&sizefilter);281 MContinue cont_width(&widthfilter);282 MContinue cont_length(&lengthfilter);283 MContinue cont_dist(&distfilter);284 MContinue cont_even(&evenfilter);285 MContinue cont_odd(&oddfilter);286 287 185 MHillasSrcCalc csrc_on; 288 186 289 // fill all histograms 290 MFillH falpha_on_abs(&hAlpha_on_abs); 291 MFillH falpha_on(&hAlpha_on); 292 MFillH fdist_on(&hDist_on); 293 MFillH fwidth_on(&hWidth_on); 294 MFillH flength_on(&hLength_on); 295 MFillH fsize_on(&hSize_on); 296 MFillH fsrcpos_on(&hSrcPos_on); 297 MFillH fevtnum_on(&hDAQEvtNumber_on); 298 299 // prints 300 MPrint pevent("MRawEvtHeader"); 301 MPrint phillas("MHillas"); 302 MPrint phillassrc("MHillasSrc"); 303 MPrint psrcpos("MSrcPosCam"); 187 // // prints 188 // MPrint pevent("MRawEvtHeader"); 189 // MPrint phillas("MHillas"); 190 // MPrint phillassrc("MHillasSrc"); 191 // MPrint psrcpos("MSrcPosCam"); 304 192 305 193 //tasklist … … 307 195 tlist_on.AddToList(&srcplace); 308 196 tlist_on.AddToList(&csrc_on); 309 tlist_on.AddToList(&fsrcpos_on);310 // tlist_on.AddToList(&cont_odd);311 tlist_on.AddToList(&cont_size);312 tlist_on.AddToList(&cont_width);313 tlist_on.AddToList(&cont_length);314 tlist_on.AddToList(&cont_dist);315 tlist_on.AddToList(&falpha_on_abs);316 tlist_on.AddToList(&falpha_on);317 tlist_on.AddToList(&fdist_on);318 tlist_on.AddToList(&fwidth_on);319 tlist_on.AddToList(&flength_on);320 tlist_on.AddToList(&fsize_on);321 // tlist_on.AddToList(&fevtnum_on);322 197 323 198 // Create and setup the eventloop … … 335 210 return; 336 211 337 MRawRunHeader* runheader_on = plist_on.FindObject("MRawRunHeader");338 MRawEvtHeader* evtheader_on = plist_on.FindObject("MRawEvtHeader");339 MTime* time_on = plist_on.FindObject("MTime");340 MHillas* hillas_on = plist_on.FindObject("MHillas");341 MHillasSrc* hillassrc_on = plist_on.FindObject("MHillasSrc");342 MReportDrive* drive_on = plist_on.FindObject("MReportDrive");343 MSrcPosCam* srcpos_on = plist_on.FindObject("MSrcPosCam");344 345 346 212 Double_t mjdFirstEventofBin=0; 347 213 Double_t mjdFirstEvent=0; … … 363 229 364 230 //create histos needed in the time bins 231 365 232 TString alphaTitle = Form("%s%02i","hAlphaOn",numberTimeBins-1); 366 233 TH1F *hAlpha_on_abs_timebin = new TH1F (alphaTitle,"",nbins_abs,minalpha_abs,maxalpha_abs); 367 Int_t nbins_srcpos = 200; 368 Double_t minsrcpos = -600.; //[mm] 369 Double_t maxsrcpos = 600.; //[mm] //!!! position precition 3mm ~ 0.01 deg 234 370 235 TString srcposTitle = Form("%s%02i","hSrcPosOn",numberTimeBins-1); 371 236 TH2F *hSrcPos_on_timebin = new TH2F (srcposTitle,"",nbins_srcpos,minsrcpos,maxsrcpos,nbins_srcpos,minsrcpos,maxsrcpos); 237 372 238 Int_t nbins_coszenith = 200; 373 239 Double_t mincoszenith = 0.; … … 379 245 { 380 246 // Compute live time 381 UInt_t run = runheader_on ->GetRunNumber();382 UInt_t evt = evtheader_on ->GetDAQEvtNumber();383 Double_t mjd = time_on ->GetMjd();247 UInt_t run = runheader_on.GetRunNumber(); 248 UInt_t evt = evtheader_on.GetDAQEvtNumber(); 249 Double_t mjd = time_on.GetMjd(); 384 250 385 251 if (mjd == 0) … … 393 259 cout << "present event:\t run " << run << " event " << evt << " mjd " << mjd << endl; 394 260 mtimeLastEvent.Print(); 395 time_on ->Print();261 time_on.Print(); 396 262 } 397 263 … … 408 274 cout << "present event:\t run " << run << " event " << evt << " mjd " << mjd << endl; 409 275 mtimeLastEvent.Print(); 410 time_on ->Print();276 time_on.Print(); 411 277 } 412 278 … … 423 289 cout << "present event:\t run " << run << " event " << evt << " mjd " << mjd << endl; 424 290 mtimeLastEvent.Print(); 425 time_on ->Print();291 time_on.Print(); 426 292 } 427 293 … … 438 304 cout << "present event:\t run " << run << " event " << evt << " mjd " << mjd << endl; 439 305 mtimeLastEvent.Print(); 440 time_on ->Print();306 time_on.Print(); 441 307 } 442 308 … … 454 320 cout << "present event:\t run " << run << " event " << evt << " mjd " << mjd << endl; 455 321 mtimeLastEvent.Print(); 456 time_on ->Print();322 time_on.Print(); 457 323 } 458 324 … … 470 336 cout << "present event:\t run " << run << " event " << evt << " mjd " << mjd << endl; 471 337 mtimeLastEvent.Print(); 472 time_on ->Print();338 time_on.Print(); 473 339 474 340 flag = kFALSE; … … 489 355 cout << "present event:\t run " << run << " event " << evt << " mjd " << mjd << endl; 490 356 mtimeLastEvent.Print(); 491 time_on ->Print();357 time_on.Print(); 492 358 } 493 359 … … 506 372 runLastEvent = run; 507 373 mjdLastEvent = mjd; 508 mtimeLastEvent = *time_on;374 mtimeLastEvent = time_on; 509 375 510 376 511 377 512 Double_t size = hillas_on ->GetSize();513 Double_t width = hillas_on ->GetWidth()*geomcam.GetConvMm2Deg();514 Double_t length = hillas_on ->GetLength()*geomcam.GetConvMm2Deg();515 Double_t dist = hillassrc_on ->GetDist()*geomcam.GetConvMm2Deg();516 Double_t alpha = hillassrc_on ->GetAlpha();517 Double_t srcposx = srcpos_on ->GetX();518 Double_t srcposy = srcpos_on ->GetY();519 Double_t zenith = drive_on ->GetNominalZd();378 Double_t size = hillas_on.GetSize(); 379 Double_t width = hillas_on.GetWidth()*geomcam.GetConvMm2Deg(); 380 Double_t length = hillas_on.GetLength()*geomcam.GetConvMm2Deg(); 381 Double_t dist = hillassrc_on.GetDist()*geomcam.GetConvMm2Deg(); 382 Double_t alpha = hillassrc_on.GetAlpha(); 383 Double_t srcposx = srcpos_on.GetX(); 384 Double_t srcposy = srcpos_on.GetY(); 385 Double_t zenith = drive_on.GetNominalZd(); 520 386 521 387 … … 530 396 if (dist > distmin[sizebin] && dist < distmax[sizebin]) 531 397 { 398 399 //General histos 400 hSize_on->Fill(log10(size)); 401 hWidth_on->Fill(width); 402 hLength_on->Fill(length); 403 hDist_on->Fill(dist); 404 hAlpha_on_abs->Fill(TMath::Abs(alpha)); 405 hAlpha_on->Fill(alpha); 406 hSrcPos_on->Fill(srcposx,srcposy); 407 408 // Time bin histos 532 409 hAlpha_on_abs_timebin->Fill(TMath::Abs(alpha)); 533 410 hSrcPos_on_timebin->Fill(srcposx,srcposy); … … 550 427 //Compute the time on 551 428 timeOn[numberTimeBins-1] += (mjdLastEvent-mjdFirstEvent)*kDay; 552 widthTimeBinOn[numberTimeBins-1] = (mjd -mjdFirstEventofBin)/2;429 widthTimeBinOn[numberTimeBins-1] = (mjdLastEvent-mjdFirstEventofBin)/2; 553 430 meanTimeBinOn[numberTimeBins-1] = mjdFirstEventofBin + widthTimeBinOn[numberTimeBins-1]; 554 431 … … 671 548 plist_off.AddToList(&tlist_off); 672 549 673 MSrcPosCam source_off; 550 MRawRunHeader runheader_off; 551 MRawEvtHeader evtheader_off; 552 MTime time_off; 553 MHillas hillas_off; 554 MHillasSrc hillassrc_off; 555 MSrcPosCam srcpos_off; 556 MReportDrive drive_off; 674 557 675 558 plist_off.AddToList(&geomcam); 676 plist_off.AddToList(&source_off); 677 plist_off.AddToList(&hillas); 678 plist_off.AddToList(&hillasscr); 679 680 //create some 1-dim histo to test only for the OFF distribution of dist, width , length, size... 681 MH3 hDist_off("MHillasSrc.fDist/MGeomCam.fConvMm2Deg"); 682 hDist_off.SetName("Dist_off"); 683 plist_off.AddToList(&hDist_off); 684 MBinning binsDist_off("BinningDist_off"); 685 binsDist_off.SetEdges(nbins_Dist, min_Dist, max_Dist); 686 plist_off.AddToList(&binsDist_off); 687 688 MH3 hWidth_off("MHillas.fWidth/MGeomCam.fConvMm2Deg"); 689 hWidth_off.SetName("Width_off"); 690 plist_off.AddToList(&hWidth_off); 691 MBinning binsWidth_off("BinningWidth_off"); 692 binsWidth_off.SetEdges(nbins_Width, min_Width, max_Width); 693 plist_off.AddToList(&binsWidth_off); 694 695 MH3 hLength_off("MHillas.fLength/MGeomCam.fConvMm2Deg"); 696 hLength_off.SetName("Length_off"); 697 plist_off.AddToList(&hLength_off); 698 MBinning binsLength_off("BinningLength_off"); 699 binsLength_off.SetEdges(nbins_Length, min_Length, max_Length); 700 plist_off.AddToList(&binsLength_off); 701 702 MH3 hSize_off("log10(MHillas.fSize)"); 703 hSize_off.SetName("Size_off"); 704 plist_off.AddToList(&hSize_off); 705 MBinning binsSize_off("BinningSize_off"); 706 binsSize_off.SetEdges(nbins_Size, min_Size, max_Size); 707 plist_off.AddToList(&binsSize_off); 708 709 //create a histo to fill the alpha values: from 0 to 90 deg -> abs value 710 MH3 hAlpha_off_abs("abs(MHillasSrc.fAlpha)"); 711 hAlpha_off_abs.SetName("Alpha_off_abs"); 712 plist_off.AddToList(&hAlpha_off_abs); 713 MBinning binsAlpha_off_abs("BinningAlpha_off_abs"); 714 binsAlpha_off_abs.SetEdges(nbins_abs, minalpha_abs, maxalpha_abs); 715 plist_off.AddToList(&binsAlpha_off_abs); 716 717 //create a histo to fill the alpha values: from -90 to 90 deg 718 MH3 hAlpha_off("MHillasSrc.fAlpha"); 719 hAlpha_off.SetName("Alpha_off"); 720 plist_off.AddToList(&hAlpha_off); 721 MBinning binsAlpha_off("BinningAlpha_off"); 722 binsAlpha_off.SetEdges(nbins, minalpha, maxalpha); 723 plist_off.AddToList(&binsAlpha_off); 724 725 726 MH3 hSrcPos_off("MSrcPosCam.fX","MSrcPosCam.fY"); 727 hSrcPos_off.SetName("SrcPos_off"); 728 plist_off.AddToList(&hSrcPos_off); 729 MBinning binsSrcPos_offX("BinningSrcPos_offX"); 730 MBinning binsSrcPos_offY("BinningSrcPos_offY"); 731 binsSrcPos_offX.SetEdges(nbins_srcpos, minsrcpos, maxsrcpos); 732 binsSrcPos_offY.SetEdges(nbins_srcpos, minsrcpos, maxsrcpos); 733 plist_off.AddToList(&binsSrcPos_offX); 734 plist_off.AddToList(&binsSrcPos_offY); 735 736 MH3 hDAQEvtNumber_off("MRawEvtHeader.fDAQEvtNumber"); 737 hDAQEvtNumber_off.SetName("DAQEvtNumber_off"); 738 plist_off.AddToList(&hDAQEvtNumber_off); 739 MBinning binsDAQEvtNumber_offX("BinningDAQEvtNumber_offX"); 740 Int_t nbins_evtnum = 100; 741 Double_t minevtnum = 0.; 742 Double_t maxevtnum = 100.; 743 binsDAQEvtNumber_offX.SetEdges(nbins_evtnum,minevtnum,maxevtnum); 744 plist_off.AddToList(&binsDAQEvtNumber_offX); 745 559 plist_off.AddToList(&runheader_off); 560 plist_off.AddToList(&evtheader_off); 561 plist_off.AddToList(&time_off); 562 plist_off.AddToList(&hillas_off); 563 plist_off.AddToList(&hillassrc_off); 564 plist_off.AddToList(&srcpos_off); 565 plist_off.AddToList(&drive_off); 566 567 TH1F *hSize_off = new TH1F ("hSizeOff","",nbins_Size,min_Size,max_Size); 568 TH1F *hWidth_off = new TH1F ("hWidthOff","",nbins_Width,min_Width,max_Width); 569 TH1F *hLength_off = new TH1F ("hLengthOff","",nbins_Length,min_Length,max_Length); 570 TH1F *hDist_off = new TH1F ("hDistOff","",nbins_Dist,min_Dist,max_Dist); 571 TH1F *hAlpha_off_abs = new TH1F ("hAbsAlphaOff","",nbins_abs,minalpha_abs,maxalpha_abs); 572 TH1F *hAlpha_off = new TH1F ("hAlphaOff","",nbins,minalpha,maxalpha); 573 TH2F *hSrcPos_off = new TH2F ("hSrcPosOff","",nbins_srcpos,minsrcpos,maxsrcpos,nbins_srcpos,minsrcpos,maxsrcpos); 574 746 575 //tasks 747 576 MReadTree read_off("Parameters", f_off_name); … … 755 584 // -------------------------------------------------------------- 756 585 757 srcplace.SetMode(MSrcPlace::kOff);586 // srcplace.SetMode(MSrcPlace::kOff); 758 587 759 588 MHillasSrcCalc csrc_off; 760 761 // fill all histograms762 MFillH falpha_off_abs(&hAlpha_off_abs);763 MFillH falpha_off(&hAlpha_off);764 MFillH fdist_off(&hDist_off);765 MFillH fwidth_off(&hWidth_off);766 MFillH flength_off(&hLength_off);767 MFillH fsize_off(&hSize_off);768 MFillH fsrcpos_off(&hSrcPos_off);769 MFillH fevtnum_off(&hDAQEvtNumber_off);770 589 771 590 //tasklist 772 591 tlist_off.AddToList(&read_off); 773 tlist_off.AddToList(&srcplace);774 tlist_off.AddToList(&csrc_off);775 tlist_off.AddToList(&fsrcpos_off);776 // tlist_off.AddToList(&cont_even);777 // tlist_off.AddToList(&cont_size);778 // tlist_off.AddToList(&cont_width);779 // tlist_off.AddToList(&cont_length);780 // tlist_off.AddToList(&cont_dist);781 // tlist_off.AddToList(&falpha_off_abs);782 // tlist_off.AddToList(&falpha_off);783 // tlist_off.AddToList(&fdist_off);784 // tlist_off.AddToList(&fwidth_off);785 // tlist_off.AddToList(&flength_off);786 // tlist_off.AddToList(&fsize_off);787 // tlist_off.AddToList(&fevtnum_off);788 592 tlist_off.AddToList(&srcplace_timebin); // This is just to run the preprocess correctely 593 tlist_off.AddToList(&csrc_off); // This is just to run the preprocess correctely 789 594 790 595 // Create and setup the eventloop … … 802 607 return; 803 608 804 805 MHillas* hillas_off = plist_off.FindObject("MHillas");806 MHillasSrc* hillassrc_off = plist_off.FindObject("MHillasSrc");807 MReportDrive* drive_off = plist_off.FindObject("MReportDrive");808 MSrcPosCam* srcpos_off = plist_off.FindObject("MSrcPosCam");809 810 TArrayI sizecut(numberTimeBins);811 TArrayI widthcut(numberTimeBins);812 TArrayI lengthcut(numberTimeBins);813 TArrayI distcut(numberTimeBins);814 TArrayI alphacut(numberTimeBins);815 816 sizecut.Reset(0);817 widthcut.Reset(0);818 lengthcut.Reset(0);819 distcut.Reset(0);820 alphacut.Reset(0);821 822 609 while(tlist_off.Process()) 823 610 { 824 611 825 //Now fill just the alpha plot in the time/zenith bins defined in on 826 Double_t zenith = drive_off->GetNominalZd(); 612 //First read the variables source(i.e. time bin) independent 613 Double_t zenith = drive_off.GetNominalZd(); 614 615 Double_t size = hillas_off.GetSize(); 616 Double_t width = hillas_off.GetWidth()*geomcam.GetConvMm2Deg(); 617 Double_t length = hillas_off.GetLength()*geomcam.GetConvMm2Deg(); 827 618 828 for (UInt_t bin=0; bin<numberTimeBins; bin++) 619 Int_t sizebin = GetBin(size,numberSizeBins,sizeBins); 620 621 if (sizebin >= 0) 829 622 { 830 srcplace_timebin.SetPositionHisto((TH2F*)srcposHistoOn[bin]); 831 srcplace_timebin.CallProcess(); 832 csrc_off.CallProcess(); 833 834 Double_t size = hillas_off->GetSize(); 835 Double_t width = hillas_off->GetWidth()*geomcam.GetConvMm2Deg(); 836 Double_t length = hillas_off->GetLength()*geomcam.GetConvMm2Deg(); 837 Double_t dist = hillassrc_off->GetDist()*geomcam.GetConvMm2Deg(); 838 Double_t alpha = hillassrc_off->GetAlpha(); 839 Double_t srcposx = srcpos_off->GetX(); 840 Double_t srcposy = srcpos_off->GetY(); 841 842 Int_t sizebin = GetBin(size,numberSizeBins,sizeBins); 843 844 if (sizebin >= 0) 623 if (width > widthmin[sizebin] && width < widthmax[sizebin]) 845 624 { 846 if ( width > widthmin[sizebin] && width < widthmax[sizebin])625 if (length > lengthmin[sizebin] && length < lengthmax[sizebin]) 847 626 { 848 if (length > lengthmin[sizebin] && length < lengthmax[sizebin]) 627 //General histos 628 629 if (dist > distmin[sizebin] && dist < distmax[sizebin]) 849 630 { 631 hSize_off->Fill(log10(size)); 632 hWidth_off->Fill(width); 633 hLength_off->Fill(length); 634 635 srcplace_timebin.SetPositionHisto(hSrcPos_on); 636 srcplace_timebin.CallProcess(); 637 csrc_off.CallProcess(); 638 639 Double_t dist = hillassrc_off.GetDist()*geomcam.GetConvMm2Deg(); 640 Double_t alpha = hillassrc_off.GetAlpha(); 641 Double_t srcposx = srcpos_off.GetX(); 642 Double_t srcposy = srcpos_off.GetY(); 643 644 hDist_off->Fill(dist); 645 hAlpha_off_abs->Fill(TMath::Abs(alpha)); 646 hAlpha_off->Fill(alpha); 647 hSrcPos_off->Fill(srcposx,srcposy); 648 } 649 650 // Time bin histos 651 for (UInt_t bin=0; bin<numberTimeBins; bin++) 652 { 653 srcplace_timebin.SetPositionHisto((TH2F*)srcposHistoOn[bin]); 654 srcplace_timebin.CallProcess(); 655 csrc_off.CallProcess(); 656 657 Double_t dist = hillassrc_off.GetDist()*geomcam.GetConvMm2Deg(); 658 Double_t alpha = hillassrc_off.GetAlpha(); 659 Double_t srcposx = srcpos_off.GetX(); 660 Double_t srcposy = srcpos_off.GetY(); 661 850 662 if (dist > distmin[sizebin] && dist < distmax[sizebin]) 851 663 { … … 853 665 ((TH2F*)srcposHistoOff[bin])->Fill(srcposx,srcposy); 854 666 } 855 else856 distcut[bin]++;857 667 } 858 else859 lengthcut[bin]++;860 668 } 861 else862 widthcut[bin]++;863 669 } 864 670 } 865 671 866 // if (zenith > zenithMaximumOn[numberTimeBins-1])867 // {868 // cout << "Exit loop because we arrive to zenith = " << zenith << endl;869 // break;870 // }672 // if (zenith > zenithMaximumOn[numberTimeBins-1]) 673 // { 674 // cout << "Exit loop because we arrive to zenith = " << zenith << endl; 675 // break; 676 // } 871 677 } 872 678 … … 874 680 875 681 tlist_off.PrintStatistics(); 876 877 // for (UInt_t bin=0; bin<numberTimeBins; bin++)878 // {879 // cout << bin << ' ' << ((TH1F*)alphaHistoOff[bin])->GetEntries() << ' ' << ((TH2F*)srcposHistoOff[bin])->GetEntries() << endl;880 // cout << "sizecut " << sizecut[bin] << endl;881 // cout << "width " << widthcut[bin] << endl;882 // cout << "length " << lengthcut[bin] << endl;883 // cout << "dist " << distcut[bin] << endl;884 // cout << "alpha " << alphacut[bin] << endl;885 // }886 887 682 888 683 TArrayD meanTimeBinOnInSec(numberTimeBins); … … 931 726 TString closepsname = psname + ")"; 932 727 933 TCanvas *c 1= new TCanvas;934 c 1->cd(1);728 TCanvas *c0 = new TCanvas; 729 c0->cd(1); 935 730 TGraphErrors* lightcurvegraph = new TGraphErrors(numberTimeBins,meanTimeBinOnInSec.GetArray(),numberExcessEventsPerMin.GetArray(),widthTimeBinOnInSec.GetArray(),errorNumberExcessEventsPerMin.GetArray()); 936 731 lightcurvegraph->SetTitle("LightCurve"); … … 939 734 lightcurvegraph->SetMarkerSize(0.03); 940 735 lightcurvegraph->Draw("AP"); 736 lightcurvegraph->GetYaxis()->SetTitle("Excess/min"); 737 lightcurvegraph->GetXaxis()->SetTitle("UTC Time"); 941 738 lightcurvegraph->GetXaxis()->SetTimeDisplay(1); 942 c 1->Print(openpsname);739 c0->Print(openpsname); 943 740 944 741 TCanvas** c = new TCanvas*[numberTimeBins]; … … 999 796 ((TH1F*)alphaHistoOn[numberTimeBins-1])->DrawCopy("E1PSAME"); 1000 797 1001 c[numberTimeBins-1]->Print(closepsname); 1002 1003 TFile input("./prueba.root", "RECREATE"); 1004 1005 for (UInt_t bin=0; bin<numberTimeBins; bin++) 1006 { 1007 ((TH1F*)alphaHistoOn[bin])->Write(); 1008 ((TH1F*)alphaHistoOff[bin])->Write(); 1009 ((TH2F*)srcposHistoOn[bin])->Write(); 1010 ((TH2F*)srcposHistoOff[bin])->Write(); 1011 ((TH1F*)coszenithHistoOn[bin])->Write(); 1012 } 1013 1014 input.Close(); 1015 1016 if(kFALSE) 1017 { 1018 1019 // ############################################################################ 1020 // look for the histograms 1021 // ############################################################################ 1022 1023 TH1F *hist_size_on = (TH1F*)hSize_on.GetHist(); 1024 TH1F *hist_size_off = (TH1F*)hSize_off.GetHist(); 1025 1026 TH1F *hist_dist_on = (TH1F*)hDist_on.GetHist(); 1027 TH1F *hist_dist_off = (TH1F*)hDist_off.GetHist(); 1028 1029 TH1F *hist_width_on = (TH1F*)hWidth_on.GetHist(); 1030 TH1F *hist_width_off = (TH1F*)hWidth_off.GetHist(); 1031 1032 TH1F *hist_length_on = (TH1F*)hLength_on.GetHist(); 1033 TH1F *hist_length_off = (TH1F*)hLength_off.GetHist(); 1034 1035 TH1F *hist_on_abs = (TH1F*)hAlpha_on_abs.GetHist(); 1036 TH1F *hist_off_abs = (TH1F*)hAlpha_off_abs.GetHist(); 1037 1038 TH1F *hist_on = (TH1F*)hAlpha_on.GetHist(); 1039 TH1F *hist_off = (TH1F*)hAlpha_off.GetHist(); 1040 798 c[numberTimeBins-1]->Print(psname); 799 800 // TFile input("./prueba.root", "RECREATE"); 801 802 // for (UInt_t bin=0; bin<numberTimeBins; bin++) 803 // { 804 // ((TH1F*)alphaHistoOn[bin])->Write(); 805 // ((TH1F*)alphaHistoOff[bin])->Write(); 806 // ((TH2F*)srcposHistoOn[bin])->Write(); 807 // ((TH2F*)srcposHistoOff[bin])->Write(); 808 // ((TH1F*)coszenithHistoOn[bin])->Write(); 809 // } 810 811 // input.Close(); 1041 812 1042 813 // ############################################################################ … … 1044 815 // ############################################################################ 1045 816 1046 Double_t norm_on_abs = (Double_t) h ist_on_abs->Integral((Int_t)bkgnormmin*nbins_abs/90+1,(Int_t)bkgnormmax*nbins_abs/90+1);1047 Double_t exces_on_abs = (Double_t) h ist_on_abs->Integral((Int_t)sigexccmin*nbins_abs/90+1,(Int_t)sigexccmax*nbins_abs/90+1);1048 Double_t norm_off_abs = (Double_t) h ist_off_abs->Integral((Int_t)bkgnormmin*nbins_abs/90+1,(Int_t)bkgnormmax*nbins_abs/90+1);1049 Double_t exces_off_abs = (Double_t) h ist_off_abs->Integral((Int_t)sigexccmin*nbins_abs/90+1,(Int_t)sigexccmax*nbins_abs/90+1);817 Double_t norm_on_abs = (Double_t) hAlpha_on_abs->Integral((Int_t)bkgnormmin*nbins_abs/90+1,(Int_t)bkgnormmax*nbins_abs/90+1); 818 Double_t exces_on_abs = (Double_t) hAlpha_on_abs->Integral((Int_t)sigexccmin*nbins_abs/90+1,(Int_t)sigexccmax*nbins_abs/90+1); 819 Double_t norm_off_abs = (Double_t) hAlpha_off_abs->Integral((Int_t)bkgnormmin*nbins_abs/90+1,(Int_t)bkgnormmax*nbins_abs/90+1); 820 Double_t exces_off_abs = (Double_t) hAlpha_off_abs->Integral((Int_t)sigexccmin*nbins_abs/90+1,(Int_t)sigexccmax*nbins_abs/90+1); 1050 821 Double_t norm = norm_on_abs/norm_off_abs; 1051 822 1052 823 char text_tit_alpha[256]; 1053 824 sprintf(text_tit_alpha, " Alpha Plot On and Off "); 1054 h ist_off_abs->SetTitle(text_tit_alpha);1055 h ist_on_abs->SetTitle(text_tit_alpha);825 hAlpha_off_abs->SetTitle(text_tit_alpha); 826 hAlpha_on_abs->SetTitle(text_tit_alpha); 1056 827 1057 828 Double_t excess = exces_on_abs - exces_off_abs*norm; 1058 829 Double_t sign = excess / sqrt( exces_on_abs + norm*norm*exces_off_abs ); 1059 Double_t int_off = (Double_t) h ist_off_abs->Integral(1, 18);1060 int h ist_on_entries = (int) hist_on_abs->GetEntries();1061 int h ist_off_entries = (int) hist_off_abs->GetEntries();830 Double_t int_off = (Double_t) hAlpha_off_abs->Integral(1, 18); 831 int hAlpha_on_entries = (int) hAlpha_on_abs->GetEntries(); 832 int hAlpha_off_entries = (int) hAlpha_off_abs->GetEntries(); 1062 833 1063 834 cout << "---> Normalization F factor =\t" << norm <<endl; 1064 835 cout << "---> Excess =\t\t\t" << excess <<endl; 1065 836 cout << "---> Significancia =\t\t" << sign <<endl; 1066 cout << "---> entries on =\t\t" << h ist_on_entries <<endl;1067 cout << "---> entries off =\t\t" << h ist_off_entries <<endl;837 cout << "---> entries on =\t\t" << hAlpha_on_entries <<endl; 838 cout << "---> entries off =\t\t" << hAlpha_off_entries <<endl; 1068 839 cout << "---> integral off =\t\t" << int_off <<endl; 1069 840 1070 841 Double_t shiftx; 1071 842 1072 //1073 //Create the display -> from now on, all histos are plotted1074 MStatusDisplay *display = new MStatusDisplay;1075 display->SetUpdateTime(3000);1076 display->Resize(850,700);1077 1078 843 // ############################################################################ 1079 844 // Draw SIZE 1080 845 // ############################################################################ 1081 display->AddTab("SIZE");846 TCanvas *c1 = new TCanvas; 1082 847 1083 848 gPad->cd(); 1084 849 1085 850 gPad->SetLogy(); 1086 h ist_size_on->Sumw2();1087 h ist_size_off->Sumw2();1088 h ist_size_off->Scale(norm);1089 h ist_size_on->SetLineColor(kBlack);1090 h ist_size_on->SetMarkerStyle(21);1091 h ist_size_on->SetMarkerSize(0.7);1092 h ist_size_on->SetMarkerColor(kBlack);1093 h ist_size_off->SetFillColor(46);1094 h ist_size_off->SetLineColor(46);1095 h ist_size_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines1096 h ist_size_off->SetMinimum(0.1);1097 h ist_size_on->SetMinimum(0.1);1098 h ist_size_on->SetTitle("SIZE distribution");1099 h ist_size_off->SetTitle("SIZE distribution");1100 1101 h ist_size_on->DrawCopy("E1P");851 hSize_on->Sumw2(); 852 hSize_off->Sumw2(); 853 hSize_off->Scale(norm); 854 hSize_on->SetLineColor(kBlack); 855 hSize_on->SetMarkerStyle(21); 856 hSize_on->SetMarkerSize(0.7); 857 hSize_on->SetMarkerColor(kBlack); 858 hSize_off->SetFillColor(46); 859 hSize_off->SetLineColor(46); 860 hSize_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines 861 hSize_off->SetMinimum(0.1); 862 hSize_on->SetMinimum(0.1); 863 hSize_on->SetTitle("SIZE distribution"); 864 hSize_off->SetTitle("SIZE distribution"); 865 866 hSize_on->DrawCopy("E1P"); 1102 867 1103 868 // move stat box to make them all visible 1104 869 gPad->Update(); 1105 TPaveStats* pavs_on_size = (TPaveStats*) h ist_size_on->GetListOfFunctions()->FindObject("stats");870 TPaveStats* pavs_on_size = (TPaveStats*) hSize_on->GetListOfFunctions()->FindObject("stats"); 1106 871 if(pavs_on_size){ 1107 872 shiftx = pavs_on_size->GetX2NDC() - pavs_on_size->GetX1NDC(); … … 1112 877 gPad->Update(); 1113 878 1114 h ist_size_off->DrawCopy("HISTSAME");1115 h ist_size_off->DrawCopy("ESAME");879 hSize_off->DrawCopy("HISTSAME"); 880 hSize_off->DrawCopy("ESAME"); 1116 881 1117 882 gPad->Modified(); 1118 883 gPad->Update(); 1119 884 1120 Double_t chisize = ChiSquareNDof((TH1D*)h ist_size_on,(TH1D*)hist_size_off);885 Double_t chisize = ChiSquareNDof((TH1D*)hSize_on,(TH1D*)hSize_off); 1121 886 1122 887 Double_t x_label_pos = log10(1000000)*0.7; 1123 Double_t y_label_pos = log10((h ist_size_on->GetBinContent(hist_size_on->GetMaximumBin()))/2.);888 Double_t y_label_pos = log10((hSize_on->GetBinContent(hSize_on->GetMaximumBin()))/2.); 1124 889 Double_t textsize = 0.03; 1125 890 … … 1134 899 gPad->Update(); 1135 900 901 c1->Print(psname); 902 1136 903 // ############################################################################ 1137 904 // DrawCopy DIST 1138 905 // ############################################################################ 1139 display->AddTab("DIST");906 TCanvas *c2 = new TCanvas; 1140 907 1141 908 gPad->cd(); 1142 909 1143 h ist_dist_on->Sumw2();1144 h ist_dist_off->Sumw2();1145 h ist_dist_off->Scale(norm);1146 h ist_dist_on->SetLineColor(kBlack);1147 h ist_dist_on->SetMarkerStyle(21);1148 h ist_dist_on->SetMarkerSize(0.7);1149 h ist_dist_on->SetMarkerColor(kBlack);1150 h ist_dist_off->SetFillColor(46);1151 h ist_dist_off->SetLineColor(46);1152 h ist_dist_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines1153 h ist_dist_off->SetMinimum(0.);1154 h ist_dist_on->SetTitle("DIST distribution");1155 h ist_dist_off->SetTitle("DIST distribution");1156 1157 h ist_dist_on->DrawCopy("E1P");910 hDist_on->Sumw2(); 911 hDist_off->Sumw2(); 912 hDist_off->Scale(norm); 913 hDist_on->SetLineColor(kBlack); 914 hDist_on->SetMarkerStyle(21); 915 hDist_on->SetMarkerSize(0.7); 916 hDist_on->SetMarkerColor(kBlack); 917 hDist_off->SetFillColor(46); 918 hDist_off->SetLineColor(46); 919 hDist_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines 920 hDist_off->SetMinimum(0.); 921 hDist_on->SetTitle("DIST distribution"); 922 hDist_off->SetTitle("DIST distribution"); 923 924 hDist_on->DrawCopy("E1P"); 1158 925 1159 926 // move stat box to make them all visible 1160 927 gPad->Update(); 1161 TPaveStats* pavs_on_dist = (TPaveStats*) h ist_dist_on->GetListOfFunctions()->FindObject("stats");928 TPaveStats* pavs_on_dist = (TPaveStats*) hDist_on->GetListOfFunctions()->FindObject("stats"); 1162 929 if(pavs_on_dist){ 1163 930 shiftx = pavs_on_dist->GetX2NDC() - pavs_on_dist->GetX1NDC(); … … 1168 935 gPad->Update(); 1169 936 1170 h ist_dist_off->DrawCopy("HISTSAME");1171 h ist_dist_off->DrawCopy("ESAME");1172 h ist_dist_on->DrawCopy("E1PSAME");1173 1174 Double_t chidist = ChiSquareNDof((TH1D*)h ist_dist_on,(TH1D*)hist_dist_off);1175 1176 x_label_pos = distmax[ 0]*0.7;1177 y_label_pos = h ist_dist_on->GetBinContent(hist_dist_on->GetMaximumBin())/2.;937 hDist_off->DrawCopy("HISTSAME"); 938 hDist_off->DrawCopy("ESAME"); 939 hDist_on->DrawCopy("E1PSAME"); 940 941 Double_t chidist = ChiSquareNDof((TH1D*)hDist_on,(TH1D*)hDist_off); 942 943 x_label_pos = distmax[numberSizeBins-1]*0.7; 944 y_label_pos = hDist_on->GetBinContent(hDist_on->GetMaximumBin())/2.; 1178 945 1179 946 char text_dist[256]; … … 1187 954 gPad->Update(); 1188 955 956 c2->Print(psname); 957 1189 958 // ############################################################################ 1190 959 // DrawCopy WIDTH 1191 960 // ############################################################################ 1192 display->AddTab("WIDTH");961 TCanvas *c3 = new TCanvas; 1193 962 1194 963 gPad->cd(); 1195 964 1196 h ist_width_off->Sumw2();1197 h ist_width_off->Scale(norm);1198 h ist_width_on->SetLineColor(kBlack);1199 h ist_width_on->SetMarkerStyle(21);1200 h ist_width_on->SetMarkerSize(0.7);1201 h ist_width_on->SetMarkerColor(kBlack);1202 h ist_width_off->SetFillColor(46);1203 h ist_width_off->SetLineColor(46);1204 h ist_width_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines1205 h ist_width_off->SetMinimum(0.);1206 h ist_width_on->SetTitle("WIDTH distribution");1207 h ist_width_off->SetTitle("WIDTH distribution");1208 1209 h ist_width_on->DrawCopy("E1P");965 hWidth_off->Sumw2(); 966 hWidth_off->Scale(norm); 967 hWidth_on->SetLineColor(kBlack); 968 hWidth_on->SetMarkerStyle(21); 969 hWidth_on->SetMarkerSize(0.7); 970 hWidth_on->SetMarkerColor(kBlack); 971 hWidth_off->SetFillColor(46); 972 hWidth_off->SetLineColor(46); 973 hWidth_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines 974 hWidth_off->SetMinimum(0.); 975 hWidth_on->SetTitle("WIDTH distribution"); 976 hWidth_off->SetTitle("WIDTH distribution"); 977 978 hWidth_on->DrawCopy("E1P"); 1210 979 1211 980 // move stat box to make them all visible 1212 981 gPad->Update(); 1213 TPaveStats* pavs_on_width = (TPaveStats*) h ist_width_on->GetListOfFunctions()->FindObject("stats");982 TPaveStats* pavs_on_width = (TPaveStats*) hWidth_on->GetListOfFunctions()->FindObject("stats"); 1214 983 if(pavs_on_width){ 1215 984 shiftx = pavs_on_width->GetX2NDC() - pavs_on_width->GetX1NDC(); … … 1220 989 gPad->Update(); 1221 990 1222 h ist_width_off->DrawCopy("HISTSAME");1223 h ist_width_off->DrawCopy("ESAME");1224 h ist_width_on->DrawCopy("E1PSAME");1225 1226 Double_t chiwidth = ChiSquareNDof((TH1D*)h ist_width_on,(TH1D*)hist_width_off);1227 1228 x_label_pos = widthmax[ 0]*0.7;1229 y_label_pos = h ist_width_on->GetBinContent(hist_width_on->GetMaximumBin())/2.;991 hWidth_off->DrawCopy("HISTSAME"); 992 hWidth_off->DrawCopy("ESAME"); 993 hWidth_on->DrawCopy("E1PSAME"); 994 995 Double_t chiwidth = ChiSquareNDof((TH1D*)hWidth_on,(TH1D*)hWidth_off); 996 997 x_label_pos = widthmax[numberSizeBins-1]*0.7; 998 y_label_pos = hWidth_on->GetBinContent(hWidth_on->GetMaximumBin())/2.; 1230 999 1231 1000 char text_width[256]; … … 1239 1008 gPad->Update(); 1240 1009 1010 c3->Print(psname); 1011 1241 1012 // ############################################################################ 1242 1013 // DrawCopy LENGTH 1243 1014 // ############################################################################ 1244 display->AddTab("LENGTH");1015 TCanvas *c4 = new TCanvas; 1245 1016 1246 1017 gPad->cd(); 1247 1018 1248 h ist_length_on->Sumw2();1249 h ist_length_off->Sumw2();1250 h ist_length_off->Scale(norm);1251 h ist_length_on->SetLineColor(kBlack);1252 h ist_length_on->SetMarkerStyle(21);1253 h ist_length_on->SetMarkerSize(0.7);1254 h ist_length_on->SetMarkerColor(kBlack);1255 h ist_length_off->SetFillColor(46);1256 h ist_length_off->SetLineColor(46);1257 h ist_length_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines1258 h ist_length_off->SetMinimum(0.);1259 h ist_length_on->SetTitle("LENGTH distribution");1260 h ist_length_off->SetTitle("LENGTH distribution");1261 1262 h ist_length_on->DrawCopy("E1P");1019 hLength_on->Sumw2(); 1020 hLength_off->Sumw2(); 1021 hLength_off->Scale(norm); 1022 hLength_on->SetLineColor(kBlack); 1023 hLength_on->SetMarkerStyle(21); 1024 hLength_on->SetMarkerSize(0.7); 1025 hLength_on->SetMarkerColor(kBlack); 1026 hLength_off->SetFillColor(46); 1027 hLength_off->SetLineColor(46); 1028 hLength_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines 1029 hLength_off->SetMinimum(0.); 1030 hLength_on->SetTitle("LENGTH distribution"); 1031 hLength_off->SetTitle("LENGTH distribution"); 1032 1033 hLength_on->DrawCopy("E1P"); 1263 1034 1264 1035 // move stat box to make them all visible 1265 1036 gPad->Update(); 1266 TPaveStats* pavs_on_length = (TPaveStats*) h ist_length_on->GetListOfFunctions()->FindObject("stats");1037 TPaveStats* pavs_on_length = (TPaveStats*) hLength_on->GetListOfFunctions()->FindObject("stats"); 1267 1038 if(pavs_on_length){ 1268 1039 shiftx = pavs_on_length->GetX2NDC() - pavs_on_length->GetX1NDC(); … … 1273 1044 gPad->Update(); 1274 1045 1275 h ist_length_off->DrawCopy("HISTSAME");1276 h ist_length_off->DrawCopy("ESAME");1277 h ist_length_on->DrawCopy("E1PSAME");1278 1279 Double_t chilength = ChiSquareNDof((TH1D*)h ist_length_on,(TH1D*)hist_length_off);1280 1281 x_label_pos = lengthmax[ 0]*0.7;1282 y_label_pos = h ist_length_on->GetBinContent(hist_length_on->GetMaximumBin())/2.;1046 hLength_off->DrawCopy("HISTSAME"); 1047 hLength_off->DrawCopy("ESAME"); 1048 hLength_on->DrawCopy("E1PSAME"); 1049 1050 Double_t chilength = ChiSquareNDof((TH1D*)hLength_on,(TH1D*)hLength_off); 1051 1052 x_label_pos = lengthmax[numberSizeBins-1]*0.7; 1053 y_label_pos = hLength_on->GetBinContent(hLength_on->GetMaximumBin())/2.; 1283 1054 1284 1055 char text_length[256]; … … 1292 1063 gPad->Update(); 1293 1064 1294 // ############################################################################ 1065 c4->Print(psname); 1066 1067 // ############################################################################ 1295 1068 // DrawCopy normalized ALPHA plot 1296 1069 // ############################################################################ 1297 display->AddTab("ALPHA");1070 TCanvas *c5 = new TCanvas; 1298 1071 1299 1072 gPad->cd(); 1300 1073 1301 h ist_on_abs->Sumw2();1302 h ist_off_abs->SetStats(0);1303 h ist_off_abs->Sumw2();1304 h ist_off_abs->Scale(norm);1305 h ist_on_abs->SetStats(0); //-> Do NOT show the legend with statistics1306 h ist_on_abs->SetLineColor(kBlack);1307 h ist_on_abs->SetMarkerStyle(21);1308 //h ist_on_abs->SetMarkerSize();1309 h ist_on_abs->SetMarkerColor(kBlack);1310 h ist_on_abs->SetMarkerSize(0.7);1311 h ist_off_abs->SetFillColor(46);1312 h ist_off_abs->SetLineColor(46);1313 h ist_off_abs->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines1314 h ist_off_abs->SetMinimum(0.);1315 h ist_on_abs->SetTitle("Alpha plot");1316 h ist_off_abs->SetTitle("Alpha plot");1317 1318 1319 h ist_on_abs->DrawCopy("E1P");1320 h ist_off_abs->DrawCopy("HISTSAME");1321 h ist_off_abs->DrawCopy("ESAME");1322 h ist_on_abs->DrawCopy("E1PSAME");1074 hAlpha_on_abs->Sumw2(); 1075 hAlpha_off_abs->SetStats(0); 1076 hAlpha_off_abs->Sumw2(); 1077 hAlpha_off_abs->Scale(norm); 1078 hAlpha_on_abs->SetStats(0); //-> Do NOT show the legend with statistics 1079 hAlpha_on_abs->SetLineColor(kBlack); 1080 hAlpha_on_abs->SetMarkerStyle(21); 1081 //hAlpha_on_abs->SetMarkerSize(); 1082 hAlpha_on_abs->SetMarkerColor(kBlack); 1083 hAlpha_on_abs->SetMarkerSize(0.7); 1084 hAlpha_off_abs->SetFillColor(46); 1085 hAlpha_off_abs->SetLineColor(46); 1086 hAlpha_off_abs->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines 1087 hAlpha_off_abs->SetMinimum(0.); 1088 hAlpha_on_abs->SetTitle("Alpha plot"); 1089 hAlpha_off_abs->SetTitle("Alpha plot"); 1090 1091 1092 hAlpha_on_abs->DrawCopy("E1P"); 1093 hAlpha_off_abs->DrawCopy("HISTSAME"); 1094 hAlpha_off_abs->DrawCopy("ESAME"); 1095 hAlpha_on_abs->DrawCopy("E1PSAME"); 1323 1096 1324 1097 … … 1326 1099 char text_Fnorm[256], text_excess[256], text_sign[256]; 1327 1100 char text_entries_on[256], text_entries_off[256], text_integral_off[256]; 1328 int h ist_on_entries = (int) hist_on_abs->GetEntries();1329 int h ist_off_entries = (int) hist_off_abs->GetEntries();1101 int hAlpha_on_entries = (int) hAlpha_on_abs->GetEntries(); 1102 int hAlpha_off_entries = (int) hAlpha_off_abs->GetEntries(); 1330 1103 sprintf(text_Fnorm, " F norm = %.3f", norm); 1331 1104 sprintf(text_excess, " Excess = %.3f", excess); 1332 1105 sprintf(text_sign, " Significance = %.3f", sign); 1333 sprintf(text_entries_on, " Entries ON = %d", h ist_on_entries);1334 sprintf(text_entries_off, " Entries OFF = %d", h ist_off_entries);1106 sprintf(text_entries_on, " Entries ON = %d", hAlpha_on_entries); 1107 sprintf(text_entries_off, " Entries OFF = %d", hAlpha_off_entries); 1335 1108 sprintf(text_integral_off," Integral OFF = %d", int_off); 1336 1109 1337 x_label_pos = alphamax[0]*0.7;1338 y_label_pos = (h ist_on_abs->GetBinContent(hist_on_abs->GetMaximumBin()))/1.6; //2.;1110 x_label_pos = 90.*0.7; 1111 y_label_pos = (hAlpha_on_abs->GetBinContent(hAlpha_on_abs->GetMaximumBin())); //2.; 1339 1112 Double_t y_label_step = y_label_pos / 8.; 1340 1113 … … 1359 1132 1360 1133 1361 Double_t chialpha = ChiSquareNDof((TH1D*)h ist_on_abs,(TH1D*)hist_off_abs);1362 1363 y_label_pos = (h ist_on_abs->GetBinContent(hist_on_abs->GetMaximumBin()))/2.;1134 Double_t chialpha = ChiSquareNDof((TH1D*)hAlpha_on_abs,(TH1D*)hAlpha_off_abs); 1135 1136 y_label_pos = (hAlpha_on_abs->GetBinContent(hAlpha_on_abs->GetMaximumBin()))/2.; 1364 1137 1365 1138 char text_alpha[256]; … … 1373 1146 gPad->Update(); 1374 1147 1148 c5->Print(psname); 1149 1375 1150 // ############################################################################ 1376 1151 // DrawCopy normalized alpha histos for alpha form -90 to 90 deg. 1377 1152 // ############################################################################ 1378 display->AddTab("ALPHA +-90");1153 TCanvas *c6 = new TCanvas; 1379 1154 1380 1155 gPad->cd(); 1381 1156 1382 h ist_on->Sumw2();1383 h ist_off->SetStats(0);1384 h ist_off->Sumw2();1385 h ist_off->Scale(norm);1386 h ist_off->SetFillColor(46);1387 h ist_off->SetLineColor(46);1388 h ist_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines1389 h ist_off->SetMinimum(0.);1390 h ist_on->SetStats(0); //-> Do NOT show the legend with statistics1391 h ist_on->SetLineColor(kBlack);1392 h ist_on->SetMarkerStyle(21);1393 h ist_on->SetMarkerSize(0.7);1394 h ist_on->SetMarkerColor(kBlack);1395 h ist_on->SetTitle("Alpha plot form -90 to 90 deg");1396 h ist_off->SetTitle("Alpha plot form -90 to 90 deg");1397 1398 h ist_on->DrawCopy("E1P");1399 h ist_off->DrawCopy("HISTSAME");1400 h ist_off->DrawCopy("ESAME");1401 h ist_on->DrawCopy("E1PSAME");1402 1403 Double_t chialpha90 = ChiSquareNDof((TH1D*)h ist_on,(TH1D*)hist_off);1404 1405 x_label_pos = alphamax[0]*0.5;1406 y_label_pos = h ist_on->GetBinContent(hist_on->GetMaximumBin())/2.;1157 hAlpha_on->Sumw2(); 1158 hAlpha_off->SetStats(0); 1159 hAlpha_off->Sumw2(); 1160 hAlpha_off->Scale(norm); 1161 hAlpha_off->SetFillColor(46); 1162 hAlpha_off->SetLineColor(46); 1163 hAlpha_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines 1164 hAlpha_off->SetMinimum(0.); 1165 hAlpha_on->SetStats(0); //-> Do NOT show the legend with statistics 1166 hAlpha_on->SetLineColor(kBlack); 1167 hAlpha_on->SetMarkerStyle(21); 1168 hAlpha_on->SetMarkerSize(0.7); 1169 hAlpha_on->SetMarkerColor(kBlack); 1170 hAlpha_on->SetTitle("Alpha plot form -90 to 90 deg"); 1171 hAlpha_off->SetTitle("Alpha plot form -90 to 90 deg"); 1172 1173 hAlpha_on->DrawCopy("E1P"); 1174 hAlpha_off->DrawCopy("HISTSAME"); 1175 hAlpha_off->DrawCopy("ESAME"); 1176 hAlpha_on->DrawCopy("E1PSAME"); 1177 1178 Double_t chialpha90 = ChiSquareNDof((TH1D*)hAlpha_on,(TH1D*)hAlpha_off); 1179 1180 x_label_pos = 90.*0.5; 1181 y_label_pos = hAlpha_on->GetBinContent(hAlpha_on->GetMaximumBin())/2.; 1407 1182 1408 1183 char text_alpha90[256]; … … 1416 1191 gPad->Modified(); 1417 1192 1193 c6->Print(psname); 1418 1194 1419 1195 cout << "---> ChiSquare/NDof [Size] =\t\t" << chisize << endl; … … 1425 1201 1426 1202 1427 display->AddTab("SRCPOS ON"); 1428 TH2F *hist_srcpos_on = (TH2F*)hSrcPos_on.GetHist(); 1429 hist_srcpos_on->DrawCopy("BOX"); 1430 1431 display->AddTab("SRCPOS OFF"); 1432 TH2F *hist_srcpos_off = (TH2F*)hSrcPos_off.GetHist(); 1433 hist_srcpos_off->DrawCopy("BOX"); 1434 1435 // display->AddTab("EVTNUM ON"); 1436 // TH1F *hist_evtnum_on = (TH1F*)hDAQEvtNumber_on.GetHist(); 1437 // hist_evtnum_on->DrawCopy(); 1438 1439 // display->AddTab("EVTNUM OFF"); 1440 // TH1F *hist_evtnum_off = (TH1F*)hDAQEvtNumber_off.GetHist(); 1441 // hist_evtnum_off->DrawCopy(); 1442 1443 } 1203 TCanvas *c7 = new TCanvas; 1204 hSrcPos_on->DrawCopy("BOX"); 1205 c7->Print(psname); 1206 1207 TCanvas *c8 = new TCanvas; 1208 hSrcPos_off->DrawCopy("BOX"); 1209 c8->Print(closepsname); 1444 1210 1445 1211 cout << "Done!!" <<endl;
Note:
See TracChangeset
for help on using the changeset viewer.