diff --git a/Alignment/MillePedeAlignmentAlgorithm/test/BuildFile.xml b/Alignment/MillePedeAlignmentAlgorithm/test/BuildFile.xml index 9a1f8a9757530..353c95e25fce0 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/test/BuildFile.xml +++ b/Alignment/MillePedeAlignmentAlgorithm/test/BuildFile.xml @@ -10,7 +10,12 @@ - - + + + + + + + diff --git a/Alignment/MillePedeAlignmentAlgorithm/test/ZMuMuMassConstraintParameterFinder/printParameters.C b/Alignment/MillePedeAlignmentAlgorithm/test/ZMuMuMassConstraintParameterFinder/printParameters.C index 3c95b40703ea9..c51468c2fcce2 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/test/ZMuMuMassConstraintParameterFinder/printParameters.C +++ b/Alignment/MillePedeAlignmentAlgorithm/test/ZMuMuMassConstraintParameterFinder/printParameters.C @@ -1,4 +1,23 @@ +#include +#include +#include +#include +#include + +bool isValidFile(const TString& fileName) { + TFile* file = TFile::Open(fileName, "read"); + if (!file || file->IsZombie()) { + std::cout << "Error: Invalid file or file is a zombie.\n"; + return false; + } + return true; +} + void printParameters(const TString& fileName) { + if (!isValidFile(fileName)) { + exit(EXIT_FAILURE); + } + TFile* file = TFile::Open(fileName, "read"); TTree* tree = static_cast(file->Get("zMuMuMassConstraintParameterFinder/di_muon_from_Z")); tree->Draw("di_muon_mass>>htemp", "in_mass_window"); @@ -10,4 +29,6 @@ void printParameters(const TString& fileName) { std::cout << " PrimaryMass = " << htemp->GetMean() << "\n"; std::cout << " PrimaryWidth = " << htemp->GetRMS() << "\n"; std::cout << "========================================\n"; + + exit(EXIT_SUCCESS); } diff --git a/Alignment/MillePedeAlignmentAlgorithm/test/testFindMassContraintParameters.cpp b/Alignment/MillePedeAlignmentAlgorithm/test/testFindMassContraintParameters.cpp new file mode 100644 index 0000000000000..97bb663a05352 --- /dev/null +++ b/Alignment/MillePedeAlignmentAlgorithm/test/testFindMassContraintParameters.cpp @@ -0,0 +1,5 @@ +#include +#include +#include "Alignment/MillePedeAlignmentAlgorithm/test/ZMuMuMassConstraintParameterFinder/printParameters.C" + +int main(int argc, char** argv) { printParameters("output.root"); } diff --git a/Alignment/MillePedeAlignmentAlgorithm/test/test_ZMuMuMassConstraintParameterFinder.sh b/Alignment/MillePedeAlignmentAlgorithm/test/test_ZMuMuMassConstraintParameterFinder.sh new file mode 100755 index 0000000000000..a46fcb76272db --- /dev/null +++ b/Alignment/MillePedeAlignmentAlgorithm/test/test_ZMuMuMassConstraintParameterFinder.sh @@ -0,0 +1,4 @@ +#!/bin/bash +function die { echo $1: status $2; exit $2; } + +(cmsRun ${SCRAM_TEST_PATH}/ZMuMuMassConstraintParameterFinder/zmumudistribution_cfg.py inputFiles=/store/relval/CMSSW_14_0_0_pre2/RelValZMM_14/GEN-SIM/133X_mcRun3_2024_realistic_v5_STD_2024_PU-v1/2590000/c38cee3f-99d7-48aa-b236-86f6bbc869b3.root,/store/relval/CMSSW_14_0_0_pre2/RelValZMM_14/GEN-SIM/133X_mcRun3_2024_realistic_v5_STD_2024_PU-v1/2590000/5bf98cca-d491-4e95-98b0-d3acb6ea0807.root,/store/relval/CMSSW_14_0_0_pre2/RelValZMM_14/GEN-SIM/133X_mcRun3_2024_realistic_v5_STD_2024_PU-v1/2590000/1e362cc1-235b-4c32-bb24-178ccac4659f.root) || die 'failed running ZMuMuMassConstraintParameterFinder' $?