Skip to content
Snippets Groups Projects
Commit 17882ac1 authored by Laurent Chevalier's avatar Laurent Chevalier Committed by Graeme Stewart
Browse files

warning correction (BFieldAthTest-01-07-01)

parent deb59495
No related merge requests found
Showing
with 4790 additions and 0 deletions
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MagFAthenaTest_H
#define MagFAthenaTest_H
//
// Author : Saclay Muon Software Group SaMuSoG
// Date : 15/06/00
//
// The MagFAthenaTest class
// is an Algorithm class to test MagFieldAthenaSvc
//
#include "GaudiKernel/Algorithm.h"
#include "GaudiKernel/ServiceHandle.h"
#include "AthenaKernel/IOVSvcDefs.h"
#include "BFieldAth/MagFieldAthena.h"
class IMagFieldAthenaSvc;
class MagFAthenaTest:public Algorithm {
public:
MagFAthenaTest (const std::string& name, ISvcLocator* pSvcLocator);
~MagFAthenaTest();
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
StatusCode callback( IOVSVC_CALLBACK_ARGS );
private:
std::vector<std::string> m_MenbersName ;//!< Names of Subalgs
std::vector<std::string> m_MenbersType ;//!< Types of Subalgs
std::vector<Algorithm*> m_ListOfMenbers ;//!< Pointers on Subalgs
ServiceHandle<IMagFieldAthenaSvc> p_MagFieldAthenaSvc ; //!< Pointer On MagFieldAthenaSvc
//Functions
// Set Access to Basic Muon Svc
void SetAccessBasicSvc();
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//
// Author : Saclay Muon Software Group SaMuSoG
// Date : 30/03/00
//
// The MagFAthenaTest01 class
// is an Algorithm class to test MagFieldAthenaSvc
//
#ifndef MAGFATHENATEST01
#define MAGFATHENATEST01
#include "GaudiKernel/Algorithm.h"
#include "GaudiKernel/ServiceHandle.h"
#include "BFieldAth/MagFieldAthena.h"
class IMagFieldAthenaSvc;
class MagFAthenaTest01:public Algorithm {
public:
MagFAthenaTest01(const std::string& name, ISvcLocator* pSvcLocator);
public:
///////////////////////////////////
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
private:
///////////////////////////////////
// Dumpy01
int DoneDumpy01 ;
void Dumpy01();
//Data
// Pointer On MagFieldAthenaSvc
ServiceHandle<IMagFieldAthenaSvc> p_MagFieldAthenaSvc;
int m_ca ;
int m_nx ;
int m_ny ;
int m_nz ;
int m_nr ;
int m_nphi ;
int m_nstx ;
int m_nsty ;
int m_nstz ;
int m_nstr ;
double m_xmax ;
double m_xmin ;
double m_ymax ;
double m_ymin ;
double m_zmax ;
double m_zmin ;
double m_rmax ;
double m_rmin ;
double m_phimax;
double m_phimin;
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//
// Author : Saclay Muon Software Group SaMuSoG
// Date : 30/03/00
//
// The MagFAthenaTest02 class
// is an Algorithm class to test MagFieldAccess
//
#ifndef MAGFATHENATEST02
#define MAGFATHENATEST02
#include "GaudiKernel/Algorithm.h"
#include "GaudiKernel/ServiceHandle.h"
#include "BFieldAth/MagFieldAthena.h"
class IMagFieldAthenaSvc;
class MagFAthenaTest02:public Algorithm {
public:
MagFAthenaTest02(const std::string& name, ISvcLocator* pSvcLocator);
public:
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
private:
void Dumpy02();
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//
// Author : Saclay Muon Software Group SaMuSoG
// Date : 18/05/00
//
// MagFAthenaTest03 is a C function for testing MagFieldAccess
//
#ifndef MAGFATHENATEST03
#define MAGFATHENATEST03
extern "C" void magfathenatest03_();
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//
// Author : Saclay Muon Software Group SaMuSoG
// Date : 30/03/00
//
// The MagFAthenaValidation class
// is an Algorithm class to test MagFieldAthenaSvc
//
#ifndef MAGFATHENAVALIDATION
#define MAGFATHENAVALIDATION
#include "GaudiKernel/Algorithm.h"
#include "GaudiKernel/ServiceHandle.h"
#include "BFieldAth/MagFieldAthena.h"
class IMagFieldAthenaSvc;
class MagFAthenaValidation:public Algorithm {
public:
MagFAthenaValidation(const std::string& name, ISvcLocator* pSvcLocator);
public:
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
private:
// Dumpy01
int DoneDumpy01 ;
void Dumpy01();
//Data
// Pointer On MagFieldAthenaSvc
ServiceHandle<IMagFieldAthenaSvc> p_MagFieldAthenaSvc;
int m_ca ;
int m_nx ;
int m_ny ;
int m_nz ;
int m_nr ;
int m_nphi ;
int m_nstx ;
int m_nsty ;
int m_nstz ;
int m_nstr ;
double m_xmax ;
double m_xmin ;
double m_ymax ;
double m_ymin ;
double m_zmax ;
double m_zmin ;
double m_rmax ;
double m_rmin ;
double m_phimax;
double m_phimin;
};
#endif
#
for TheFile in $* ; do
echo "-------->Comparing" $TheFile
if test ! -f $TheFile ; then
echo " Problem! Not existing file " $TheFile
else
TheFileReference="../Testing/Reference_${TheFile}"
# echo $TheFileReference
if test ! -f $TheFileReference ; then
echo " Problem! Not existing file " $TheFileReference
else
diff $TheFile $TheFileReference > TheDiff
var=`ls -al TheDiff | awk '{print $5}'`
# echo $var
if test ! "${var}" = 0 ; then
echo " Problem! Files differ "
cat TheDiff
else
echo " Ok"
fi
/bin/rm -f TheDiff
fi
fi
done
#
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
*Running script_post_check.sh
-------->Comparing Out.Test01
Ok
-------->Comparing Out.Test02
Ok
-------->Comparing Out.Test03
Ok
#
echo "Starting script_post_check.sh"
#
cd $BFIELDATHTESTROOT/run
#
#Cleaning
/bin/rm -f result_check
echo "*Running script_post_check.sh " > result_check
#
#Comparing
source ../Testing/CompareFiles.sh Out.Test01 Out.Test02 Out.Test03 >> result_check
#
#Testing
diff result_check ../Testing/Reference_result_check
#
echo "Starting script_pre_check.sh"
#
cd $BFIELDATHTESTROOT/run
#
#Cleaning
/bin/rm -f Out.Test01
/bin/rm -f Out.Test02
/bin/rm -f Out.Test03
/bin/rm -f BFieldAthTesting.log
#
#Set All
source $BFIELDATHTESTROOT/share/BFieldAthTestSetAll.sh
cd $BFIELDATHTESTROOT/run
#
package BFieldAthTest
author Marc Virchaux <virchaux@hep.saclay.cea.fr>
#
public
use AtlasPolicy AtlasPolicy-*
use TestPolicy TestPolicy-*
use GaudiInterface GaudiInterface-01-* External
use EventInfo EventInfo-00-* Event
use AthenaKernel AthenaKernel-* Control
#
macro_append includes " -I$(BFIELDATHROOT)/src"
####use BFieldAthTest BFieldAthTest-01-* MagneticField
use BFieldAth BFieldAth-01-* MagneticField
use BFieldCore BFieldCore-01-* MagneticField
# Install run-time files
apply_pattern install_runtime
# Install (symlink) applications
apply_pattern install_applications
apply_pattern athenarun_test name="BFieldAthTesting" pre_script="../Testing/script_pre_check.sh" options="jobOptions.txt" post_script="../Testing/script_post_check.sh"
apply_pattern declare_joboptions files="*.txt *.py"
#
private
macro_remove use_linkopts "$(BFieldAthTest_linkopts)"
#
public
apply_pattern installed_library
apply_pattern component_library
library BFieldAthTest \
-s=../src *.cxx
#
echo "Starting BFieldAthTestSetAll.sh"
#
#
#B field
ln -fs /afs/cern.ch/atlas/offline/data/BmagAtlas02.data fieldmap.dat
#
#Take joboptions files
cp $BFIELDATHTESTROOT/share/BFieldAthTest_jobOptions.txt jobOptions.txt
#
#Stagein one tape
stagein -h atlas003d -M /castor/cern.ch/atlas/tape/Y01628/Y01628.1.al -p atlas_stage mu100Pt
ln -fs mu100Pt ZEBRA.P
#stagein -h atlas003d -M /castor/cern.ch/atlas/project/dc1/simul/data/001103/dc1.001103.simul.0001.test.mu_minus_20.zebra -p atlas_stage mu20Pt
#ln -fs mu20Pt ZEBRA.P
#
#--------------------------------------------------------------
# BFieldAth
#--------------------------------------------------------------
include( "BFieldAth/BFieldAth_jobOptions.py" )
#-----------------------------------------------------------------
# Steering Parameters for BFieldAthTest
#-----------------------------------------------------------------
from AthenaCommon.AlgSequence import AlgSequence
topSequence=AlgSequence()
from BFieldAthTest.BFieldAthTestConf import MagFAthenaTest
topSequence += MagFAthenaTest( "MagFAthenaTestMaster" )
# --- GeoModel
from AtlasGeoModel import SetGeometryVersion
from AtlasGeoModel import GeoModelInit
theApp.EvtMax =10
#-----------------------------------------------------------------
theMagFAthenaTestMaster = topSequence.MagFAthenaTestMaster
theMagFAthenaTestMaster.MenbersName += [ "MagFTest01" ]
theMagFAthenaTestMaster.MenbersType += [ "MagFAthenaTest01" ]
from BFieldAthTest.BFieldAthTestConf import MagFAthenaTest01
theMagFAthenaTestMaster += MagFAthenaTest01("MagFTest01")
#-----------------------------------------------------------------
from BFieldAthTest.BFieldAthTestConf import MagFAthenaTest01
theMagFTest01 = MagFAthenaTest01("MagFTest01")
theMagFTest01.ca = 9 ;
theMagFTest01.nx = 2 ;
theMagFTest01.ny = 150 ;
theMagFTest01.nz = 230 ;
theMagFTest01.nr = 1500 ;
theMagFTest01.nphi = 23 ;
theMagFTest01.nstx = 1 ;
theMagFTest01.nsty = 10 ;
theMagFTest01.nstz = 10 ;
theMagFTest01.nstr = 0 ;
theMagFTest01.xmax = 0 ;
theMagFTest01.xmin = 0 ;
theMagFTest01.ymax = 1500 ;
theMagFTest01.ymin = 0 ;
theMagFTest01.zmax = 10 ;
theMagFTest01.zmin = 10 ;
theMagFTest01.rmax = 1500 ;
theMagFTest01.rmin = 0 ;
theMagFTest01.phimax= 23 ;
theMagFTest01.phimin= 0.5 ;
//##############################################################
//
// Job options file (RENAME jobOptions.txt to use)
//
//==============================================================
//--------------------------------------------------------------
// Input
//--------------------------------------------------------------
// to read Zebra TDR data
#include "AthenaCommon/Atlas_ZebraTDR.UnixStandardJob.txt"
//
// specify input file
//
ApplicationMgr.EvtSel = "FILE ZEBRA.P";
#
// to read in Objy (need to do once: source RecExCommon_Objy_setup.sh )
// uncomment the following line and comment out #include "Atlas_ZebraTDR.UnixStandardJob.txt"
//#include "$ATHENACOMMONROOT/share/Atlas_ObjyTDR.UnixStandardJob.txt"
#PERSO "
// tape number
// dummy if not reading Objy (SHOULD NOT BE NECESSARY IN THE FUTURE ANY MORE)
// Z->bbar
//EventSelector.dataSetNames = {"Y23406.1"} ;
// H->eemumu
//EventSelector.dataSetNames = {"Y01606.1"} ;
// Y23420 13 : single muon 20 GeV
EventSelector.dataSetNames = {"Y01628.1"} ;
//--------------------------------------------------------------
// BFieldAth
//--------------------------------------------------------------
#include "BFieldAth/BFieldAth_jobOptions.txt"
//--------------------------------------------------------------
// Get only relevant digits from Event
//--------------------------------------------------------------
EventSelector.calos = false;
EventSelector.muons = false;
EventSelector.trt = false;
EventSelector.sct = false;
EventSelector.pixel = false;
//--------------------------------------------------------------
// Set output level threshold
//--------------------------------------------------------------
//(0=NIL 1=VERBOSE, 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
MessageSvc.OutputLevel = 2;
//--------------------------------------------------------------
// Number of events to be processed
//--------------------------------------------------------------
ApplicationMgr.EvtMax = 1;
//--------------------------------------------------------------
// Histogram output file
//--------------------------------------------------------------
// Ntuple output (hbook only)
ApplicationMgr.DLLs += { "HbookCnv" };
NTupleSvc.Output = { "FILE1 DATAFILE='ntuple.hbook' OPT='NEW'" };
ApplicationMgr.HistogramPersistency = "HBOOK";
// Root Ntuple output (uncomment these lines, comment the two previous lines)
//ApplicationMgr.DLLs += { "RootHistCnv" };
//ApplicationMgr.HistogramPersistency = "ROOT";
//NTupleSvc.Output = { "FILE1 DATAFILE='ntuple.root' OPT='NEW'" };
// Specify the appropriate output file type
HistogramPersistencySvc.OutputFile = "histo.hbook";
//--------------------------------------------------------------
// BFieldAthTest
//--------------------------------------------------------------
//load relevant libraries
ApplicationMgr.DLLs += { "BFieldAthTest"};
//top algorithms to be run
ApplicationMgr.TopAlg += {"MagFAthenaTest" };
//==============================================================
//
// End of job options file
//
//##############################################################
#
echo "Starting doBFieldAthTestAll.sh"
#
cd $BFIELDATHTESTROOT/run
#
#Cleaning
/bin/rm -f Out.Test01
/bin/rm -f Out.Test02
/bin/rm -f Out.Test03
/bin/rm -f athena.log
#
#Set All
source $BFIELDATHTESTROOT/share/BFieldAthTestSetAll.sh
cd $BFIELDATHTESTROOT/run
#
#Run
../$CMTCONFIG/athena.exe jobOptions.txt > athena.log
#
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "BFieldAthTest/MagFAthenaTest.h"
#include "BFieldAthTest/MagFAthenaTest01.h"
#include "BFieldAthTest/MagFAthenaTest02.h"
#include "BFieldAthTest/MagFAthenaValidation.h"
#include "GaudiKernel/DeclareFactoryEntries.h"
DECLARE_ALGORITHM_FACTORY( MagFAthenaTest )
DECLARE_ALGORITHM_FACTORY( MagFAthenaTest01 )
DECLARE_ALGORITHM_FACTORY( MagFAthenaTest02 )
DECLARE_ALGORITHM_FACTORY( MagFAthenaValidation )
DECLARE_FACTORY_ENTRIES( BFieldAthTest ) {
DECLARE_ALGORITHM( MagFAthenaTest );
DECLARE_ALGORITHM( MagFAthenaTest01 );
DECLARE_ALGORITHM( MagFAthenaTest02 );
DECLARE_ALGORITHM( MagFAthenaValidation );
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "GaudiKernel/LoadFactoryEntries.h"
LOAD_FACTORY_ENTRIES( BFieldAthTest )
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//
// Author : Saclay Muon Software Group SaMuSoG
// Date : 15/06/00
//
// The MagFAthenaTest class
// is an Algorithm class to test MagFieldAthenaSvc
//
#include "BFieldAth/IMagFieldAthenaSvc.h"
#include "BFieldAthTest/MagFAthenaTest.h"
#include "BFieldAthTest/MagFAthenaTest03.h"
MagFAthenaTest::MagFAthenaTest(const std::string& name, ISvcLocator* pSvcLocator):
Algorithm(name, pSvcLocator),
p_MagFieldAthenaSvc("MagFieldAthenaSvc", name)
{
//Sub Algs
declareProperty("MenbersName",m_MenbersName);
declareProperty("MenbersType",m_MenbersType);
declareProperty("MagFieldSvc", p_MagFieldAthenaSvc, "Magnet Field used by this algorithm") ;
}
MagFAthenaTest::~MagFAthenaTest(){}
StatusCode MagFAthenaTest::initialize()
{
StatusCode sc ;
MsgStream mlog(messageService(), name());
mlog << MSG::INFO << "================================" << endreq;
mlog << MSG::INFO << "=Proprieties are " << endreq;
mlog << MSG::INFO << "= Menbers: " << endreq;
for (unsigned int iAlgo=0; iAlgo<m_MenbersName.size() ; iAlgo++){
mlog << MSG::INFO << " of Type=" << m_MenbersType[iAlgo] << " of Name=" << m_MenbersName[iAlgo]
<< endreq;
}
mlog << MSG::INFO << "================================" << endreq;
//Set pointer on MagFieldAthenaSvc
if (p_MagFieldAthenaSvc.retrieve().isFailure()){
mlog << MSG::WARNING << "Could not find MagFieldAthenaSvc" << endreq;
return( StatusCode::FAILURE );
}
// Setup callback to be notified when magnetic field is ready
// if (StatusCode::SUCCESS==p_MagFieldAthenaSvc->regFcn(
// &MagFAthenaTest::callback,this)) {
// mlog << MSG::INFO << "Booked callback for " << name() << endreq;
// } else {
// mlog << MSG::ERROR << "Could not book callback for " << name () << endreq;
// return StatusCode::FAILURE;
// }
//Access Basic Muon Svc - now via callback
// SetAccessBasicSvc();
for (unsigned int iAlgo=0; iAlgo<m_MenbersName.size() ; iAlgo++){
Algorithm* AlgoPointer;
sc = createSubAlgorithm(m_MenbersType[iAlgo],m_MenbersName[iAlgo] ,AlgoPointer);
if (sc.isFailure()){
mlog << MSG::FATAL << "Unable to create SubAlgorithm"
<< " of Type=" << m_MenbersType[iAlgo] << " of Name=" << m_MenbersName[iAlgo]
<< endreq;
return StatusCode::FAILURE;
}
m_ListOfMenbers.push_back(AlgoPointer);
}
mlog << MSG::INFO << "Initialisation ended " << endreq;
return StatusCode::SUCCESS;
}
StatusCode MagFAthenaTest::finalize(){return StatusCode::SUCCESS;}
StatusCode MagFAthenaTest::execute()
{
MsgStream mlog( messageService(), name() );
StatusCode sc;
//Access Basic Muon Svc
// this is now done from the callback function
// SetAccessBasicSvc();
//Loop on SubAlgs
const std::size_t NberOfAlgo = m_ListOfMenbers.size();
for ( std::size_t iAlgo=0; iAlgo<NberOfAlgo; iAlgo++ ) {
sc = m_ListOfMenbers[iAlgo]->sysExecute();
if (sc.isFailure()){
mlog << MSG::FATAL << "execute () of SubAlgo "
<< " of Type=" << m_MenbersType[iAlgo] << " of Name=" << m_MenbersName[iAlgo]
<< " failed "
<< endreq;
return StatusCode::FAILURE;
}
}
return StatusCode::SUCCESS;
}
// Set Access to Basic Muon Svc
// void MagFAthenaTest::SetAccessBasicSvc(){
// //*Access MagFieldAthena
// MagFieldAthena* pMagFieldAthena=p_MagFieldAthenaSvc->GetMagFieldAthena();
// MagFieldAccess::SetAbstractMagneticField(pMagFieldAthena);
//}
// StatusCode MagFAthenaTest::callback( IOVSVC_CALLBACK_ARGS ) {
// MsgStream mlog( messageService(), name() );
// mlog << MSG::INFO << "MagFAthenaTest callback was called!" << endreq;
// // get the field pointer and do setup
// MagFieldAthena* pMagFieldAthena=
// p_MagFieldAthenaSvc->GetUpdatedMagFieldAthena();
// MagFieldAccess::SetAbstractMagneticField(pMagFieldAthena);
// return StatusCode::SUCCESS;
// }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment