/* ======================================================================== *\ ! ! * ! * 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 12/2000 ! Author(s): Harald Kornmayer 1/2001 ! ! Copyright: MAGIC Software Development, 2000-2001 ! ! Modified 4/7/2002 Abelardo Moralejo: now the dimension of fTrigger is ! set dinamically, to allow an arbitrary large number of trigger ! conditions to be processed. ! ! \* ======================================================================== */ #include "MMcTriggerRateCalc.h" #include "MLog.h" #include "MLogManip.h" #include "MParList.h" #include "MHMcRate.h" #include "MMcEvt.hxx" #include "MMcTrig.hxx" ClassImp(MMcTriggerRateCalc); void MMcTriggerRateCalc::Init(int dim, int part, float *trigbg, float simbg, const char *name, const char *title) { fName = name ? name : "MMcTriggerRateCalc"; fTitle = title ? title : "Task to calc the trigger rate "; fMcTrig = NULL; fMcRate = NULL; fShowers = 0; fAnalShow = simbg; fPartId=part; fFirst = dim>0 ? 1 : -dim; fLast = dim>0 ? dim : -dim; fNum = fLast-fFirst+1; fTrigger = new float[fNum]; for (UInt_t i=0;iFindObject("MMcEvt"); if (!fMcEvt) { *fLog << err << dbginf << "MMcEvt not found... aborting." << endl; return kFALSE; } UInt_t num; fMcTrig = new TObjArray(pList->FindObjectList("MMcTrig", fFirst, fLast)); num = fMcTrig->GetEntriesFast(); if (num != fNum) { *fLog << err << dbginf << fNum << " MMcTrig objects requested, "; *fLog << num << " are available... aborting." << endl; return kFALSE; } fMcRate = new TObjArray(pList->FindObjectList("MHMcRate", fFirst, fLast)); num = fMcRate->GetEntriesFast(); if (num != fNum) { *fLog << err << dbginf << fNum << " MHMcRate objects requested, "; *fLog << num << " are available... aborting." << endl; return kFALSE; } for (UInt_t i=0; iGetPhotElfromShower()) fAnalShow++; // // Getting angles, energy and impact parameter to set boundaries // const Float_t theta = fMcEvt->GetTheta(); const Float_t phi = fMcEvt->GetPhi(); const Float_t param = fMcEvt->GetImpact(); const Float_t ener = fMcEvt->GetEnergy()/1000.0; // // Counting number of triggers // for (UInt_t i=0; iGetFirstLevel()) fTrigger[i] ++; GetRate(i)->UpdateBoundaries(ener, theta, phi, param); } return kTRUE; } // -------------------------------------------------------------------------- // // The PostProcess-function calculates and shows the trigger rate // Bool_t MMcTriggerRateCalc::PostProcess() { // // Computing trigger rate // for (UInt_t i=0; iCalcRate(fTrigger[i], fAnalShow, fShowers); return kTRUE; }