Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCC ntupler 76x - October2015 #11832

Merged
merged 2 commits into from
Oct 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 62 additions & 2 deletions RecoLuminosity/LumiProducer/test/analysis/plugins/PCCNTupler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ PCCNTupler::PCCNTupler(edm::ParameterSet const& iConfig):
saveType(iConfig.getUntrackedParameter<string>("saveType")),
sampleType(iConfig.getUntrackedParameter<string>("sampleType")),
includeVertexInformation(iConfig.getUntrackedParameter<bool>("includeVertexInformation",1)),
includePixels(iConfig.getUntrackedParameter<bool>("includePixels",1))
includePixels(iConfig.getUntrackedParameter<bool>("includePixels",1)),
includeJets(iConfig.getUntrackedParameter<bool>("includeJets",0)),
splitByBX(iConfig.getUntrackedParameter<bool>("splitByBX",1))
{
cout << "----------------------------------------------------------------------" << endl;
cout << "--- PCCNTupler constructor" << endl;
Expand Down Expand Up @@ -114,6 +116,28 @@ PCCNTupler::PCCNTupler(edm::ParameterSet const& iConfig):
pileUpToken=consumes<std::vector< PileupSummaryInfo> >(fPileUpInfoLabel);
tree->Branch("nPU",&nPU,"nPU/I");
}

