CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
HGCalTriggerNtupleHGCClusters Class Reference
Inheritance diagram for HGCalTriggerNtupleHGCClusters:
HGCalTriggerNtupleBase

Public Member Functions

void fill (const edm::Event &e, const HGCalTriggerNtupleEventSetup &es) final
 
 HGCalTriggerNtupleHGCClusters (const edm::ParameterSet &conf)
 
void initialize (TTree &, const edm::ParameterSet &, edm::ConsumesCollector &&) final
 
 ~HGCalTriggerNtupleHGCClusters () override
 
- Public Member Functions inherited from HGCalTriggerNtupleBase
bool accessEventSetup () const
 
virtual void fill (const edm::Event &, const edm::EventSetup &)
 
 HGCalTriggerNtupleBase (const edm::ParameterSet &conf)
 
const std::string & name () const
 
virtual ~HGCalTriggerNtupleBase ()
 

Private Member Functions

void clear () final
 

Private Attributes

std::vector< std::vector
< uint32_t > > 
cl_cells_id_
 
std::vector< int > cl_cells_n_
 
std::vector< float > cl_energy_
 
std::vector< float > cl_eta_
 
std::vector< uint32_t > cl_id_
 
std::vector< int > cl_layer_
 
std::vector< float > cl_mipPt_
 
std::vector< uint32_t > cl_multicluster_id_
 
std::vector< float > cl_multicluster_pt_
 
int cl_n_
 
std::vector< float > cl_phi_
 
std::vector< float > cl_pt_
 
std::vector< int > cl_subdet_
 
edm::EDGetToken clusters_token_
 
bool filter_clusters_in_multiclusters_
 
edm::EDGetToken multiclusters_token_
 
HGCalTriggerTools triggerTools_
 

Additional Inherited Members

- Protected Attributes inherited from HGCalTriggerNtupleBase
bool accessEventSetup_ = true
 
const std::string name_
 

Detailed Description

Definition at line 9 of file HGCalTriggerNtupleHGCClusters.cc.

Constructor & Destructor Documentation

HGCalTriggerNtupleHGCClusters::HGCalTriggerNtupleHGCClusters ( const edm::ParameterSet conf)

Definition at line 40 of file HGCalTriggerNtupleHGCClusters.cc.

References HGCalTriggerNtupleBase::accessEventSetup_.

