CMS 3D CMS Logo

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 edm::EventSetup &es) final
 
 HGCalTriggerNtupleHGCClusters (const edm::ParameterSet &conf)
 
void initialize (TTree &, const edm::ParameterSet &, edm::ConsumesCollector &&) final
 
 ~HGCalTriggerNtupleHGCClusters () override
 
- Public Member Functions inherited from HGCalTriggerNtupleBase
 HGCalTriggerNtupleBase (const edm::ParameterSet &conf)
 
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

Detailed Description

Definition at line 10 of file HGCalTriggerNtupleHGCClusters.cc.

Constructor & Destructor Documentation

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

Definition at line 41 of file HGCalTriggerNtupleHGCClusters.cc.

42  : HGCalTriggerNtupleBase(conf),
43  filter_clusters_in_multiclusters_(conf.getParameter<bool>("FilterClustersInMulticlusters")) {}
T getParameter(std::string const &) const
HGCalTriggerNtupleBase(const edm::ParameterSet &conf)
HGCalTriggerNtupleHGCClusters::~HGCalTriggerNtupleHGCClusters ( )
inlineoverride

Definition at line 13 of file HGCalTriggerNtupleHGCClusters.cc.

References clear(), MillePedeFileConverter_cfg::e, fill(), and initialize().

13 {};

Member Function Documentation

void HGCalTriggerNtupleHGCClusters::clear ( void  )
finalprivatevirtual

Implements HGCalTriggerNtupleBase.

Definition at line 122 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(), and ~HGCalTriggerNtupleHGCClusters().

122  {
123  cl_n_ = 0;
124  cl_id_.clear();
125  cl_mipPt_.clear();
126  cl_pt_.clear();
127  cl_energy_.clear();
128  cl_eta_.clear();
129  cl_phi_.clear();
130  cl_layer_.clear();
131  cl_subdet_.clear();
132  cl_cells_n_.clear();
133  cl_cells_id_.clear();
134  cl_multicluster_id_.clear();
135  cl_multicluster_pt_.clear();
136 }
std::vector< std::vector< uint32_t > > cl_cells_id_
void HGCalTriggerNtupleHGCClusters::fill ( const edm::Event e,
const edm::EventSetup es 
)
finalvirtual

Implements HGCalTriggerNtupleBase.

Definition at line 67 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(), fastPrimaryVertexProducer_cfi::clusters, clusters_token_, BXVector< T >::end(), HGCalTriggerTools::eventSetup(), filter_clusters_in_multiclusters_, geometry, edm::EventSetup::get(), edm::Event::getByToken(), HGCalTriggerTools::layerWithOffset(), multiclusters_token_, create_public_lumi_plots::transform, and triggerTools_.

Referenced by ~HGCalTriggerNtupleHGCClusters().

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

Implements HGCalTriggerNtupleBase.

Definition at line 45 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(), and multiclusters_token_.

Referenced by ~HGCalTriggerNtupleHGCClusters().

47  {
50  collector.consumes<l1t::HGCalMulticlusterBxCollection>(conf.getParameter<edm::InputTag>("Multiclusters"));
51 
52  tree.Branch("cl_n", &cl_n_, "cl_n/I");
53  tree.Branch("cl_id", &cl_id_);
54  tree.Branch("cl_mipPt", &cl_mipPt_);
55  tree.Branch("cl_pt", &cl_pt_);
56  tree.Branch("cl_energy", &cl_energy_);
57  tree.Branch("cl_eta", &cl_eta_);
58  tree.Branch("cl_phi", &cl_phi_);
59  tree.Branch("cl_layer", &cl_layer_);
60  tree.Branch("cl_subdet", &cl_subdet_);
61  tree.Branch("cl_cells_n", &cl_cells_n_);
62  tree.Branch("cl_cells_id", &cl_cells_id_);
63  tree.Branch("cl_multicluster_id", &cl_multicluster_id_);
64  tree.Branch("cl_multicluster_pt", &cl_multicluster_pt_);
65 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< std::vector< uint32_t > > cl_cells_id_
Definition: tree.py:1

Member Data Documentation

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

Definition at line 34 of file HGCalTriggerNtupleHGCClusters.cc.

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

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

Definition at line 33 of file HGCalTriggerNtupleHGCClusters.cc.

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

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

Definition at line 28 of file HGCalTriggerNtupleHGCClusters.cc.

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

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

Definition at line 29 of file HGCalTriggerNtupleHGCClusters.cc.

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

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

Definition at line 25 of file HGCalTriggerNtupleHGCClusters.cc.

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

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

Definition at line 31 of file HGCalTriggerNtupleHGCClusters.cc.

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

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

Definition at line 26 of file HGCalTriggerNtupleHGCClusters.cc.

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

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

Definition at line 35 of file HGCalTriggerNtupleHGCClusters.cc.

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

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

Definition at line 36 of file HGCalTriggerNtupleHGCClusters.cc.

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

int HGCalTriggerNtupleHGCClusters::cl_n_
private

Definition at line 24 of file HGCalTriggerNtupleHGCClusters.cc.

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

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

Definition at line 30 of file HGCalTriggerNtupleHGCClusters.cc.

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

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

Definition at line 27 of file HGCalTriggerNtupleHGCClusters.cc.

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

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

Definition at line 32 of file HGCalTriggerNtupleHGCClusters.cc.

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

edm::EDGetToken HGCalTriggerNtupleHGCClusters::clusters_token_
private

Definition at line 21 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by fill(), and initialize().

bool HGCalTriggerNtupleHGCClusters::filter_clusters_in_multiclusters_
private

Definition at line 20 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by fill().

edm::EDGetToken HGCalTriggerNtupleHGCClusters::multiclusters_token_
private

Definition at line 21 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by fill(), and initialize().

HGCalTriggerTools HGCalTriggerNtupleHGCClusters::triggerTools_
private

Definition at line 22 of file HGCalTriggerNtupleHGCClusters.cc.

Referenced by fill().