178 const std::vector<CaloParticle>&
caloParticles = *caloParticleHandle;
184 const auto& rechitsEE = *recHitHandleEE;
185 const auto& rechitsFH = *recHitHandleFH;
186 const auto& rechitsBH = *recHitHandleBH;
188 std::map<DetId, const HGCRecHit*> hitmap;
189 for (
unsigned int i = 0;
i < rechitsEE.size(); ++
i) {
190 hitmap[rechitsEE[
i].detid()] = &rechitsEE[
i];
192 for (
unsigned int i = 0;
i < rechitsFH.size(); ++
i) {
193 hitmap[rechitsFH[
i].detid()] = &rechitsFH[
i];
195 for (
unsigned int i = 0;
i < rechitsBH.size(); ++
i) {
196 hitmap[rechitsBH[
i].detid()] = &rechitsBH[
i];
201 <<
"Number of caloParticles: " << caloParticles.size() << std::endl;
202 if (caloParticles.size() == 2) {
203 auto eta1 = caloParticles[0].eta();
204 auto phi1 = caloParticles[0].phi();
205 auto theta1 = 2.*atan(
exp(-eta1));
206 auto eta2 = caloParticles[1].eta();
207 auto phi2 = caloParticles[1].phi();
208 auto theta2 = 2.*atan(
exp(-eta2));
218 float energy_tmp = 0.;
219 for (
const auto& it_caloPart : caloParticles) {
222 size += simClusterRefVector.
size();
223 for (
const auto& it_sc : simClusterRefVector) {
225 const std::vector<std::pair<uint32_t, float> >& hits_and_fractions =
227 for (
const auto& it_haf : hits_and_fractions) {
228 if (hitmap.count(it_haf.first))
229 energy += hitmap[it_haf.first]->energy()*it_haf.second;
245 for (
const auto& it_caloPart : caloParticles) {
248 <<
">>> " << simClusterRefVector.
size() << std::endl;
249 for (
const auto& it_sc : simClusterRefVector) {
251 if (simCluster.
energy() < 80*0.8)
255 <<
">>> SC.energy(): " << simCluster.
energy()
256 <<
" SC.simEnergy(): " << simCluster.
simEnergy()
258 const std::vector<std::pair<uint32_t, float> >& hits_and_fractions =
261 for (
const auto& it_haf : hits_and_fractions) {
262 if (!hitmap.count(it_haf.first))
266 float globalx = global.
x();
267 float globaly = global.y();
268 float globalz = global.z();
271 auto rho1 = globalz*
tan(theta1);
272 auto rho2 = globalz*
tan(theta2);
273 auto x1 = rho1*
cos(phi1);
274 auto y1 = rho1*
sin(phi1);
275 auto x2 = rho2*
cos(phi2);
276 auto y2 = rho2*
sin(phi2);
277 auto half_point_x = (x1+x2)/2.;
278 auto half_point_y = (y1+y2)/2.;
279 auto half_point =
sqrt((x1-half_point_x)*(x1-half_point_x)+(y1-half_point_y)*(y1-half_point_y));
280 auto d_len =
sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
281 auto dn_x = (x2-x1)/d_len;
282 auto dn_y = (y2-y1)/d_len;
283 auto distance = (globalx-x1)*dn_x + (globaly - y1)*dn_y;
285 auto idealDistance =
sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
286 if (hitmap.count(it_haf.first)) {
288 10.*(globaly-half_point_y),
289 hitmap[it_haf.first]->energy()*it_haf.second);
291 10.*(globaly-half_point_y),
292 hitmap[it_haf.first]->energy()*it_haf.second);
295 hitmap[it_haf.first]->energy()*it_haf.second);
298 hitmap[it_haf.first]->energy()*it_haf.second);
305 centers_[hitlayer]->Fill(10.*half_point_x, 10.*half_point_y);
309 <<
" " << hitmap[it_haf.first]->energy()*it_haf.second
313 hitmap[it_haf.first]->energy()*it_haf.second);
edm::EDGetTokenT< HGCRecHitCollection > recHitsEE_
MonitorElement * scEnergy_
bool filterOnEnergyAndCaloP_
edm::EDGetTokenT< HGCRecHitCollection > recHitsFH_
std::vector< std::pair< uint32_t, float > > hits_and_fractions() const
Returns list of rechit IDs and fractions for this SimCluster.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * layerEnergy_
MonitorElement * deltaEtaPhi_
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_
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
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.
float simEnergy() const
returns the accumulated sim energy in the cluster
hgcal::RecHitTools recHitTools_
MonitorElement * layerDistance_
std::vector< MonitorElement * > centers_
size_type size() const
Size of the RefVector.
std::vector< MonitorElement * > idealDistanceOnLayer_
MonitorElement * showerProfile_