From 849841331c894c411a09a30ee8e62a6316df991a Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Wed, 28 Oct 2020 18:05:17 +0200 Subject: [PATCH 01/19] Update BuildFile.xml --- JetAnalyzers/BuildFile.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/JetAnalyzers/BuildFile.xml b/JetAnalyzers/BuildFile.xml index a4d9509b..8852bf1d 100644 --- a/JetAnalyzers/BuildFile.xml +++ b/JetAnalyzers/BuildFile.xml @@ -15,6 +15,7 @@ + From 2c2decbb477d3104201c8be5cd13c17a57cb77ab Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Wed, 28 Oct 2020 18:08:49 +0200 Subject: [PATCH 02/19] Update JetResponseAnalyzer.hh --- JetAnalyzers/interface/JetResponseAnalyzer.hh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/JetAnalyzers/interface/JetResponseAnalyzer.hh b/JetAnalyzers/interface/JetResponseAnalyzer.hh index 55a2a23a..2834f9a8 100644 --- a/JetAnalyzers/interface/JetResponseAnalyzer.hh +++ b/JetAnalyzers/interface/JetResponseAnalyzer.hh @@ -38,6 +38,7 @@ #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/PatCandidates/interface/PackedGenParticle.h" #include "JetMETCorrections/Objects/interface/JetCorrector.h" @@ -104,7 +105,8 @@ private: //edm::EDGetTokenT > srcPFCandidates_; edm::EDGetTokenT srcPFCandidates_; edm::EDGetTokenT > > srcPFCandidatesAsFwdPtr_; - edm::EDGetTokenT > srcGenParticles_; +// edm::EDGetTokenT > srcGenParticles_; + edm::EDGetTokenT > srcGenParticles_; std::string jecLabel_; From 5588ac55f5a32e47ba3424ec1477d021fa188473 Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Wed, 28 Oct 2020 18:15:42 +0200 Subject: [PATCH 03/19] Update JetReconstruction_cff.py --- JetAnalyzers/python/JetReconstruction_cff.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/JetAnalyzers/python/JetReconstruction_cff.py b/JetAnalyzers/python/JetReconstruction_cff.py index 5d9f7098..6e10c970 100644 --- a/JetAnalyzers/python/JetReconstruction_cff.py +++ b/JetAnalyzers/python/JetReconstruction_cff.py @@ -87,7 +87,9 @@ #! #! PF JETS CHS #! -ak1PFCHSJets = ak1PFJets.clone( src = 'pfNoPileUpJME' ) + + +ak1PFCHSJets = ak1PFJets.clone( src = 'pfCHS' ) ak2PFCHSJets = ak1PFCHSJets.clone( rParam=0.2 ) ak3PFCHSJets = ak1PFCHSJets.clone( rParam=0.3 ) ak4PFCHSJets = ak1PFCHSJets.clone( rParam=0.4 ) From 2fd6c93d01c9b512bbb40e6902fcf12f6c620e66 Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Wed, 28 Oct 2020 18:19:13 +0200 Subject: [PATCH 04/19] Update addAlgorithm.py --- JetAnalyzers/python/addAlgorithm.py | 60 ++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/JetAnalyzers/python/addAlgorithm.py b/JetAnalyzers/python/addAlgorithm.py index 4b89cc95..eb09765e 100644 --- a/JetAnalyzers/python/addAlgorithm.py +++ b/JetAnalyzers/python/addAlgorithm.py @@ -5,7 +5,7 @@ ################################################################################ partons = cms.EDProducer('PartonSelector', - src = cms.InputTag('genParticles'), + src = cms.InputTag('packedGenParticles'), withLeptons = cms.bool(False), skipFirstN = cms.uint32(0) ) @@ -20,6 +20,11 @@ from JetMETAnalysis.JetAnalyzers.JetCorrection_cff import * from RecoTauTag.TauTagTools.tauDecayModes_cfi import * from CommonTools.PileupAlgos.Puppi_cff import * +from JetMETAnalysis.JetAnalyzers.customizePuppiTune_cff import * + + + +genParticlesForJetsNoNu.src = cms.InputTag("packedGenParticles") stdClusteringAlgorithms = ['ak'] #Options: {ak,kt} stdJetTypes = ['calo','pf','pfchs','puppi'] #Options: {'calo','pf','pfchs','puppi'} @@ -102,6 +107,7 @@ stdRecJetsDict['ak5tauHPSall'] = 'hpsPFTauProducer' recJetsDict['ak5tauHPSall'] = ('hpsPFTauProducer', hpsPFTauProducer) + tauDiscriminatorDict = { "ak5tauHPSlooseCombDBcorr" : "hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits", "ak5tauHPSmediumCombDBcorr" : "hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr3Hits", @@ -382,8 +388,26 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): sequence = cms.Sequence(recJets * sequence) if type == 'PUPPI': process.load('CommonTools.PileupAlgos.Puppi_cff') + process.load('JetMETAnalysis.JetAnalyzers.customizePuppiTune_cff') #puppi.candName = cms.InputTag("particleFlow") + #80x change + puppiCentral[0].applyLowPUCorr = cms.bool(False) + puppiForward[0].applyLowPUCorr = cms.bool(False) + puppi.vertexName = "offlineSlimmedPrimaryVertices" + + #UpdatePuppiTuneV14(process) + + + + #puppi.UseFromPVLooseTight = cms.bool(False) + #puppi.UseDeltaZCut = cms.bool(False) + #puppi.PtMaxCharged = cms.double(20.) + #puppi.EtaMaxCharged = cms.double(2.5) + #puppi.PtMaxNeutralsStartSlope = cms.double(20.) + sequence = cms.Sequence(puppi * sequence) + + #sequence = cms.Sequence(process.puppiMETSequence * process.fullPatMetSequencePuppi * process.patPuppiJetSpecificProducer * process.slimmedJetsPuppi * sequence) if type == 'Track': process.load('JetMETAnalysis.JetAnalyzers.TrackJetReconstruction_cff') sequence = cms.Sequence(trackJetSequence * sequence) @@ -505,10 +529,10 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): srcRhos = cms.InputTag(''), srcRho = cms.InputTag(''), srcRhoHLT = cms.InputTag(''), - srcVtx = cms.InputTag('offlinePrimaryVertices'), + srcVtx = cms.InputTag('offlineSlimmedPrimaryVertices'), srcJetToUncorJetMap = cms.InputTag(jetToUncorJet.label(), 'rec2gen'), srcPFCandidates = cms.InputTag(''), - srcGenParticles = cms.InputTag('genParticles') + srcGenParticles = cms.InputTag('packedGenParticles') ) if doProducer: jraAnalyzer = 'JetResponseAnalyzerProducer' @@ -519,10 +543,10 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): jecLabel = cms.string(''), srcRho = cms.InputTag(''), srcRhoHLT = cms.InputTag(''), - srcVtx = cms.InputTag('offlinePrimaryVertices'), + srcVtx = cms.InputTag('offlineSlimmedPrimaryVertices'), srcJetToUncorJetMap = cms.InputTag(jetToUncorJet.label(), 'rec2gen'), srcPFCandidates = cms.InputTag(''), - srcGenParticles = cms.InputTag('genParticles') + srcGenParticles = cms.InputTag('packedGenParticles') ) if type == 'CaloHLT': @@ -531,35 +555,38 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): elif type == 'Calo': jra.srcRho = cms.InputTag("fixedGridRhoFastjetAllCalo") elif type == 'PFchs': - process.kt6PFchsJetsRhos = kt6PFJets.clone(src = 'pfNoPileUpJME', + process.pfCHS = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV")) + process.kt6PFchsJetsRhos = kt6PFJets.clone(src = 'pfCHS', doFastJetNonUniform = cms.bool(True), puCenters = cms.vdouble(-5,-4,-3,-2,-1,0,1,2,3,4,5), puWidth = cms.double(.8), nExclude = cms.uint32(2)) - sequence = cms.Sequence(process.kt6PFchsJetsRhos * sequence) + sequence = cms.Sequence(process.pfCHS * process.kt6PFchsJetsRhos * sequence) jra.srcRhos = cms.InputTag("kt6PFchsJetsRhos", "rhos") jra.srcRho = cms.InputTag("fixedGridRhoFastjetAll") - jra.srcPFCandidates = cms.InputTag('pfNoPileUpJME') + jra.srcPFCandidates = cms.InputTag('pfCHS') elif type == 'PFHLT': - jra.srcRho = ak4PFL1Fastjet.srcRho #added 02/15/2012 + jra.srcRho = ak4PFL1Fastjet.srcRho jra.srcRhoHLT = ak5PFHLTL1Fastjet.srcRho elif type == 'PFchsHLT': - jra.srcRho = ak4PFchsL1Fastjet.srcRho #added 02/15/2012 + jra.srcRho = ak4PFchsL1Fastjet.srcRho jra.srcRhoHLT = ak5PFchsHLTL1Fastjet.srcRho elif type == 'PF': + process.particleFlow = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("")) process.kt6PFJetsRhos = kt6PFJets.clone(doFastJetNonUniform = cms.bool(True), puCenters = cms.vdouble(-5,-4,-3,-2,-1,0,1,2,3,4,5), puWidth = cms.double(.8), nExclude = cms.uint32(2)) - sequence = cms.Sequence(process.kt6PFJetsRhos * sequence) + sequence = cms.Sequence(process.particleFlow * process.kt6PFJetsRhos * sequence) jra.srcRhos = cms.InputTag("kt6PFJetsRhos", "rhos") jra.srcRho = cms.InputTag("fixedGridRhoFastjetAll") - jra.srcPFCandidates = cms.InputTag('particleFlow') + jra.srcPFCandidates = cms.InputTag('packedPFCandidates') elif type == 'PUPPI': + process.particleFlow = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("")) process.kt6PFJetsRhos = kt6PFJets.clone(doFastJetNonUniform = cms.bool(True), puCenters = cms.vdouble(-5,-4,-3,-2,-1,0,1,2,3,4,5), puWidth = cms.double(.8), nExclude = cms.uint32(2)) - sequence = cms.Sequence(process.kt6PFJetsRhos * sequence) + sequence = cms.Sequence(process.particleFlow * process.kt6PFJetsRhos * sequence) jra.srcRhos = cms.InputTag("kt6PFJetsRhos", "rhos") jra.srcRho = cms.InputTag("fixedGridRhoFastjetAll") jra.srcPFCandidates = cms.InputTag('puppi') @@ -575,13 +602,10 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): setattr(process,alg_size_type_corr,jra) sequence = cms.Sequence(sequence * jra) - ## add chs to path is needed - if type == 'PFchs': - sequence = cms.Sequence(process.pfNoPileUpJMESequence * sequence) - - ## create the path and put in the sequence + sequence = cms.Sequence(sequence) setattr(process, alg_size_type_corr + 'Sequence', sequence) path = cms.Path( sequence ) setattr(process, alg_size_type_corr + 'Path', path) + print alg_size_type_corr From 77d77473a2b821ea1fd3f5c3d8adb66239300080 Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Wed, 28 Oct 2020 18:21:30 +0200 Subject: [PATCH 05/19] Update JetResponseAnalyzer.cc --- JetAnalyzers/src/JetResponseAnalyzer.cc | 86 +++++++++++++++++++------ 1 file changed, 67 insertions(+), 19 deletions(-) diff --git a/JetAnalyzers/src/JetResponseAnalyzer.cc b/JetAnalyzers/src/JetResponseAnalyzer.cc index dc0ccc14..09214521 100644 --- a/JetAnalyzers/src/JetResponseAnalyzer.cc +++ b/JetAnalyzers/src/JetResponseAnalyzer.cc @@ -25,11 +25,11 @@ JetResponseAnalyzer::JetResponseAnalyzer(const edm::ParameterSet& iConfig) , srcRhoHLT_ (consumes(iConfig.getParameter ("srcRhoHLT"))) , srcVtx_ (consumes(iConfig.getParameter ("srcVtx"))) , srcGenInfo_ (consumes(edm::InputTag("generator")) ) - , srcPileupInfo_ (consumes >(edm::InputTag("addPileupInfo")) ) + , srcPileupInfo_ (consumes >(edm::InputTag("slimmedAddPileupInfo")) ) //, srcPFCandidates_ (consumes >(iConfig.getParameter("srcPFCandidates"))) , srcPFCandidates_ (consumes(iConfig.getParameter("srcPFCandidates"))) , srcPFCandidatesAsFwdPtr_(consumes > >(iConfig.getParameter("srcPFCandidates"))) - , srcGenParticles_ (consumes >(iConfig.getParameter("srcGenParticles"))) + , srcGenParticles_ (consumes >(iConfig.getParameter("srcGenParticles"))) , jecLabel_ (iConfig.getParameter ("jecLabel")) , doComposition_ (iConfig.getParameter ("doComposition")) , doFlavor_ (iConfig.getParameter ("doFlavor")) @@ -115,6 +115,50 @@ void JetResponseAnalyzer::beginJob() } + + + + +void getMult( vector const & particles, int* nMult, int* chMult ) { + + vector::const_iterator itParticle; + for (itParticle=particles.begin();itParticle!=particles.end();++itParticle){ + const reco::Candidate* pfCand = itParticle->get(); + + switch (std::abs(pfCand->pdgId())) { + + case 211: //PFCandidate::h: // charged hadron + (*chMult)++; + break; + + case 130: //PFCandidate::h0 : // neutral hadron + (*nMult)++; + break; + + case 22: //PFCandidate::gamma: // photon + (*nMult)++; + break; + + case 11: // PFCandidate::e: // electron + (*chMult)++; + break; + + case 13: //PFCandidate::mu: // muon + (*chMult)++; + break; + + case 1: // PFCandidate::h_HF : // hadron in HF + (*nMult)++; + break; + + case 2: //PFCandidate::egamma_HF : // electromagnetic in HF + (*nMult)++; + break; + } + } +} + +//_______________ //______________________________________________________________________________ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) @@ -134,7 +178,7 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, edm::Handle vtx; edm::Handle pfCandidates; edm::Handle > > pfCandidatesAsFwdPtr; - edm::Handle > genParticles; + edm::Handle > genParticles; // Jet CORRECTOR jetCorrector_ = (jecLabel_.empty()) ? 0 : JetCorrector::getJetCorrector(jecLabel_,iSetup); @@ -189,8 +233,8 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, JRAEvt_->refpvz = -1000.0; iEvent.getByToken(srcGenParticles_, genParticles); for (size_t i = 0; i < genParticles->size(); ++i) { - const reco::GenParticle & genIt = (*genParticles)[i]; - if ( genIt.isHardProcess() ) { + const pat::PackedGenParticle & genIt = (*genParticles)[i]; + if ( genIt.fromHardProcessFinalState() ) { JRAEvt_->refpvz = genIt.vz(); break; } @@ -257,18 +301,19 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, JRAEvt_->refdphijt->push_back(reco::deltaPhi(jet->phi(),ref->phi())); else JRAEvt_->refdrjt->push_back(reco::deltaR(jet->eta(),jet->phi(),ref->eta(),ref->phi())); - + if ((!doBalancing_&&JRAEvt_->refdrjt->at(JRAEvt_->nref)>deltaRMax_)|| (doBalancing_&&std::abs(JRAEvt_->refdphijt->at(JRAEvt_->nref))refdphijt->pop_back(); else JRAEvt_->refdrjt->pop_back(); continue; } - JRAEvt_->refpdgid->push_back(0); - JRAEvt_->refpdgid_algorithmicDef->push_back(0); - JRAEvt_->refpdgid_physicsDef->push_back(0); + if (getFlavorFromMap_) { + JRAEvt_->refpdgid_algorithmicDef->push_back(0); + JRAEvt_->refpdgid_physicsDef->push_back(0); + reco::JetMatchedPartonsCollection::const_iterator itPartonMatch; itPartonMatch=refToPartonMap->begin(); for (;itPartonMatch!=refToPartonMap->end();++itPartonMatch) { @@ -277,7 +322,7 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, const reco::Candidate* cand = &(*jetRef); if (cand==&(*ref)) break; } - + if (itPartonMatch!=refToPartonMap->end()&& itPartonMatch->second.algoDefinitionParton().get()!=0&& itPartonMatch->second.physicsDefinitionParton().get()!=0) { @@ -315,10 +360,6 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, } } } - else { - JRAEvt_->refpdgid_algorithmicDef->at(JRAEvt_->nref)=0; - JRAEvt_->refpdgid_physicsDef->at(JRAEvt_->nref)=0; - } JRAEvt_->refpdgid->at(JRAEvt_->nref)=ref->pdgId(); // Beta/Beta Star Calculation @@ -439,12 +480,21 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, JRAEvt_->jtmuf ->push_back(pfJetRef->muonEnergyFraction() *JRAEvt_->jtjec->at(JRAEvt_->nref)); JRAEvt_->jthfhf->push_back(pfJetRef->HFHadronEnergyFraction() *JRAEvt_->jtjec->at(JRAEvt_->nref)); JRAEvt_->jthfef->push_back(pfJetRef->HFEMEnergyFraction() *JRAEvt_->jtjec->at(JRAEvt_->nref)); +int chMult=0, nMult=0; + getMult( ref.castTo()->getJetConstituents(), &nMult, &chMult ); + JRAEvt_->refnMult ->push_back( nMult ); + JRAEvt_->refchMult->push_back( chMult ); + + //this method exists for pfjets (neutralMultiplicity()), but not for genjets + //original i thought since genjet didn't have it i should make this method + chMult=0; nMult=0; + getMult( jet.castTo()->getJetConstituents(), &nMult, &chMult ); + JRAEvt_->jtnMult ->push_back( nMult ); + JRAEvt_->jtchMult->push_back( chMult ); } } - JRAEvt_->nref++; } - // PFCANDIDATE INFORMATION //Dual handle idea from https://github.com/aperloff/cmssw/blob/CMSSW_7_6_X/RecoJets/JetProducers/plugins/VirtualJetProducer.cc //Random-Cone algo from https://github.com/cihar29/OffsetAnalysis/blob/master/run_offset.py @@ -483,10 +533,8 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, } } } - - tree_->Fill(); - + return; } From 345364f88646e28db57c8b26f37accf00e89e622 Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Wed, 28 Oct 2020 18:27:53 +0200 Subject: [PATCH 06/19] Update Defaults_cff.py --- JetAnalyzers/python/Defaults_cff.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/JetAnalyzers/python/Defaults_cff.py b/JetAnalyzers/python/Defaults_cff.py index b5bd3a06..d8551c3c 100644 --- a/JetAnalyzers/python/Defaults_cff.py +++ b/JetAnalyzers/python/Defaults_cff.py @@ -25,14 +25,14 @@ JetResponseParameters = cms.PSet( # record flavor information, consider both RefPt and JetPt doComposition = cms.bool(True), - doFlavor = cms.bool(True), + doFlavor = cms.bool(False), doRefPt = cms.bool(True), doJetPt = cms.bool(True), saveCandidates = cms.bool(False), # MATCHING MODE: deltaR(ref,jet) - deltaRMax = cms.double(0.25), + deltaRMax = cms.double(0.4), # deltaR(ref,parton) IF doFlavor is True - deltaRPartonMax = cms.double(0.25), + deltaRPartonMax = cms.double(0.4), # consider all matched references nRefMax = cms.uint32(0), # is the sample an HLT sample @@ -76,7 +76,7 @@ dobalance = cms.bool(False), doflavor = cms.bool(False), noabsflavors = cms.bool(False), - drmax = cms.double(0.3), + drmax = cms.double(0.4), dphimin = cms.double(2.7), dojetpt = cms.bool(False), dorefpt = cms.bool(True), From f9c3488e9a983052ba6c789944b030271d4625c9 Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Wed, 28 Oct 2020 18:29:52 +0200 Subject: [PATCH 07/19] Update JRAEvent.cc --- JetUtilities/src/JRAEvent.cc | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/JetUtilities/src/JRAEvent.cc b/JetUtilities/src/JRAEvent.cc index 64f863a8..f879f52a 100644 --- a/JetUtilities/src/JRAEvent.cc +++ b/JetUtilities/src/JRAEvent.cc @@ -84,8 +84,8 @@ void JRAEvent::MakeTree(TTree* tree) fChain->Branch("evt", &evt, "evt/L"); fChain->Branch("nref", &nref, "nref/b"); fChain->Branch("refrank", "vector", &refrank); + fChain->Branch("refpdgid", "vector", &refpdgid); if(!flags.test(0) || (flags.test(0) && flags.test(2))) { - fChain->Branch("refpdgid", "vector", &refpdgid); fChain->Branch("refpdgid_algorithmicDef", "vector", &refpdgid_algorithmicDef); fChain->Branch("refpdgid_physicsDef", "vector", &refpdgid_physicsDef); } @@ -120,6 +120,11 @@ void JRAEvent::MakeTree(TTree* tree) fChain->Branch("jtmuf", "vector", &jtmuf); fChain->Branch("jthfhf", "vector", &jthfhf); fChain->Branch("jthfef", "vector", &jthfef); + + fChain->Branch("refnMult", "vector", &refnMult); + fChain->Branch("refchMult", "vector", &refchMult); + fChain->Branch("jtnMult", "vector", &jtnMult); + fChain->Branch("jtchMult", "vector", &jtchMult); } } if (!flags.test(0) || (flags.test(0) && flags.test(6) && flags.test(7))) { @@ -184,8 +189,8 @@ void JRAEvent::Init(TTree *tree) fChain->SetBranchAddress("evt", &evt, &b_evt); fChain->SetBranchAddress("nref", &nref, &b_nref); fChain->SetBranchAddress("refrank", &refrank, &b_refrank); + fChain->SetBranchAddress("refpdgid", &refpdgid, &b_refpdgid); if(!flags.test(0) || (flags.test(0) && flags.test(2))) { - fChain->SetBranchAddress("refpdgid", &refpdgid, &b_refpdgid); fChain->SetBranchAddress("refpdgid_algorithmicDef", &refpdgid_algorithmicDef, &b_refpdgid_algorithmicDef); fChain->SetBranchAddress("refpdgid_physicsDef", &refpdgid_physicsDef, &b_refpdgid_physicsDef); } @@ -220,6 +225,11 @@ void JRAEvent::Init(TTree *tree) fChain->SetBranchAddress("jtmuf", &jtmuf, &b_jtmuf); fChain->SetBranchAddress("jthfhf", &jthfhf, &b_jthfhf); fChain->SetBranchAddress("jthfef", &jthfef, &b_jthfef); + + fChain->SetBranchAddress("refnMult", &refnMult, &b_refnMult); + fChain->SetBranchAddress("refchMult", &refchMult, &b_refchMult); + fChain->SetBranchAddress("jtnMult", &jtnMult, &b_jtnMult); + fChain->SetBranchAddress("jtchMult", &jtchMult, &b_jtchMult); } } if (!flags.test(0) || (flags.test(0) && flags.test(6) && flags.test(7))) { @@ -274,8 +284,8 @@ void JRAEvent::MakeVectors() ntrks_highpt = new vector; rhos = new vector; refrank = new vector; + refpdgid = new vector; if(!flags.test(0) || (flags.test(0) && flags.test(2))) { - refpdgid = new vector; refpdgid_algorithmicDef = new vector; refpdgid_physicsDef = new vector; } @@ -310,6 +320,11 @@ void JRAEvent::MakeVectors() jtmuf = new vector; jthfhf = new vector; jthfef = new vector; + + refnMult = new vector; + refchMult = new vector; + jtnMult = new vector; + jtchMult = new vector; } } if (!flags.test(0) || (flags.test(0) && flags.test(6) && flags.test(7))) { @@ -336,8 +351,8 @@ void JRAEvent::clear() ntrks_highpt->clear(); rhos->clear(); refrank->clear(); + refpdgid->clear(); if(!flags.test(0) || (flags.test(0) && flags.test(2))) { - refpdgid->clear(); refpdgid_algorithmicDef->clear(); refpdgid_physicsDef->clear(); } @@ -372,6 +387,11 @@ void JRAEvent::clear() jtmuf->clear(); jthfhf->clear(); jthfef->clear(); + + refnMult->clear(); + refchMult->clear(); + jtnMult->clear(); + jtchMult->clear(); } } if (!flags.test(0) || (flags.test(0) && flags.test(6) && flags.test(7))) { From 650984b94e3ccbf3371f684764c425d6b60078ab Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Wed, 28 Oct 2020 18:31:02 +0200 Subject: [PATCH 08/19] Update JRAEvent.h --- JetUtilities/interface/JRAEvent.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/JetUtilities/interface/JRAEvent.h b/JetUtilities/interface/JRAEvent.h index 8a4ba580..c6308c13 100644 --- a/JetUtilities/interface/JRAEvent.h +++ b/JetUtilities/interface/JRAEvent.h @@ -80,6 +80,8 @@ public : vector* refpdgid_physicsDef; vector* refe; vector* refpt; + vector* refnMult; + vector* refchMult; vector* refeta; vector* refphi; vector* refy; @@ -88,6 +90,8 @@ public : vector* refarea; vector* jte; vector* jtpt; + vector* jtnMult; + vector* jtchMult; vector* jteta; vector* jtphi; vector* jty; @@ -140,6 +144,8 @@ public : TBranch *b_refpdgid_physicsDef; //! TBranch *b_refe; //! TBranch *b_refpt; //! + TBranch *b_refnMult; //! + TBranch *b_refchMult; //! TBranch *b_refeta; //! TBranch *b_refphi; //! TBranch *b_refy; //! @@ -148,6 +154,8 @@ public : TBranch *b_refarea; //! TBranch *b_jte; //! TBranch *b_jtpt; //! + TBranch *b_jtnMult; //! + TBranch *b_jtchMult; //! TBranch *b_jteta; //! TBranch *b_jtphi; //! TBranch *b_jty; //! From 8edaf1ceab743ae95156bd49f16ae53b5750c20d Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Tue, 3 Nov 2020 18:47:52 +0200 Subject: [PATCH 09/19] Create XrdClFileSystem_v2.hh A slightly modified script of the xrootd/XrdCl/XrdClFileSystem.hh one, in order to avoid compilation errors. --- JetAnalyzers/XrdClFileSystem_v2.hh | 759 +++++++++++++++++++++++++++++ 1 file changed, 759 insertions(+) create mode 100644 JetAnalyzers/XrdClFileSystem_v2.hh diff --git a/JetAnalyzers/XrdClFileSystem_v2.hh b/JetAnalyzers/XrdClFileSystem_v2.hh new file mode 100644 index 00000000..34acff93 --- /dev/null +++ b/JetAnalyzers/XrdClFileSystem_v2.hh @@ -0,0 +1,759 @@ +//------------------------------------------------------------------------------ +// Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN) +// Author: Lukasz Janyst +//------------------------------------------------------------------------------ +// This file is part of the XRootD software suite. +// +// XRootD is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// XRootD is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with XRootD. If not, see . +// +// In applying this licence, CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +//------------------------------------------------------------------------------ + +#ifndef __XRD_CL_FILE_SYSTEM_HH__ +#define __XRD_CL_FILE_SYSTEM_HH__ + +#include "XrdCl/XrdClURL.hh" +#include "XrdCl/XrdClStatus.hh" +#include "XrdOuc/XrdOucEnum.hh" +#include "XrdOuc/XrdOucCompiler.hh" +#include "XrdCl/XrdClXRootDResponses.hh" +#include "XrdSys/XrdSysPthread.hh" +#include "XProtocol/XProtocol.hh" +#include +#include + +namespace XrdCl +{ + class PostMaster; + class Message; + class FileSystemPlugIn; + struct MessageSendParams; + + //---------------------------------------------------------------------------- + //! XRootD query request codes + //---------------------------------------------------------------------------- + struct QueryCode + { + //-------------------------------------------------------------------------- + //! XRootD query request codes + //-------------------------------------------------------------------------- + enum Code + { + Config = kXR_Qconfig, //!< Query server configuration + ChecksumCancel = kXR_Qckscan, //!< Query file checksum cancellation + Checksum = kXR_Qcksum, //!< Query file checksum + Opaque = kXR_Qopaque, //!< Implementation dependent + OpaqueFile = kXR_Qopaquf, //!< Implementation dependent + Prepare = kXR_QPrep, //!< Query prepare status + Space = kXR_Qspace, //!< Query logical space stats + Stats = kXR_QStats, //!< Query server stats + Visa = kXR_Qvisa, //!< Query file visa attributes + XAttr = kXR_Qxattr //!< Query file extended attributes + }; + }; + + //---------------------------------------------------------------------------- + //! Open flags, may be or'd when appropriate + //---------------------------------------------------------------------------- + struct OpenFlags + { + //-------------------------------------------------------------------------- + //! Open flags, may be or'd when appropriate + //-------------------------------------------------------------------------- + enum Flags + { + None = 0, //!< Nothing + Compress = kXR_compress, //!< Read compressed data for open (ignored), + //!< for kXR_locate return unique hosts + Delete = kXR_delete, //!< Open a new file, deleting any existing + //!< file + Force = kXR_force, //!< Ignore file usage rules, for kXR_locate + //!< it means ignoreing network dependencies + MakePath = kXR_mkpath, //!< Create directory path if it does not + //!< already exist + New = kXR_new, //!< Open the file only if it does not already + //!< exist + NoWait = kXR_nowait, //!< Open the file only if it does not cause + //!< a wait. For locate: provide a location as + //!< soon as one becomes known. This means + //!< that not all locations are necessarily + //!< returned. If the file does not exist a + //!< wait is still imposed. + Append = kXR_open_apnd, //!< Open only for appending + Read = kXR_open_read, //!< Open only for reading + Update = kXR_open_updt, //!< Open for reading and writing + Write = kXR_open_wrto, //!< Open only for writing + POSC = kXR_posc, //!< Enable Persist On Successful Close + //!< processing + Refresh = kXR_refresh, //!< Refresh the cached information on file's + //!< location. Voids NoWait. + Replica = kXR_replica, //!< The file is being opened for replica + //!< creation + SeqIO = kXR_seqio, //!< File will be read or written sequentially + PrefName = kXR_prefname //!< Hostname response is prefered, applies + //!< only to FileSystem::Locate + }; + }; + XRDOUC_ENUM_OPERATORS( OpenFlags::Flags ) + + //---------------------------------------------------------------------------- + //! Access mode + //---------------------------------------------------------------------------- + struct Access + { + //-------------------------------------------------------------------------- + //! Access mode + //-------------------------------------------------------------------------- + enum Mode + { + None = 0, + UR = kXR_ur, //!< owner readable + UW = kXR_uw, //!< owner writable + UX = kXR_ux, //!< owner executable/browsable + GR = kXR_gr, //!< group readable + GW = kXR_gw, //!< group writable + GX = kXR_gx, //!< group executable/browsable + OR = kXR_or, //!< world readable + OW = kXR_ow, //!< world writeable + OX = kXR_ox //!< world executable/browsable + }; + }; + XRDOUC_ENUM_OPERATORS( Access::Mode ) + + //---------------------------------------------------------------------------- + //! MkDir flags + //---------------------------------------------------------------------------- + struct MkDirFlags + { + enum Flags + { + None = 0, //!< Nothing special + MakePath = 1 //!< create the entire directory tree if it doesn't exist + }; + }; + XRDOUC_ENUM_OPERATORS( MkDirFlags::Flags ) + + //---------------------------------------------------------------------------- + //! DirList flags + //---------------------------------------------------------------------------- + struct DirListFlags + { + enum Flags + { + None = 0, //!< Nothing special + Stat = 1, //!< Stat each entry + Locate = 2, //!< Locate all servers hosting the directory and send + //!< the dirlist request to all of them + Recursive = 4, //!< Do a recursive listing + Merge = 8, //!< Merge duplicates + Chunked = 16, //!< Serve chunked results for better performance + Zip = 32 //!< List content of ZIP files + }; + }; + XRDOUC_ENUM_OPERATORS( DirListFlags::Flags ) + + //---------------------------------------------------------------------------- + //! Prepare flags + //---------------------------------------------------------------------------- + struct PrepareFlags + { + enum Flags + { + None = 0, //!< no flags + Colocate = kXR_coloc, //!< co-locate staged files, if possible + Fresh = kXR_fresh, //!< refresh file access time even if + //!< the location is known + Stage = kXR_stage, //!< stage the file to disk if it is not + //!< online + WriteMode = kXR_wmode, //!< the file will be accessed for + //!< modification + Cancel = kXR_cancel, //!< cancel staging request + Evict = kXR_wait << 8 //!< evict the file from disk cache + //!< we have to shift kXR_evict as its value + //!< is the same as cancel's because this + //!< flag goes to options extension + }; + }; + XRDOUC_ENUM_OPERATORS( PrepareFlags::Flags ) + + //---------------------------------------------------------------------------- + //! Send file/filesystem queries to an XRootD cluster + //---------------------------------------------------------------------------- + class FileSystem + { + friend class AssignLBHandler; + friend class ForkHandler; + + public: + typedef std::vector LocationList; //!< Location list + + //------------------------------------------------------------------------ + //! Constructor + //! + //! @param url URL of the entry-point server to be contacted + //! @param enablePlugIns enable the plug-in mechanism for this object + //------------------------------------------------------------------------ + FileSystem( const URL &url, bool enablePlugIns = true ); + + //------------------------------------------------------------------------ + //! Destructor + //------------------------------------------------------------------------ + ~FileSystem(); + + //------------------------------------------------------------------------ + //! Locate a file - async + //! + //! @param path path to the file to be located + //! @param flags some of the OpenFlags::Flags + //! @param handler handler to be notified when the response arrives, + //! the response parameter will hold a Buffer object + //! if the procedure is successful + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Locate( const std::string &path, + OpenFlags::Flags flags, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Locate a file - sync + //! + //! @param path path to the file to be located + //! @param flags some of the OpenFlags::Flags + //! @param response the response (to be deleted by the user) + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Locate( const std::string &path, + OpenFlags::Flags flags, + LocationInfo *&response, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Locate a file, recursively locate all disk servers - async + //! + //! @param path path to the file to be located + //! @param flags some of the OpenFlags::Flags + //! @param handler handler to be notified when the response arrives, + //! the response parameter will hold a Buffer object + //! if the procedure is successful + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus DeepLocate( const std::string &path, + OpenFlags::Flags flags, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Locate a file, recursively locate all disk servers - sync + //! + //! @param path path to the file to be located + //! @param flags some of the OpenFlags::Flags + //! @param response the response (to be deleted by the user) + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus DeepLocate( const std::string &path, + OpenFlags::Flags flags, + LocationInfo *&response, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Move a directory or a file - async + //! + //! @param source the file or directory to be moved + //! @param dest the new name + //! @param handler handler to be notified when the response arrives, + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Mv( const std::string &source, + const std::string &dest, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Move a directory or a file - sync + //! + //! @param source the file or directory to be moved + //! @param dest the new name + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Mv( const std::string &source, + const std::string &dest, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Obtain server information - async + //! + //! @param queryCode the query code as specified in the QueryCode struct + //! @param arg query argument + //! @param handler handler to be notified when the response arrives, + //! the response parameter will hold a Buffer object + //! if the procedure is successful + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Query( QueryCode::Code queryCode, + const Buffer &arg, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Obtain server information - sync + //! + //! @param queryCode the query code as specified in the QueryCode struct + //! @param arg query argument + //! @param response the response (to be deleted by the user) + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Query( QueryCode::Code queryCode, + const Buffer &arg, + Buffer *&response, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Truncate a file - async + //! + //! @param path path to the file to be truncated + //! @param size file size + //! @param handler handler to be notified when the response arrives + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Truncate( const std::string &path, + uint64_t size, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Truncate a file - sync + //! + //! @param path path to the file to be truncated + //! @param size file size + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Truncate( const std::string &path, + uint64_t size, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Remove a file - async + //! + //! @param path path to the file to be removed + //! @param handler handler to be notified when the response arrives + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Rm( const std::string &path, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Remove a file - sync + //! + //! @param path path to the file to be removed + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Rm( const std::string &path, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Create a directory - async + //! + //! @param path path to the directory + //! @param flags or'd MkDirFlags + //! @param mode access mode, or'd Access::Mode + //! @param handler handler to be notified when the response arrives + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus MkDir( const std::string &path, + MkDirFlags::Flags flags, + Access::Mode mode, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Create a directory - sync + //! + //! @param path path to the directory + //! @param flags or'd MkDirFlags + //! @param mode access mode, or'd Access::Mode + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus MkDir( const std::string &path, + MkDirFlags::Flags flags, + Access::Mode mode, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Remove a directory - async + //! + //! @param path path to the directory to be removed + //! @param handler handler to be notified when the response arrives + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus RmDir( const std::string &path, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Remove a directory - sync + //! + //! @param path path to the directory to be removed + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus RmDir( const std::string &path, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Change access mode on a directory or a file - async + //! + //! @param path file/directory path + //! @param mode access mode, or'd Access::Mode + //! @param handler handler to be notified when the response arrives + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus ChMod( const std::string &path, + Access::Mode mode, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Change access mode on a directory or a file - sync + //! + //! @param path file/directory path + //! @param mode access mode, or'd Access::Mode + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus ChMod( const std::string &path, + Access::Mode mode, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Check if the server is alive - async + //! + //! @param handler handler to be notified when the response arrives + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Ping( ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Check if the server is alive - sync + //! + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Ping( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Obtain status information for a path - async + //! + //! @param path file/directory path + //! @param handler handler to be notified when the response arrives, + //! the response parameter will hold a StatInfo object + //! if the procedure is successful + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Stat( const std::string &path, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Obtain status information for a path - sync + //! + //! @param path file/directory path + //! @param response the response (to be deleted by the user only if the + //! procedure is successful) + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Stat( const std::string &path, + StatInfo *&response, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Obtain status information for a Virtual File System - async + //! + //! @param path file/directory path + //! @param handler handler to be notified when the response arrives, + //! the response parameter will hold a StatInfoVFS object + //! if the procedure is successful + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus StatVFS( const std::string &path, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Obtain status information for a Virtual File System - sync + //! + //! @param path file/directory path + //! @param response the response (to be deleted by the user) + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus StatVFS( const std::string &path, + StatInfoVFS *&response, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Obtain server protocol information - async + //! + //! @param handler handler to be notified when the response arrives, + //! the response parameter will hold a ProtocolInfo object + //! if the procedure is successful + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Protocol( ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Obtain server protocol information - sync + //! + //! @param response the response (to be deleted by the user) + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Protocol( ProtocolInfo *&response, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! List entries of a directory - async + //! + //! @param path directory path + //! @param flags currently unused + //! @param handler handler to be notified when the response arrives, + //! the response parameter will hold a DirectoryList + //! object if the procedure is successful + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus DirList( const std::string &path, + DirListFlags::Flags flags, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! List entries of a directory - sync + //! + //! @param path directory path + //! @param flags DirListFlags + //! @param response the response (to be deleted by the user) + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus DirList( const std::string &path, + DirListFlags::Flags flags, + DirectoryList *&response, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Send info to the server (up to 1024 characters)- async + //! + //! @param info the info string to be sent + //! @param handler handler to be notified when the response arrives, + //! the response parameter will hold a Buffer object + //! if the procedure is successful + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus SendInfo( const std::string &info, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Send info to the server (up to 1024 characters) - sync + //! + //! @param info the info string to be sent + //! @param response the response (to be deleted by the user) + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus SendInfo( const std::string &info, + Buffer *&response, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Prepare one or more files for access - async + //! + //! @param fileList list of files to be prepared + //! @param flags PrepareFlags::Flags + //! @param priority priority of the request 0 (lowest) - 3 (highest) + //! @param handler handler to be notified when the response arrives, + //! the response parameter will hold a Buffer object + //! if the procedure is successful + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Prepare( const std::vector &fileList, + PrepareFlags::Flags flags, + uint8_t priority, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Prepare one or more files for access - sync + //! + //! @param fileList list of files to be prepared + //! @param flags PrepareFlags::Flags + //! @param priority priority of the request 0 (lowest) - 3 (highest) + //! @param response the response (to be deleted by the user) + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Prepare( const std::vector &fileList, + PrepareFlags::Flags flags, + uint8_t priority, + Buffer *&response, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Set filesystem property + //! + //! Filesystem properties: + //! FollowRedirects [true/false] - enable/disable following redirections + //------------------------------------------------------------------------ + bool SetProperty( const std::string &name, const std::string &value ); + + //------------------------------------------------------------------------ + //! Get filesystem property + //! + //! @see FileSystem::SetProperty for property list + //------------------------------------------------------------------------ + bool GetProperty( const std::string &name, std::string &value ) const; + + private: + FileSystem(const FileSystem &other); + FileSystem &operator = (const FileSystem &other); + + //------------------------------------------------------------------------ + // Send a message in a locked environment + //------------------------------------------------------------------------ + Status Send( Message *msg, + ResponseHandler *handler, + MessageSendParams ¶ms ); + + //------------------------------------------------------------------------ + // Assign a load balancer if it has not already been assigned + //------------------------------------------------------------------------ + void AssignLoadBalancer( const URL &url ); + + //------------------------------------------------------------------------ + // Lock the internal lock + //------------------------------------------------------------------------ + void Lock() + { + pMutex.Lock(); + } + + //------------------------------------------------------------------------ + // Unlock the internal lock + //------------------------------------------------------------------------ + void UnLock() + { + pMutex.UnLock(); + } + + XrdSysMutex pMutex; + bool pLoadBalancerLookupDone; + bool pFollowRedirects; + URL *pUrl; + FileSystemPlugIn *pPlugIn; + }; +} + +#endif // __XRD_CL_FILE_SYSTEM_HH__ From 19a622ad81cdb6d3401040cd23aa713aa8bd8f6e Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Tue, 3 Nov 2020 18:52:04 +0200 Subject: [PATCH 10/19] Update jet_correction_analyzer_x.cc This change includes the XrdClFileSystem_v2.hh script instead of the XrdClFileSystem.hh so as to avoid compilation errors. --- JetAnalyzers/bin/jet_correction_analyzer_x.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/JetAnalyzers/bin/jet_correction_analyzer_x.cc b/JetAnalyzers/bin/jet_correction_analyzer_x.cc index 69453955..804f80fa 100644 --- a/JetAnalyzers/bin/jet_correction_analyzer_x.cc +++ b/JetAnalyzers/bin/jet_correction_analyzer_x.cc @@ -18,7 +18,8 @@ #include "CondFormats/JetMETObjects/interface/FactorizedJetCorrector.h" #include "PhysicsTools/Utilities/interface/LumiReWeighting.h" #if __has_include("xrootd/XrdCl/XrdClFileSystem.hh") -#include "xrootd/XrdCl/XrdClFileSystem.hh" +//#include "xrootd/XrdCl/XrdClFileSystem.hh" +#include "JetMETAnalysis/JetAnalyzers/XrdClFileSystem_v2.hh" #define has_xrdcl 1 #else #define has_xrdcl 0 From a60f42dbb28c823888623424f7fd274a24c651de Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Thu, 5 Nov 2020 19:47:26 +0200 Subject: [PATCH 11/19] Delete XrdClFileSystem_v2.hh --- JetAnalyzers/XrdClFileSystem_v2.hh | 759 ----------------------------- 1 file changed, 759 deletions(-) delete mode 100644 JetAnalyzers/XrdClFileSystem_v2.hh diff --git a/JetAnalyzers/XrdClFileSystem_v2.hh b/JetAnalyzers/XrdClFileSystem_v2.hh deleted file mode 100644 index 34acff93..00000000 --- a/JetAnalyzers/XrdClFileSystem_v2.hh +++ /dev/null @@ -1,759 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN) -// Author: Lukasz Janyst -//------------------------------------------------------------------------------ -// This file is part of the XRootD software suite. -// -// XRootD is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// XRootD is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with XRootD. If not, see . -// -// In applying this licence, CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -//------------------------------------------------------------------------------ - -#ifndef __XRD_CL_FILE_SYSTEM_HH__ -#define __XRD_CL_FILE_SYSTEM_HH__ - -#include "XrdCl/XrdClURL.hh" -#include "XrdCl/XrdClStatus.hh" -#include "XrdOuc/XrdOucEnum.hh" -#include "XrdOuc/XrdOucCompiler.hh" -#include "XrdCl/XrdClXRootDResponses.hh" -#include "XrdSys/XrdSysPthread.hh" -#include "XProtocol/XProtocol.hh" -#include -#include - -namespace XrdCl -{ - class PostMaster; - class Message; - class FileSystemPlugIn; - struct MessageSendParams; - - //---------------------------------------------------------------------------- - //! XRootD query request codes - //---------------------------------------------------------------------------- - struct QueryCode - { - //-------------------------------------------------------------------------- - //! XRootD query request codes - //-------------------------------------------------------------------------- - enum Code - { - Config = kXR_Qconfig, //!< Query server configuration - ChecksumCancel = kXR_Qckscan, //!< Query file checksum cancellation - Checksum = kXR_Qcksum, //!< Query file checksum - Opaque = kXR_Qopaque, //!< Implementation dependent - OpaqueFile = kXR_Qopaquf, //!< Implementation dependent - Prepare = kXR_QPrep, //!< Query prepare status - Space = kXR_Qspace, //!< Query logical space stats - Stats = kXR_QStats, //!< Query server stats - Visa = kXR_Qvisa, //!< Query file visa attributes - XAttr = kXR_Qxattr //!< Query file extended attributes - }; - }; - - //---------------------------------------------------------------------------- - //! Open flags, may be or'd when appropriate - //---------------------------------------------------------------------------- - struct OpenFlags - { - //-------------------------------------------------------------------------- - //! Open flags, may be or'd when appropriate - //-------------------------------------------------------------------------- - enum Flags - { - None = 0, //!< Nothing - Compress = kXR_compress, //!< Read compressed data for open (ignored), - //!< for kXR_locate return unique hosts - Delete = kXR_delete, //!< Open a new file, deleting any existing - //!< file - Force = kXR_force, //!< Ignore file usage rules, for kXR_locate - //!< it means ignoreing network dependencies - MakePath = kXR_mkpath, //!< Create directory path if it does not - //!< already exist - New = kXR_new, //!< Open the file only if it does not already - //!< exist - NoWait = kXR_nowait, //!< Open the file only if it does not cause - //!< a wait. For locate: provide a location as - //!< soon as one becomes known. This means - //!< that not all locations are necessarily - //!< returned. If the file does not exist a - //!< wait is still imposed. - Append = kXR_open_apnd, //!< Open only for appending - Read = kXR_open_read, //!< Open only for reading - Update = kXR_open_updt, //!< Open for reading and writing - Write = kXR_open_wrto, //!< Open only for writing - POSC = kXR_posc, //!< Enable Persist On Successful Close - //!< processing - Refresh = kXR_refresh, //!< Refresh the cached information on file's - //!< location. Voids NoWait. - Replica = kXR_replica, //!< The file is being opened for replica - //!< creation - SeqIO = kXR_seqio, //!< File will be read or written sequentially - PrefName = kXR_prefname //!< Hostname response is prefered, applies - //!< only to FileSystem::Locate - }; - }; - XRDOUC_ENUM_OPERATORS( OpenFlags::Flags ) - - //---------------------------------------------------------------------------- - //! Access mode - //---------------------------------------------------------------------------- - struct Access - { - //-------------------------------------------------------------------------- - //! Access mode - //-------------------------------------------------------------------------- - enum Mode - { - None = 0, - UR = kXR_ur, //!< owner readable - UW = kXR_uw, //!< owner writable - UX = kXR_ux, //!< owner executable/browsable - GR = kXR_gr, //!< group readable - GW = kXR_gw, //!< group writable - GX = kXR_gx, //!< group executable/browsable - OR = kXR_or, //!< world readable - OW = kXR_ow, //!< world writeable - OX = kXR_ox //!< world executable/browsable - }; - }; - XRDOUC_ENUM_OPERATORS( Access::Mode ) - - //---------------------------------------------------------------------------- - //! MkDir flags - //---------------------------------------------------------------------------- - struct MkDirFlags - { - enum Flags - { - None = 0, //!< Nothing special - MakePath = 1 //!< create the entire directory tree if it doesn't exist - }; - }; - XRDOUC_ENUM_OPERATORS( MkDirFlags::Flags ) - - //---------------------------------------------------------------------------- - //! DirList flags - //---------------------------------------------------------------------------- - struct DirListFlags - { - enum Flags - { - None = 0, //!< Nothing special - Stat = 1, //!< Stat each entry - Locate = 2, //!< Locate all servers hosting the directory and send - //!< the dirlist request to all of them - Recursive = 4, //!< Do a recursive listing - Merge = 8, //!< Merge duplicates - Chunked = 16, //!< Serve chunked results for better performance - Zip = 32 //!< List content of ZIP files - }; - }; - XRDOUC_ENUM_OPERATORS( DirListFlags::Flags ) - - //---------------------------------------------------------------------------- - //! Prepare flags - //---------------------------------------------------------------------------- - struct PrepareFlags - { - enum Flags - { - None = 0, //!< no flags - Colocate = kXR_coloc, //!< co-locate staged files, if possible - Fresh = kXR_fresh, //!< refresh file access time even if - //!< the location is known - Stage = kXR_stage, //!< stage the file to disk if it is not - //!< online - WriteMode = kXR_wmode, //!< the file will be accessed for - //!< modification - Cancel = kXR_cancel, //!< cancel staging request - Evict = kXR_wait << 8 //!< evict the file from disk cache - //!< we have to shift kXR_evict as its value - //!< is the same as cancel's because this - //!< flag goes to options extension - }; - }; - XRDOUC_ENUM_OPERATORS( PrepareFlags::Flags ) - - //---------------------------------------------------------------------------- - //! Send file/filesystem queries to an XRootD cluster - //---------------------------------------------------------------------------- - class FileSystem - { - friend class AssignLBHandler; - friend class ForkHandler; - - public: - typedef std::vector LocationList; //!< Location list - - //------------------------------------------------------------------------ - //! Constructor - //! - //! @param url URL of the entry-point server to be contacted - //! @param enablePlugIns enable the plug-in mechanism for this object - //------------------------------------------------------------------------ - FileSystem( const URL &url, bool enablePlugIns = true ); - - //------------------------------------------------------------------------ - //! Destructor - //------------------------------------------------------------------------ - ~FileSystem(); - - //------------------------------------------------------------------------ - //! Locate a file - async - //! - //! @param path path to the file to be located - //! @param flags some of the OpenFlags::Flags - //! @param handler handler to be notified when the response arrives, - //! the response parameter will hold a Buffer object - //! if the procedure is successful - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Locate( const std::string &path, - OpenFlags::Flags flags, - ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Locate a file - sync - //! - //! @param path path to the file to be located - //! @param flags some of the OpenFlags::Flags - //! @param response the response (to be deleted by the user) - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Locate( const std::string &path, - OpenFlags::Flags flags, - LocationInfo *&response, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Locate a file, recursively locate all disk servers - async - //! - //! @param path path to the file to be located - //! @param flags some of the OpenFlags::Flags - //! @param handler handler to be notified when the response arrives, - //! the response parameter will hold a Buffer object - //! if the procedure is successful - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus DeepLocate( const std::string &path, - OpenFlags::Flags flags, - ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Locate a file, recursively locate all disk servers - sync - //! - //! @param path path to the file to be located - //! @param flags some of the OpenFlags::Flags - //! @param response the response (to be deleted by the user) - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus DeepLocate( const std::string &path, - OpenFlags::Flags flags, - LocationInfo *&response, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Move a directory or a file - async - //! - //! @param source the file or directory to be moved - //! @param dest the new name - //! @param handler handler to be notified when the response arrives, - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Mv( const std::string &source, - const std::string &dest, - ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Move a directory or a file - sync - //! - //! @param source the file or directory to be moved - //! @param dest the new name - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Mv( const std::string &source, - const std::string &dest, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Obtain server information - async - //! - //! @param queryCode the query code as specified in the QueryCode struct - //! @param arg query argument - //! @param handler handler to be notified when the response arrives, - //! the response parameter will hold a Buffer object - //! if the procedure is successful - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Query( QueryCode::Code queryCode, - const Buffer &arg, - ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Obtain server information - sync - //! - //! @param queryCode the query code as specified in the QueryCode struct - //! @param arg query argument - //! @param response the response (to be deleted by the user) - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Query( QueryCode::Code queryCode, - const Buffer &arg, - Buffer *&response, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Truncate a file - async - //! - //! @param path path to the file to be truncated - //! @param size file size - //! @param handler handler to be notified when the response arrives - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Truncate( const std::string &path, - uint64_t size, - ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Truncate a file - sync - //! - //! @param path path to the file to be truncated - //! @param size file size - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Truncate( const std::string &path, - uint64_t size, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Remove a file - async - //! - //! @param path path to the file to be removed - //! @param handler handler to be notified when the response arrives - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Rm( const std::string &path, - ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Remove a file - sync - //! - //! @param path path to the file to be removed - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Rm( const std::string &path, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Create a directory - async - //! - //! @param path path to the directory - //! @param flags or'd MkDirFlags - //! @param mode access mode, or'd Access::Mode - //! @param handler handler to be notified when the response arrives - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus MkDir( const std::string &path, - MkDirFlags::Flags flags, - Access::Mode mode, - ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Create a directory - sync - //! - //! @param path path to the directory - //! @param flags or'd MkDirFlags - //! @param mode access mode, or'd Access::Mode - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus MkDir( const std::string &path, - MkDirFlags::Flags flags, - Access::Mode mode, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Remove a directory - async - //! - //! @param path path to the directory to be removed - //! @param handler handler to be notified when the response arrives - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus RmDir( const std::string &path, - ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Remove a directory - sync - //! - //! @param path path to the directory to be removed - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus RmDir( const std::string &path, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Change access mode on a directory or a file - async - //! - //! @param path file/directory path - //! @param mode access mode, or'd Access::Mode - //! @param handler handler to be notified when the response arrives - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus ChMod( const std::string &path, - Access::Mode mode, - ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Change access mode on a directory or a file - sync - //! - //! @param path file/directory path - //! @param mode access mode, or'd Access::Mode - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus ChMod( const std::string &path, - Access::Mode mode, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Check if the server is alive - async - //! - //! @param handler handler to be notified when the response arrives - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Ping( ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Check if the server is alive - sync - //! - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Ping( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Obtain status information for a path - async - //! - //! @param path file/directory path - //! @param handler handler to be notified when the response arrives, - //! the response parameter will hold a StatInfo object - //! if the procedure is successful - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Stat( const std::string &path, - ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Obtain status information for a path - sync - //! - //! @param path file/directory path - //! @param response the response (to be deleted by the user only if the - //! procedure is successful) - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Stat( const std::string &path, - StatInfo *&response, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Obtain status information for a Virtual File System - async - //! - //! @param path file/directory path - //! @param handler handler to be notified when the response arrives, - //! the response parameter will hold a StatInfoVFS object - //! if the procedure is successful - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus StatVFS( const std::string &path, - ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Obtain status information for a Virtual File System - sync - //! - //! @param path file/directory path - //! @param response the response (to be deleted by the user) - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus StatVFS( const std::string &path, - StatInfoVFS *&response, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Obtain server protocol information - async - //! - //! @param handler handler to be notified when the response arrives, - //! the response parameter will hold a ProtocolInfo object - //! if the procedure is successful - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Protocol( ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Obtain server protocol information - sync - //! - //! @param response the response (to be deleted by the user) - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Protocol( ProtocolInfo *&response, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! List entries of a directory - async - //! - //! @param path directory path - //! @param flags currently unused - //! @param handler handler to be notified when the response arrives, - //! the response parameter will hold a DirectoryList - //! object if the procedure is successful - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus DirList( const std::string &path, - DirListFlags::Flags flags, - ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! List entries of a directory - sync - //! - //! @param path directory path - //! @param flags DirListFlags - //! @param response the response (to be deleted by the user) - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus DirList( const std::string &path, - DirListFlags::Flags flags, - DirectoryList *&response, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Send info to the server (up to 1024 characters)- async - //! - //! @param info the info string to be sent - //! @param handler handler to be notified when the response arrives, - //! the response parameter will hold a Buffer object - //! if the procedure is successful - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus SendInfo( const std::string &info, - ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Send info to the server (up to 1024 characters) - sync - //! - //! @param info the info string to be sent - //! @param response the response (to be deleted by the user) - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus SendInfo( const std::string &info, - Buffer *&response, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Prepare one or more files for access - async - //! - //! @param fileList list of files to be prepared - //! @param flags PrepareFlags::Flags - //! @param priority priority of the request 0 (lowest) - 3 (highest) - //! @param handler handler to be notified when the response arrives, - //! the response parameter will hold a Buffer object - //! if the procedure is successful - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Prepare( const std::vector &fileList, - PrepareFlags::Flags flags, - uint8_t priority, - ResponseHandler *handler, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Prepare one or more files for access - sync - //! - //! @param fileList list of files to be prepared - //! @param flags PrepareFlags::Flags - //! @param priority priority of the request 0 (lowest) - 3 (highest) - //! @param response the response (to be deleted by the user) - //! @param timeout timeout value, if 0 the environment default will - //! be used - //! @return status of the operation - //------------------------------------------------------------------------ - XRootDStatus Prepare( const std::vector &fileList, - PrepareFlags::Flags flags, - uint8_t priority, - Buffer *&response, - uint16_t timeout = 0 ) - XRD_WARN_UNUSED_RESULT; - - //------------------------------------------------------------------------ - //! Set filesystem property - //! - //! Filesystem properties: - //! FollowRedirects [true/false] - enable/disable following redirections - //------------------------------------------------------------------------ - bool SetProperty( const std::string &name, const std::string &value ); - - //------------------------------------------------------------------------ - //! Get filesystem property - //! - //! @see FileSystem::SetProperty for property list - //------------------------------------------------------------------------ - bool GetProperty( const std::string &name, std::string &value ) const; - - private: - FileSystem(const FileSystem &other); - FileSystem &operator = (const FileSystem &other); - - //------------------------------------------------------------------------ - // Send a message in a locked environment - //------------------------------------------------------------------------ - Status Send( Message *msg, - ResponseHandler *handler, - MessageSendParams ¶ms ); - - //------------------------------------------------------------------------ - // Assign a load balancer if it has not already been assigned - //------------------------------------------------------------------------ - void AssignLoadBalancer( const URL &url ); - - //------------------------------------------------------------------------ - // Lock the internal lock - //------------------------------------------------------------------------ - void Lock() - { - pMutex.Lock(); - } - - //------------------------------------------------------------------------ - // Unlock the internal lock - //------------------------------------------------------------------------ - void UnLock() - { - pMutex.UnLock(); - } - - XrdSysMutex pMutex; - bool pLoadBalancerLookupDone; - bool pFollowRedirects; - URL *pUrl; - FileSystemPlugIn *pPlugIn; - }; -} - -#endif // __XRD_CL_FILE_SYSTEM_HH__ From b9712c6ca2300837223ab1058f736947d303394e Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Thu, 5 Nov 2020 19:48:14 +0200 Subject: [PATCH 12/19] Update jet_correction_analyzer_x.cc --- JetAnalyzers/bin/jet_correction_analyzer_x.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/JetAnalyzers/bin/jet_correction_analyzer_x.cc b/JetAnalyzers/bin/jet_correction_analyzer_x.cc index 804f80fa..33a19c37 100644 --- a/JetAnalyzers/bin/jet_correction_analyzer_x.cc +++ b/JetAnalyzers/bin/jet_correction_analyzer_x.cc @@ -18,8 +18,8 @@ #include "CondFormats/JetMETObjects/interface/FactorizedJetCorrector.h" #include "PhysicsTools/Utilities/interface/LumiReWeighting.h" #if __has_include("xrootd/XrdCl/XrdClFileSystem.hh") -//#include "xrootd/XrdCl/XrdClFileSystem.hh" -#include "JetMETAnalysis/JetAnalyzers/XrdClFileSystem_v2.hh" +#include "xrootd/XProtocol/XProtocol.hh" +#include "xrootd/XrdCl/XrdClFileSystem.hh" #define has_xrdcl 1 #else #define has_xrdcl 0 From dbf79afd322609690b19831d6e12d0cb8df0cc4d Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Fri, 20 Nov 2020 12:10:49 +0200 Subject: [PATCH 13/19] Update JetResponseAnalyzer.hh --- JetAnalyzers/interface/JetResponseAnalyzer.hh | 2 -- 1 file changed, 2 deletions(-) diff --git a/JetAnalyzers/interface/JetResponseAnalyzer.hh b/JetAnalyzers/interface/JetResponseAnalyzer.hh index 2834f9a8..ac3adb7d 100644 --- a/JetAnalyzers/interface/JetResponseAnalyzer.hh +++ b/JetAnalyzers/interface/JetResponseAnalyzer.hh @@ -102,10 +102,8 @@ private: edm::EDGetTokenT srcVtx_; edm::EDGetTokenT srcGenInfo_; edm::EDGetTokenT > srcPileupInfo_; - //edm::EDGetTokenT > srcPFCandidates_; edm::EDGetTokenT srcPFCandidates_; edm::EDGetTokenT > > srcPFCandidatesAsFwdPtr_; -// edm::EDGetTokenT > srcGenParticles_; edm::EDGetTokenT > srcGenParticles_; std::string jecLabel_; From a80a146e4180f1ecd04b87442dee3e81c9a8ecbd Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Fri, 20 Nov 2020 12:13:59 +0200 Subject: [PATCH 14/19] Update JetReconstruction_cff.py --- JetAnalyzers/python/JetReconstruction_cff.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/JetAnalyzers/python/JetReconstruction_cff.py b/JetAnalyzers/python/JetReconstruction_cff.py index 6e10c970..51d89a82 100644 --- a/JetAnalyzers/python/JetReconstruction_cff.py +++ b/JetAnalyzers/python/JetReconstruction_cff.py @@ -87,8 +87,6 @@ #! #! PF JETS CHS #! - - ak1PFCHSJets = ak1PFJets.clone( src = 'pfCHS' ) ak2PFCHSJets = ak1PFCHSJets.clone( rParam=0.2 ) ak3PFCHSJets = ak1PFCHSJets.clone( rParam=0.3 ) From 34aebadb66d136892bbf8ba5bbfa87db8b3e6187 Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Fri, 20 Nov 2020 12:30:52 +0200 Subject: [PATCH 15/19] Update addAlgorithm.py --- JetAnalyzers/python/addAlgorithm.py | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/JetAnalyzers/python/addAlgorithm.py b/JetAnalyzers/python/addAlgorithm.py index eb09765e..f27defbf 100644 --- a/JetAnalyzers/python/addAlgorithm.py +++ b/JetAnalyzers/python/addAlgorithm.py @@ -22,8 +22,6 @@ from CommonTools.PileupAlgos.Puppi_cff import * from JetMETAnalysis.JetAnalyzers.customizePuppiTune_cff import * - - genParticlesForJetsNoNu.src = cms.InputTag("packedGenParticles") stdClusteringAlgorithms = ['ak'] #Options: {ak,kt} @@ -107,7 +105,6 @@ stdRecJetsDict['ak5tauHPSall'] = 'hpsPFTauProducer' recJetsDict['ak5tauHPSall'] = ('hpsPFTauProducer', hpsPFTauProducer) - tauDiscriminatorDict = { "ak5tauHPSlooseCombDBcorr" : "hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits", "ak5tauHPSmediumCombDBcorr" : "hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr3Hits", @@ -394,20 +391,7 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): puppiCentral[0].applyLowPUCorr = cms.bool(False) puppiForward[0].applyLowPUCorr = cms.bool(False) puppi.vertexName = "offlineSlimmedPrimaryVertices" - - #UpdatePuppiTuneV14(process) - - - - #puppi.UseFromPVLooseTight = cms.bool(False) - #puppi.UseDeltaZCut = cms.bool(False) - #puppi.PtMaxCharged = cms.double(20.) - #puppi.EtaMaxCharged = cms.double(2.5) - #puppi.PtMaxNeutralsStartSlope = cms.double(20.) - sequence = cms.Sequence(puppi * sequence) - - #sequence = cms.Sequence(process.puppiMETSequence * process.fullPatMetSequencePuppi * process.patPuppiJetSpecificProducer * process.slimmedJetsPuppi * sequence) if type == 'Track': process.load('JetMETAnalysis.JetAnalyzers.TrackJetReconstruction_cff') sequence = cms.Sequence(trackJetSequence * sequence) @@ -601,11 +585,8 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): setattr(process,alg_size_type_corr,jra) sequence = cms.Sequence(sequence * jra) - - sequence = cms.Sequence(sequence) setattr(process, alg_size_type_corr + 'Sequence', sequence) path = cms.Path( sequence ) - setattr(process, alg_size_type_corr + 'Path', path) - + setattr(process, alg_size_type_corr + 'Path', path) print alg_size_type_corr From e1fb6303a0ae5f40f5a2ba61803f9294c3b6e28d Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Fri, 20 Nov 2020 12:37:29 +0200 Subject: [PATCH 16/19] Update JetResponseAnalyzer.cc --- JetAnalyzers/src/JetResponseAnalyzer.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/JetAnalyzers/src/JetResponseAnalyzer.cc b/JetAnalyzers/src/JetResponseAnalyzer.cc index 09214521..35bc0afe 100644 --- a/JetAnalyzers/src/JetResponseAnalyzer.cc +++ b/JetAnalyzers/src/JetResponseAnalyzer.cc @@ -115,10 +115,6 @@ void JetResponseAnalyzer::beginJob() } - - - - void getMult( vector const & particles, int* nMult, int* chMult ) { vector::const_iterator itParticle; @@ -301,7 +297,7 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, JRAEvt_->refdphijt->push_back(reco::deltaPhi(jet->phi(),ref->phi())); else JRAEvt_->refdrjt->push_back(reco::deltaR(jet->eta(),jet->phi(),ref->eta(),ref->phi())); - + if ((!doBalancing_&&JRAEvt_->refdrjt->at(JRAEvt_->nref)>deltaRMax_)|| (doBalancing_&&std::abs(JRAEvt_->refdphijt->at(JRAEvt_->nref))refdphijt->pop_back(); @@ -309,11 +305,9 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, continue; } JRAEvt_->refpdgid->push_back(0); - if (getFlavorFromMap_) { JRAEvt_->refpdgid_algorithmicDef->push_back(0); JRAEvt_->refpdgid_physicsDef->push_back(0); - reco::JetMatchedPartonsCollection::const_iterator itPartonMatch; itPartonMatch=refToPartonMap->begin(); for (;itPartonMatch!=refToPartonMap->end();++itPartonMatch) { @@ -322,7 +316,7 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, const reco::Candidate* cand = &(*jetRef); if (cand==&(*ref)) break; } - + if (itPartonMatch!=refToPartonMap->end()&& itPartonMatch->second.algoDefinitionParton().get()!=0&& itPartonMatch->second.physicsDefinitionParton().get()!=0) { @@ -480,7 +474,7 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, JRAEvt_->jtmuf ->push_back(pfJetRef->muonEnergyFraction() *JRAEvt_->jtjec->at(JRAEvt_->nref)); JRAEvt_->jthfhf->push_back(pfJetRef->HFHadronEnergyFraction() *JRAEvt_->jtjec->at(JRAEvt_->nref)); JRAEvt_->jthfef->push_back(pfJetRef->HFEMEnergyFraction() *JRAEvt_->jtjec->at(JRAEvt_->nref)); -int chMult=0, nMult=0; + int chMult=0, nMult=0; getMult( ref.castTo()->getJetConstituents(), &nMult, &chMult ); JRAEvt_->refnMult ->push_back( nMult ); JRAEvt_->refchMult->push_back( chMult ); @@ -534,7 +528,7 @@ int chMult=0, nMult=0; } } tree_->Fill(); - + return; } From 28e40e4d118a1c27365d2c66131ab5372341f632 Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Fri, 20 Nov 2020 12:42:05 +0200 Subject: [PATCH 17/19] Update JRAEvent.h --- JetUtilities/interface/JRAEvent.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/JetUtilities/interface/JRAEvent.h b/JetUtilities/interface/JRAEvent.h index c6308c13..0ea7f1cd 100644 --- a/JetUtilities/interface/JRAEvent.h +++ b/JetUtilities/interface/JRAEvent.h @@ -80,8 +80,8 @@ public : vector* refpdgid_physicsDef; vector* refe; vector* refpt; - vector* refnMult; - vector* refchMult; + vector* refnMult; + vector* refchMult; vector* refeta; vector* refphi; vector* refy; @@ -90,8 +90,8 @@ public : vector* refarea; vector* jte; vector* jtpt; - vector* jtnMult; - vector* jtchMult; + vector* jtnMult; + vector* jtchMult; vector* jteta; vector* jtphi; vector* jty; From 95ad4db5601191daa8618953e8faa6af003e35e1 Mon Sep 17 00:00:00 2001 From: izisopou <54803536+izisopou@users.noreply.github.com> Date: Sun, 22 Nov 2020 12:18:35 +0200 Subject: [PATCH 18/19] Update Defaults_cff.py --- JetAnalyzers/python/Defaults_cff.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/JetAnalyzers/python/Defaults_cff.py b/JetAnalyzers/python/Defaults_cff.py index d8551c3c..c43f02a8 100644 --- a/JetAnalyzers/python/Defaults_cff.py +++ b/JetAnalyzers/python/Defaults_cff.py @@ -30,9 +30,9 @@ doJetPt = cms.bool(True), saveCandidates = cms.bool(False), # MATCHING MODE: deltaR(ref,jet) - deltaRMax = cms.double(0.4), + deltaRMax = cms.double(0.25), # deltaR(ref,parton) IF doFlavor is True - deltaRPartonMax = cms.double(0.4), + deltaRPartonMax = cms.double(0.25), # consider all matched references nRefMax = cms.uint32(0), # is the sample an HLT sample @@ -76,7 +76,7 @@ dobalance = cms.bool(False), doflavor = cms.bool(False), noabsflavors = cms.bool(False), - drmax = cms.double(0.4), + drmax = cms.double(0.3), dphimin = cms.double(2.7), dojetpt = cms.bool(False), dorefpt = cms.bool(True), From c30dca5cc0b5a590f04985cd0a08a17bf5657a38 Mon Sep 17 00:00:00 2001 From: izisopou Date: Tue, 30 Nov 2021 11:31:14 +0100 Subject: [PATCH 19/19] Update HistogramUtilities.cc --- JetUtilities/src/HistogramUtilities.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/JetUtilities/src/HistogramUtilities.cc b/JetUtilities/src/HistogramUtilities.cc index bd4c23a4..ef2a4788 100644 --- a/JetUtilities/src/HistogramUtilities.cc +++ b/JetUtilities/src/HistogramUtilities.cc @@ -117,7 +117,7 @@ namespace HistUtil { b[i] = hist->GetBinLowEdge(i+1); } Double_t median = Median(nbins,x,y,b,0,debug); - // Set the error equal to the difference between the median and the bin boundary +/* // Set the error equal to the difference between the median and the bin boundary // Choose the difference which is biggest // We cannot determine the exact median from binned values // The best we can do is a linear approximation of where inside the bin the median resides @@ -126,14 +126,27 @@ namespace HistUtil { Double_t width = hist->GetBinWidth(hist->FindBin(median)); Double_t high_edge = hist->GetBinLowEdge(hist->FindBin(median)) + width; Double_t error = std::max(std::abs(median-low_edge),std::abs(high_edge-median)); +*/ + + // The error on the median is non-trivial + // We use the "standard" relationship http://davidmlane.com/hyperstat/A106993.html + // for the error. But this only works if your distribution is ~normal. + // Fine binning is better to more precisely calculate the median & RMS + // EffectiveEntries is used to account for weights + Double_t error = 1.253 * hist->GetRMS() / TMath::Sqrt(hist->GetEffectiveEntries()); + if (debug) { - cout << "\tlow_dege: " << low_edge << endl << "\thigh_edge: " << high_edge << endl + /* cout << "\tlow_dege: " << low_edge << endl << "\thigh_edge: " << high_edge << endl << "\twidth: " << width << endl << "\terror: " << error << endl; cout << "\tdouble check error: " << std::max(std::abs(median-low_edge),std::abs(high_edge-median)) << endl << "\tabs(median-low_edge): " << std::abs(median-low_edge) << endl << "\tabs(high_edge-median): " << std::abs(high_edge-median) << endl << "\tmedian-low_edge: " << median-low_edge << endl << "\thigh_edge-median: " << high_edge-median << endl; +*/ + cout << "\terror: " << error << endl; + cout << "\tRMS: " << hist->GetRMS() << endl + << "\tentries: " << hist->GetEffectiveEntries() << endl; } delete [] x; delete [] y;