CMS 3D CMS Logo

Functions

/data/refman/pasoursint/CMSSW_5_3_6/src/FastSimulation/Event/src/FSimTrack.cc File Reference

#include "FastSimulation/Event/interface/FSimTrack.h"
#include <iomanip>
#include <string>

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &o, const FSimTrack &t)

Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const FSimTrack t 
)

Definition at line 106 of file FSimTrack.cc.

References FSimTrack::daughter(), FSimTrack::ecalEntrance(), FSimTrack::endVertex(), SimTrack::genpartIndex(), i, FSimVertex::id(), FSimTrack::id(), gen::k, FSimTrack::layer1Entrance(), FSimTrack::momentum(), FSimTrack::mother(), mergeVDriftHistosByStation::name, FSimTrack::nDaughters(), FSimTrack::noEndVertex(), python::connectstrParser::o, FSimTrack::onEcal(), FSimTrack::onLayer1(), FSimTrack::particleInfo(), FSimVertex::position(), RawParticle::vertex(), and FSimTrack::vertex().

                                                            {

  std::string name = t.particleInfo() ? t.particleInfo()->name() : "Unknown";
  XYZTLorentzVector momentum1 = t.momentum();
  XYZVector vertex1 = t.vertex().position().Vect();
  int vertexId1 = t.vertex().id();

  o.setf(std::ios::fixed, std::ios::floatfield);
  o.setf(std::ios::right, std::ios::adjustfield);

  o << std::setw(4) << t.id() << " " 
    << std::setw(4) << t.genpartIndex() << " " 
    << name;

  for(unsigned int k=0;k<11-name.length() && k<12; k++) o << " ";  

  o << std::setw(6) << std::setprecision(2) << momentum1.eta() << " " 
    << std::setw(6) << std::setprecision(2) << momentum1.phi() << " " 
    << std::setw(6) << std::setprecision(2) << momentum1.pt() << " " 
    << std::setw(6) << std::setprecision(2) << momentum1.e() << " " 
    << std::setw(4) << vertexId1 << " " 
    << std::setw(6) << std::setprecision(1) << vertex1.x() << " " 
    << std::setw(6) << std::setprecision(1) << vertex1.y() << " " 
    << std::setw(6) << std::setprecision(1) << vertex1.z() << " "
    << std::setw(4) << t.mother().id() << " ";
  
  if ( !t.noEndVertex() ) {
    XYZTLorentzVector vertex2 = t.endVertex().position();
    int vertexId2 = t.endVertex().id();
    
    o << std::setw(4) << vertexId2 << " "
      << std::setw(6) << std::setprecision(2) << vertex2.eta() << " " 
      << std::setw(6) << std::setprecision(2) << vertex2.phi() << " " 
      << std::setw(5) << std::setprecision(1) << vertex2.pt() << " " 
      << std::setw(6) << std::setprecision(1) << vertex2.z() << " ";
    for (int i=0; i<t.nDaughters(); ++i)
      o << std::setw(4) << t.daughter(i).id() << " ";

  } else {

    if ( t.onLayer1() ) {

      XYZTLorentzVector vertex2 = t.layer1Entrance().vertex();
      
      o << std::setw(4) << -t.onLayer1() << " " 
        << std::setw(6) << std::setprecision(2) << vertex2.eta() << " " 
        << std::setw(6) << std::setprecision(2) << vertex2.phi() << " " 
        << std::setw(5) << std::setprecision(1) << vertex2.pt() << " " 
        << std::setw(6) << std::setprecision(1) << vertex2.z() << " "
        << std::setw(6) << std::setprecision(2) << t.layer1Entrance().pt() << " " 
        << std::setw(6) << std::setprecision(2) << t.layer1Entrance().e() << " ";
      
    } else if ( t.onEcal() ) { 

      XYZTLorentzVector vertex2 = t.ecalEntrance().vertex();
      
      o << std::setw(4) << -t.onEcal() << " " 
        << std::setw(6) << std::setprecision(2) << vertex2.eta() << " " 
        << std::setw(6) << std::setprecision(2) << vertex2.phi() << " " 
        << std::setw(5) << std::setprecision(1) << vertex2.pt() << " " 
        << std::setw(6) << std::setprecision(1) << vertex2.z() << " "
        << std::setw(6) << std::setprecision(2) << t.ecalEntrance().pt() << " " 
        << std::setw(6) << std::setprecision(2) << t.ecalEntrance().e() << " ";
    }
  }
  return o;
}