CMS 3D CMS Logo

Public Member Functions | Static Private Attributes

SimHitPrinter Class Reference

#include <SimHitPrinter.h>

List of all members.

Public Member Functions

void printEloss (float) const
void printGlobal (GlobalPoint) const
void printId (int) const
void printLocal (LocalPoint, LocalPoint) const
void printPabs (float) const
void printTrack (int) const
 SimHitPrinter (std::string)
void startNewEvent (int)
void startNewSimHit (std::string)
 ~SimHitPrinter ()

Static Private Attributes

static std::ofstream * theFile

Detailed Description

class to print sim hits for validation and debugging

Author:
Tommaso Boccali <Tommaso.Boccali@cern.ch> Arno Straesser <Arno.Straessner@cern.ch>

Modification:

Definition at line 22 of file SimHitPrinter.h.


Constructor & Destructor Documentation

SimHitPrinter::SimHitPrinter ( std::string  filename)

Definition at line 8 of file SimHitPrinter.cc.

References dbtoconf::out, and theFile.

                                              {
  if (theFile) return;
  const char* theName = filename.c_str();
  theFile = new std::ofstream(theName, std::ios::out);
}
SimHitPrinter::~SimHitPrinter ( )

Definition at line 14 of file SimHitPrinter.cc.

                             {
  //  theFile->close();
}

Member Function Documentation

void SimHitPrinter::printEloss ( float  eloss) const

Definition at line 56 of file SimHitPrinter.cc.

References gather_cfg::cout.

                                               {
  std::cout << " Eloss: "<<eloss<<std::endl;
  (*theFile) << " e "<<eloss;
}
void SimHitPrinter::printGlobal ( GlobalPoint  global) const

Definition at line 74 of file SimHitPrinter.cc.

References gather_cfg::cout, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by MuonSensitiveDetector::saveHit().

                                                        {
  (*theFile).width(10);
  (*theFile).setf(std::ios::right,std::ios::adjustfield);
  (*theFile).setf(std::ios::floatfield);
  (*theFile).precision(6);
  std::cout << " Global(en): "<<global.x()<<" "<< global.y()<<" "
             <<global.z()<<std::endl;
  (*theFile) << " gl "<<global.x()<<" "<< global.y()<<" "
             <<global.z()<<std::endl;
}
void SimHitPrinter::printId ( int  id) const

Definition at line 35 of file SimHitPrinter.cc.

References gather_cfg::cout, and ExpressReco_HICollisions_FallBack::id.

Referenced by MuonSensitiveDetector::saveHit().

                                       {
  std::cout << " Id: "<<id<<std::endl;
  (*theFile) << " id ";
  (*theFile).width(10);
  (*theFile).setf(std::ios::right,std::ios::adjustfield);
  (*theFile) <<id;
}
void SimHitPrinter::printLocal ( LocalPoint  localen,
LocalPoint  localex 
) const

Definition at line 61 of file SimHitPrinter.cc.

References gather_cfg::cout, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by MuonSensitiveDetector::saveHit().

                                                                         {
  (*theFile).width(10);
  (*theFile).setf(std::ios::right,std::ios::adjustfield);
  (*theFile).setf(std::ios::floatfield);
  (*theFile).precision(6);
  std::cout << " Local(en/ex): "<<localen.x()<<" "<< localen.y()<<" "
       <<localen.z()<<" / "<<localex.x()<<" "<< localex.y()<<" "
       <<localex.z()<<std::endl;
  (*theFile) << " en/ex "<<localen.x()<<" "<< localen.y()<<" "
       <<localen.z()<<" / "<<localex.x()<<" "<< localex.y()<<" "
       <<localex.z();
}
void SimHitPrinter::printPabs ( float  pabs) const

Definition at line 51 of file SimHitPrinter.cc.

References gather_cfg::cout.

                                             {
  std::cout << " Pabs: "<<pabs<<std::endl;
  (*theFile) << " p "<<pabs;
}
void SimHitPrinter::printTrack ( int  id) const

Definition at line 43 of file SimHitPrinter.cc.

References gather_cfg::cout, and ExpressReco_HICollisions_FallBack::id.

                                          {
  std::cout << " Track: "<<id<<std::endl;
  (*theFile) << " trk ";
  (*theFile).width(10);
  (*theFile).setf(std::ios::right,std::ios::adjustfield);
  (*theFile) << id;
}
void SimHitPrinter::startNewEvent ( int  num)

Definition at line 31 of file SimHitPrinter.cc.

                                        {
  (*theFile) << "Event "<<num<<std::endl;
}
void SimHitPrinter::startNewSimHit ( std::string  s)

Definition at line 18 of file SimHitPrinter.cc.

References gather_cfg::cout, and asciidump::s.

Referenced by MuonSensitiveDetector::saveHit().

                                             {
  std::cout.width(10);
  std::cout.setf(std::ios::right,std::ios::adjustfield);
  std::cout.setf(std::ios::scientific,std::ios::floatfield);
  std::cout.precision(6);
  std::cout << "SimHit in "<<s<<std::endl;
  (*theFile).width(10);
  (*theFile).setf(std::ios::right,std::ios::adjustfield);
  (*theFile).setf(std::ios::scientific|std::ios::uppercase|std::ios::showpos,std::ios::floatfield);
  (*theFile).precision(5);
  (*theFile) << "SimHit in "<<s;
}

Member Data Documentation

std::ofstream * SimHitPrinter::theFile [static, private]

Definition at line 37 of file SimHitPrinter.h.

Referenced by SimHitPrinter().