if(includeJets){
hltjetsToken_=consumes<reco::CaloJetCollection >(edm::InputTag("ak4CaloJets"));
const int kMaxJetCal = 100;
jhcalpt = new float[kMaxJetCal];
jhcalphi = new float[kMaxJetCal];
jhcaleta = new float[kMaxJetCal];
jhcale = new float[kMaxJetCal];
jhcalemf = new float[kMaxJetCal];
jhcaln90 = new float[kMaxJetCal];
jhcaln90hits = new float[kMaxJetCal];

//ccla HLTJETS
tree->Branch("NohJetCal",&nhjetcal,"NohJetCal/I");
tree->Branch("ohJetCalPt",jhcalpt,"ohJetCalPt[NohJetCal]/F");
tree->Branch("ohJetCalPhi",jhcalphi,"ohJetCalPhi[NohJetCal]/F");
tree->Branch("ohJetCalEta",jhcaleta,"ohJetCalEta[NohJetCal]/F");
tree->Branch("ohJetCalE",jhcale,"ohJetCalE[NohJetCal]/F");
tree->Branch("ohJetCalEMF",jhcalemf,"ohJetCalEMF[NohJetCal]/F");
tree->Branch("ohJetCalN90",jhcaln90,"ohJetCalN90[NohJetCal]/F");
tree->Branch("ohJetCalN90hits",jhcaln90hits,"ohJetCalN90hits[NohJetCal]/F");
}
}

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -192,6 +216,9 @@ void PCCNTupler::analyze(const edm::Event& iEvent,
//LN = -99; // FIXME need the luminibble
event = iEvent.id().event();
bunchCrossing = iEvent.bunchCrossing();
if(!splitByBX){ //if no splitting by BX then we can remove info.
bunchCrossing=-10;
}
timeStamp_local = iEvent.time().unixTime();
if(timeStamp_end <timeStamp_local) timeStamp_end =timeStamp_local;
if(timeStamp_begin>timeStamp_local) timeStamp_begin =timeStamp_local;
Expand Down Expand Up @@ -225,9 +252,10 @@ void PCCNTupler::analyze(const edm::Event& iEvent,


if(recVtxs.isValid()){
nVtx=recVtxs->size();
//nVtx=recVtxs->size();
int ivtx=0;
for(reco::VertexCollection::const_iterator v=recVtxs->begin(); v!=recVtxs->end(); ++v){
if(v->isFake()) continue;
vtx_isGood[ivtx] = false;
vtx_nTrk[ivtx] = v->tracksSize();
vtx_ndof[ivtx] = (int)v->ndof();
Expand All @@ -252,6 +280,38 @@ void PCCNTupler::analyze(const edm::Event& iEvent,
}
ivtx++;
}
nVtx=ivtx;
}
}

if(includeJets){
edm::Handle< reco::CaloJetCollection > hltjets;
iEvent.getByToken(hltjetsToken_, hltjets);
bool valid = hltjets.isValid();
if (not valid) {
std::cout << "hltjets not valid "<<std::endl;
nhjetcal = -1;
} else {
reco::CaloJetCollection mycalojets;
mycalojets=*hltjets;
//std::sort(mycalojets.begin(),mycalojets.end(),PtGreater());
typedef reco::CaloJetCollection::const_iterator cjiter;
int jhcal=0;
for ( cjiter i=mycalojets.begin(); i!=mycalojets.end(); i++) {
if (i->pt()>5 && i->energy()>0.){
jhcalpt[jhcal] = i->pt();
jhcalphi[jhcal] = i->phi();
jhcaleta[jhcal] = i->eta();
jhcale[jhcal] = i->energy();
jhcalemf[jhcal] = i->emEnergyFraction();
jhcaln90[jhcal] = i->n90();
//jetID->calculate( iEvent, *i );
//jhcaln90hits[jhcal] = jetID->n90Hits();
jhcal++;
}

}
nhjetcal = jhcal;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "DataFormats/VertexReco/interface/Vertex.h"

#include "DataFormats/JetReco/interface/CaloJetCollection.h"

#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Utilities/interface/EDGetToken.h"

Expand Down Expand Up @@ -64,7 +66,10 @@ class PCCNTupler : public edm::one::EDAnalyzer<edm::one::SharedResources, edm::o
edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > pixelToken;
edm::EDGetTokenT<reco::VertexCollection> recoVtxToken;
edm::EDGetTokenT<std::vector< PileupSummaryInfo> > pileUpToken;

edm::EDGetTokenT<reco::CaloJetCollection> hltjetsToken_;
float *jhcalpt, *jhcalphi, *jhcaleta, *jhcale, *jhcalemf, *jhcaln90, *jhcaln90hits;
int nhjetcal;

edm::InputTag fPrimaryVertexCollectionLabel;
edm::InputTag fPixelClusterLabel;
edm::InputTag fPileUpInfoLabel;
Expand Down Expand Up @@ -96,6 +101,8 @@ class PCCNTupler : public edm::one::EDAnalyzer<edm::one::SharedResources, edm::o

bool includeVertexInformation;
bool includePixels;
bool includeJets;
bool splitByBX;

int nPU;
int nVtx;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
sampleType = cms.untracked.string('MC'), # MC, DATA
includeVertexInformation = cms.untracked.bool(True),
includePixels = cms.untracked.bool(True),
splitByBX = cms.untracked.bool(True),
L1GTReadoutRecordLabel = cms.untracked.InputTag('gtDigis'),
hltL1GtObjectMap = cms.untracked.InputTag('hltL1GtObjectMap'),
HLTResultsLabel = cms.untracked.InputTag('TriggerResults::HLT')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
sampleType = cms.untracked.string('DATA'), # MC, DATA
includeVertexInformation = cms.untracked.bool(False),
includePixels = cms.untracked.bool(True),
splitByBX = cms.untracked.bool(True),
L1GTReadoutRecordLabel = cms.untracked.InputTag('gtDigis'),
hltL1GtObjectMap = cms.untracked.InputTag('hltL1GtObjectMap'),
HLTResultsLabel = cms.untracked.InputTag('TriggerResults::HLT')
Expand All @@ -78,4 +79,5 @@
secFiles = cms.untracked.vstring()
process.source = cms.Source ("PoolSource",fileNames = readFiles, secondaryFileNames = secFiles)
readFiles.extend([
'/store/data/Run2015C/AlCaLumiPixels/ALCARECO/LumiPixels-PromptReco-v1/000/253/684/00000/5C6B6D62-BB3E-E511-943E-02163E01431C.root',
'/store/data/Run2015B/AlCaLumiPixels/ALCARECO/LumiPixels-PromptReco-v1/000/251/497/00000/28D83B84-E428-E511-8F44-02163E0138B3.root',])
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# ######################################################################
#
# pixelLumi.py
#
# ----------------------------------------------------------------------
import os
import FWCore.ParameterSet.Config as cms
process = cms.Process("Lumi")

# ----------------------------------------------------------------------
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger.cerr.threshold = 'INFO'
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
process.MessageLogger.categories.append('HLTrigReport')
process.MessageLogger.categories.append('L1GtTrigReport')
process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )

# -- Database configuration
process.load("CondCore.DBCommon.CondDBCommon_cfi")
process.load("CondCore.DBCommon.CondDBSetup_cfi")

# -- Conditions
process.load("Configuration.StandardSequences.MagneticField_38T_cff")
process.load("Configuration.StandardSequences.GeometryRecoDB_cff") # works for MC & data
process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi")

process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff')
from Configuration.AlCa.GlobalTag_condDBv2 import GlobalTag
#process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '')
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_hlt_GRun', '')

process.load("Configuration.StandardSequences.Reconstruction_cff")

# -- number of events
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(-1)
)

# -- skimming
process.zerobiasfilter = cms.EDFilter("HLTHighLevel",
TriggerResultsTag = cms.InputTag("TriggerResults","","HLT"),
#HLTPaths = cms.vstring("HLT_ZeroBias_v*"),
HLTPaths = cms.vstring("*ZeroBias*"),
eventSetupPathsKey = cms.string(""),
andOr = cms.bool(True),
throw = cms.bool(False)
)

# the main Analyzer
process.lumi = cms.EDAnalyzer(
"PCCNTupler",
verbose = cms.untracked.int32(0),
#rootFileName = cms.untracked.string(rootFileName),
#type = cms.untracked.string(getDataset(process.source.fileNames[0])),
globalTag = process.GlobalTag.globaltag,
dumpAllEvents = cms.untracked.int32(0),
vertexCollLabel = cms.untracked.InputTag('offlinePrimaryVertices'),
pixelClusterLabel = cms.untracked.InputTag('siPixelClusters'),
saveType = cms.untracked.string('LumiSect'), # LumiSect, LumiNib, Event
sampleType = cms.untracked.string('DATA'), # MC, DATA
includeVertexInformation = cms.untracked.bool(True),
includePixels = cms.untracked.bool(True),
splitByBX = cms.untracked.bool(False),
L1GTReadoutRecordLabel = cms.untracked.InputTag('gtDigis'),
hltL1GtObjectMap = cms.untracked.InputTag('hltL1GtObjectMap'),
HLTResultsLabel = cms.untracked.InputTag('TriggerResults::HLT')
)

# -- Path
process.p = cms.Path(
process.zerobiasfilter*
process.lumi
)


outFile = 'pcc_Data_PixVtx_LS.root'
process.TFileService = cms.Service("TFileService",fileName = cms.string(outFile))
readFiles = cms.untracked.vstring()
secFiles = cms.untracked.vstring()
process.source = cms.Source ("PoolSource",fileNames = readFiles, secondaryFileNames = secFiles)
readFiles.extend([
'/store/express/Run2015C/ExpressPhysics_0T/FEVT/Express-v3/000/256/385/00000/02EC6A5B-5B59-E511-A555-02163E011A29.root',
'/store/express/Run2015C/ExpressPhysics_0T/FEVT/Express-v3/000/256/385/00000/0616947E-5959-E511-9D4F-02163E0132A0.root',
'/store/express/Run2015C/ExpressPhysics_0T/FEVT/Express-v3/000/256/385/00000/0C5246A7-6959-E511-A58E-02163E0124A9.root',
'/store/express/Run2015C/ExpressPhysics_0T/FEVT/Express-v3/000/256/385/00000/10DD1A69-5859-E511-B314-02163E0140DE.root',
])
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
sampleType = cms.untracked.string('DATA'), # MC, DATA
includeVertexInformation = cms.untracked.bool(True),
includePixels = cms.untracked.bool(True),
splitByBX = cms.untracked.bool(True),
L1GTReadoutRecordLabel = cms.untracked.InputTag('gtDigis'),
hltL1GtObjectMap = cms.untracked.InputTag('hltL1GtObjectMap'),
HLTResultsLabel = cms.untracked.InputTag('TriggerResults::HLT')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
sampleType = cms.untracked.string('MC'), # MC, DATA
includeVertexInformation = cms.untracked.bool(True),
includePixels = cms.untracked.bool(False),
splitByBX = cms.untracked.bool(True),
L1GTReadoutRecordLabel = cms.untracked.InputTag('gtDigis'),
hltL1GtObjectMap = cms.untracked.InputTag('hltL1GtObjectMap'),
HLTResultsLabel = cms.untracked.InputTag('TriggerResults::HLT')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@

#name='Pt15to30'
config.section_("General")
config.General.requestName = 'PCC_AlCaLumiPixels_Run2015A_PIXONLY_LS'
config.General.requestName = 'PCC_AlCaLumiPixels_Run2015C_PIXONLY_LS_v2'
config.General.workArea = 'taskManagement'

config.section_("JobType")
config.JobType.pluginName = 'Analysis'
config.JobType.psetName = 'Run_Pix_LS.py'
config.JobType.psetName = 'Run_AlCaLumiPixels_LS.py'
config.JobType.allowUndistributedCMSSW = True


#config.JobType.inputFiles = ['dttf_config.db']

config.section_("Data")
config.Data.inputDataset = '/AlCaLumiPixels/Run2015A-LumiPixels-PromptReco-v1/ALCARECO'
config.Data.lumiMask = ''
config.Data.inputDataset = '/AlCaLumiPixels/Run2015C-LumiPixels-PromptReco-v1/ALCARECO'
#config.Data.lumiMask = ''
config.Data.runRange = '254833'

config.Data.ignoreLocality = True
#useParent = True
Expand All @@ -27,10 +28,10 @@
config.Data.splitting = 'LumiBased'
#config.Data.splitting = 'EventAwareLumiBased'
config.Data.publication = False
config.Data.unitsPerJob = 50
config.Data.unitsPerJob = 10
#config.Data.totalUnits = -1
#config.Data.publishDbsUrl = 'test'
config.Data.publishDataName = 'PCC_AlCaLumiPixels_Run2015A_PIXONLY_LS'
config.Data.publishDataName = 'PCC_AlCaLumiPixels_Run2015C_PIXONLY_LS_254833'
config.Data.outLFNDirBase = '/store/group/comm_luminosity/PCC/ForLumiComputation'

config.section_("Site")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from WMCore.Configuration import Configuration
config = Configuration()


#name='Pt15to30'
config.section_("General")
config.General.requestName = 'PCC_ExpressStream_121015'
config.General.workArea = 'taskManagement'

config.section_("JobType")
config.JobType.pluginName = 'Analysis'
config.JobType.psetName = 'Run_PixVertex_DataCert.py'
config.JobType.allowUndistributedCMSSW = True


#config.JobType.inputFiles = ['dttf_config.db']

config.section_("Data")
config.Data.inputDataset = '/StreamExpress/Run2015D-LumiPixelsMinBias-Express-v4/ALCARECO'
#config.Data.inputDataset = '/ZeroBias/Run2015C-PromptReco-v1/RECO'
config.Data.runRange = ''


config.Data.ignoreLocality = True
#useParent = True


config.Data.inputDBS = 'global'
config.Data.splitting = 'LumiBased'
#config.Data.splitting = 'EventAwareLumiBased'
config.Data.publication = False
config.Data.unitsPerJob = 25
#config.Data.totalUnits = -1
#config.Data.publishDbsUrl = 'test'
config.Data.publishDataName = 'PCC_ExpressStream_121015'
config.Data.outLFNDirBase = '/store/group/comm_luminosity/PCC/DataCert'

config.section_("Site")
config.Site.storageSite = 'T2_CH_CERN'
config.Site.whitelist=['T2_FR_CCIN2P3','T2_IT_Pisa','T2_UK_London_IC','T2_HU_Budapest']
#config.Site.whitelist=['T2_FR_CCIN2P3']
12 changes: 6 additions & 6 deletions RecoLuminosity/LumiProducer/test/analysis/test/crab3_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@

#name='Pt15to30'
config.section_("General")
config.General.requestName = 'PCC_ZeroBias_RAW_miniVdM_252116'
config.General.requestName = 'PCC_ZeroBias_DataCert_150820'
config.General.workArea = 'taskManagement'

config.section_("JobType")
config.JobType.pluginName = 'Analysis'
config.JobType.psetName = 'RunFromRAW_AlwaysTrue_Data_Event.py'
config.JobType.psetName = 'Run_PixVertex_LS.py'
config.JobType.allowUndistributedCMSSW = True


#config.JobType.inputFiles = ['dttf_config.db']

config.section_("Data")
config.Data.inputDataset = '/ZeroBias/Run2015B-v1/RAW'
config.Data.lumiMask = 'json_252116_optScan.txt'
config.Data.inputDataset = '/ZeroBias/Run2015C-LumiPixelsMinBias-PromptReco-v1/ALCARECO'
config.Data.lumiMask = 'jsondummy_254227_254459.txt'

config.Data.ignoreLocality = True
#useParent = True
Expand All @@ -27,10 +27,10 @@
config.Data.splitting = 'LumiBased'
#config.Data.splitting = 'EventAwareLumiBased'
config.Data.publication = False
config.Data.unitsPerJob = 4
config.Data.unitsPerJob = 10
#config.Data.totalUnits = -1
#config.Data.publishDbsUrl = 'test'
config.Data.publishDataName = 'PCC_ZeroBias_RAW_miniVdM_252116'
config.Data.publishDataName = 'PCC_ZeroBias_DataCert_150820'

config.section_("Site")
config.Site.storageSite = 'T2_CH_CERN'
Expand Down