CMS 3D CMS Logo

HGCalTriggerNtupleHGCMulticlusters.cc
Go to the documentation of this file.
6 
8 public:
11  void initialize(TTree&, const edm::ParameterSet&, edm::ConsumesCollector&&) final;
12  void fill(const edm::Event& e, const edm::EventSetup& es) final;
13 
14 private:
15  void clear() final;
16 
18 
21 
23 
24  int cl3d_n_;
25  std::vector<uint32_t> cl3d_id_;
26  std::vector<float> cl3d_pt_;
28  std::vector<float> cl3d_eta_;
29  std::vector<float> cl3d_phi_;
33  // cluster shower shapes
42  std::vector<float> cl3d_szz_;
47  std::vector<float> cl3d_hoe_;
58 };
59 
61 
63  : HGCalTriggerNtupleBase(conf),
64  fill_layer_info_(conf.getParameter<bool>("FillLayerInfo")),
65  fill_interpretation_info_(conf.getParameter<bool>("FillInterpretationInfo")) {}
66 
68  const edm::ParameterSet& conf,
69  edm::ConsumesCollector&& collector) {
71  collector.consumes<l1t::HGCalMulticlusterBxCollection>(conf.getParameter<edm::InputTag>("Multiclusters"));
72  id_ = std::unique_ptr<HGCalTriggerClusterIdentificationBase>{
73  HGCalTriggerClusterIdentificationFactory::get()->create("HGCalTriggerClusterIdentificationBDT")};
74  id_->initialize(conf.getParameter<edm::ParameterSet>("EGIdentification"));
75 
76  std::string prefix(conf.getUntrackedParameter<std::string>("Prefix", "cl3d"));
77 
78  std::string bname;
79  auto withPrefix([&prefix, &bname](char const* vname) -> char const* {
80  bname = prefix + "_" + vname;
81  return bname.c_str();
82  });
83 
84  tree.Branch(withPrefix("n"), &cl3d_n_, (prefix + "_n/I").c_str());
85  tree.Branch(withPrefix("id"), &cl3d_id_);
86  tree.Branch(withPrefix("pt"), &cl3d_pt_);
87  tree.Branch(withPrefix("energy"), &cl3d_energy_);
88  tree.Branch(withPrefix("eta"), &cl3d_eta_);
89  tree.Branch(withPrefix("phi"), &cl3d_phi_);
90  tree.Branch(withPrefix("clusters_n"), &cl3d_clusters_n_);
91  tree.Branch(withPrefix("clusters_id"), &cl3d_clusters_id_);
92  if (fill_layer_info_)
93  tree.Branch(withPrefix("layer_pt"), &cl3d_layer_pt_);
94  tree.Branch(withPrefix("showerlength"), &cl3d_showerlength_);
95  tree.Branch(withPrefix("coreshowerlength"), &cl3d_coreshowerlength_);
96  tree.Branch(withPrefix("firstlayer"), &cl3d_firstlayer_);
97  tree.Branch(withPrefix("maxlayer"), &cl3d_maxlayer_);
98  tree.Branch(withPrefix("seetot"), &cl3d_seetot_);
99  tree.Branch(withPrefix("seemax"), &cl3d_seemax_);
100  tree.Branch(withPrefix("spptot"), &cl3d_spptot_);
101  tree.Branch(withPrefix("sppmax"), &cl3d_sppmax_);
102  tree.Branch(withPrefix("szz"), &cl3d_szz_);
103  tree.Branch(withPrefix("srrtot"), &cl3d_srrtot_);
104  tree.Branch(withPrefix("srrmax"), &cl3d_srrmax_);
105  tree.Branch(withPrefix("srrmean"), &cl3d_srrmean_);
106  tree.Branch(withPrefix("emaxe"), &cl3d_emaxe_);
107  tree.Branch(withPrefix("hoe"), &cl3d_hoe_);
108  tree.Branch(withPrefix("meanz"), &cl3d_meanz_);
109  tree.Branch(withPrefix("layer10"), &cl3d_layer10_);
110  tree.Branch(withPrefix("layer50"), &cl3d_layer50_);
111  tree.Branch(withPrefix("layer90"), &cl3d_layer90_);
112  tree.Branch(withPrefix("ntc67"), &cl3d_ntc67_);
113  tree.Branch(withPrefix("ntc90"), &cl3d_ntc90_);
114  tree.Branch(withPrefix("bdteg"), &cl3d_bdteg_);
115  tree.Branch(withPrefix("quality"), &cl3d_quality_);
117  tree.Branch(withPrefix("ipt"), &cl3d_ipt_);
118  tree.Branch(withPrefix("ienergy"), &cl3d_ienergy_);
119  }
120 }
121 
123  // retrieve clusters 3D
125  e.getByToken(multiclusters_token_, multiclusters_h);
126  const l1t::HGCalMulticlusterBxCollection& multiclusters = *multiclusters_h;
127 
128  // retrieve geometry
131 
132  clear();
133  for (auto cl3d_itr = multiclusters.begin(0); cl3d_itr != multiclusters.end(0); cl3d_itr++) {
134  cl3d_n_++;
135  cl3d_id_.emplace_back(cl3d_itr->detId());
136  // physical values
137  cl3d_pt_.emplace_back(cl3d_itr->pt());
138  cl3d_energy_.emplace_back(cl3d_itr->energy());
139  cl3d_eta_.emplace_back(cl3d_itr->eta());
140  cl3d_phi_.emplace_back(cl3d_itr->phi());
141  cl3d_clusters_n_.emplace_back(cl3d_itr->constituents().size());
142  cl3d_showerlength_.emplace_back(cl3d_itr->showerLength());
143  cl3d_coreshowerlength_.emplace_back(cl3d_itr->coreShowerLength());
144  cl3d_firstlayer_.emplace_back(cl3d_itr->firstLayer());
145  cl3d_maxlayer_.emplace_back(cl3d_itr->maxLayer());
146  cl3d_seetot_.emplace_back(cl3d_itr->sigmaEtaEtaTot());
147  cl3d_seemax_.emplace_back(cl3d_itr->sigmaEtaEtaMax());
148  cl3d_spptot_.emplace_back(cl3d_itr->sigmaPhiPhiTot());
149  cl3d_sppmax_.emplace_back(cl3d_itr->sigmaPhiPhiMax());
150  cl3d_szz_.emplace_back(cl3d_itr->sigmaZZ());
151  cl3d_srrtot_.emplace_back(cl3d_itr->sigmaRRTot());
152  cl3d_srrmax_.emplace_back(cl3d_itr->sigmaRRMax());
153  cl3d_srrmean_.emplace_back(cl3d_itr->sigmaRRMean());
154  cl3d_emaxe_.emplace_back(cl3d_itr->eMax() / cl3d_itr->energy());
155  cl3d_hoe_.emplace_back(cl3d_itr->hOverE());
156  cl3d_meanz_.emplace_back(std::abs(cl3d_itr->zBarycenter()));
157  cl3d_layer10_.emplace_back(cl3d_itr->layer10percent());
158  cl3d_layer50_.emplace_back(cl3d_itr->layer50percent());
159  cl3d_layer90_.emplace_back(cl3d_itr->layer90percent());
160  cl3d_ntc67_.emplace_back(cl3d_itr->triggerCells67percent());
161  cl3d_ntc90_.emplace_back(cl3d_itr->triggerCells90percent());
162  cl3d_bdteg_.emplace_back(id_->value(*cl3d_itr));
163  cl3d_quality_.emplace_back(cl3d_itr->hwQual());
165  std::vector<float> iPts(cl3d_itr->interpretations_size());
166  std::vector<float> iEnergies(cl3d_itr->interpretations_size());
167  for (auto interp = cl3d_itr->interpretations_begin(); interp != cl3d_itr->interpretations_end(); ++interp) {
168  iPts.emplace_back(cl3d_itr->iPt(*interp));
169  iEnergies.emplace_back(cl3d_itr->iEnergy(*interp));
170  }
171  cl3d_ipt_.push_back(iPts);
172  cl3d_ienergy_.push_back(iEnergies);
173  }
174 
175  //Per layer cluster information
176  if (fill_layer_info_) {
177  const unsigned nlayers = geometry->lastTriggerLayer();
178  std::vector<float> layer_pt(nlayers, 0.0);
179  for (const auto& cl_ptr : cl3d_itr->constituents()) {
180  unsigned layer = geometry->triggerLayer(cl_ptr.second->detId());
181  layer_pt[layer] += cl_ptr.second->pt();
182  }
183  cl3d_layer_pt_.emplace_back(layer_pt);
184  }
185 
186  // Retrieve indices of trigger cells inside cluster
187  cl3d_clusters_id_.emplace_back(cl3d_itr->constituents().size());
188  std::transform(cl3d_itr->constituents_begin(),
189  cl3d_itr->constituents_end(),
190  cl3d_clusters_id_.back().begin(),
191  [](const std::pair<uint32_t, edm::Ptr<l1t::HGCalCluster>>& id_cl) { return id_cl.second->detId(); });
192  }
193 }
194 
196  cl3d_n_ = 0;
197  cl3d_id_.clear();
198  cl3d_pt_.clear();
199  cl3d_energy_.clear();
200  cl3d_eta_.clear();
201  cl3d_phi_.clear();
202  cl3d_clusters_n_.clear();
203  cl3d_clusters_id_.clear();
204  cl3d_layer_pt_.clear();
205  cl3d_showerlength_.clear();
206  cl3d_coreshowerlength_.clear();
207  cl3d_firstlayer_.clear();
208  cl3d_maxlayer_.clear();
209  cl3d_seetot_.clear();
210  cl3d_seemax_.clear();
211  cl3d_spptot_.clear();
212  cl3d_sppmax_.clear();
213  cl3d_szz_.clear();
214  cl3d_srrtot_.clear();
215  cl3d_srrmax_.clear();
216  cl3d_srrmean_.clear();
217  cl3d_emaxe_.clear();
218  cl3d_hoe_.clear();
219  cl3d_meanz_.clear();
220  cl3d_layer10_.clear();
221  cl3d_layer50_.clear();
222  cl3d_layer90_.clear();
223  cl3d_ntc67_.clear();
224  cl3d_ntc90_.clear();
225  cl3d_bdteg_.clear();
226  cl3d_quality_.clear();
227  cl3d_ipt_.clear();
228  cl3d_ienergy_.clear();
229 }
HGCalTriggerNtupleHGCMulticlusters::cl3d_quality_
std::vector< int > cl3d_quality_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:55
HGCalTriggerNtupleHGCMulticlusters::cl3d_id_
std::vector< uint32_t > cl3d_id_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:25
geometry
ESHandle< TrackerGeometry > geometry
Definition: TkLasBeamFitter.cc:200
HGCalTriggerNtupleHGCMulticlusters::cl3d_ipt_
std::vector< std::vector< float > > cl3d_ipt_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:56
HGCalTriggerClusterIdentificationBase
Definition: HGCalTriggerClusterIdentificationBase.h:7
HGCalTriggerNtupleHGCMulticlusters::cl3d_clusters_id_
std::vector< std::vector< uint32_t > > cl3d_clusters_id_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:31
HGCalTriggerNtupleHGCMulticlusters::cl3d_layer_pt_
std::vector< std::vector< float > > cl3d_layer_pt_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:32
HGCalTriggerNtupleHGCMulticlusters::cl3d_layer50_
std::vector< float > cl3d_layer50_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:50
HGCalTriggerNtupleHGCMulticlusters::cl3d_seetot_
std::vector< float > cl3d_seetot_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:38
HGCalTriggerNtupleHGCMulticlusters::cl3d_pt_
std::vector< float > cl3d_pt_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:26
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
HGCalTriggerClusterIdentificationBase.h
tree
Definition: tree.py:1
HGCalTriggerNtupleHGCMulticlusters::cl3d_hoe_
std::vector< float > cl3d_hoe_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:47
geometry
Definition: geometry.py:1
HGCalTriggerNtupleHGCMulticlusters::initialize
void initialize(TTree &, const edm::ParameterSet &, edm::ConsumesCollector &&) final
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:67
HGCalTriggerNtupleHGCMulticlusters::cl3d_emaxe_
std::vector< float > cl3d_emaxe_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:46
HGCalTriggerNtupleHGCMulticlusters::id_
std::unique_ptr< HGCalTriggerClusterIdentificationBase > id_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:22
HGCalTriggerNtupleHGCMulticlusters::cl3d_ienergy_
std::vector< std::vector< float > > cl3d_ienergy_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:57
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HGCalTriggerNtupleHGCMulticlusters::cl3d_phi_
std::vector< float > cl3d_phi_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:29
HGCalTriggerNtupleHGCMulticlusters::cl3d_bdteg_
std::vector< float > cl3d_bdteg_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:54
watchdog.const
const
Definition: watchdog.py:83
edm::Handle
Definition: AssociativeIterator.h:50
HGCalTriggerNtupleHGCMulticlusters::cl3d_seemax_
std::vector< float > cl3d_seemax_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:39
HGCalTriggerNtupleHGCMulticlusters::fill_interpretation_info_
bool fill_interpretation_info_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:20
HGCalTriggerNtupleHGCMulticlusters::multiclusters_token_
edm::EDGetToken multiclusters_token_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:17
BXVector
Definition: BXVector.h:15
HGCalTriggerNtupleBase
Definition: HGCalTriggerNtupleBase.h:10
HGCalTriggerNtupleHGCMulticlusters::cl3d_spptot_
std::vector< float > cl3d_spptot_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:40
HGCalTriggerNtupleHGCMulticlusters::fill
void fill(const edm::Event &e, const edm::EventSetup &es) final
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:122
HGCalTriggerNtupleHGCMulticlusters::cl3d_srrmax_
std::vector< float > cl3d_srrmax_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:44
HGCalMulticluster.h
HGCalTriggerNtupleHGCMulticlusters::cl3d_layer10_
std::vector< float > cl3d_layer10_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:49
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
HGCalTriggerGeometryBase.h
edm::ESHandle< HGCalTriggerGeometryBase >
Event
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
HGCalTriggerNtupleHGCMulticlusters::clear
void clear() final
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:195
HGCalTriggerNtupleHGCMulticlusters::cl3d_energy_
std::vector< float > cl3d_energy_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:27
BXVector::begin
const_iterator begin(int bx) const
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
CaloGeometryRecord.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
BXVector::end
const_iterator end(int bx) const
edm::ParameterSet
Definition: ParameterSet.h:47
HGCalTriggerNtupleHGCMulticlusters::cl3d_srrtot_
std::vector< float > cl3d_srrtot_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:43
ParameterSet
Definition: Functions.h:16
HGCalTriggerNtupleHGCMulticlusters::cl3d_maxlayer_
std::vector< int > cl3d_maxlayer_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:37
edmplugin::PluginFactory
Definition: PluginFactory.h:34
HGCalTriggerNtupleBase.h
HGCalTriggerNtupleHGCMulticlusters::cl3d_clusters_n_
std::vector< int > cl3d_clusters_n_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:30
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
HGCalTriggerNtupleHGCMulticlusters::cl3d_layer90_
std::vector< float > cl3d_layer90_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:51
HGCalTriggerNtupleHGCMulticlusters::cl3d_coreshowerlength_
std::vector< int > cl3d_coreshowerlength_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:35
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
HGCalTriggerNtupleHGCMulticlusters::cl3d_showerlength_
std::vector< int > cl3d_showerlength_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:34
HGCalTriggerNtupleHGCMulticlusters::fill_layer_info_
bool fill_layer_info_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:19
HGCalTriggerNtupleHGCMulticlusters::cl3d_srrmean_
std::vector< float > cl3d_srrmean_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:45
EDGetToken
cms::cuda::device::unique_ptr
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
Definition: device_unique_ptr.h:33
HGCalTriggerNtupleHGCMulticlusters::~HGCalTriggerNtupleHGCMulticlusters
~HGCalTriggerNtupleHGCMulticlusters() override
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:10
std
Definition: JetResolutionObject.h:76
HGCalTriggerNtupleHGCMulticlusters::HGCalTriggerNtupleHGCMulticlusters
HGCalTriggerNtupleHGCMulticlusters(const edm::ParameterSet &conf)
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:62
HGCalTriggerNtupleHGCMulticlusters
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:7
HGCalTriggerNtupleHGCMulticlusters::cl3d_sppmax_
std::vector< float > cl3d_sppmax_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:41
HGCalTriggerNtupleHGCMulticlusters::cl3d_n_
int cl3d_n_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:24
hgcalTriggerNtuples_cfi.FillLayerInfo
FillLayerInfo
Definition: hgcalTriggerNtuples_cfi.py:90
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HGCalTriggerNtupleHGCMulticlusters::cl3d_eta_
std::vector< float > cl3d_eta_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:28
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
EventSetup
HGCalTriggerNtupleHGCMulticlusters::cl3d_meanz_
std::vector< float > cl3d_meanz_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:48
edm::Event
Definition: Event.h:73
HGCalTriggerNtupleHGCMulticlusters::cl3d_ntc67_
std::vector< float > cl3d_ntc67_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:52
hgcalTriggerNtuples_cfi.FillInterpretationInfo
FillInterpretationInfo
Definition: hgcalTriggerNtuples_cfi.py:91
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
HGCalTriggerNtupleHGCMulticlusters::cl3d_firstlayer_
std::vector< int > cl3d_firstlayer_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:36
HGCalTriggerNtupleHGCMulticlusters::cl3d_szz_
std::vector< float > cl3d_szz_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:42
HGCalTriggerNtupleHGCMulticlusters::cl3d_ntc90_
std::vector< float > cl3d_ntc90_
Definition: HGCalTriggerNtupleHGCMulticlusters.cc:53
nlayers
Definition: HIMultiTrackSelector.h:48
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
ZMuMuAnalysisNtupler_cff.prefix
prefix
Definition: ZMuMuAnalysisNtupler_cff.py:14