.so
). These shared library object files will be loaded dynamically when really needed during the compilation of the actual executable. Consequently the compilation of a new cmsRun executable consists of two parts:
.h
) files that were added in the implementation of the source code.
.so
). In this step all .so
files needed for the compilation of the executable are searched and linked.
.so
files. When ever you added a .h
file in your source code to declare a function you did not implement yourself the probability is high that you will also have to make the implementation of this function known to the complier by pointing to the corresponding .so
file. We list a few parsing and linker errors below:
... >> Entering Package PhysicsTools/PatExamples >> Compiling /afs/cern.ch/user/r/rwolf/scratch0/CMSSW_3_8_X_2010-09-12-1300/src/CMS.PhysicsTools/PatExamples/plugins/PatBasicAnalyzer.cc /afs/cern.ch/user/r/rwolf/scratch0/CMSSW_3_8_X_2010-09-12-1300/src/CMS.PhysicsTools/PatExamples/plugins/PatBasicAnalyzer.cc: In member function 'virtual void PatBasicAnalyzer::analyze(const edm::Event&, const edm::EventSetup&)': /afs/cern.ch/user/r/rwolf/scratch0/CMSSW_3_8_X_2010-09-12-1300/src/CMS.PhysicsTools/PatExamples/plugins/PatBasicAnalyzer.cc:107: error: expected `;' before 'histContainer_' ...
histContainer_["jets"]->Fill(nJets);
... >> Compiling /afs/cern.ch/user/r/rwolf/scratch0/CMSSW_3_8_X_2010-09-12-1300/src/CMS.PhysicsTools/PatExamples/plugins/PatBasicAnalyzer.cc /afs/cern.ch/user/r/rwolf/scratch0/CMSSW_3_8_X_2010-09-12-1300/src/CMS.PhysicsTools/PatExamples/plugins/PatBasicAnalyzer.cc: In member function 'virtual void PatBasicAnalyzer::analyze(const edm::Event&, const edm::EventSetup&)': /afs/cern.ch/user/r/rwolf/scratch0/CMSSW_3_8_X_2010-09-12-1300/src/CMS.PhysicsTools/PatExamples/plugins/PatBasicAnalyzer.cc:116: error: a function-definition is not allowed here before '{' token /afs/cern.ch/user/r/rwolf/scratch0/CMSSW_3_8_X_2010-09-12-1300/src/CMS.PhysicsTools/PatExamples/plugins/PatBasicAnalyzer.cc:133: error: a function-definition is not allowed here before '{' token ... afs/cern.ch/cms/slc5_ia32_gcc434/external/gcc/4.3.4/bin/../lib/gcc/i686-pc-linux-gnu/4.3.4/../../../../include/c++/4.3.4/bits/locale_facets_nonio.h:46: error: expected `;' before '__attribute__' /afs/cern.ch/user/r/rwolf/scratch0/CMSSW_3_8_X_2010-09-12-1300/src/CMS.PhysicsTools/PatExamples/plugins/PatBasicAnalyzer.cc:137: error: expected `}' at end of input gmake: *** [tmp/slc5_ia32_gcc434/src/PhysicsTools/PatExamples/plugins/PhysicsToolsPatExamples_plugins/PatBasicAnalyzer.o] Error 1 ...
.h
file for the declaration of pat::Muons from the PatBasicAnalyzer.cc in the PatExamples package:
... >> Entering Package PhysicsTools/PatExamples >> Compiling /afs/cern.ch/user/r/rwolf/scratch0/CMSSW_3_8_X_2010-09-12-1300/src/CMS.PhysicsTools/PatExamples/plugins/PatBasicAnalyzer.cc /afs/cern.ch/user/r/rwolf/scratch0/CMSSW_3_8_X_2010-09-12-1300/src/CMS.PhysicsTools/PatExamples/plugins/PatBasicAnalyzer.cc: In member function 'virtual void PatBasicAnalyzer::analyze(const edm::Event&, const edm::EventSetup&)': /afs/cern.ch/user/r/rwolf/scratch0/CMSSW_3_8_X_2010-09-12-1300/src/CMS.PhysicsTools/PatExamples/plugins/PatBasicAnalyzer.cc:75: error: 'Muon' is not a member of 'pat' ...
.h
file.
.h
file that contains the declaration of the object you defined in your source code.
.h
file again:
#include "DataFormats/PatCandidates/interface/Muon.h"
.so
files needed to compile the executable are defined in the CMS.BuildFile of your package or corresponding subdirectories. The complete name of each corresponding .so
file inherits from the name of the package and the subsystem the referred function is declared and implemented in. If you add the corresponding .so
file of this package the error should be gone.
Some plugins in the PatExamples package make use of function that have been defined in the PatExamples package itself. For the error given below we commented the .so
file of the PatExamples package from the CMS.BuildFile located in the plugins directory of the PatExamples package:
... tmp/slc5_ia32_gcc434/src/PhysicsTools/PatExamples/plugins/PhysicsToolsPatExamples_plugins/libPhysicsToolsPatExamples_plugins.so: undefined reference to `PatBTagCommonHistos::~PatBTagCommonHistos()' tmp/slc5_ia32_gcc434/src/PhysicsTools/PatExamples/plugins/PhysicsToolsPatExamples_plugins/libPhysicsToolsPatExamples_plugins.so: undefined reference to `PatBTagCommonHistos::Set(std::basic_string<char>, std::allocator >)' tmp/slc5_ia32_gcc434/src/PhysicsTools/PatExamples/plugins/PhysicsToolsPatExamples_plugins/libPhysicsToolsPatExamples_plugins.so: undefined reference to `PatBTagCommonHistos::PatBTagCommonHistos(edm::ParameterSet const&)' tmp/slc5_ia32_gcc434/src/PhysicsTools/PatExamples/plugins/PhysicsToolsPatExamples_plugins/libPhysicsToolsPatExamples_plugins.so: undefined reference to `PatBTagCommonHistos::Fill(boost::indirect_iterator<__gnu_cxx::__normal_iterator<pat::Jet const* const*, std::vector<pat::Jet const*, std::allocator<pat::Jet const*> > >, boost::use_default, boost::use_default, boost::use_default, boost::use_default>&, std::basic_string<char>, std::allocator >)' tmp/slc5_ia32_gcc434/src/PhysicsTools/PatExamples/plugins/PhysicsToolsPatExamples_plugins/libPhysicsToolsPatExamples_plugins.so: undefined reference to `PatBTagCommonHistos::Sumw2()' collect2: ld returned 1 exit status gmake: *** [tmp/slc5_ia32_gcc434/src/PhysicsTools/PatExamples/plugins/PhysicsToolsPatExamples_plugins/libPhysicsToolsPatExamples_plugins.so] Error 1 ...
.h
file where the declaration of the function can be found. You forgot to make the .so
file known to the compiler in which the implementation (located in the .cc
file in the corresponding package) is defined.
.so
file in the CMS.BuildFile of your package. A safe way is to check for all packages that you used in your source code to declare your objects from the start on.
.so
file again:
<use name="CMS.PhysicsTools/PatExamples"/>
python PhysticsTools/PatExamples/test/patTuple_standard_cfg.pyA set of typical python errors is given below:
Traceback (most recent call last): File "CMS.PhysicsTools/PatExamples/test/analyzeTopSelection_cfg.py", line 137, in process.step7 * AttributeError: 'Process' object has no attribute 'step7'
process.step7 = countPatJets.clone(src = 'goodJets' , minNumber = 4)
Traceback (most recent call last): File "CMS.PhysicsTools/PatExamples/test/analyzeTopSelection_cfg.py", line 35, in process.load("CMS.PhysicsTools.PatExamples.topObjectSelection") File "/afs/naf.desy.de/group/cms/sw/slc5_ia32_gcc434/cms/cmssw/CMSSW_3_8_2/python/FWCore/ParameterSet/Config.py", line 409, in load module = __import__(moduleName) ImportError: No module named topObjectSelection
import
or load
statement that does not exist.
import
or load
that does not exist, or you introduced a typo in the file name or path.
process.load("CMS.PhysicsTools.PatExamples.topObjectSelection:cff")
Traceback (most recent call last): File "CMS.PhysicsTools/PatExamples/test/analyzeTopSelection_cfg.py", line 67, in process.step7 = countPatJets.clone(src2 = 'goodJets' , minNumber = 4) File "/afs/naf.desy.de/group/cms/sw/slc5_ia32_gcc434/cms/cmssw/CMSSW_3_8_2/python/FWCore/ParameterSet/Mixins.py", line 297, in clone self._Parameterizable__raiseBadSetAttr(key) File "/afs/naf.desy.de/group/cms/sw/slc5_ia32_gcc434/cms/cmssw/CMSSW_3_8_2/python/FWCore/ParameterSet/Mixins.py", line 221, in __raiseBadSetAttr raise TypeError(name+" does not already exist, so it can only be set to a CMS python configuration type") TypeError: src2 does not already exist, so it can only be set to a CMS python configuration type
process.step7 = countPatJets.clone(src = 'goodJets' , minNumber = 4)
... Problem with configuration file analyser_cfg.py ---- Configuration BEGIN python encountered the error: more than 255 arguments (analyser_cfg.py, line 11) ---- Configuration END ...
%MSG-s CMSException: AfterFile 15-Sep-2010 13:06:41 CEST pre-events cms::Exception caught in cmsRun ---- FileOpenError BEGIN ---- StorageFactory::open() BEGIN Failed to open the file 'wjets/patTuple_0_wjets10_madAODs.root' because: ---- File::sysopen() BEGIN open() failed with system error 'No such file or directory' (error code 2) ---- File::sysopen() END ---- StorageFactory::open() END
RootInputFileSequence::initFile(): Input file file:wjets/patTuple_0_wjets10_madAODs.root was not found or could not be opened.
Error occurred while creating source PoolSource ---- FileOpenError END %MSG
file:
to specify that the given file is to be specified locally.
process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring( 'file:wjets/patTuple_0_wjets10_madAOD.root' ) )
%MSG-s CMSException: AfterModConstruction 15-Sep-2010 13:30:37 CEST pre-events cms::Exception caught in cmsRun ---- PluginNotFound BEGIN Unable to find plugin 'PatTopSelectionAnalyser'. Please check spelling of name. ---- PluginNotFound END %MSG
grep -r PatTopSelectionAnalyser PhysicsTools/PatExamples CMS.PhysicsTools/PatExamples/python/PatTopSelectionAnalyzer_cfi.py:analyzePatTopSelection = cms.EDAnalyzer("PatTopSelectionAnalyser", Binary file PhysicsTools/PatExamples/python/PatTopSelectionAnalyzer_cfi.pyc matches edmPluginDump | grep PatTopSelectionAnalyser emacs PhysicsTools/PatExamples/plugins/PatTopSelectionAnalyzer.cc
cms::Exception caught in cmsRun ---- EventProcessorFailure BEGIN EventProcessingStopped ---- ScheduleExecutionFailure BEGIN ProcessingStopped ---- NoRecord BEGIN No "JetCorrectionsRecord" record found in the EventSetup. Please add an ESSource or ESProducer that delivers such a record.
## load jet corrections process.load("JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff") process.prefer("ak5CaloL2L3")The exact choice of the correction service might depend on the jet collections you are going to use. Please have a look to SWGuideJetMet, or contact the corresponding experts for more details.
cms::Exception caught in cmsRun ---- EventProcessorFailure BEGIN EventProcessingStopped ---- ScheduleExecutionFailure BEGIN ProcessingStopped ---- ProductNotFound BEGIN getByLabel: Found zero products matching all criteria Looking for sequence of type: reco::Candidate Looking for module label: goodJet Looking for productInstanceName: cms::Exception going through module PATCandViewCountFilter/step6a run: 1 lumi: 2 event: 1369557 If you wish to continue processing events after a ProductNotFound exception, add "SkipEvent = cms.untracked.vstring('ProductNotFound')" to the "options" PSet in the configuration. ---- ProductNotFound END Exception going through path looseEventSelection ---- ScheduleExecutionFailure END an exception occurred during current event processing cms::Exception caught in CMS.EventProcessor and rethrown ---- EventProcessorFailure END
[rwolf@tcx061]~/scratch/CMSSW_3_8_2/src% edmDumpEventContent top/patTuple_top_madgraph.root_ttbar10_madAOD.root edm::TriggerResults "TriggerResults" "" "HLT8E29." edm::TriggerResults "TriggerResults" "" "HLT." edm::TriggerResults "TriggerResults" "" "REDIGI." edm::TriggerResults "TriggerResults" "" "RECO." vector "offlinePrimaryVertices" "" "RECO." edm::OwnVector > "selectedPatJets" "tagInfos" "PAT." edm::TriggerResults "TriggerResults" "" "PAT." vector "selectedPatJets" "caloTowers" "PAT." vector "selectedPatElectrons" "" "PAT." vector "selectedPatJets" "" "PAT." vector "patMETs" "" "PAT." vector "selectedPatMuons" "" "PAT." vector "selectedPatJets" "genJets" "PAT." vector "selectedPatJets" "pfCandidates" "PAT."Alternatively you can define the EventContentAnalyzer module and place it at an arbitrary position in front of the module which causes you trouble:
## check the event content process.content = cms.EDAnalyzer("EventContentAnalyzer") process.p = cms.Path( ... process.content * ... )
%MSG-s CMSException: AfterFile 02-Jun-2010 14:31:43 CEST PostEndRun cms::Exception caught in cmsRun ---- EventProcessorFailure BEGIN EventProcessingStopped ---- ScheduleExecutionFailure BEGIN ProcessingStopped ---- InvalidReference BEGIN BadRefCore Attempt to dereference a RefCore containing an invalid ProductID has been detected. Please modify the calling code to test validity before dereferencing. cms::Exception going through module PatMCMatching/analyzePatMCMatching run: 1 lumi: 666672 event: 305 ---- InvalidReference END Exception going through path p ---- ScheduleExecutionFailure END an exception occurred during current event processing cms::Exception caught in CMS.EventProcessor and rethrown ---- EventProcessorFailure END
if(!muon.innerTrack().isNull()){ //now go on if the innerTrack pointer really corresponds to a valid object... }Unfortunately the information you wanted to have is most probably lost from the input file you are using. Due to the 'hidden' reference structure of the hogh analysis objects it is non trivial to reduce the file size of an AOD/RECO input file without loosing analysis relevant information. The Physics Analysis Toolkit (PAT) tries to assist you on this quest. Have a look at SWGuidePATEmbeddingExercise to learn more about this.
Reviewer/Editor and Date (copy from screen) | Comments |
---|---|
JohnStupak - 16-September-2013 | Review |
RogerWolf - 15 Sept 2010 | Complete overhaul |