41  : HGCalTriggerNtupleBase(conf),
42  filter_clusters_in_multiclusters_(conf.getParameter<bool>("FilterClustersInMulticlusters")) {
43  accessEventSetup_ = false;
44 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HGCalTriggerNtupleBase(const edm::ParameterSet &conf)
HGCalTriggerNtupleHGCClusters::~HGCalTriggerNtupleHGCClusters ( )
inlineoverride

Definition at line 12 of file HGCalTriggerNtupleHGCClusters.cc.

12 {};

Member Function Documentation

void HGCalTriggerNtupleHGCClusters::clear ( void  )
finalprivatevirtual

Implements HGCalTriggerNtupleBase.

Definition at line 128 of file HGCalTriggerNtupleHGCClusters.cc.

References cl_cells_id_, cl_cells_n_, cl_energy_, cl_eta_, cl_id_, cl_layer_, cl_mipPt_, cl_multicluster_id_, cl_multicluster_pt_, cl_n_, cl_phi_, cl_pt_, and cl_subdet_.

Referenced by fill().

128  {
129  cl_n_ = 0;
130  cl_id_.clear();
131  cl_mipPt_.clear();
132  cl_pt_.clear();
133  cl_energy_.clear();
134  cl_eta_.clear();
135  cl_phi_.clear();
136  cl_layer_.clear();
137  cl_subdet_.clear();
138  cl_cells_n_.clear();
139  cl_cells_id_.clear();
140  cl_multicluster_id_.clear();
141  cl_multicluster_pt_.clear();
142 }
std::vector< std::vector< uint32_t > > cl_cells_id_
void HGCalTriggerNtupleHGCClusters::fill ( const edm::Event e,
const HGCalTriggerNtupleEventSetup es 
)
finalvirtual

Reimplemented from HGCalTriggerNtupleBase.

Definition at line 77 of file HGCalTriggerNtupleHGCClusters.cc.

References BXVector< T >::begin(), cl_cells_id_, cl_cells_n_, cl_energy_, cl_eta_, cl_id_, cl_layer_, cl_mipPt_, cl_multicluster_id_, cl_multicluster_pt_, cl_n_, cl_phi_, cl_pt_, cl_subdet_, clear(), HLT_FULL_cff::clusters, clusters_token_, BXVector< T >::end(), filter_clusters_in_multiclusters_, HGCalTriggerNtupleEventSetup::geometry, edm::Event::getByToken(), HGCalTriggerTools::layerWithOffset(), multiclusters_token_, edm::ESHandle< class >::product(), HGCalTriggerTools::setGeometry(), HcalDetIdTransform::transform(), and triggerTools_.

77  {
78  // retrieve clusters
80  e.getByToken(clusters_token_, clusters_h);
81  const l1t::HGCalClusterBxCollection& clusters = *clusters_h;
83  e.getByToken(multiclusters_token_, multiclusters_h);
84  const l1t::HGCalMulticlusterBxCollection& multiclusters = *multiclusters_h;
85 
87 
88  // Associate cells to clusters
89  std::unordered_map<uint32_t, l1t::HGCalMulticlusterBxCollection::const_iterator> cluster2multicluster;
90  for (auto mcl_itr = multiclusters.begin(0); mcl_itr != multiclusters.end(0); mcl_itr++) {
91  // loop on 2D clusters inside 3D clusters
92  for (const auto& cl_ptr : mcl_itr->constituents()) {
93  cluster2multicluster.emplace(cl_ptr.second->detId(), mcl_itr);
94  }
95  }
96 
97  clear();
98  for (auto cl_itr = clusters.begin(0); cl_itr != clusters.end(0); cl_itr++) {
99  auto mcl_itr = cluster2multicluster.find(cl_itr->detId());
100  uint32_t mcl_id = (mcl_itr != cluster2multicluster.end() ? mcl_itr->second->detId() : 0);
101  float mcl_pt = (mcl_itr != cluster2multicluster.end() ? mcl_itr->second->pt() : 0.);
102  if (filter_clusters_in_multiclusters_ && mcl_id == 0)
103  continue;
104  cl_n_++;
105  cl_mipPt_.emplace_back(cl_itr->mipPt());
106  // physical values
107  cl_pt_.emplace_back(cl_itr->pt());
108  cl_energy_.emplace_back(cl_itr->energy());
109  cl_eta_.emplace_back(cl_itr->eta());
110  cl_phi_.emplace_back(cl_itr->phi());
111 
112  cl_id_.emplace_back(cl_itr->detId());
113  cl_layer_.emplace_back(triggerTools_.layerWithOffset(cl_itr->detId()));
114  cl_subdet_.emplace_back(cl_itr->subdetId());
115  cl_cells_n_.emplace_back(cl_itr->constituents().size());
116  // Retrieve indices of trigger cells inside cluster
117  cl_cells_id_.emplace_back(cl_itr->constituents().size());
119  cl_itr->constituents_begin(),
120  cl_itr->constituents_end(),
121  cl_cells_id_.back().begin(),
122  [](const std::pair<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& id_tc) { return id_tc.second->detId(); });
123  cl_multicluster_id_.emplace_back(mcl_id);
124  cl_multicluster_pt_.emplace_back(mcl_pt);
125  }
126 }
const_iterator end(int bx) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
unsigned layerWithOffset(const DetId &) const
edm::ESHandle< HGCalTriggerGeometryBase > geometry
std::vector< std::vector< uint32_t > > cl_cells_id_
void setGeometry(const HGCalTriggerGeometryBase *const)
T const * product() const
Definition: ESHandle.h:86
const_iterator begin(int bx) const
unsigned transform(const HcalDetId &id, unsigned transformCode)
void HGCalTriggerNtupleHGCClusters::initialize ( TTree &  tree,
const edm::ParameterSet conf,
edm::ConsumesCollector &&  collector 
)
finalvirtual

Implements HGCalTriggerNtupleBase.

Definition at line 46 of file HGCalTriggerNtupleHGCClusters.cc.

References cl_cells_id_, cl_cells_n_, cl_energy_, cl_eta_, cl_id_, cl_layer_, cl_mipPt_, cl_multicluster_id_, cl_multicluster_pt_, cl_n_, cl_phi_, cl_pt_, cl_subdet_, clusters_token_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), multiclusters_token_, PostProcessorHGCAL_cfi::prefix, and AlCaHLTBitMon_QueryRunRegistry::string.

