/* ======================================================================== *\ ! ! * ! * This file is part of MARS, the MAGIC Analysis and Reconstruction ! * Software. It is distributed to you in the hope that it can be a useful ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. ! * It is distributed WITHOUT ANY WARRANTY. ! * ! * Permission to use, copy, modify and distribute this software and its ! * documentation for any purpose is hereby granted without fee, ! * provided that the above copyright notice appear in all copies and ! * that both that copyright notice and this permission notice appear ! * in supporting documentation. It is provided "as is" without express ! * or implied warranty. ! * ! ! ! Author(s): Thomas Bretz, 5/2002 ! Author(s): Rudy Bock, 5/2002 ! ! Copyright: MAGIC Software Development, 2000-2002 ! ! \* ======================================================================== */ void plot() { // // This is a demonstration program which calculates the Hillas // parameter out of a Magic root file. // // Create a empty Parameter List and an empty Task List // The tasklist is identified in the eventloop by its name // MParList plist; MTaskList tlist; plist.AddToList(&tlist); // // Now setup the tasks and tasklist: // --------------------------------- // // The first argument is the tree you want to read. // Events: Cosmic ray events // PedEvents: Pedestal Events // CalEvents: Calibration Events // MReadMarsFile read("Events", "star.root"); read.DisableAutoScheme(); tlist.AddToList(&read); MFParticleId fgamma("MMcEvt", '=', kGAMMA); tlist.AddToList(&fgamma); MFParticleId fhadrons("MMcEvt", '!', kGAMMA); tlist.AddToList(&fhadrons); // ------------------------------------------------------- // // set the name of the variable to plot and the binning // TString var("MHillas.fSize"); MBinning bins("BinningMH3X"); bins.SetEdgesLog(50, 100, 20000); // // ------------------------------------------------- MH3 h3g(var); MH3 h3h(var); plist.AddToList(&h3g); plist.AddToList(&h3h); plist.AddToList(&bins); MFillH fillg(&h3g); fillg.SetFilter(&fgamma); tlist.AddToList(&fillg); MFillH fillh(&h3h); fillh.SetFilter(&fhadrons); tlist.AddToList(&fillh); // // Create and setup the eventloop // MEvtLoop evtloop; evtloop.SetParList(&plist); // // Execute your analysis // if (!evtloop.Eventloop()) return; tlist.PrintStatistics(); MH::MakeDefCanvas("Plot"); h3h.GetHist().SetLineColor(kRed); h3h.GetHist().SetFillStyle(4000); h3g.GetHist().DrawCopy(); h3h.GetHist().DrawCopy("same"); TH1D h; MH::SetBinning(&h, &bins); h.Divide(&h3g.GetHist(), &h3h.GetHist()); h.SetLineColor(kGreen); h.SetFillStyle(4000); h.DrawCopy("same"); gPad->SetLogx(); }