Skip to content

Commit

Permalink
Merge pull request cms-sw#125 from jbsauvan/ntuple-cluster-links
Browse files Browse the repository at this point in the history
Add constituent links to clusters in ntuples
  • Loading branch information
jbsauvan authored Jul 2, 2017
2 parents 91aa618 + 8a54bfd commit f5332f2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

#include <algorithm>
#include "DataFormats/L1THGCal/interface/HGCalCluster.h"
#include "DataFormats/ForwardDetId/interface/HGCalDetId.h"
#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h"
Expand Down Expand Up @@ -28,6 +29,7 @@ class HGCalTriggerNtupleHGCClusters : public HGCalTriggerNtupleBase
std::vector<float> cl_phi_;
std::vector<int> cl_layer_;
std::vector<int> cl_ncells_;
std::vector<std::vector<unsigned>> cl_cells_;

};

Expand All @@ -54,6 +56,7 @@ initialize(TTree& tree, const edm::ParameterSet& conf, edm::ConsumesCollector&&
tree.Branch("cl_phi", &cl_phi_);
tree.Branch("cl_layer", &cl_layer_);
tree.Branch("cl_ncells", &cl_ncells_);
tree.Branch("cl_cells", &cl_cells_);
}

void
Expand Down Expand Up @@ -81,6 +84,11 @@ fill(const edm::Event& e, const edm::EventSetup& es)
cl_phi_.emplace_back(cl_itr->phi());
cl_layer_.emplace_back(cl_itr->layer());
cl_ncells_.emplace_back(cl_itr->constituents().size());
// Retrieve indices of trigger cells inside cluster
cl_cells_.emplace_back(cl_itr->constituents().size());
std::transform(cl_itr->constituents_begin(), cl_itr->constituents_end(),
cl_cells_.back().begin(), [](const edm::Ptr<l1t::HGCalTriggerCell>& tc){return tc.key();}
);
}
}

Expand All @@ -96,6 +104,7 @@ clear()
cl_phi_.clear();
cl_layer_.clear();
cl_ncells_.clear();
cl_cells_.clear();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class HGCalTriggerNtupleHGCMulticlusters : public HGCalTriggerNtupleBase
std::vector<float> cl3d_eta_;
std::vector<float> cl3d_phi_;
std::vector<int> cl3d_nclu_;
std::vector<std::vector<unsigned>> cl3d_clusters_;
};

DEFINE_EDM_PLUGIN(HGCalTriggerNtupleFactory,
Expand All @@ -51,6 +52,7 @@ initialize(TTree& tree, const edm::ParameterSet& conf, edm::ConsumesCollector&&
tree.Branch("cl3d_eta", &cl3d_eta_);
tree.Branch("cl3d_phi", &cl3d_phi_);
tree.Branch("cl3d_nclu", &cl3d_nclu_);
tree.Branch("cl3d_clusters", &cl3d_clusters_);

}

Expand Down Expand Up @@ -78,6 +80,11 @@ fill(const edm::Event& e, const edm::EventSetup& es)
cl3d_eta_.emplace_back(cl3d_itr->eta());
cl3d_phi_.emplace_back(cl3d_itr->phi());
cl3d_nclu_.emplace_back(cl3d_itr->constituents().size());
// Retrieve indices of trigger cells inside cluster
cl3d_clusters_.emplace_back(cl3d_itr->constituents().size());
std::transform(cl3d_itr->constituents_begin(), cl3d_itr->constituents_end(),
cl3d_clusters_.back().begin(), [](const edm::Ptr<l1t::HGCalCluster>& cl){return cl.key();}
);
}
}

Expand All @@ -92,6 +99,7 @@ clear()
cl3d_eta_.clear();
cl3d_phi_.clear();
cl3d_nclu_.clear();
cl3d_clusters_.clear();

}

Expand Down

0 comments on commit f5332f2

Please sign in to comment.