CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 31 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.

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