diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaGammaJetProducer.cc b/Calibration/HcalAlCaRecoProducers/src/AlCaGammaJetProducer.cc index 42e938ee7a1aa..fe6215241b521 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaGammaJetProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/src/AlCaGammaJetProducer.cc @@ -104,9 +104,9 @@ AlCaGammaJetProducer::AlCaGammaJetProducer(const edm::ParameterSet& iConfig) : n tok_loosePhoton_ = consumes >(labelLoosePhot_); tok_tightPhoton_ = consumes >(labelTightPhot_); tok_GsfElec_ = consumes(labelGsfEle_); - tok_Rho_ = consumes(labelRho_); - tok_Conv_ = consumes(labelConv_); - tok_BS_ = consumes(labelBeamSpot_); + tok_Rho_ = consumes(labelRho_); + tok_Conv_ = consumes(labelConv_); + tok_BS_ = consumes(labelBeamSpot_); // register your products produces(labelPhoton_.encode()); @@ -275,7 +275,6 @@ void AlCaGammaJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iS std::auto_ptr > miniLoosePhoton(new std::vector()); std::auto_ptr > miniTightPhoton(new std::vector()); - // See if this event is useful bool accept = select(photon, pfjets); if (accept) { @@ -355,24 +354,24 @@ void AlCaGammaJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iS } } } - } - //Put them in the event - iEvent.put( miniPhotonCollection, labelPhoton_.encode()); - iEvent.put( miniPFjetCollection, labelPFJet_.encode()); - iEvent.put( miniHBHECollection, labelHBHE_.encode()); - iEvent.put( miniHFCollection, labelHF_.encode()); - iEvent.put( miniHOCollection, labelHO_.encode()); - iEvent.put( miniTriggerCollection, labelTrigger_.encode()); - iEvent.put( miniPFCandCollection, labelPFCandidate_.encode()); - iEvent.put( miniVtxCollection, labelVertex_.encode()); - iEvent.put( miniPFMETCollection, labelPFMET_.encode()); - iEvent.put( miniGSFeleCollection, labelGsfEle_.encode()); - iEvent.put( miniRhoCollection, labelRho_.encode()); - iEvent.put( miniConversionCollection, labelConv_.encode()); - iEvent.put( miniBeamSpotCollection, labelBeamSpot_.encode()); - iEvent.put( miniLoosePhoton, labelLoosePhot_.encode()); - iEvent.put( miniTightPhoton, labelTightPhot_.encode()); + //Put them in the event + iEvent.put( miniPhotonCollection, labelPhoton_.encode()); + iEvent.put( miniPFjetCollection, labelPFJet_.encode()); + iEvent.put( miniHBHECollection, labelHBHE_.encode()); + iEvent.put( miniHFCollection, labelHF_.encode()); + iEvent.put( miniHOCollection, labelHO_.encode()); + iEvent.put( miniTriggerCollection, labelTrigger_.encode()); + iEvent.put( miniPFCandCollection, labelPFCandidate_.encode()); + iEvent.put( miniVtxCollection, labelVertex_.encode()); + iEvent.put( miniPFMETCollection, labelPFMET_.encode()); + iEvent.put( miniGSFeleCollection, labelGsfEle_.encode()); + iEvent.put( miniRhoCollection, labelRho_.encode()); + iEvent.put( miniConversionCollection, labelConv_.encode()); + iEvent.put( miniBeamSpotCollection, labelBeamSpot_.encode()); + iEvent.put( miniLoosePhoton, labelLoosePhot_.encode()); + iEvent.put( miniTightPhoton, labelTightPhot_.encode()); + } return; diff --git a/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.cc b/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.cc index a0e51dbab8bf3..beaf62711fa29 100644 --- a/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.cc +++ b/Calibration/HcalCalibAlgos/src/GammaJetAnalysis.cc @@ -181,7 +181,7 @@ GammaJetAnalysis::~GammaJetAnalysis() {} void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup) { nProcessed_++; - LogDebug("GammaJetAnalysis") << "nProcessed=" << nProcessed_ << "\n"; + edm::LogInfo("GammaJetAnalysis") << "nProcessed=" << nProcessed_ << "\n"; // 1st. Get Photons // edm::Handle photons; @@ -193,12 +193,12 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& } if ((photons->size()==0) && !allowNoPhoton_) { - if (debug_>0) LogDebug("GammaJetAnalysis") << "No photons in the event"; + if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "No photons in the event"; return; } nPhotons_= photons->size(); - LogDebug("GammaJetAnalysis") << "nPhotons_=" << nPhotons_; + edm::LogInfo("GammaJetAnalysis") << "nPhotons_=" << nPhotons_; // Get photon quality flags edm::Handle > loosePhotonQual, tightPhotonQual; @@ -236,7 +236,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& HERE(Form("photonpairset.size=%d",int(photonpairset.size()))); if ((photonpairset.size()==0) && !allowNoPhoton_) { - if (debug_>0) LogDebug("GammaJetAnalysis") << "No good quality photons in the event"; + if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "No good quality photons in the event"; return; } @@ -265,7 +265,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& // cut on photon pt if (photon_tag.isValid() && ( photon_tag.pt() < photonPtMin_ )) { - if (debug_>0) LogDebug("GammaJetAnalysis") << "largest photonPt=" << photon_tag.pt(); + if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "largest photonPt=" << photon_tag.pt(); return; } @@ -291,11 +291,11 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& HERE(Form("anyJetCount=%d",anyJetCount)); if (anyJetCount==0) { - if (debug_>0) LogDebug("GammaJetAnalysis") << "Event contains no jets"; + if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "Event contains no jets"; return; } - if (debug_>0) LogDebug("GammaJetAnalysis") << "nPhotons=" << nPhotons_ << ", nPFJets=" - << nPFJets_; + if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "nPhotons=" << nPhotons_ + << ", nPFJets=" << nPFJets_; HERE(Form("nPhotons_=%d, nPFJets_=%d",nPhotons_,nPFJets_)); @@ -327,14 +327,14 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& const edm::TriggerNames &evTrigNames =iEvent.triggerNames(*triggerResults); if (debugHLTTrigNames>0) { - if (debug_>1) LogDebug("GammaJetAnalysis") << "debugHLTTrigNames is on"; + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "debugHLTTrigNames is on"; const std::vector *trNames= & evTrigNames.triggerNames(); for (size_t i=0; isize(); ++i) { if (trNames->at(i).find("_Photon")!=std::string::npos) { - if (debug_>1) LogDebug("GammaJetAnalysis") << " - " << trNames->at(i); + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << " - " << trNames->at(i); } } - if (debug_>1) LogDebug("GammaJetAnalysis") << " "; + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << " "; debugHLTTrigNames--; } @@ -374,7 +374,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& } if (!photonTrigFlag && !jetTrigFlag) { - if (debug_>0) LogDebug("GammaJetAnalysis") << "no trigger fired"; + if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "no trigger fired"; return; } @@ -514,8 +514,9 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& tagPho_idTight_ = (tightPhotonQual_Vec.isValid()) ? tightPhotonQual_Vec->at(photon_tag.idx()) : -1; } - if (debug_>1) LogDebug("GammaJetAnalysis") << "photon tag ID = " << tagPho_idLoose_ - << " and " << tagPho_idTight_; + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "photon tag ID = " + << tagPho_idLoose_ << " and " + << tagPho_idTight_; HERE(Form("tagPhoID= %d and %d",tagPho_idLoose_,tagPho_idTight_)); @@ -595,8 +596,9 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& for(edm::SortedCollection>::const_iterator ith=hbhereco->begin(); ith!=hbhereco->end(); ++ith){ HBHE_n++; if(iEvent.id().event() == debugEvent){ - if (debug_>1) LogDebug("GammaJetAnalysis") << (*ith).id().ieta() << " " - << (*ith).id().iphi(); + if (debug_>1) + edm::LogInfo("GammaJetAnalysis") << (*ith).id().ieta() << " " + << (*ith).id().iphi(); } } } @@ -951,10 +953,10 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& int HFEM_n_ = 0; int HF_type_ = 0; int maxElement=(*it)->elementsInBlocks().size(); - if (debug_>1) LogDebug("GammaJetAnalysis") << "maxElement=" << maxElement; + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "maxElement=" << maxElement; if (workOnAOD_==1) { maxElement=0; - if (debug_>1) LogDebug("GammaJetAnalysis") << "forced 0"; + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "forced 0"; } HERE(Form("maxElement=%d",maxElement)); for(int e=0; egetCorners(); float avgeta = (cv[0].eta() + cv[2].eta())/2.0; float avgphi = (static_cast(cv[0].phi()) + static_cast(cv[2].phi()))/2.0; - if((cv[0].phi() < cv[2].phi()) && (debug_>1)) LogDebug("GammaJetAnalysis") << "pHB" << cv[0].phi() << " " << cv[2].phi(); + if((cv[0].phi() < cv[2].phi()) && (debug_>1)) edm::LogInfo("GammaJetAnalysis") << "pHB" << cv[0].phi() << " " << cv[2].phi(); if(cv[0].phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast(cv[0].phi()) + static_cast(cv[2].phi()))/2.0; ppfjet_twr_dR_.push_back(deltaR(ppfjet_eta_,ppfjet_phi_,avgeta,avgphi)); break; @@ -1023,7 +1025,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& const CaloCellGeometry::CornersVec& cv = thisCell->getCorners(); float avgeta = (cv[0].eta() + cv[2].eta())/2.0; float avgphi = (static_cast(cv[0].phi()) + static_cast(cv[2].phi()))/2.0; - if((cv[0].phi() < cv[2].phi()) && (debug_>1)) LogDebug("GammaJetAnalysis") << "pHE" << cv[0].phi() << " " << cv[2].phi(); + if((cv[0].phi() < cv[2].phi()) && (debug_>1)) edm::LogInfo("GammaJetAnalysis") << "pHE" << cv[0].phi() << " " << cv[2].phi(); if(cv[0].phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast(cv[0].phi()) + static_cast(cv[2].phi()))/2.0; ppfjet_twr_dR_.push_back(deltaR(ppfjet_eta_,ppfjet_phi_,avgeta,avgphi)); break; @@ -1082,7 +1084,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& ppfjet_twr_candtrackind_.push_back(-1); float avgeta = (cv[0].eta() + cv[2].eta())/2.0; float avgphi = (static_cast(cv[0].phi()) + static_cast(cv[2].phi()))/2.0; - if((cv[0].phi() < cv[2].phi()) && (debug_>1)) LogDebug("GammaJetAnalysis") << "pHFhad" << cv[0].phi() << " " << cv[2].phi(); + if((cv[0].phi() < cv[2].phi()) && (debug_>1)) edm::LogInfo("GammaJetAnalysis") << "pHFhad" << cv[0].phi() << " " << cv[2].phi(); if(cv[0].phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast(cv[0].phi()) + static_cast(cv[2].phi()))/2.0; ppfjet_twr_dR_.push_back(deltaR(ppfjet_eta_,ppfjet_phi_,avgeta,avgphi)); ++ppfjet_ntwrs_; @@ -1124,7 +1126,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& ppfjet_twr_candtrackind_.push_back(-1); float avgeta = (cv[0].eta() + cv[2].eta())/2.0; float avgphi = (static_cast(cv[0].phi()) + static_cast(cv[2].phi()))/2.0; - if((cv[0].phi() < cv[2].phi()) && (debug_>1)) LogDebug("GammaJetAnalysis") << "pHFem" << cv[0].phi() << " " << cv[2].phi(); + if((cv[0].phi() < cv[2].phi()) && (debug_>1)) edm::LogInfo("GammaJetAnalysis") << "pHFem" << cv[0].phi() << " " << cv[2].phi(); if(cv[0].phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast(cv[0].phi()) + static_cast(cv[2].phi()))/2.0; ppfjet_twr_dR_.push_back(deltaR(ppfjet_eta_,ppfjet_phi_,avgeta,avgphi)); ++ppfjet_ntwrs_; @@ -1178,7 +1180,7 @@ void GammaJetAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& const CaloCellGeometry::CornersVec& cv = thisCell->getCorners(); float avgeta = (cv[0].eta() + cv[2].eta())/2.0; float avgphi = (static_cast(cv[0].phi()) + static_cast(cv[2].phi()))/2.0; - if((cv[0].phi() < cv[2].phi()) && (debug_>1)) LogDebug("GammaJetAnalysis") << "pHO" << cv[0].phi() << " " << cv[2].phi(); + if((cv[0].phi() < cv[2].phi()) && (debug_>1)) edm::LogInfo("GammaJetAnalysis") << "pHO" << cv[0].phi() << " " << cv[2].phi(); if(cv[0].phi() < cv[2].phi()) avgphi = (2.0*3.141592653 + static_cast(cv[0].phi()) + static_cast(cv[2].phi()))/2.0; ppfjet_twr_dR_.push_back(deltaR(ppfjet_eta_,ppfjet_phi_,avgeta,avgphi)); @@ -1566,9 +1568,8 @@ GammaJetAnalysis::endJob() { // --------------------------------------------------------------------- void GammaJetAnalysis::beginRun(const edm::Run &iRun, - const edm::EventSetup &setup) -{ - if (debug_>1) LogDebug("GammaJetAnalysis") << "beginRun()"; + const edm::EventSetup &setup) { + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "beginRun()"; if (!ignoreHLT_) { int noPhotonTrigger= (photonTrigNamesV_.size()==0) ? 1:0; @@ -1581,17 +1582,16 @@ void GammaJetAnalysis::beginRun(const edm::Run &iRun, (jetTrigNamesV_[0].length()==0)) noJetTrigger=1; if (noPhotonTrigger && noJetTrigger) { ignoreHLT_=true; - if (debug_>1) LogDebug("GammaJetAnalysis") << "HLT trigger ignored: no trigger requested"; + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "HLT trigger ignored: no trigger requested"; } - } - else { + } else { // clear trigger names, if needed photonTrigNamesV_.clear(); jetTrigNamesV_.clear(); } if (!ignoreHLT_) { - if (debug_>0) LogDebug("GammaJetAnalysis") << "Initializing trigger information for individual run"; + if (debug_>0) edm::LogInfo("GammaJetAnalysis") << "Initializing trigger information for individual run"; bool changed(true); std::string processName="HLT"; if (hltConfig_.init(iRun,setup,processName,changed)) { @@ -1616,7 +1616,7 @@ void GammaJetAnalysis::beginRun(const edm::Run &iRun, // helper function float GammaJetAnalysis::pfEcalIso(const reco::Photon* localPho1, edm::Handle pfHandle, float dRmax, float dRVetoBarrel, float dRVetoEndcap, float etaStripBarrel, float etaStripEndcap, float energyBarrel, float energyEndcap, reco::PFCandidate::ParticleType pfToUse) { - if (debug_>1) LogDebug("GammaJetAnalysis") << "Inside pfEcalIso"; + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "Inside pfEcalIso"; reco::Photon* localPho = localPho1->clone(); float dRVeto; float etaStrip; @@ -1671,7 +1671,7 @@ float GammaJetAnalysis::pfEcalIso(const reco::Photon* localPho1, edm::Handle pfHandle,float dRmax, float dRveto,reco::PFCandidate::ParticleType pfToUse) { - if (debug_>1) LogDebug("GammaJetAnalysis") << "Inside pfHcalIso"; + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "Inside pfHcalIso"; return pfEcalIso(localPho, pfHandle, dRmax, dRveto, dRveto, 0.0, 0.0, 0.0, 0.0, pfToUse); } @@ -1680,7 +1680,7 @@ float GammaJetAnalysis::pfHcalIso(const reco::Photon* localPho,edm::Handle GammaJetAnalysis::pfTkIsoWithVertex(const reco::Photon* localPho1, edm::Handle pfHandle, edm::Handle vtxHandle, float dRmax, float dRvetoBarrel, float dRvetoEndcap, float ptMin, float dzMax, float dxyMax, reco::PFCandidate::ParticleType pfToUse) { - if (debug_>1) LogDebug("GammaJetAnalysis") << "Inside pfTkIsoWithVertex()"; + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "Inside pfTkIsoWithVertex()"; reco::Photon* localPho = localPho1->clone(); float dRveto; @@ -1693,50 +1693,55 @@ std::vector GammaJetAnalysis::pfTkIsoWithVertex(const reco::Photon* local const reco::PFCandidateCollection* forIsolation = pfHandle.product(); //Calculate isolation sum separately for each vertex - if (debug_>1) LogDebug("GammaJetAnalysis") << "vtxHandle->size() = " << vtxHandle->size(); + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "vtxHandle->size() = " << vtxHandle->size(); for(unsigned int ivtx=0; ivtx<(vtxHandle->size()); ++ivtx) { - if (debug_>1) LogDebug("GammaJetAnalysis") << "Vtx " << ivtx; + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "Vtx " << ivtx; // Shift the photon according to the vertex reco::VertexRef vtx(vtxHandle, ivtx); math::XYZVector photon_directionWrtVtx(localPho->superCluster()->x() - vtx->x(), localPho->superCluster()->y() - vtx->y(), localPho->superCluster()->z() - vtx->z()); - if (debug_>1) LogDebug("GammaJetAnalysis") << "pfTkIsoWithVertex :: Will Loop over the PFCandidates"; + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "pfTkIsoWithVertex :: Will Loop over the PFCandidates"; float sum = 0; // Loop over the PFCandidates for(unsigned i=0; isize(); i++) { - if (debug_>1) LogDebug("GammaJetAnalysis") << "inside loop"; + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "inside loop"; const reco::PFCandidate& pfc = (*forIsolation)[i]; //require that PFCandidate is a charged hadron - if (debug_>1) LogDebug("GammaJetAnalysis") << "pfToUse=" << pfToUse; - if (debug_>1) LogDebug("GammaJetAnalysis") << "pfc.particleId()=" << pfc.particleId(); + if (debug_>1) { + edm::LogInfo("GammaJetAnalysis") << "pfToUse=" << pfToUse; + edm::LogInfo("GammaJetAnalysis") << "pfc.particleId()=" << pfc.particleId(); + } if (pfc.particleId() == pfToUse) { - if (debug_>1) LogDebug("GammaJetAnalysis") << "\n ***** HERE pfc.particleId() == pfToUse "; - if (debug_>1) LogDebug("GammaJetAnalysis") << "pfc.pt()=" << pfc.pt(); - if (pfc.pt() < ptMin) - continue; + if (debug_>1) { + edm::LogInfo("GammaJetAnalysis") << "\n ***** HERE pfc.particleId() == pfToUse "; + edm::LogInfo("GammaJetAnalysis") << "pfc.pt()=" << pfc.pt(); + } + if (pfc.pt() < ptMin) continue; float dz = fabs(pfc.trackRef()->dz(vtx->position())); - if (dz > dzMax) continue; + if (dz > dzMax) continue; float dxy = fabs(pfc.trackRef()->dxy(vtx->position())); if(fabs(dxy) > dxyMax) continue; float dR = deltaR(photon_directionWrtVtx.Eta(), photon_directionWrtVtx.Phi(), pfc.momentum().Eta(), pfc.momentum().Phi()); if(dR > dRmax || dR < dRveto) continue; sum += pfc.pt(); - if (debug_>1) LogDebug("GammaJetAnalysis") << "pt=" << pfc.pt(); + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "pt=" << pfc.pt(); } } - if (debug_>1) LogDebug("GammaJetAnalysis") << "sum=" << sum; + if (debug_>1) edm::LogInfo("GammaJetAnalysis") << "sum=" << sum; sum = sum*1.0; result.push_back(sum); } - if (debug_>1) LogDebug("GammaJetAnalysis") << "Will return result"; - if (debug_>1) LogDebug("GammaJetAnalysis") << "result" << &result; + if (debug_>1) { + edm::LogInfo("GammaJetAnalysis") << "Will return result"; + edm::LogInfo("GammaJetAnalysis") << "result" << &result; + edm::LogInfo("GammaJetAnalysis") << "Result returned"; + } return result; - if (debug_>1) LogDebug("GammaJetAnalysis") << "Result returned"; } // --------------------------------------------------------------------- diff --git a/Calibration/HcalCalibAlgos/test/gammaJetAnalysis_cfg.py b/Calibration/HcalCalibAlgos/test/gammaJetAnalysis_cfg.py index 3bbd13ec45958..57520a20803f7 100644 --- a/Calibration/HcalCalibAlgos/test/gammaJetAnalysis_cfg.py +++ b/Calibration/HcalCalibAlgos/test/gammaJetAnalysis_cfg.py @@ -1,13 +1,66 @@ import FWCore.ParameterSet.Config as cms process = cms.Process('ANALYSIS') -process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.StandardSequences.Services_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') -#process.MessageLogger.messages = cms.untracked.PSet( -# threshold = cms.untracked.vstring('DEBUG') -#) +process.MessageLogger = cms.Service("MessageLogger", + destinations = cms.untracked.vstring('warnings','errors', + 'cout','cerr'), + categories = cms.untracked.vstring('GammaJetAnalysis'), + debugModules = cms.untracked.vstring('*'), + warnings = cms.untracked.PSet( + placeholder = cms.untracked.bool(True) + ), + default = cms.untracked.PSet( + + ), + errors = cms.untracked.PSet( + placeholder = cms.untracked.bool(True) + ), + cerr = cms.untracked.PSet( + optionalPSet = cms.untracked.bool(True), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + noTimeStamps = cms.untracked.bool(False), + FwkReport = cms.untracked.PSet( + optionalPSet = cms.untracked.bool(True), + reportEvery = cms.untracked.int32(500), + limit = cms.untracked.int32(10000000) + ), + default = cms.untracked.PSet( + limit = cms.untracked.int32(10000000) + ), + Root_NoDictionary = cms.untracked.PSet( + optionalPSet = cms.untracked.bool(True), + limit = cms.untracked.int32(0) + ), + FwkJob = cms.untracked.PSet( + optionalPSet = cms.untracked.bool(True), + limit = cms.untracked.int32(0) + ), + FwkSummary = cms.untracked.PSet( + optionalPSet = cms.untracked.bool(True), + reportEvery = cms.untracked.int32(1), + limit = cms.untracked.int32(10000000) + ), + threshold = cms.untracked.string('INFO') + ), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('INFO'), + noTimeStamps = cms.untracked.bool(True), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + GammaJetAnalysis = cms.untracked.PSet( + limit = cms.untracked.int32(-1) + ) + ) +) process.load("Configuration.Geometry.GeometryIdeal_cff") process.load("MagneticField.Engine.autoMagneticFieldProducer_cfi") @@ -51,16 +104,15 @@ process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring( + 'file:gjet.root' # '/store/relval/CMSSW_7_3_0/RelValPhotonJets_Pt_10_13/GEN-SIM-RECO/MCRUN2_73_V7-v1/00000/522CE329-7B81-E411-B6C3-0025905A6110.root', # '/store/relval/CMSSW_7_3_0/RelValPhotonJets_Pt_10_13/GEN-SIM-RECO/MCRUN2_73_V7-v1/00000/5279D224-7B81-E411-BCAA-002618943930.root' - 'file:../../HcalAlCaRecoProducers/test/gjet.root' +# '/store/relval/CMSSW_7_3_0/RelValPhotonJets_Pt_10_13/GEN-SIM-RECO/MCRUN2_73_V7-v1/00000/522CE329-7B81-E411-B6C3-0025905A6110.root' +# '/store/relval/CMSSW_7_4_0_pre6/RelValPhotonJets_Pt_10_13/GEN-SIM-RECO/MCRUN2_74_V1-v1/00000/6EC8FCC8-E2A8-E411-9506-002590596468.root' ) ) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) -#process.MessageLogger.cerr.threshold = cms.untracked.string('DEBUG') # does not work? -process.MessageLogger.cerr.FwkReport.reportEvery=cms.untracked.int32(500) -process.MessageLogger.cerr.FwkReport.reportEvery=cms.untracked.int32(1) process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) ) # Load pfNoPileUP @@ -72,11 +124,12 @@ #) #process.load('Calibration.HcalCalibAlgos.gammaJetAnalysis_CHSJECs_cff') - +# name of the process that used the GammaJetProd producer +process.GammaJetAnalysis.prodProcess = 'MYGAMMAJET' # specify 'workOnAOD=2' to apply tokens from GammaJetProd producer -process.GammaJetAnalysis.workOnAOD = cms.int32(2) -process.GammaJetAnalysis.doGenJets = cms.bool(False) -process.GammaJetAnalysis.debug = cms.untracked.int32(1) +process.GammaJetAnalysis.workOnAOD = 2 +process.GammaJetAnalysis.doGenJets = False +process.GammaJetAnalysis.debug = 2 process.p = cms.Path( # process.PF2PAT diff --git a/Calibration/IsolatedParticles/interface/eHCALMatrix.h b/Calibration/IsolatedParticles/interface/eHCALMatrix.h index f2209d5e37dc3..7964d77ffdccd 100644 --- a/Calibration/IsolatedParticles/interface/eHCALMatrix.h +++ b/Calibration/IsolatedParticles/interface/eHCALMatrix.h @@ -27,8 +27,11 @@ Created: August 2009 #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/Candidate/interface/Candidate.h" #include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/CaloTopology/interface/HcalTopology.h" namespace spr{ @@ -71,6 +74,7 @@ namespace spr{ HcalDetId getHotCell(std::vector& hit, bool& includeHO, bool& debug); + HcalDetId getHotCell(std::vector::const_iterator>& hit, bool& includeHO, bool& debug); } #include "Calibration/IsolatedParticles/interface/eHCALMatrix.icc" diff --git a/Calibration/IsolatedParticles/interface/eHCALMatrix.icc b/Calibration/IsolatedParticles/interface/eHCALMatrix.icc index a095caeab618d..be2fcc7fe54f3 100644 --- a/Calibration/IsolatedParticles/interface/eHCALMatrix.icc +++ b/Calibration/IsolatedParticles/interface/eHCALMatrix.icc @@ -260,39 +260,5 @@ namespace spr{ if (debug) std::cout << "hitsHCAL::Number of hits " << hitlist.size() << std::endl; } - - HcalDetId getHotCell(std::vector& hit, bool& includeHO, bool& debug) { - - std::vector dets; - std::vector energies; - for (unsigned int ihit=0; ihitid(); - if ((id0.subdet() != HcalOuter) || includeHO) { - HcalDetId id1(id0.subdet(),id0.ieta(),id0.iphi(),1); - bool found(false); - for (unsigned int idet=0; idet energyMax) { - energyMax = energies[ihit]; - hotCell = dets[ihit]; - } - } - return hotCell; - } } diff --git a/Calibration/IsolatedParticles/plugins/BuildFile.xml b/Calibration/IsolatedParticles/plugins/BuildFile.xml index 9c3c27305cbb8..2c96698f2cb25 100644 --- a/Calibration/IsolatedParticles/plugins/BuildFile.xml +++ b/Calibration/IsolatedParticles/plugins/BuildFile.xml @@ -48,3 +48,4 @@ + diff --git a/Calibration/IsolatedParticles/plugins/HcalRaddamMuon.cc b/Calibration/IsolatedParticles/plugins/HcalRaddamMuon.cc new file mode 100755 index 0000000000000..503642195d357 --- /dev/null +++ b/Calibration/IsolatedParticles/plugins/HcalRaddamMuon.cc @@ -0,0 +1,807 @@ +#include +#include +#include + +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Common/interface/TriggerNames.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/EcalDetId/interface/EcalSubdetector.h" +#include "DataFormats/EcalDetId/interface/EBDetId.h" +#include "DataFormats/EcalDetId/interface/EEDetId.h" +#include "DataFormats/EcalDetId/interface/ESDetId.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/HLTReco/interface/TriggerObject.h" +#include "DataFormats/HLTReco/interface/TriggerEvent.h" +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" +#include "HLTrigger/HLTcore/interface/HLTConfigData.h" + +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" +#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h" +#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h" + + +#include "Calibration/IsolatedParticles/interface/CaloPropagateTrack.h" +#include "Calibration/IsolatedParticles/interface/eECALMatrix.h" +#include "Calibration/IsolatedParticles/interface/eHCALMatrix.h" + +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h" +#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h" +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "Geometry/CaloTopology/interface/CaloTopology.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" + +class HcalDDDRecConstants { +public: + HcalDDDRecConstants(); + ~HcalDDDRecConstants(); + + struct HcalActiveLength { + int ieta, depth; + double eta, thick; + HcalActiveLength(int ie=0, int d=0, double et=0, + double t=0) : ieta(ie), depth(d), eta(et), thick(t) {} + }; + + std::vector getThickActive(const int type) const; + +private: + std::vector actHB, actHE; +}; + +HcalDDDRecConstants::HcalDDDRecConstants() { + int ietaHB[18] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 15, 16, 16}; + int depthHB[18] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 1, 2}; + double etaHB[18] = {0.0435, 0.1305, 0.2175, 0.3045, 0.3915, 0.4785, + 0.5655, 0.6525, 0.7395, 0.8265, 0.9135, 1.0005, + 1.0875, 1.1745, 1.2615, 1.2615, 1.3485, 1.3485}; + double actLHB[18]= {7.35696, 7.41268, 7.52454, 7.69339, 7.92051, 8.20761, + 8.55688, 8.97096, 9.45298, 10.0066, 10.6360, 11.3460, + 12.1419, 13.0297, 10.1832, 3.83301, 2.61066, 5.32410}; + actHB.clear(); + for (int i=0; i<18; ++i) { + HcalDDDRecConstants::HcalActiveLength act(ietaHB[i],depthHB[i],etaHB[i],actLHB[i]); + actHB.push_back(act); + } + + int ietaHE[28] = {16, 17, 18, 18, 19, 19, 20, 20, 21, 21, + 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, + 27, 27, 27, 28, 28, 28, 29, 29}; + int depthHE[28] = {3, 1, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 3, 1, 2, 3, 1, 2}; + double etaHE[28] = {1.3485, 1.4355, 1.5225, 1.5225, 1.6095, 1.6095, 1.6965, + 1.6965, 1.7850, 1.7850, 1.8800, 1.8800, 1.9865, 1.9865, + 2.1075, 2.1075, 2.2470, 2.2470, 2.4110, 2.4110, 2.5750, + 2.5750, 2.5750, 2.7590, 2.7590, 2.8250, 2.9340, 2.9340}; + double actLHE[28]= {4.23487, 8.05342, 2.21090, 5.69774, 2.57831, 5.21078, + 2.54554, 5.14455, 2.51790, 5.08871, 2.49347, 5.03933, + 2.47129, 4.99449, 2.45137, 4.95424, 2.43380, 4.91873, + 2.41863, 4.88808, 1.65913, 0.74863, 4.86612, 1.65322, + 0.74596, 4.84396, 1.64930, 0.744198}; + actHE.clear(); + for (int i=0; i<28; ++i) { + HcalDDDRecConstants::HcalActiveLength act(ietaHE[i],depthHE[i],etaHE[i],actLHE[i]); + actHE.push_back(act); + } +} + +HcalDDDRecConstants::~HcalDDDRecConstants() { + std::cout << "HcalDDDRecConstants::destructed!!!" << std::endl; +} + +std::vector +HcalDDDRecConstants::getThickActive(const int type) const { + + if (type == 0) return actHB; + else return actHE; +} + +class HcalRaddamMuon : public edm::EDAnalyzer { + +public: + explicit HcalRaddamMuon(const edm::ParameterSet&); + ~HcalRaddamMuon(); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + virtual void beginJob() ; + virtual void analyze(const edm::Event&, const edm::EventSetup& ); + virtual void endJob() ; + virtual void beginRun(edm::Run const&, edm::EventSetup const&); + virtual void endRun(edm::Run const&, edm::EventSetup const&); + virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&); + virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&); + void clearVectors(); + int matchId(const HcalDetId&, const HcalDetId&); + double activeLength(const DetId&); + + // ----------member data --------------------------- + std::vector PtGlob ,track_cosmic_positionIX ,track_cosmic_positionIY , track_cosmic_positionIZ, track_cosmic_positionOX, track_cosmic_positionOY, track_cosmic_positionOZ; + + std::vector track_cosmic_momentumOX,track_cosmic_momentumOY,track_cosmic_momentumOZ,track_cosmic_momentumIX,track_cosmic_momentumIY,track_cosmic_momentumIZ, track_cosmic_detIDinner, track_cosmic_detIDouter; + std::vector EtaGlob; + std::vector PhiGlob,chiGlobal,GlobalMuonHits,MatchedStat,GlobalTrckPt,GlobalTrckEta,GlobalTrckPhi; + std::vector TrackerLayer,innerTrackpt,innerTracketa,innerTrackphi; + std::vector NumPixelLayers,chiTracker,DxyTracker,DzTracker; + std::vector OuterTrackPt,OuterTrackEta,OuterTrackPhi,OuterTrackChi,OuterTrackHits,OuterTrackRHits; + std::vector trackerlayer_hits,No_pixelLayers,NormChi2,ImpactParameter; + std::vector Tight_GlobalMuonTrkFit,Tight_MuonHits,Tight_MatchedStations,Tight_LongPara,Tight_PixelHits,Tight_TrkerLayers,Tight_TransImpara,High_TrackLayers; + std::vector innerTrack, OuterTrack, GlobalTrack; + std::vector IsolationR04,IsolationR03; + std::vector Energy,MuonHcalEnergy,MuonEcalEnergy,MuonHOEnergy,MuonEcal3x3Energy,MuonHcal1x1Energy, Pmuon; + std::vector MuonEcalDetId,MuonHcalDetId,MuonEHcalDetId, MuonHcalHot, MuonHcalHotCalo; + std::vector MuonHcalDepth1Energy,MuonHcalDepth2Energy,MuonHcalDepth3Energy,MuonHcalDepth4Energy,MuonHcalDepth5Energy,MuonHcalDepth6Energy,MuonHcalDepth7Energy; + std::vector MuonHcalDepth1HotEnergy,MuonHcalDepth2HotEnergy,MuonHcalDepth3HotEnergy,MuonHcalDepth4HotEnergy,MuonHcalDepth5HotEnergy,MuonHcalDepth6HotEnergy,MuonHcalDepth7HotEnergy; + + // + std::vector MuonHcalDepth1EnergyCalo,MuonHcalDepth2EnergyCalo,MuonHcalDepth3EnergyCalo,MuonHcalDepth4EnergyCalo,MuonHcalDepth5EnergyCalo,MuonHcalDepth6EnergyCalo,MuonHcalDepth7EnergyCalo; + std::vector MuonHcalDepth1HotEnergyCalo,MuonHcalDepth2HotEnergyCalo,MuonHcalDepth3HotEnergyCalo,MuonHcalDepth4HotEnergyCalo,MuonHcalDepth5HotEnergyCalo,MuonHcalDepth6HotEnergyCalo,MuonHcalDepth7HotEnergyCalo; + + // + std::vector MuonHcalActiveLength; + std::vector actHB , actHE; + int maxDepth_,type; + edm::Service fs; + ////////////////////////////////////////////////////// + HLTConfigProvider hltConfig_; + int verbosity_; + bool isAOD_, isSLHC_; + std::string hltlabel_; + std::vector all_triggers,all_triggers1,all_triggers2,all_triggers3,all_triggers4,all_triggers5; + //////////////////////////////////////////////////////////// + + std::vector isHB, isHE; + TTree *TREE; + std::vector all_ifTriggerpassed; + std::vector muon_is_good, muon_global, muon_tracker, Trk_match_MuStat; + std::vector hltresults; + std::vector energy_hb,time_hb; + std::vector hltpaths,TrigName_; + std::vector v_RH_h3x3_ieta; + std::vector v_RH_h3x3_iphi; + std::vector v_RH_h3x3_ene, PxGlob, PyGlob,PzGlob,Pthetha; + std::vector PCharge,PChi2,PD0, PD0Error,dxyWithBS,dzWithBS,PdxyTrack, PdzTrack,PNormalizedChi2, PNDoF, PValidHits, PLostHits, NPvx, NPvy, NPvz, NQOverP, NQOverPError, NTrkMomentum, NRefPointX, NRefPointY, NRefPointZ; + std::vector NTrkQuality; + double h3x3, h3x3Calo; + unsigned int RunNumber, EventNumber , LumiNumber, BXNumber; + double _RecoMuon1TrackIsoSumPtMaxCutValue_03, _RecoMuon1TrackIsoSumPtMaxCutValue_04; + int ntriggers; + edm::InputTag HLTriggerResults_; + std::string theTrackQuality; + edm::InputTag muonsrc_; + std::vector track_cosmic_xposition , track_cosmic_yposition, track_cosmic_zposition, track_cosmic_xmomentum,track_cosmic_ymomentum, track_cosmic_zmomentum, track_cosmic_rad, track_cosmic_detid; + }; + +HcalRaddamMuon::HcalRaddamMuon(const edm::ParameterSet& iConfig) { + //now do what ever initialization is needed + HLTriggerResults_ = iConfig.getUntrackedParameter("HLTriggerResults_"); + verbosity_ = iConfig.getUntrackedParameter("Verbosity",0); + isAOD_ = iConfig.getUntrackedParameter("IsAOD",false); + isSLHC_ = iConfig.getUntrackedParameter("IsSLHC",true); + maxDepth_ = iConfig.getUntrackedParameter("MaxDepth",4); + // muonsrc_ = iConfig.getUntrackedParameter("muonsrc"); + if (maxDepth_ > 7) maxDepth_ = 7; + else if (maxDepth_ < 1) maxDepth_ = 4; +} + +HcalRaddamMuon::~HcalRaddamMuon() { + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) +} + + + +// +// member functions +// + +// ------------ method called for each event ------------ +void HcalRaddamMuon::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + + clearVectors(); + RunNumber = iEvent.id().run(); + EventNumber = iEvent.id().event(); + LumiNumber = iEvent.id().luminosityBlock(); + BXNumber = iEvent.bunchCrossing(); + + edm::Handle calosimhits; + iEvent.getByLabel("g4SimHits","HcalHits",calosimhits); + + edm::Handle _Triggers; + iEvent.getByLabel(HLTriggerResults_,_Triggers); + + if ((verbosity_%10)>1) std::cout << "size of all triggers " + << all_triggers.size() << std::endl; + int Ntriggers = all_triggers.size(); + + if ((verbosity_%10)>1) std::cout << "size of HLT MENU: " + << _Triggers->size() << std::endl; + + if (_Triggers.isValid()) { + const edm::TriggerNames &triggerNames_ = iEvent.triggerNames(*_Triggers); + + std::vector index; + for (int i=0;i < Ntriggers;i++) { + index.push_back(triggerNames_.triggerIndex(all_triggers[i])); + int triggerSize =int( _Triggers->size()); + if ((verbosity_%10)>2) std::cout << "outside loop " << index[i] + << "\ntriggerSize " << triggerSize + << std::endl; + if (index[i] < triggerSize) { + hltresults.push_back(_Triggers->accept(index[i])) ; + if ((verbosity_%10)>2) std::cout << "trigger_info " << triggerSize + << " triggerSize " << index[i] + << " trigger_index " << hltresults.at(i) + << " hltresult " << std::endl; + } else { + edm::LogInfo("TriggerBlock") << "Requested HLT path \"" << "\" does not exist"; + } + } + } + + // get handles to calogeometry and calotopology + edm::ESHandle pG; + iSetup.get().get(pG); + const CaloGeometry* geo = pG.product(); + + edm::ESHandle bFieldH; + iSetup.get().get(bFieldH); + const MagneticField* bField = bFieldH.product(); + + edm::ESHandle ecalChStatus; + iSetup.get().get(ecalChStatus); + const EcalChannelStatus* theEcalChStatus = ecalChStatus.product(); + + edm::ESHandle sevlv; + iSetup.get().get(sevlv); + + edm::ESHandle theCaloTopology; + iSetup.get().get(theCaloTopology); + const CaloTopology *caloTopology = theCaloTopology.product(); + + edm::ESHandle htopo; + iSetup.get().get(htopo); + const HcalTopology* theHBHETopology = htopo.product(); + + edm::Handle bmspot; + iEvent.getByLabel("offlineBeamSpot",bmspot); + + edm::Handle vtx; + iEvent.getByLabel("offlinePrimaryVertices",vtx); + + edm::Handle barrelRecHitsHandle; + edm::Handle endcapRecHitsHandle; + if (isAOD_) { + iEvent.getByLabel("EcalRecHitsEB",barrelRecHitsHandle); + iEvent.getByLabel("EcalRecHitsEE",endcapRecHitsHandle); + } else { + iEvent.getByLabel("ecalRecHit","EcalRecHitsEB",barrelRecHitsHandle); + iEvent.getByLabel("ecalRecHit","EcalRecHitsEE",endcapRecHitsHandle); + } + + edm::Handle hbhe; + if (isSLHC_) { + if (isAOD_) iEvent.getByLabel("reducedHcalRecHits","hbheUpgradeReco",hbhe); + else iEvent.getByLabel("hbheUpgradeReco", hbhe); + } else { + if (isAOD_) iEvent.getByLabel("reducedHcalRecHits","hbhereco",hbhe); + else iEvent.getByLabel("hbhereco", hbhe); + } + + edm::Handle _Muon; + iEvent.getByLabel("muons",_Muon); + const reco::Vertex& vertex = (*(vtx)->begin()); + + math::XYZPoint bspot; + bspot= (bmspot.isValid()) ? bmspot->position() : math::XYZPoint(0,0,0); + + if (_Muon.isValid()) { + for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon!= _Muon->end(); ++RecMuon) { + muon_is_good.push_back(RecMuon->isPFMuon()); + muon_global.push_back(RecMuon->isGlobalMuon()); + muon_tracker.push_back(RecMuon->isTrackerMuon()); + PtGlob.push_back((RecMuon)->pt()); + EtaGlob.push_back(RecMuon->eta()); + PhiGlob.push_back(RecMuon->phi()); + Energy.push_back(RecMuon->energy()); + Pmuon.push_back(RecMuon->p()); + // if (RecMuon->isPFMuon()) goodEvent = true; + // acessing tracker hits info + if (RecMuon->track().isNonnull()) { + TrackerLayer.push_back(RecMuon->track()->hitPattern().trackerLayersWithMeasurement()); + } else { + TrackerLayer.push_back(-1); + } + if (RecMuon->innerTrack().isNonnull()) { + innerTrack.push_back(true); + NumPixelLayers.push_back(RecMuon->innerTrack()->hitPattern().pixelLayersWithMeasurement()); + chiTracker.push_back(RecMuon->innerTrack()->normalizedChi2()); + DxyTracker.push_back(fabs(RecMuon->innerTrack()->dxy((vertex).position()))); + DzTracker.push_back(fabs(RecMuon->innerTrack()->dz((vertex).position()))); + innerTrackpt.push_back(RecMuon->innerTrack()->pt()); + innerTracketa.push_back(RecMuon->innerTrack()->eta()); + innerTrackphi.push_back(RecMuon->innerTrack()->phi()); + Tight_PixelHits.push_back(RecMuon->innerTrack()->hitPattern().numberOfValidPixelHits()); + } else { + innerTrack.push_back(false); + NumPixelLayers.push_back(0); + chiTracker.push_back(0); + DxyTracker.push_back(0); + DzTracker.push_back(0); + innerTrackpt.push_back(0); + innerTracketa.push_back(0); + innerTrackphi.push_back(0); + Tight_PixelHits.push_back(0); + } + // outer track info + + if (RecMuon->outerTrack().isNonnull()) { + OuterTrack.push_back(true); + OuterTrackPt.push_back(RecMuon->outerTrack()->pt()); + OuterTrackEta.push_back(RecMuon->outerTrack()->eta()); + OuterTrackPhi.push_back(RecMuon->outerTrack()->phi()); + OuterTrackChi.push_back(RecMuon->outerTrack()->normalizedChi2()); + OuterTrackHits.push_back(RecMuon->outerTrack()->numberOfValidHits()); + OuterTrackRHits.push_back(RecMuon->outerTrack()->recHitsSize()); + } else { + OuterTrack.push_back(false); + OuterTrackPt.push_back(0); + OuterTrackEta.push_back(0); + OuterTrackPhi.push_back(0); + OuterTrackChi.push_back(0); + OuterTrackHits.push_back(0); + OuterTrackRHits.push_back(0); + } + // Tight Muon cuts + if (RecMuon->globalTrack().isNonnull()) { + GlobalTrack.push_back(true); + chiGlobal.push_back(RecMuon->globalTrack()->normalizedChi2()); + GlobalMuonHits.push_back(RecMuon->globalTrack()->hitPattern().numberOfValidMuonHits()); + MatchedStat.push_back(RecMuon->numberOfMatchedStations()); + GlobalTrckPt.push_back(RecMuon->globalTrack()->pt()); + GlobalTrckEta.push_back(RecMuon->globalTrack()->eta()); + GlobalTrckPhi.push_back(RecMuon->globalTrack()->phi()); + Tight_TransImpara.push_back(fabs(RecMuon->muonBestTrack()->dxy(vertex.position()))); + Tight_LongPara.push_back(fabs(RecMuon->muonBestTrack()->dz(vertex.position()))); + } else { + GlobalTrack.push_back(false); + chiGlobal.push_back(0); + GlobalMuonHits.push_back(0); + MatchedStat.push_back(0); + GlobalTrckPt.push_back(0); + GlobalTrckEta.push_back(0); + GlobalTrckPhi.push_back(0); + Tight_TransImpara.push_back(0); + Tight_LongPara.push_back(0); + } + + IsolationR04.push_back(((RecMuon->pfIsolationR04().sumChargedHadronPt + std::max(0.,RecMuon->pfIsolationR04().sumNeutralHadronEt + RecMuon->pfIsolationR04().sumPhotonEt - (0.5 *RecMuon->pfIsolationR04().sumPUPt))) / RecMuon->pt()) ); + + IsolationR03.push_back(((RecMuon->pfIsolationR03().sumChargedHadronPt + std::max(0.,RecMuon->pfIsolationR03().sumNeutralHadronEt + RecMuon->pfIsolationR03().sumPhotonEt - (0.5 * RecMuon->pfIsolationR03().sumPUPt))) / RecMuon->pt())); + + MuonEcalEnergy.push_back(RecMuon->calEnergy().emS9); + MuonHcalEnergy.push_back(RecMuon->calEnergy().hadS9); + MuonHOEnergy.push_back(RecMuon->calEnergy().hoS9); + + double eEcal(0),eHcal(0),activeL(0),eHcalDepth[7],eHcalDepthHot[7],eHcalDepthCalo[7],eHcalDepthHotCalo[7]; + unsigned int isHot = 0; + unsigned int isHotCalo = 0; + + for (int i=0; i<7; ++i) eHcalDepth[i]=eHcalDepthHot[i]=eHcalDepthCalo[i]=eHcalDepthHotCalo[i]=-10000 ; + + if (RecMuon->innerTrack().isNonnull()) { + const reco::Track* pTrack = (RecMuon->innerTrack()).get(); + spr::propagatedTrackID trackID = spr::propagateCALO(pTrack, geo, bField, (((verbosity_/100)%10>0))); + + MuonEcalDetId.push_back((trackID.detIdECAL)()); + MuonHcalDetId.push_back((trackID.detIdHCAL)()); + MuonEHcalDetId.push_back((trackID.detIdEHCAL)()); + + if(trackID.okECAL){ + const DetId isoCell(trackID.detIdECAL); + std::pair e3x3 = spr::eECALmatrix(isoCell,barrelRecHitsHandle,endcapRecHitsHandle,*theEcalChStatus,geo,caloTopology,sevlv.product(),1,1,-100.0,-100.0,-500.0,500.0,false); + + eEcal = e3x3.first; + //std::cout<<"eEcal"< > ehdepth; + spr::energyHCALCell((HcalDetId) closestCell, hbhe, ehdepth, maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0, (((verbosity_/1000)%10)>0)); + for (unsigned int i=0; i > ehdepthCalo; + spr::energyHCALCell((HcalDetId) closestCellCalo, calosimhits, ehdepthCalo, maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0, (((verbosity_/1000)%10)>0)); + for (unsigned int i=0; i" << " ClosestCell <" << (HcalDetId)(closestCell) << "> hotCell id < " << hotCell << "> isHot" << isHot << std::endl; + if (hotCell != HcalDetId()) { + std::vector > ehdepth; + // spr::energyHCALCell(hotCell, hbhe, ehdepth, maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0, false);//(((verbosity_/1000)%10)>0 )); + spr::energyHCALCell(hotCell, hbhe, ehdepth, maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0, false); + for (unsigned int i=0; i > ehdepthCalo; + + spr::energyHCALCell(hotCellCalo, calosimhits, ehdepthCalo, maxDepth_, -100.0, -100.0, -100.0, -100.0, -500.0, 500.0, false); + for (unsigned int i=0; iFill(); +} + +// ------------ method called once each job just before starting event loop ------------ +void HcalRaddamMuon::beginJob() { + + TREE = fs->make("TREE", "TREE"); + TREE->Branch("Event_No",&EventNumber); + TREE->Branch("Run_No",&RunNumber); + TREE->Branch("LumiNumber",&LumiNumber); + TREE->Branch("BXNumber",&BXNumber); + TREE->Branch("pt_of_muon",&PtGlob); + TREE->Branch("eta_of_muon",&EtaGlob); + TREE->Branch("phi_of_muon",&PhiGlob); + TREE->Branch("energy_of_muon",&Energy); + TREE->Branch("p_of_muon",&Pmuon); + TREE->Branch("PF_Muon",&muon_is_good); + TREE->Branch("Global_Muon",&muon_global); + TREE->Branch("Tracker_muon",&muon_tracker); + + + TREE->Branch("hcal_3into3",&MuonHcalEnergy); + TREE->Branch("hcal_1x1",&MuonHcal1x1Energy); + TREE->Branch("hcal_detID",&MuonHcalDetId); + TREE->Branch("hcal_edepth1",&MuonHcalDepth1Energy); + TREE->Branch("hcal_edepth2",&MuonHcalDepth2Energy); + TREE->Branch("hcal_edepth3",&MuonHcalDepth3Energy); + TREE->Branch("hcal_edepth4",&MuonHcalDepth4Energy); + TREE->Branch("hcal_edepthHot1",&MuonHcalDepth1HotEnergy); + TREE->Branch("hcal_edepthHot2",&MuonHcalDepth2HotEnergy); + TREE->Branch("hcal_edepthHot3",&MuonHcalDepth3HotEnergy); + TREE->Branch("hcal_edepthHot4",&MuonHcalDepth4HotEnergy); + + TREE->Branch("hcal_edepth1PSim",&MuonHcalDepth1EnergyCalo); + TREE->Branch("hcal_edepth2PSim",&MuonHcalDepth2EnergyCalo); + TREE->Branch("hcal_edepth3PSim",&MuonHcalDepth3EnergyCalo); + TREE->Branch("hcal_edepth4PSim",&MuonHcalDepth4EnergyCalo); + TREE->Branch("hcal_edepthHot1PSim",&MuonHcalDepth1HotEnergyCalo); + TREE->Branch("hcal_edepthHot2PSim",&MuonHcalDepth2HotEnergyCalo); + TREE->Branch("hcal_edepthHot3PSim",&MuonHcalDepth3HotEnergyCalo); + TREE->Branch("hcal_edepthHot4PSim",&MuonHcalDepth4HotEnergyCalo); + + if (maxDepth_ > 4) { + TREE->Branch("hcal_edepth5PSim",&MuonHcalDepth5EnergyCalo); + TREE->Branch("hcal_edepthHot5PSim",&MuonHcalDepth5HotEnergyCalo); + if (maxDepth_ > 5) { + TREE->Branch("hcal_edepth6PSim",&MuonHcalDepth6EnergyCalo); + TREE->Branch("hcal_edepthHot6PSim",&MuonHcalDepth6HotEnergyCalo); + if (maxDepth_ > 6) { + TREE->Branch("hcal_edepth7PSim",&MuonHcalDepth7EnergyCalo); + TREE->Branch("hcal_edepthHot7PSim",&MuonHcalDepth7HotEnergyCalo); + } + } + } + + TREE->Branch("TrackerLayer",&TrackerLayer); + TREE->Branch("innerTrack",&innerTrack); + TREE->Branch("innerTrackpt",&innerTrackpt); + TREE->Branch("innerTracketa",&innerTracketa); + TREE->Branch("innerTrackphi",&innerTrackphi); + TREE->Branch("MatchedStat",&MatchedStat); + TREE->Branch("GlobalTrckPt",&GlobalTrckPt); + TREE->Branch("GlobalTrckEta",&GlobalTrckEta); + TREE->Branch("GlobalTrckPhi",&GlobalTrckPhi); + TREE->Branch("NumPixelLayers",&NumPixelLayers); + TREE->Branch("chiTracker",&chiTracker); + TREE->Branch("DxyTracker",&DxyTracker); + TREE->Branch("DzTracker",&DzTracker); + TREE->Branch("OuterTrack",&OuterTrack); + TREE->Branch("OuterTrackPt",&OuterTrackPt); + TREE->Branch("OuterTrackEta",&OuterTrackEta); + TREE->Branch("OuterTrackPhi",&OuterTrackPhi); + TREE->Branch("OuterTrackHits",&OuterTrackHits); + TREE->Branch("OuterTrackRHits",&OuterTrackRHits); + TREE->Branch("OuterTrackChi",&OuterTrackChi); + TREE->Branch("GlobalTrack",&GlobalTrack); + TREE->Branch("GlobTrack_Chi",&chiGlobal); + TREE->Branch("Global_Muon_Hits",&GlobalMuonHits); + TREE->Branch("MatchedStations",&MatchedStat); + TREE->Branch("Global_Track_Pt",&GlobalTrckPt); + TREE->Branch("Global_Track_Eta",&GlobalTrckEta); + TREE->Branch("Global_Track_Phi",&GlobalTrckPhi); + /////////////////////////////// + TREE->Branch("Tight_LongitudinalImpactparameter",&Tight_LongPara); + TREE->Branch("Tight_TransImpactparameter",&Tight_TransImpara); + TREE->Branch("InnerTrackPixelHits",&Tight_PixelHits); + TREE->Branch("IsolationR04",&IsolationR04); + TREE->Branch("IsolationR03",&IsolationR03); + + TREE->Branch("hcal_cellHot",&MuonHcalHot); + TREE->Branch("hcal_cellHotPSim",&MuonHcalHotCalo); + + TREE->Branch("ecal_3into3",&MuonEcalEnergy); + TREE->Branch("ecal_3x3",&MuonEcal3x3Energy); + TREE->Branch("ecal_detID",&MuonEcalDetId); + TREE->Branch("ehcal_detID",&MuonEHcalDetId); + TREE->Branch("tracker_3into3",&MuonHOEnergy); + TREE->Branch("activeLength",&MuonHcalActiveLength); + + + /////////////////////////////// + TREE->Branch("hltresults",&hltresults); + TREE->Branch("all_triggers",&all_triggers); + TREE->Branch("rechit_energy",&energy_hb); + TREE->Branch("rechit_time",&time_hb); +} + +// ------------ method called once each job just after ending the event loop ------------ +void HcalRaddamMuon::endJob() {} + +// ------------ method called when starting to processes a run ------------ +void HcalRaddamMuon::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { + /* edm::ESHandle pHRNDC; + iSetup.get().get(pHRNDC); + const HcalDDDRecConstants & hdc = (*pHRNDC); + */ + + HcalDDDRecConstants hdc; + actHB.clear(); + actHE.clear(); + actHB = hdc.getThickActive(0); + actHE = hdc.getThickActive(1); + + bool changed = true; + all_triggers.clear(); + if (hltConfig_.init(iRun, iSetup,"HLT" , changed)) { + // if init returns TRUE, initialisation has succeeded! + edm::LogInfo("TriggerBlock") << "HLT config with process name " + << "HLT" << " successfully extracted"; + std::string string_search[5]={"HLT_IsoMu_","HLT_L1SingleMu_","HLT_L2Mu","HLT_Mu","HLT_RelIso1p0Mu"}; + unsigned int ntriggers = hltConfig_.size(); + for(unsigned int t=0;t +#include + +namespace spr{ + HcalDetId getHotCell(std::vector& hit, bool& includeHO, bool& debug) { + + std::vector dets; + std::vector energies; + for (unsigned int ihit=0; ihitid(); + if ((id0.subdet() != HcalOuter) || includeHO) { + HcalDetId id1(id0.subdet(),id0.ieta(),id0.iphi(),1); + bool found(false); + for (unsigned int idet=0; idet energyMax) { + energyMax = energies[ihit]; + hotCell = dets[ihit]; + } + } + return hotCell; + } + + HcalDetId getHotCell(std::vector::const_iterator>& hit, bool& includeHO, bool& debug) { + + std::vector dets; + std::vector energies; + for (unsigned int ihit=0; ihitenergy(); + HcalDetId id0 = hit.at(ihit)->id(); + if ((id0.subdet() != HcalOuter) || includeHO) { + HcalDetId id1(id0.subdet(),id0.ieta(),id0.iphi(),1); + bool found(false); + for (unsigned int idet=0; idet energyMax) { + energyMax = energies[ihit]; + hotCell = dets[ihit]; + } + } + return hotCell; + } +} diff --git a/DQMOffline/CalibCalo/test/isoTrackMon_cfg.py b/DQMOffline/CalibCalo/test/isoTrackMon_cfg.py index 7eb9eb767574e..6f9d9796c2172 100644 --- a/DQMOffline/CalibCalo/test/isoTrackMon_cfg.py +++ b/DQMOffline/CalibCalo/test/isoTrackMon_cfg.py @@ -7,7 +7,7 @@ process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) process.options = cms.untracked.PSet( -wantSummary=cms.untracked.bool(True) + wantSummary=cms.untracked.bool(True) ) process.source = cms.Source("PoolSource", @@ -20,14 +20,22 @@ 'rfio:/castor/cern.ch/user/s/safronov/isoTrData/2305_ARfromRAW_0805-2205/AlCaReco_skimfromRAW_101.root', 'rfio:/castor/cern.ch/user/s/safronov/isoTrData/2305_ARfromRAW_0805-2205/AlCaReco_skimfromRAW_102.root' )) +# Output definition + +process.DQMOutput = cms.OutputModule("PoolOutputModule", + outputCommands = cms.untracked.vstring('drop *', 'keep *_MEtoEDMConverter_*_*'), + fileName = cms.untracked.string('dqm.root'), +) + process.load("DQMOffline.CalibCalo.MonitorHcalIsoTrackAlCaReco_cfi") -process.MonitorHcalIsoTrackAlCaReco.saveToFile=cms.bool(True) -process.MonitorHcalIsoTrackAlCaReco.outputRootFileName=cms.string("outputIsoTrackMon.root") process.load("DQMServices.Components.MEtoEDMConverter_cff") process.MEtoEDMConverter.verbose = cms.untracked.int32(1) -process.p = cms.Path(process.MonitorHcalIsoTrackAlCaReco) - +process.p1 = cms.Path(process.MonitorHcalIsoTrackAlCaReco) +process.p2 = cms.Path(process.MEtoEDMConverter) +process.op = cms.EndPath(process.DQMOutput) +# Schedule definition +process.schedule = cms.Schedule(process.p1,process.p2,process.op) diff --git a/DQMOffline/CalibCalo/test/isoTrackPost_cfg.py b/DQMOffline/CalibCalo/test/isoTrackPost_cfg.py new file mode 100644 index 0000000000000..3f809e88646d7 --- /dev/null +++ b/DQMOffline/CalibCalo/test/isoTrackPost_cfg.py @@ -0,0 +1,33 @@ +import FWCore.ParameterSet.Config as cms +import os + +process = cms.Process("CONV") + +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.FwkReport.reportEvery = 1 + +# summary +process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) ) + +process.load("DQMServices.Core.DQM_cfg") +process.DQM.collectorHost = '' + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring('file:dqm.root', + ) + ) + +process.load("Configuration.StandardSequences.EDMtoMEAtRunEnd_cff") +process.dqmSaver.referenceHandling = cms.untracked.string('all') + +cmssw_version = os.environ.get('CMSSW_VERSION','CMSSW_X_Y_Z') +process.dqmSaver.workflow = '/Test/Cal/DQM' + +process.load("DQMOffline.CalibCalo.PostProcessorHcalIsoTrack_cfi") +process.PostProcessorHcalIsoTrack.saveToFile = True + +process.p = cms.Path(process.EDMtoME * process.PostProcessorHcalIsoTrack * process.dqmSaver)