54 void fillWithRecHits(std::map<DetId, const HGCRecHit*>&,
DetId,
unsigned int,
float,
int&,
float&);
87 :
debug_(iConfig.getParameter<
int>(
"debug")),
94 recHitsFH_ = consumes<HGCRecHitCollection>(recHitsFH);
95 recHitsBH_ = consumes<HGCRecHitCollection>(recHitsBH);
110 eta1_ = ibooker.
book1D(
"eta1",
"eta1", 80, 0., 4.);
111 eta2_ = ibooker.
book1D(
"eta2",
"eta2", 80, 0., 4.);
116 layerEnergy_ = ibooker.
book2D(
"LayerEnergy",
"LayerEnergy", 60, 0., 60., 50, 0., 0.1);
117 layerDistance_ = ibooker.
book2D(
"LayerDistance",
"LayerDistance", 60, 0., 60., 400, -400., 400.);
118 etaPhi_ = ibooker.
book2D(
"EtaPhi",
"EtaPhi", 800, -4., 4., 800, -4., 4.);
119 deltaEtaPhi_ = ibooker.
book2D(
"DeltaEtaPhi",
"DeltaEtaPhi", 100, -0.5, 0.5, 100, -0.5, 0.5);
130 std::string(
"GlobalProfileOnLayer_") + std::to_string(
i),
143 std::string(
"IdealDistanceOnLayer_") + std::to_string(
i),
177 const std::vector<CaloParticle>&
caloParticles = *caloParticleHandle;
182 const auto& rechitsEE = *recHitHandleEE;
183 const auto& rechitsFH = *recHitHandleFH;
184 const auto& rechitsBH = *recHitHandleBH;
186 std::map<DetId, const HGCRecHit*> hitmap;
187 for (
unsigned int i = 0;
i < rechitsEE.size(); ++
i) {
188 hitmap[rechitsEE[
i].detid()] = &rechitsEE[
i];
190 for (
unsigned int i = 0;
i < rechitsFH.size(); ++
i) {
191 hitmap[rechitsFH[
i].detid()] = &rechitsFH[
i];
193 for (
unsigned int i = 0;
i < rechitsBH.size(); ++
i) {
194 hitmap[rechitsBH[
i].detid()] = &rechitsBH[
i];
198 IfLogTrace(
debug_ > 0,
"HGCalShowerSeparation") <<
"Number of caloParticles: " << caloParticles.size() << std::endl;
199 if (caloParticles.size() == 2) {
200 auto eta1 = caloParticles[0].eta();
201 auto phi1 = caloParticles[0].phi();
202 auto theta1 = 2. * atan(
exp(-
eta1));
203 auto eta2 = caloParticles[1].eta();
204 auto phi2 = caloParticles[1].phi();
205 auto theta2 = 2. * atan(
exp(-
eta2));
214 float energy_tmp = 0.;
215 for (
const auto& it_caloPart : caloParticles) {
218 size += simClusterRefVector.
size();
219 for (
const auto& it_sc : simClusterRefVector) {
221 const std::vector<std::pair<uint32_t, float> >& hits_and_fractions = simCluster.
hits_and_fractions();
222 for (
const auto& it_haf : hits_and_fractions) {
223 if (hitmap.count(it_haf.first))
224 energy += hitmap[it_haf.first]->energy() * it_haf.second;
240 for (
const auto& it_caloPart : caloParticles) {
242 IfLogTrace(
debug_ > 0,
"HGCalShowerSeparation") <<
">>> " << simClusterRefVector.
size() << std::endl;
243 for (
const auto& it_sc : simClusterRefVector) {
245 if (simCluster.
energy() < 80 * 0.8)
249 <<
">>> SC.energy(): " << simCluster.
energy() <<
" SC.simEnergy(): " << simCluster.
simEnergy() << std::endl;
250 const std::vector<std::pair<uint32_t, float> >& hits_and_fractions = simCluster.
hits_and_fractions();
252 for (
const auto& it_haf : hits_and_fractions) {
253 if (!hitmap.count(it_haf.first))
257 float globalx = global.
x();
258 float globaly = global.y();
259 float globalz = global.z();
262 auto rho1 = globalz *
tan(theta1);
263 auto rho2 = globalz *
tan(theta2);
264 auto x1 = rho1 *
cos(phi1);
265 auto y1 = rho1 *
sin(phi1);
266 auto x2 = rho2 *
cos(phi2);
267 auto y2 = rho2 *
sin(phi2);
268 auto half_point_x = (
x1 +
x2) / 2.;
269 auto half_point_y = (
y1 +
y2) / 2.;
270 auto half_point =
sqrt((
x1 - half_point_x) * (
x1 - half_point_x) + (
y1 - half_point_y) * (
y1 - half_point_y));
272 auto dn_x = (
x2 -
x1) / d_len;
273 auto dn_y = (
y2 -
y1) / d_len;
274 auto distance = (globalx -
x1) * dn_x + (globaly -
y1) * dn_y;
277 if (hitmap.count(it_haf.first)) {
279 10. * (globaly - half_point_y),
280 hitmap[it_haf.first]->energy() * it_haf.second);
282 10. * (globaly - half_point_y),
283 hitmap[it_haf.first]->energy() * it_haf.second);
284 globalProfileOnLayer_[hitlayer]->Fill(globalx, globaly, hitmap[it_haf.first]->energy() * it_haf.second);
292 centers_[hitlayer]->Fill(10. * half_point_x, 10. * half_point_y);
294 <<
">>> " <<
distance <<
" " << hitlayer <<
" " << hitmap[it_haf.first]->energy() * it_haf.second
308 desc.
add<
int>(
"debug", 1);
309 desc.
add<
bool>(
"filterOnEnergyAndCaloP",
false);
314 descriptions.
add(
"hgcalShowerSeparationDefault", desc);
edm::EDGetTokenT< HGCRecHitCollection > recHitsEE_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
T getParameter(std::string const &) const
MonitorElement * scEnergy_
bool filterOnEnergyAndCaloP_
edm::EDGetTokenT< HGCRecHitCollection > recHitsFH_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * layerEnergy_
MonitorElement * deltaEtaPhi_
void setCurrentFolder(std::string const &fullpath)
MonitorElement * energy1_
Sin< T >::type sin(const T &t)
MonitorElement * energy2_
std::vector< MonitorElement * > globalProfileOnLayer_
#define IfLogTrace(cond, cat)
std::vector< MonitorElement * > idealDeltaXY_
std::vector< MonitorElement * > profileOnLayer_
MonitorElement * energytot_
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< HGCRecHitCollection > recHitsBH_
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)
float energy() const
Energy. Note this is taken from the first SimTrack only.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
float simEnergy() const
returns the accumulated sim energy in the cluster
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
hgcal::RecHitTools recHitTools_
void fillWithRecHits(std::map< DetId, const HGCRecHit * > &, DetId, unsigned int, float, int &, float &)
MonitorElement * layerDistance_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
std::vector< MonitorElement * > centers_
size_type size() const
Size of the RefVector.
~HGCalShowerSeparation() override
std::vector< MonitorElement * > idealDistanceOnLayer_
MonitorElement * showerProfile_
std::vector< std::pair< uint32_t, float > > hits_and_fractions() const
Returns list of rechit IDs and fractions for this SimCluster.
HGCalShowerSeparation(const edm::ParameterSet &)