567 if (
config_.exists(
"TestMode") )
570 if (
config_.exists(
"UseFullName") )
574 edm::Service<TFileService> fs;
576 TFileDirectory eventsDir = fs -> mkdir(
"Events");
579 std::string fullname;
588 btagAlgos_.push_back(
"pfCombinedInclusiveSecondaryVertexV2BJetTags");
590 if (
config_.exists(
"BTagAlgorithmsAlias") )
595 if (
config_.exists(
"BTagAlgorithms") )
609 for (
size_t it = 0 ; it < btagAlgos_.size() ; ++it )
616 std::vector<std::string > jec_files;
622 if(
config_.exists(
"JECUncertaintyFiles"))
624 jec_files =
config_.getParameter< std::vector<std::string > >(
"JECUncertaintyFiles");
628 std::vector<std::string > jer_files;
629 std::vector<std::string > jersf_files;
635 if(
config_.exists(
"JERResFiles"))
637 jer_files =
config_.getParameter< std::vector<std::string > >(
"JERResFiles");
639 if(
config_.exists(
"JERSfFiles"))
641 jersf_files =
config_.getParameter< std::vector<std::string > >(
"JERSfFiles");
652 std::cout <<
"*** ERROR *** Ntuplizer: Number of JEC Records less than the number of PatJet collections." << std::endl;;
657 std::cout <<
"*** ERROR *** Ntuplizer: Number of JER Records less than the number of PatJet collections." << std::endl;;
660 if (
jerRecords_.size() != 0 && jer_files.size() != 0 && jersf_files.size()!=0 &&(
jerRecords_.size() != jer_files.size() ||
jerRecords_.size() != jersf_files.size()) )
662 std::cerr <<
"*** ERROR *** Ntuplizer: Number of JER Records are not the same as number of provided input files. " <<std::endl;
669 if (
config_.exists(
"FixedGridRhoAll") )
671 eventinfo_ -> FixedGridRhoInfo(
config_.getParameter<edm::InputTag>(
"FixedGridRhoAll"));
678 eventinfo_ -> LumiScalersInfo(
config_.getParameter<edm::InputTag>(
"LumiScalers"));
685 if (
config_.exists(
"CrossSection") )
688 edm::InputTag trgRes;
696 bool splitTriggerObject =
config_.exists(
"TriggerObjectSplits");
704 splitTriggerObject = !triggerObjectSplitsTypes_.empty();
710 std::cout <<
"-w- Ntuplizer: Size of trigger splits and splits types do not match!" << std::endl;
711 std::cout <<
" No splitting will be done" << std::endl;
712 splitTriggerObject =
false;
728 int patJetCounter = 0;
729 for (
auto & collection : collections )
732 std::string label = collection.label();
733 std::string inst = collection.instance();
734 std::string proc = collection.process();
736 if ( find_first(inputTags,
"L1Extra") )
739 std::string l1obj = inputTags;
740 erase_first(l1obj,
"L1Extra");
743 fullname = name +
"_" + inst +
"_" + proc;
744 name += inputTags ==
"L1ExtraJets" && !
use_full_name_ ?
"_" + inst :
"";
745 if ( collection.instance() !=
"" && collections.size() > 1 )
752 if ( inputTags !=
"TriggerObjectStandAlone" && inputTags !=
"TriggerEvent" )
753 tree_[
name] = eventsDir.make<TTree>(name.c_str(),fullname.c_str());
756 if ( inputTags ==
"L1ExtraJets" )
763 if ( inputTags ==
"L1ExtraMuons" )
770 if ( inputTags ==
"CaloJets" )
776 if ( inputTags ==
"PFJets" )
782 if ( inputTags ==
"RecoMuons" )
788 if ( inputTags ==
"RecoTracks" )
795 if ( inputTags ==
"PatJets" )
802 if ( patJetCounter == 0 &&
jecRecords_.size() > 0 ) std::cout <<
"*** Jet Energy Corrections Records - PatJets ***" << std::endl;
805 if ( jec_files.size() > 0 && jec_files[patJetCounter] !=
"" )
812 if ( patJetCounter == 0 &&
jerRecords_.size() > 0 ) std::cout <<
"*** Jet Energy Resolutions Records - PatJets ***" << std::endl;
815 if ( jer_files.size() > 0 && jer_files[patJetCounter] !=
"" )
841 if ( inputTags ==
"PatMETs" )
847 if ( inputTags ==
"PatMuons" )
853 if ( inputTags ==
"GenJets" )
859 if ( inputTags ==
"GenParticles" )
865 if ( inputTags ==
"JetsTags" )
872 if ( inputTags ==
"L1TJets" )
881 std::cout <<
"Ntuplizer: # l1 jet collections > 1. Skipping." << std::endl;
886 if ( inputTags ==
"L1TMuons" )
895 std::cout <<
"Ntuplizer: # l1 muon collections > 1. Skipping." << std::endl;
899 if ( inputTags ==
"ChargedCandidates" )
912 std::string dir =
name;
913 TFileDirectory triggerObjectsDir = eventsDir.mkdir(dir);
917 name = triggerObjectLabel;
919 tree_[
name] = triggerObjectsDir.make<TTree>(name.c_str(),name.c_str());
923 if ( splitTriggerObject )
925 std::vector<std::string> types;
930 boost::split(types,triggerObjectSplitsTypes_.at(tos),boost::is_any_of(
":"));
934 sort( types.begin(), types.end() );
935 types.erase( unique( types.begin(), types.end() ), types.end() );
936 for (
auto & tot : types )
938 std::string namesplit = name +
"_" + tot;
939 tree_[namesplit] = triggerObjectsDir.make<TTree>(namesplit.c_str(),namesplit.c_str());
953 if ( triggerObjectLabels_.empty() )
954 triggerObjectLabels_ =
config_.getParameter< std::vector<std::string> >(
"TriggerObjectLabels");
955 sort( triggerObjectLabels_.begin(), triggerObjectLabels_.end() );
956 triggerObjectLabels_.erase( unique( triggerObjectLabels_.begin(), triggerObjectLabels_.end() ), triggerObjectLabels_.end() );
957 std::string dir =
name;
958 TFileDirectory triggerObjectsDir = eventsDir.mkdir(dir);
960 for (
auto & triggerObjectLabel : triggerObjectLabels_ )
962 name = triggerObjectLabel;
964 tree_[
name] = triggerObjectsDir.make<TTree>(name.c_str(),name.c_str());
974 std::vector< std::string> triggerpaths;
975 triggerpaths.clear();
976 std::vector< std::string> l1seeds;
979 if (
config_.exists(
"TriggerPaths") ) triggerpaths =
config_.getParameter< std::vector< std::string> >(
"TriggerPaths");
980 if (
config_.exists(
"L1Seeds") ) l1seeds =
config_.getParameter< std::vector< std::string> >(
"L1Seeds");
1006 if ( inputTags ==
"PrimaryVertices" )
1018 int nMHatCounters = 0;
1021 edm::InputTag collection =
config_.getParameter<edm::InputTag>(inputTag);
1024 std::string label = collection.label();
1025 std::string inst = collection.instance();
1026 std::string proc = collection.process();
1028 fullname = name +
"_" + inst +
"_" + proc;
1034 metadata_ -> SetGeneratorFilter(
config_.getParameter<edm::InputTag> (
"GenFilterInfo"));
std::unique_ptr< Metadata > pMetadata
std::vector< pL1TJetCandidates > l1tjets_collections_
std::unique_ptr< EventInfo > pEventInfo
std::vector< std::string > inputTags_
analysis::ntuple::PileupInfo PileupInfo
std::vector< pTriggerObjectCandidates > triggerobjects_collections_
std::vector< std::string > triggerObjectLabels_
std::unique_ptr< L1JetCandidates > pL1JetCandidates
analysis::ntuple::Metadata Metadata
std::unique_ptr< ChargedCandidates > pChargedCandidates
std::vector< pL1JetCandidates > l1jets_collections_
analysis::ntuple::Candidates< trigger::TriggerObject > TriggerObjectRecoCandidates
std::unique_ptr< PatJetCandidates > pPatJetCandidates
analysis::ntuple::FilterResults genFilterResults_
std::vector< pL1MuonCandidates > l1muons_collections_
std::unique_ptr< PatMETCandidates > pPatMETCandidates
std::vector< pPFJetCandidates > pfjets_collections_
analysis::ntuple::JetsTags JetsTags
std::unique_ptr< GenParticleCandidates > pGenParticleCandidates
std::vector< TitleAlias > btagVars_
std::shared_ptr< HLTPrescaleProvider > hltPrescaleProvider_
std::unique_ptr< JetsTags > pJetsTags
analysis::ntuple::Candidates< l1extra::L1MuonParticle > L1MuonCandidates
std::unique_ptr< L1TJetCandidates > pL1TJetCandidates
std::vector< std::string > triggerObjectSplitsTypes_
std::vector< std::string > triggerObjectSplits_
std::vector< std::string > btagAlgos_
std::vector< pPatJetCandidates > patjets_collections_
std::vector< pPatMETCandidates > patmets_collections_
InputTags mHatEventCounters_
std::unique_ptr< TriggerObjectCandidates > pTriggerObjectCandidates
std::vector< std::string > jecRecords_
analysis::ntuple::TriggerAccepts TriggerAccepts
std::unique_ptr< RecoTrackCandidates > pRecoTrackCandidates
std::vector< std::string > jerRecords_
std::unique_ptr< RecoMuonCandidates > pRecoMuonCandidates
std::vector< std::string > btagAlgosAlias_
std::vector< pCaloJetCandidates > calojets_collections_
analysis::ntuple::Candidates< pat::Jet > PatJetCandidates
analysis::ntuple::Candidates< reco::GenParticle > GenParticleCandidates
std::unique_ptr< L1TMuonCandidates > pL1TMuonCandidates
edm::InputTag totalEvents_
analysis::ntuple::Candidates< reco::Muon > RecoMuonCandidates
analysis::ntuple::Candidates< reco::PFJet > PFJetCandidates
analysis::ntuple::FilterResults eventFilterResults_
std::vector< pTriggerObjectRecoCandidates > triggerobjectsreco_collections_
analysis::ntuple::Candidates< l1t::Muon > L1TMuonCandidates
std::unique_ptr< PrimaryVertices > pPrimaryVertices
analysis::ntuple::Candidates< l1extra::L1JetParticle > L1JetCandidates
std::unique_ptr< GenJetCandidates > pGenJetCandidates
std::vector< pRecoTrackCandidates > recotracks_collections_
std::vector< pChargedCandidates > chargedcands_collections_
edm::InputTag filteredEvents_
analysis::ntuple::Candidates< l1t::Jet > L1TJetCandidates
edm::ParameterSet config_
edm::InputTag fixedGridRhoAll_
analysis::ntuple::Candidates< reco::CaloJet > CaloJetCandidates
std::vector< pL1TMuonCandidates > l1tmuons_collections_
std::map< std::string, TTree * > tree_
std::unique_ptr< CaloJetCandidates > pCaloJetCandidates
analysis::ntuple::Candidates< reco::RecoChargedCandidate > ChargedCandidates
std::vector< std::string > inputTagsVec_
std::unique_ptr< PFJetCandidates > pPFJetCandidates
std::vector< pRecoMuonCandidates > recomuons_collections_
std::vector< pPatMuonCandidates > patmuons_collections_
std::unique_ptr< L1MuonCandidates > pL1MuonCandidates
edm::InputTag filteredMHatEvents_
analysis::ntuple::Candidates< reco::Track > RecoTrackCandidates
std::unique_ptr< TriggerAccepts > pTriggerAccepts
std::vector< pGenJetCandidates > genjets_collections_
std::vector< pTriggerAccepts > triggeraccepts_collections_
std::vector< pPrimaryVertices > primaryvertices_collections_
std::vector< edm::InputTag > InputTags
analysis::ntuple::Candidates< pat::MET > PatMETCandidates
std::unique_ptr< PatMuonCandidates > pPatMuonCandidates
analysis::ntuple::EventInfo EventInfo
analysis::ntuple::Candidates< pat::Muon > PatMuonCandidates
std::unique_ptr< TriggerObjectRecoCandidates > pTriggerObjectRecoCandidates
analysis::ntuple::Candidates< reco::GenJet > GenJetCandidates
std::vector< pJetsTags > jetstags_collections_
std::vector< pGenParticleCandidates > genparticles_collections_
analysis::ntuple::Vertices PrimaryVertices
analysis::ntuple::Candidates< pat::TriggerObject > TriggerObjectCandidates