本文整理汇总了C++中edm::Event::isRealData方法的典型用法代码示例。如果您正苦于以下问题:C++ Event::isRealData方法的具体用法?C++ Event::isRealData怎么用?C++ Event::isRealData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edm::Event
的用法示例。
在下文中一共展示了Event::isRealData方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEvtId
void ChPartTree::GetEvtId(const edm::Event& iEvent)
{
using namespace std;
if ( EvtIdDebug )
{
cout << "XJ: EvdId: " << iEvent.id() << endl ;
cout << "XJ: Run : " << iEvent.id().run() << endl ;
cout << "XJ: Evt : " << iEvent.id().event() << endl ;
cout << "XJ: Lumbl: " << iEvent.luminosityBlock() << endl ;
// cout << "XJ: proID: " << iEvent.processHistoryID() << endl;
// cout << "XJ: GUID : " << iEvent.processGUID() << endl;
edm::Timestamp Time=iEvent.time();
cout << "XJ: time : " << Time.value() << endl;
cout << "XJ: isDa : " << iEvent.isRealData() << endl;
cout << "XJ: expTy: " << iEvent.experimentType() << endl ;
cout << "XJ: Bx : " << iEvent.bunchCrossing() << endl;
cout << "XJ: Orbit: " << iEvent.orbitNumber() << endl;
// cout << "XJ: Store: " << iEvent.storeNumber() << endl;
}
EvtId.Reset();
EvtId.Run = iEvent.id().run() ;
EvtId.Evt = iEvent.id().event() ;
EvtId.LumiSect = iEvent.luminosityBlock();
edm::Timestamp Time=iEvent.time();
EvtId.Time = Time.value();
EvtId.IsData = iEvent.isRealData();
EvtId.ExpType = iEvent.experimentType();
EvtId.Bunch = iEvent.bunchCrossing();
EvtId.Orbit = iEvent.orbitNumber();
}
示例2: analyze
int NeroAll::analyze(const edm::Event&iEvent)
{
if(isMc_ <0 )
{
isMc_ = ( iEvent.isRealData() ) ? 0 : 1;
isRealData = ( iEvent.isRealData() ) ? 1 : 0;
}
if( isSkim() == 0)
{
//TODO FILL all_
isRealData = ( iEvent.isRealData() ) ? 1 : 0;
runNum = iEvent.id().run();
lumiNum = iEvent.luminosityBlock();
eventNum = iEvent.id().event();
iEvent.getByLabel(edm::InputTag("generator"), info_handle); // USE TOKEN AND INPUT TAG ?
iEvent.getByLabel(edm::InputTag("addPileupInfo"), pu_handle);
mcWeight = info_handle->weight();
//PU
puTrueInt = 0;
for(const auto & pu : *pu_handle)
{
//Intime
if (pu.getBunchCrossing() == 0)
puTrueInt += pu.getTrueNumInteractions();
//Out-of-time
}
}
return 0;
}
示例3: analyze
int NeroMonteCarlo::analyze(const edm::Event& iEvent){
if ( iEvent.isRealData() ) return 0;
isRealData = iEvent.isRealData() ? 1 : 0 ; // private, not the one in the tree
TStopwatch sw;
if(VERBOSE)sw.Start();
// maybe handle should be taken before
iEvent.getByToken(info_token, info_handle);
iEvent.getByToken(packed_token, packed_handle);
iEvent.getByToken(pruned_token, pruned_handle);
iEvent.getByToken(pu_token, pu_handle);
iEvent.getByToken(jet_token, jet_handle);
if ( not info_handle.isValid() ) cout<<"[NeroMonteCarlo]::[analyze]::[ERROR] info_handle is not valid"<<endl;
if ( not packed_handle.isValid() ) cout<<"[NeroMonteCarlo]::[analyze]::[ERROR] packed_handle is not valid"<<endl;
if ( not pruned_handle.isValid() ) cout<<"[NeroMonteCarlo]::[analyze]::[ERROR] pruned_handle is not valid"<<endl;
if ( not pu_handle.isValid() ) cout<<"[NeroMonteCarlo]::[analyze]::[ERROR] pu_handle is not valid"<<endl;
if ( not jet_handle.isValid() ) cout<<"[NeroMonteCarlo]::[analyze]::[ERROR] jet_handle is not valid"<<endl;
if(VERBOSE){ sw.Stop() ; cout<<"[NeroMonteCarlo]::[analyze] getToken took "<<sw.CpuTime()<<" Cpu and "<<sw.RealTime()<<" RealTime"<<endl; sw.Reset(); sw.Start();}
// INFO
if(VERBOSE>1) cout<<"[NeroMonteCarlo]::[analyze]::[DEBUG] mcWeight="<<endl;
mcWeight = info_handle -> weight();
if(VERBOSE>1) cout<<" mcWeight="<<mcWeight<<endl;
//weights()
//--- scale
if ( info_handle -> weights() .size() >= 9){
r1f2 = info_handle -> weights() [1] ;
r1f5 = info_handle -> weights() [2] ;
r2f1 = info_handle -> weights() [3] ;
r2f2 = info_handle -> weights() [4] ;
r5f1 = info_handle -> weights() [6] ;
r5f5 = info_handle -> weights() [8] ;
}
if (info_handle -> weights().size() > 109)
for( int pdfw = 9 ; pdfw<109 ;++pdfw)
{
pdfRwgt -> push_back( info_handle -> weights() [pdfw] );
}
// --- fill pdf Weights
//
if(VERBOSE>1) cout<<"[NeroMonteCarlo]::[analyze]::[DEBUG] PDF="<<endl;
if ( mParticleGun ) {
qScale = -999 ;
alphaQED = -999 ;
alphaQCD = -999 ;
x1 = -999 ;
x2 = -999 ;
pdf1Id = -999 ;
pdf2Id = -999 ;
scalePdf = -999 ;
}
else {
qScale = info_handle -> qScale();
alphaQED = info_handle -> alphaQED();
alphaQCD = info_handle -> alphaQCD();
x1 = info_handle -> pdf() -> x.first;
x2 = info_handle -> pdf() -> x.second;
pdf1Id = info_handle -> pdf() -> id.first;
pdf2Id = info_handle -> pdf() -> id.second;
scalePdf = info_handle -> pdf() -> scalePDF;
}
if(VERBOSE>1) cout<<" PDF="<<qScale<<" "<< alphaQED<<endl;
//PU
if(VERBOSE>1){ cout<<endl<<"[NeroMonteCarlo]::[analyze] PU LOOP"<<endl;}
puTrueInt = 0;
for(const auto & pu : *pu_handle)
{
//Intime
if (pu.getBunchCrossing() == 0)
puTrueInt += pu.getTrueNumInteractions();
//puInt += getPU_NumInteractions(); //old
//Out-of-time
}
if(VERBOSE){ sw.Stop() ; cout<<"[NeroMonteCarlo]::[analyze] pu&info took "<<sw.CpuTime()<<" Cpu and "<<sw.RealTime()<<" RealTime"<<endl; sw.Reset(); sw.Start();}
// GEN PARTICLES
//TLorentzVector genmet(0,0,0,0);
//for ( auto & gen : *packed_handle)
for ( unsigned int i=0;i < packed_handle->size() ;++i)
{
const auto gen = & (*packed_handle)[i];
if (gen->pt() < 5 ) continue;
if (gen->pt() < mMinGenParticlePt ) continue;
int pdg = gen->pdgId();
int apdg = abs(pdg);
//neutrinos
// --- if ( (apdg != 12 and apdg !=14 and apdg != 16
// --- and apdg > 1000000 neutrinos and neutralinos
// --- )//SUSY
// --- and fabs(gen->eta() ) <4.7
// --- )
// --- {
// --- TLorentzVector tmp( gen->px(),gen->py(),gen->pz(),gen->energy() );
// --- genmet += tmp;
// --- }
//.........这里部分代码省略.........
示例4: analyze
int NeroMet::analyze(const edm::Event& iEvent){
if ( mOnlyMc ) return 0; // in principle I would like to have the gen met: TODO
// maybe handle should be taken before
iEvent.getByToken(token, handle);
const pat::MET &met = handle->front();
// FILL
new ( (*p4)[p4->GetEntriesFast()]) TLorentzVector( met.px(),met.py(),met.pz(),met.energy() );
ptJESUP -> push_back( met.shiftedPt(pat::MET::JetEnUp) );
ptJESDOWN -> push_back( met.shiftedPt(pat::MET::JetEnDown) );
if (IsExtend())
{
//MetNoMu
TLorentzVector metnomu(met.px(),met.py(),met.pz(),met.energy());
TLorentzVector pfmet_e3p0(0,0,0,0);
TLorentzVector chMet(0,0,0,0);
TLorentzVector nhMet(0,0,0,0);
TLorentzVector phoMet(0,0,0,0);
if ( pf == NULL ) cout<<"[NeroMet]::[analyze]::[ERROR] PF pointer is null. Run NeroPF. "<<endl;
for (unsigned int i = 0, n = pf->handle->size(); i < n; ++i) {
const pat::PackedCandidate &cand = (*pf->handle)[i];
// only up to eta 3
if (std::abs(cand.eta()) < 3.0)
pfmet_e3p0 += TLorentzVector(cand.px(),cand.py(),cand.pz(),cand.energy());
if (std::abs(cand.pdgId()) == 13)
metnomu += TLorentzVector(cand.px(),cand.py(),cand.pz(),cand.energy());
// only charge hadrons
if ( cand.charge() != 0 and cand.pdgId() > 20 )
chMet += TLorentzVector(cand.px(),cand.py(),cand.pz(),cand.energy());
if ( cand.charge() == 0 and cand.pdgId() == 22 )
phoMet += TLorentzVector(cand.px(),cand.py(),cand.pz(),cand.energy());
if ( cand.charge() == 0 and cand.pdgId() != 22 )
nhMet += TLorentzVector(cand.px(),cand.py(),cand.pz(),cand.energy());
}
*metNoMu = TLorentzVector(metnomu);
*metChargedHadron = TLorentzVector(chMet);
*metNeutralHadron = TLorentzVector(nhMet);
*metNeutralEM = TLorentzVector(phoMet);
*pfMet_e3p0 = TLorentzVector(pfmet_e3p0);
}
// GEN INFO
if ( not iEvent.isRealData () ){
new ( (*genP4)[genP4->GetEntriesFast()]) TLorentzVector( met.genMET()->px(),met.genMET()->py(),met.genMET()->pz(),met.genMET()->energy() );
}
return 0;
}
示例5: analyze
int NeroMetRecluster::analyze(const edm::Event& iEvent){
if ( mOnlyMc ) return 0; // in principle I would like to have the gen met: TODO
// maybe handle should be taken before
iEvent.getByToken(token, handle);
if ( not handle.isValid() ) cout<<"[NeroMetRecluster]::[analyze]::[ERROR] handle is not valid"<<endl;
iEvent.getByToken(token_puppi,handle_puppi);
if ( not handle_puppi.isValid() ) cout<<"[NeroMetRecluster]::[analyze]::[ERROR] handle_puppi is not valid"<<endl;
iEvent.getByToken(token_puppiUncorr,handle_puppiUncorr);
if ( not handle_puppiUncorr.isValid() ) cout<<"[NeroMetRecluster]::[analyze]::[ERROR] handle_puppiUncorr is not valid"<<endl;
//--
const pat::MET &met = handle->front();
caloMet_Pt = met.caloMETPt();
caloMet_Phi = met.caloMETPhi();
caloMet_SumEt = met.caloMETSumEt();
// FILL
new ( (*p4)[p4->GetEntriesFast()]) TLorentzVector( met.px(),met.py(),met.pz(),met.energy() );
sumEtRaw = met.uncorSumEt();
ptJESUP -> push_back( met.shiftedPt(pat::MET::JetEnUp) );
ptJESDOWN -> push_back( met.shiftedPt(pat::MET::JetEnDown) );
rawMet_Pt = met.uncorPt();
rawMet_Phi = met.uncorPhi();
if (IsExtend())
{
//MetNoMu
TLorentzVector metnomu(met.px(),met.py(),met.pz(),met.energy());
TLorentzVector tkMet(0,0,0,0);
TLorentzVector pfmet_3p0(0,0,0,0);
if ( pf == NULL ) cout<<"[NeroMetRecluster]::[analyze]::[ERROR] PF pointer is null. Run NeroPF. "<<endl;
for (unsigned int i = 0, n = pf->handle->size(); i < n; ++i) {
const pat::PackedCandidate &cand = (*pf->handle)[i];
// only up to eta 3
if (std::abs(cand.pdgId()) == 13)
metnomu += TLorentzVector(cand.px(),cand.py(),cand.pz(),cand.energy());
// only charge hadrons
if ( cand.charge() != 0 )
tkMet += TLorentzVector(cand.px(),cand.py(),cand.pz(),cand.energy());
if (std::abs(cand.eta()) < 3.0 )
pfmet_3p0 += TLorentzVector(cand.px(),cand.py(),cand.pz(),cand.energy());
}
*pfMet_e3p0 = TLorentzVector( -pfmet_3p0 );
*metNoMu = TLorentzVector(metnomu); // no minus
*trackMet = TLorentzVector( -tkMet );
auto &puppi = handle_puppi->front();
*metPuppi = TLorentzVector( puppi.px(), puppi.py(),puppi.pz(),puppi.energy() );
sumEtRawPuppi = handle_puppiUncorr->front().sumEt();
}
// GEN INFO
if ( not iEvent.isRealData () ){
new ( (*genP4)[genP4->GetEntriesFast()]) TLorentzVector( met.genMET()->px(),met.genMET()->py(),met.genMET()->pz(),met.genMET()->energy() );
}
return 0;
}
示例6: analyze
int NeroPuppiFatJets::analyze(const edm::Event& iEvent)
{
if ( mOnlyMc ) return 0;
if ( mMinId == "none" ) return 0;
// maybe handle should be taken before
iEvent.getByToken(token, handle);
iEvent.getByToken(rho_token,rho_handle);
TString tPrefix(cachedPrefix);
edm::Handle<reco::PFJetCollection> subjets_handle;
edm::InputTag subjetLabel("PFJetsSoftDrop"+tPrefix,"SubJets");
//iEvent.getByLabel(subjetLabel,subjets_handle);
iEvent.getByToken(subjets_token,subjets_handle);
const reco::PFJetCollection *subjetCol = subjets_handle.product();
assert(subjets_handle.isValid());
edm::Handle<reco::JetTagCollection> btags_handle;
//iEvent.getByLabel(edm::InputTag((tPrefix+"PFCombinedInclusiveSecondaryVertexV2BJetTags").Data()),btags_handle);
iEvent.getByToken(btags_token,btags_handle);
assert((btags_handle.isValid()));
FactorizedJetCorrector *corrector = ( iEvent.isRealData() ) ? mDataJetCorrector : mMCJetCorrector;
int ijetRef = -1;
int nsubjet = 0;
for (const pat::Jet& j : *handle)
{
ijetRef++;
if (fabs(j.eta() ) > mMaxEta) continue;
if ( !NeroPuppiJets::JetId(j,mMinId) ) continue;
// pT cut applied after applying JEC if necessary
// GET ValueMaps
// Fill output object
// this was reclustered from mini AOD, so we have to apply JEC, etc
edm::RefToBase<pat::Jet> jetRef(edm::Ref<pat::JetCollection>(handle,ijetRef));
double jecFactor=0;
if (fabs(j.eta())<5.191) {
corrector->setJetPt(j.pt());
corrector->setJetEta(j.eta());
corrector->setJetPhi(j.phi());
corrector->setJetE(j.energy());
corrector->setRho(*rho_handle);
corrector->setJetA(j.jetArea());
corrector->setJetEMF(-99.0);
jecFactor = corrector->getCorrection();
}
if (j.pt()*jecFactor < mMinPt) continue;
rawPt -> push_back (j.pt());
new ( (*p4)[p4->GetEntriesFast()]) TLorentzVector(j.px()*jecFactor, j.py()*jecFactor, j.pz()*jecFactor, j.energy()*jecFactor);
tau1 -> push_back(j.userFloat(tPrefix+"Njettiness:tau1"));
tau2 -> push_back(j.userFloat(tPrefix+"Njettiness:tau2"));
tau3 -> push_back(j.userFloat(tPrefix+"Njettiness:tau3"));
softdropMass->push_back(j.userFloat(tPrefix+"SDKinematics:Mass")*jecFactor);
unsigned int nsubjetThisJet=0;
firstSubjet->push_back(nsubjet);
for (reco::PFJetCollection::const_iterator i = subjetCol->begin(); i!=subjetCol->end(); ++i) {
if (reco::deltaR(i->eta(),i->phi(),j.eta(),j.phi())>jetRadius) continue;
nsubjetThisJet++;
new ( (*subjet)[nsubjet]) TLorentzVector(i->px(), i->py(), i->pz(), i->energy());
nsubjet++;
reco::JetBaseRef sjBaseRef(reco::PFJetRef(subjets_handle,i-subjetCol->begin()));
subjet_btag->push_back((float)(*(btags_handle.product()))[sjBaseRef]);
}
nSubjets->push_back(nsubjetThisJet);
}
return 0;
}
示例7: analyze
//.........这里部分代码省略.........
if (IsExtend())
{
//MetNoMu
TLorentzVector metnomu(met.px(),met.py(),met.pz(),met.energy());
TLorentzVector tkMet(0,0,0,0);
TLorentzVector pfmet_3p0(0,0,0,0);
if ( pf == NULL ) cout<<"[NeroMet]::[analyze]::[ERROR] PF pointer is null. Run NeroPF. "<<endl;
for (unsigned int i = 0, n = pf->handle->size(); i < n; ++i) {
const pat::PackedCandidate &cand = (*pf->handle)[i];
// only up to eta 3
if (std::abs(cand.pdgId()) == 13)
metnomu += TLorentzVector(cand.px(),cand.py(),cand.pz(),cand.energy());
// only charge hadrons
if ( cand.charge() != 0 )
tkMet += TLorentzVector(cand.px(),cand.py(),cand.pz(),cand.energy());
if (std::abs(cand.eta()) < 3.0 )
pfmet_3p0 += TLorentzVector(cand.px(),cand.py(),cand.pz(),cand.energy());
}
*pfMet_e3p0 = TLorentzVector( -pfmet_3p0 );
*metNoMu = TLorentzVector(metnomu); // no minus
*trackMet = TLorentzVector( -tkMet );
if (rerunPuppi) {
auto &puppi = handle_puppiRerun->front();
*metPuppi = TLorentzVector( puppi.px(), puppi.py(),puppi.pz(),puppi.energy() );
sumEtRawPuppi = handle_puppiRerunUncorr->front().sumEt();
} else {
auto &puppi = handle_puppi->front();
*metPuppi = TLorentzVector( puppi.px(), puppi.py(),puppi.pz(),puppi.energy() );
//sumEtRawPuppi = handle_puppiUncorr->front().sumEt();
sumEtRawPuppi = puppi.uncorSumEt();
}
for(Syst mysyst = (Syst)0; mysyst < MaxSyst ; mysyst = (Syst)((int)mysyst +1 ) )
{
pat::MET::METUncertainty miniAODUnc=pat::MET::METUncertaintySize;
// JetResUp=0, JetResDown=1, JetEnUp=2, JetEnDown=3,
// MuonEnUp=4, MuonEnDown=5, ElectronEnUp=6, ElectronEnDown=7,
// TauEnUp=8, TauEnDown=9, UnclusteredEnUp=10, UnclusteredEnDown=11,
// PhotonEnUp=12, PhotonEnDown=13, NoShift=14, METUncertaintySize=15,
// JetResUpSmear=16, JetResDownSmear=17, METFullUncertaintySize=18
// translate
switch (mysyst)
{
case JesUp : {miniAODUnc = pat::MET::JetEnUp; break;}
case JesDown : {miniAODUnc = pat::MET::JetEnDown; break;}
case JerUp : {miniAODUnc = pat::MET::JetResUp; break;}
case JerDown : {miniAODUnc = pat::MET::JetResDown; break;}
case UnclusterUp : {miniAODUnc = pat::MET::UnclusteredEnUp; break;}
case UnclusterDown : {miniAODUnc = pat::MET::UnclusteredEnDown; break;}
case TauUp : {miniAODUnc = pat::MET::TauEnUp; break;}
case TauDown : {miniAODUnc = pat::MET::TauEnDown; break;}
case PhotonUp : {miniAODUnc = pat::MET::PhotonEnDown; break;}
case PhotonDown : {miniAODUnc = pat::MET::PhotonEnDown; break;}
case ElectronUp : {miniAODUnc = pat::MET::ElectronEnUp; break;}
case ElectronDown : {miniAODUnc = pat::MET::ElectronEnDown; break;}
case MuonUp : {miniAODUnc = pat::MET::MuonEnUp; break;}
case MuonDown : {miniAODUnc = pat::MET::MuonEnDown; break;}
default : break;
}
if (miniAODUnc == pat::MET::METUncertaintySize)
cout <<"[NeroMet]::[analyze]::[WARNING] unable to translate met syst,"<< int(mysyst) <<endl;
/*
new ( (*metPuppiSyst)[ mysyst ] ) TLorentzVector(
puppi . shiftedP4( miniAODUnc).px(),
puppi . shiftedP4(miniAODUnc).py(),
puppi . shiftedP4(miniAODUnc).pz(),
puppi . shiftedP4(miniAODUnc).energy()
);
*/
new ( (*metSyst)[ mysyst ] ) TLorentzVector(
met . shiftedP4( miniAODUnc).px(),
met . shiftedP4(miniAODUnc).py(),
met . shiftedP4(miniAODUnc).pz(),
met . shiftedP4(miniAODUnc).energy()
);
}// end syst loop
}
// GEN INFO
if ( not iEvent.isRealData () ){
new ( (*genP4)[genP4->GetEntriesFast()]) TLorentzVector( met.genMET()->px(),met.genMET()->py(),met.genMET()->pz(),met.genMET()->energy() );
}
return 0;
}