Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
423b426
adding ca15 doubleb
Nov 4, 2016
13e28fd
solving conflicts
Nov 4, 2016
a17b699
solving conflicts
Nov 4, 2016
2442754
removing ~ files
Nov 4, 2016
5025bab
keep trying
Nov 9, 2016
9b022e4
extracting tag info from pat
Nov 11, 2016
4378224
extracting tag info from pat
Nov 11, 2016
f895c6e
doubleb finally working
Nov 14, 2016
536c3fb
solving crash on data
Nov 20, 2016
226a99a
removing crab stuff
Nov 20, 2016
ebbaf91
solving conflicts
Nov 21, 2016
8e270c9
latest chages before merging with Sid
Nov 30, 2016
31579c8
latest chages before merging with Sid
Nov 30, 2016
0bd0d56
solving conflicts
Nov 30, 2016
cbe349b
running copy
Dec 5, 2016
1c663e2
running copy
Dec 5, 2016
c65d98d
fixing conflicts
Dec 5, 2016
c1ae093
to send on crab
Dec 5, 2016
8a0408f
fixing btagging for ak4 puppi
Dec 9, 2016
03edbcf
merging
Dec 9, 2016
3f8ad66
lower fat jet pt
Dec 15, 2016
05dfabe
Merge branch 'master' of https://github.com/PandaPhysics/PandaProd
Dec 16, 2016
54296a4
last commit before merging
Jan 19, 2017
1008d03
before merge request
Jan 19, 2017
917d0ec
configuring new jec
Jan 20, 2017
70f91c9
ca15 genjets
Jan 20, 2017
42cf816
Egm stuff
Jan 20, 2017
6684e0f
fixing pho id, triggers on MC
Jan 20, 2017
4124705
adding trigger filter, dropping some gen info for data
Jan 20, 2017
ea9ec47
configuring to run on summer16
Jan 21, 2017
937b7cf
cleaning
Jan 21, 2017
f571485
fixing GT
Jan 21, 2017
a81a9a2
updating GT; fixing some indentation
Jan 21, 2017
6d9db92
further cleaning
Jan 21, 2017
c9cc560
further cleaning
Jan 21, 2017
0ead4a2
for merging
Jan 21, 2017
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*~
*.swp
*.root
*.d
Expand Down
180 changes: 90 additions & 90 deletions Filter/plugins/InfoProducer.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// -*- C++ -*-
//
// Package: NtupleTools/InfoProducer
// Class: InfoProducer
// Package: NtupleTools/InfoProducer
// Class: InfoProducer
//
/**\class InfoProducer InfoProducer.cc NtupleTools/InfoProducer/plugins/InfoProducer.cc

Expand Down Expand Up @@ -40,135 +40,135 @@ using namespace edm;
using namespace std;

class InfoProducer : public edm::one::EDProducer<edm::one::WatchLuminosityBlocks,
edm::EndLuminosityBlockProducer>{
public:
explicit InfoProducer(const edm::ParameterSet&);
~InfoProducer();
edm::EndLuminosityBlockProducer>{
public:
explicit InfoProducer(const edm::ParameterSet&);
~InfoProducer();


private:
virtual void produce(edm::Event&, const edm::EventSetup&) override;
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup&) override;
virtual void endLuminosityBlock(edm::LuminosityBlock const&, const edm::EventSetup&) override;
virtual void endLuminosityBlockProduce(edm::LuminosityBlock &, const edm::EventSetup&) override;
// ----------member data ---------------------------
unsigned int eventsProcessedInLumi_;
double mcWeights_;
private:
virtual void produce(edm::Event&, const edm::EventSetup&) override;
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup&) override;
virtual void endLuminosityBlock(edm::LuminosityBlock const&, const edm::EventSetup&) override;
virtual void endLuminosityBlockProduce(edm::LuminosityBlock &, const edm::EventSetup&) override;
// ----------member data ---------------------------
unsigned int eventsProcessedInLumi_;
double mcWeights_;

template <class T>
void inline copyVector( const vector<T> &a, vector<T> &b){ b.clear(); for (auto x : a) b.push_back(x); }
template <class T>
void inline copyVector( const vector<T> &a, vector<T> &b){ b.clear(); for (auto x : a) b.push_back(x); }

vector<long> vecEvents_;
vector<float> vecMcWeights_;
vector<int> vecPuTrueInt_;
vector<long> vecEvents_;
vector<float> vecMcWeights_;
vector<int> vecPuTrueInt_;

edm::EDGetTokenT<GenEventInfoProduct> info_token;
edm::Handle<GenEventInfoProduct> info_handle;
edm::EDGetTokenT<GenEventInfoProduct> info_token;
edm::Handle<GenEventInfoProduct> info_handle;

edm::EDGetTokenT<std::vector<PileupSummaryInfo> > pu_token;
edm::Handle< std::vector<PileupSummaryInfo> > pu_handle;
edm::EDGetTokenT<std::vector<PileupSummaryInfo> > pu_token;
edm::Handle< std::vector<PileupSummaryInfo> > pu_handle;


};
};

InfoProducer::InfoProducer(const edm::ParameterSet& iConfig)
: info_token(consumes<GenEventInfoProduct>(iConfig.getParameter<edm::InputTag>("generator")) ),
//pu_token(consumes<std::vector<PileupSummaryInfo> >(edm::InputTag("addPileupInfo")))
pu_token(consumes<std::vector<PileupSummaryInfo> >(edm::InputTag("slimmedAddPileupInfo")))
: info_token(consumes<GenEventInfoProduct>(iConfig.getParameter<edm::InputTag>("generator")) ),
//pu_token(consumes<std::vector<PileupSummaryInfo> >(edm::InputTag("addPileupInfo")))
pu_token(consumes<std::vector<PileupSummaryInfo> >(edm::InputTag("slimmedAddPileupInfo")))
{
//register your products
//produces<edm::ValueMap<bool> >("monojetSelection");
produces<edm::MergeableCounter, edm::InLumi>("numberEvents");
produces<edm::MergeableCounter, edm::InLumi>("sumMcWeights");

// save this info for all the events, in the lumiblock
produces<std::vector<long>, edm::InLumi>("vecEvents");
produces<std::vector<float>, edm::InLumi>("vecMcWeights");
produces<std::vector<int>, edm::InLumi>("vecPuTrueInt");
//register your products
//produces<edm::ValueMap<bool> >("monojetSelection");
produces<edm::MergeableCounter, edm::InLumi>("numberEvents");
produces<edm::MergeableCounter, edm::InLumi>("sumMcWeights");

// save this info for all the events, in the lumiblock
produces<std::vector<long>, edm::InLumi>("vecEvents");
produces<std::vector<float>, edm::InLumi>("vecMcWeights");
produces<std::vector<int>, edm::InLumi>("vecPuTrueInt");
}


InfoProducer::~InfoProducer(){}

void
void
InfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
{
// edm::Handle<edm::View<reco::Jet> > ak4Jets;
// iEvent.getByLabel("slimmedJets", ak4Jets);
// prepare output
// edm::Handle<edm::View<reco::Jet> > ak4Jets;
// iEvent.getByLabel("slimmedJets", ak4Jets);
// prepare output

// fill information
eventsProcessedInLumi_++;
vecEvents_.push_back(iEvent.id().event());
// fill information
eventsProcessedInLumi_++;
vecEvents_.push_back(iEvent.id().event());


if ( not iEvent.isRealData() )
{
// define input
iEvent.getByToken(info_token, info_handle);
mcWeights_ += info_handle -> weight();
if ( not iEvent.isRealData() )
{
// define input
iEvent.getByToken(info_token, info_handle);
mcWeights_ += info_handle -> weight();

vecMcWeights_ . push_back( info_handle -> weight());
vecMcWeights_ . push_back( info_handle -> weight());

iEvent.getByToken(pu_token, pu_handle);
iEvent.getByToken(pu_token, pu_handle);

int puTrueInt = 0;
for(const auto & pu : *pu_handle)
{
//Intime
if (pu.getBunchCrossing() == 0)
puTrueInt += pu.getTrueNumInteractions();
//puInt += getPU_NumInteractions(); //old
//Out-of-time
}
int puTrueInt = 0;
for(const auto & pu : *pu_handle)
{
//Intime
if (pu.getBunchCrossing() == 0)
puTrueInt += pu.getTrueNumInteractions();
//puInt += getPU_NumInteractions(); //old
//Out-of-time
}


vecPuTrueInt_ . push_back(puTrueInt);
}
vecPuTrueInt_ . push_back(puTrueInt);
}

// finalize
// finalize
}


void InfoProducer::beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup&)
{
mcWeights_ = 0;
eventsProcessedInLumi_ = 0;
mcWeights_ = 0;
eventsProcessedInLumi_ = 0;

vecMcWeights_ . clear();
vecPuTrueInt_ . clear();
vecEvents_ . clear();
vecMcWeights_ . clear();
vecPuTrueInt_ . clear();
vecEvents_ . clear();
}

void InfoProducer::endLuminosityBlock(edm::LuminosityBlock const&, const edm::EventSetup&)
{}

void InfoProducer::endLuminosityBlockProduce(edm::LuminosityBlock &iLumi, const edm::EventSetup&)
{
// ---
auto_ptr<edm::MergeableCounter> numEventsPtr(new edm::MergeableCounter);
auto_ptr<edm::MergeableCounter> sumMcWeights(new edm::MergeableCounter);

numEventsPtr->value = eventsProcessedInLumi_;
sumMcWeights->value = mcWeights_;

iLumi.put(numEventsPtr,"numberEvents");
iLumi.put(sumMcWeights,"sumMcWeights");

// ---
auto_ptr<std::vector<long> > vecEventsPtr( new vector<long> );
auto_ptr<std::vector<float> > vecMcWeightsPtr( new vector<float> );
auto_ptr<std::vector<int> > vecPuTrueIntPtr( new vector<int> );

copyVector(vecEvents_, *vecEventsPtr.get());
copyVector(vecMcWeights_, *vecMcWeightsPtr.get());
copyVector(vecPuTrueInt_, *vecPuTrueIntPtr.get());
//
iLumi.put(vecEventsPtr,"vecEvents");
iLumi.put(vecMcWeightsPtr,"vecMcWeights");
iLumi.put(vecPuTrueIntPtr,"vecPuTrueInt");
// ---
auto_ptr<edm::MergeableCounter> numEventsPtr(new edm::MergeableCounter);
auto_ptr<edm::MergeableCounter> sumMcWeights(new edm::MergeableCounter);

numEventsPtr->value = eventsProcessedInLumi_;
sumMcWeights->value = mcWeights_;

iLumi.put(numEventsPtr,"numberEvents");
iLumi.put(sumMcWeights,"sumMcWeights");

// ---
auto_ptr<std::vector<long> > vecEventsPtr( new vector<long> );
auto_ptr<std::vector<float> > vecMcWeightsPtr( new vector<float> );
auto_ptr<std::vector<int> > vecPuTrueIntPtr( new vector<int> );

copyVector(vecEvents_, *vecEventsPtr.get());
copyVector(vecMcWeights_, *vecMcWeightsPtr.get());
copyVector(vecPuTrueInt_, *vecPuTrueIntPtr.get());
//
iLumi.put(vecEventsPtr,"vecEvents");
iLumi.put(vecMcWeightsPtr,"vecMcWeights");
iLumi.put(vecPuTrueIntPtr,"vecPuTrueInt");
}
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------

//define this as a plug-in
DEFINE_FWK_MODULE(InfoProducer);
Loading