/* ======================================================================== *\ ! ! * ! * 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, 09/2003 ! ! Copyright: MAGIC Software Development, 2000-2003 ! ! \* ======================================================================== */ ////////////////////////////////////////////////////////////////////////////// // // MGeomApply // // Applies the geometry to geometry dependant containers. // // It changes the size of the arrays in the containers to a size // matching the number of pixels, eg: // // MPedestalCam // MBlindPixels // // It uses the geometry (MGeomCam) found in the parameter list. // If it is not found the task tries to create the geometry // specified in the constructor. The default geometry is // MGeomCamMagic. // // Input Containers: // [MGeomCam] // // Output Containers: // MPedestalCam, MBlindPixels // ////////////////////////////////////////////////////////////////////////////// #include "MGeomApply.h" #include "MLog.h" #include "MLogManip.h" #include "MParList.h" #include "MGeomCam.h" #include "MPedestalCam.h" #include "MBlindPixels.h" ClassImp(MGeomApply); using namespace std; // -------------------------------------------------------------------------- // // Default constructor. MGeomCamMagic is the default geometry. // MGeomApply::MGeomApply(const char *name, const char *title) : fGeomName("MGeomCamMagic") { fName = name ? name : "MGeomApply"; fTitle = title ? title : "Task to apply geometry settings"; } // -------------------------------------------------------------------------- // // Give the name of the geometry you want to have, eg. MGeomCamCT1 // MGeomApply::MGeomApply(const TString cam, const char *name, const char *title) : fGeomName(cam) { fName = name ? name : "MGeomApply"; fTitle = title ? title : "Task to apply geometry settings"; } // -------------------------------------------------------------------------- // // Try to find 'MGeomCam' in the Parameter List. If it is not found, // try to create a fGeomName object. // Int_t MGeomApply::PreProcess(MParList *pList) { MGeomCam *cam = (MGeomCam*)pList->FindObject("MGeomCam"); if (cam) return kTRUE; cam = (MGeomCam*)pList->FindCreateObj(fGeomName, "MGeomCam"); return cam ? kTRUE : kFALSE; } // -------------------------------------------------------------------------- // // Try to find 'MGeomCam' in the Parameter List. If it is not found, // processing is stopped. // // The size of MPedestalCam and MBlindPixels is set accordingly. // Bool_t MGeomApply::ReInit(MParList *pList) { MGeomCam *cam = (MGeomCam*)pList->FindObject("MGeomCam"); if (!cam) { *fLog << err << GetDescriptor() << ": No MGeomCam found... aborting." << endl; return kFALSE; } MPedestalCam *ped = (MPedestalCam*)pList->FindObject("MPedestalCam"); if (ped) ped->InitSize(cam->GetNumPixels()); MBlindPixels *bnd = (MBlindPixels*)pList->FindObject("MBlindPixels"); if (bnd) bnd->InitSize(cam->GetNumPixels()); return kTRUE; }