47 void fillWithRecHits(std::unordered_map<DetId, const HGCRecHit*>&,
DetId,
unsigned int,
float,
int&,
float&);
80 debug_(iConfig.getParameter<
int>(
"debug")),
81 filterOnEnergyAndCaloP_(iConfig.getParameter<
bool>(
"filterOnEnergyAndCaloP")) {
84 hitMap_ = consumes<std::unordered_map<DetId, const HGCRecHit*>>(hitMapInputTag);
99 layerDistance_ = ibooker.
book2D(
"LayerDistance",
"LayerDistance", 60, 0., 60., 400, -400., 400.);
100 etaPhi_ = ibooker.
book2D(
"EtaPhi",
"EtaPhi", 800, -4., 4., 800, -4., 4.);
101 deltaEtaPhi_ = ibooker.
book2D(
"DeltaEtaPhi",
"DeltaEtaPhi", 100, -0.5, 0.5, 100, -0.5, 0.5);
156 const auto hitmap = *hitMapHandle;
163 auto theta1 = 2. * std::atan(
exp(-
eta1));
166 auto theta2 = 2. * std::atan(
exp(-
eta2));
175 float energy_tmp = 0.;
180 for (
const auto& it_sc : simClusterRefVector) {
182 const std::vector<std::pair<uint32_t, float>>& hits_and_fractions = simCluster.
hits_and_fractions();
183 for (
const auto& it_haf : hits_and_fractions) {
184 if (hitmap.count(it_haf.first))
185 energy += hitmap.at(it_haf.first)->energy() * it_haf.second;
203 IfLogTrace(
debug_ > 0,
"HGCalShowerSeparation") <<
">>> " << simClusterRefVector.
size() << std::endl;
204 for (
const auto& it_sc : simClusterRefVector) {
206 if (simCluster.
energy() < 80 * 0.8)
210 <<
">>> SC.energy(): " << simCluster.
energy() <<
" SC.simEnergy(): " << simCluster.
simEnergy() << std::endl;
211 const std::vector<std::pair<uint32_t, float>>& hits_and_fractions = simCluster.
hits_and_fractions();
213 for (
const auto& it_haf : hits_and_fractions) {
214 if (!hitmap.count(it_haf.first))
218 float globalx = global.
x();
219 float globaly = global.y();
220 float globalz = global.z();
223 auto rho1 = globalz *
tan(theta1);
224 auto rho2 = globalz *
tan(theta2);
225 auto x1 = rho1 *
cos(phi1);
226 auto y1 = rho1 *
sin(phi1);
227 auto x2 = rho2 *
cos(phi2);
228 auto y2 = rho2 *
sin(phi2);
229 auto half_point_x = (
x1 +
x2) / 2.;
230 auto half_point_y = (
y1 +
y2) / 2.;
231 auto half_point =
sqrt((
x1 - half_point_x) * (
x1 - half_point_x) + (
y1 - half_point_y) * (
y1 - half_point_y));
233 auto dn_x = (
x2 -
x1) / d_len;
234 auto dn_y = (
y2 -
y1) / d_len;
235 auto distance = (globalx -
x1) * dn_x + (globaly -
y1) * dn_y;
238 if (hitmap.count(it_haf.first)) {
240 10. * (globaly - half_point_y),
241 hitmap.at(it_haf.first)->energy() * it_haf.second);
243 10. * (globaly - half_point_y),
244 hitmap.at(it_haf.first)->energy() * it_haf.second);
245 globalProfileOnLayer_[hitlayer]->Fill(globalx, globaly, hitmap.at(it_haf.first)->energy() * it_haf.second);
246 globalProfileOnLayer_[55]->Fill(globalx, globaly, hitmap.at(it_haf.first)->energy() * it_haf.second);
253 centers_[hitlayer]->Fill(10. * half_point_x, 10. * half_point_y);
255 <<
">>> " <<
distance <<
" " << hitlayer <<
" " << hitmap.at(it_haf.first)->energy() * it_haf.second
269 desc.add<
int>(
"debug", 1);
270 desc.add<
bool>(
"filterOnEnergyAndCaloP",
false);
273 descriptions.
add(
"hgcalShowerSeparationDefault",
desc);
MonitorElement * scEnergy_
T getParameter(std::string const &) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
bool filterOnEnergyAndCaloP_
virtual void setCurrentFolder(std::string const &fullpath)
#define IfLogTrace(cond, cat)
MonitorElement * layerEnergy_
MonitorElement * deltaEtaPhi_
MonitorElement * energy1_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
Sin< T >::type sin(const T &t)
edm::EDGetTokenT< std::unordered_map< DetId, const HGCRecHit * > > hitMap_
T const * product() const
static constexpr int layers_
MonitorElement * energy2_
std::vector< MonitorElement * > globalProfileOnLayer_
std::string to_string(const V &value)
~HGCalShowerSeparation() override=default
std::vector< MonitorElement * > idealDeltaXY_
std::vector< std::pair< uint32_t, float > > hits_and_fractions() const
Returns list of rechit IDs and fractions for this SimCluster.
float simEnergy() const
returns the accumulated sim energy in the cluster
std::vector< MonitorElement * > profileOnLayer_
MonitorElement * energytot_
void fillWithRecHits(std::unordered_map< DetId, const HGCRecHit *> &, DetId, unsigned int, float, int &, float &)
Monte Carlo truth information used for tracking validation.
edm::EDGetTokenT< std::vector< CaloParticle > > caloParticles_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::vector< MonitorElement * > distanceOnLayer_
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
size_type size() const
Size of the RefVector.
hgcal::RecHitTools recHitTools_
MonitorElement * layerDistance_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void analyze(const edm::Event &, const edm::EventSetup &) override
float energy() const
Energy. Note this is taken from the first SimTrack only.
std::vector< MonitorElement * > centers_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
std::vector< MonitorElement * > idealDistanceOnLayer_
MonitorElement * showerProfile_
HGCalShowerSeparation(const edm::ParameterSet &)