48  {
51  collector.consumes<l1t::HGCalMulticlusterBxCollection>(conf.getParameter<edm::InputTag>("Multiclusters"));
52 
53  std::string prefix(conf.getUntrackedParameter<std::string>("Prefix", "cl"));
54 
55  std::string bname;
56  auto withPrefix([&prefix, &bname](char const* vname) -> char const* {
57  bname = prefix + "_" + vname;
58  return bname.c_str();
59  });
60 
61  // note: can't use withPrefix() twice within a same statement because bname gets overwritten
62  tree.Branch(withPrefix("n"), &cl_n_, (prefix + "_n/I").c_str());
63  tree.Branch(withPrefix("id"), &cl_id_);
64  tree.Branch(withPrefix("mipPt"), &cl_mipPt_);
65  tree.Branch(withPrefix("pt"), &cl_pt_);
66  tree.Branch(withPrefix("energy"), &cl_energy_);
67  tree.Branch(withPrefix("eta"), &cl_eta_);
68  tree.Branch(withPrefix("phi"), &cl_phi_);
69  tree.Branch(withPrefix("layer"), &cl_layer_);
70  tree.Branch(withPrefix("subdet"), &cl_subdet_);
71  tree.Branch(withPrefix("cells_n"), &cl_cells_n_);
72  tree.Branch(withPrefix("cells_id"), &cl_cells_id_);
73  tree.Branch(withPrefix("multicluster_id"), &cl_multicluster_id_);
74  tree.Branch(withPrefix("multicluster_pt"), &cl_multicluster_pt_);
75 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::vector< uint32_t > > cl_cells_id_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

Member Data Documentation

std::vector<std::vector<uint32_t> > HGCalTriggerNtupleHGCClusters::cl_cells_id_
private

Definition at line 33 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by clear(), fill(), and initialize().

std::vector<int> HGCalTriggerNtupleHGCClusters::cl_cells_n_
private

Definition at line 32 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by clear(), fill(), and initialize().

std::vector<float> HGCalTriggerNtupleHGCClusters::cl_energy_
private

Definition at line 27 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by clear(), fill(), and initialize().

std::vector<float> HGCalTriggerNtupleHGCClusters::cl_eta_
private

Definition at line 28 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by clear(), fill(), and initialize().

std::vector<uint32_t> HGCalTriggerNtupleHGCClusters::cl_id_
private

Definition at line 24 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by clear(), fill(), and initialize().

std::vector<int> HGCalTriggerNtupleHGCClusters::cl_layer_
private

Definition at line 30 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by clear(), fill(), and initialize().

std::vector<float> HGCalTriggerNtupleHGCClusters::cl_mipPt_
private

Definition at line 25 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by clear(), fill(), and initialize().

std::vector<uint32_t> HGCalTriggerNtupleHGCClusters::cl_multicluster_id_
private

Definition at line 34 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by clear(), fill(), and initialize().

std::vector<float> HGCalTriggerNtupleHGCClusters::cl_multicluster_pt_
private

Definition at line 35 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by clear(), fill(), and initialize().

int HGCalTriggerNtupleHGCClusters::cl_n_
private

Definition at line 23 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by clear(), fill(), and initialize().

std::vector<float> HGCalTriggerNtupleHGCClusters::cl_phi_
private

Definition at line 29 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by clear(), fill(), and initialize().

std::vector<float> HGCalTriggerNtupleHGCClusters::cl_pt_
private

Definition at line 26 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by clear(), fill(), and initialize().

std::vector<int> HGCalTriggerNtupleHGCClusters::cl_subdet_
private

Definition at line 31 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by clear(), fill(), and initialize().

edm::EDGetToken HGCalTriggerNtupleHGCClusters::clusters_token_
private

Definition at line 20 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by fill(), and initialize().

bool HGCalTriggerNtupleHGCClusters::filter_clusters_in_multiclusters_
private

Definition at line 19 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by fill().

edm::EDGetToken HGCalTriggerNtupleHGCClusters::multiclusters_token_
private

Definition at line 20 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by fill(), and initialize().

HGCalTriggerTools HGCalTriggerNtupleHGCClusters::triggerTools_
private

Definition at line 21 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by fill().