CMS 3D CMS Logo

Functions
SimCluster.cc File Reference
#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h"
#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <numeric>

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &s, SimCluster const &tp)
 

Function Documentation

std::ostream& operator<< ( std::ostream &  s,
SimCluster const &  tp 
)

Definition at line 38 of file SimCluster.cc.

References EncodedEventId::bunchCrossing(), SimCluster::charge(), EncodedEventId::event(), SimCluster::eventId(), SimCluster::fractions_, SimCluster::g4Track_begin(), SimCluster::g4Track_end(), SimCluster::genParticle_begin(), SimCluster::genParticle_end(), SimCluster::hits_, SimCluster::p4(), SimCluster::pdgId(), and alignCSCRings::s.

39 {
40  s << "CP momentum, q, ID, & Event #: "
41  << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " "
42  << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl;
43 
44  for (SimCluster::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT)
45  {
46  s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl;
47  }
48 
49  for (SimCluster::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T)
50  {
51  s << " Geant Track Momentum " << g4T->momentum() << std::endl;
52  s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl;
53  if (g4T->type() != tp.pdgId())
54  {
55  s << " Mismatch b/t SimCluster and Geant types" << std::endl;
56  }
57  }
58  s << " # of cells = " << tp.hits_.size()
59  << ", effective cells = " << std::accumulate(tp.fractions_.begin(),tp.fractions_.end(),0.f) << std::endl;
60  return s;
61 }
std::vector< SimTrack >::const_iterator g4t_iterator
Definition: SimCluster.h:40