source: DMM/src/MCWCHit.cxx @ 454

Last change on this file since 454 was 373, checked in by campagne, 17 years ago

Data Model for MEMPHYS

File size: 2.4 KB
Line 
1#include "DMM/MCWCHit.h"
2
3
4MEMPHYS::DMM::MCWCHit::MCWCHit(MEMPHYS::DMM::IDataServices& aService)   
5  :MEMPHYS::DMM::WCHit(aService)
6  ,m_totalPE(0)
7  ,m_PEtimes()
8{
9  std::cout << "Create MCWCHit("<<this<<")"<<std::endl;
10}//Ctor
11//----------------------------------------------------------
12MEMPHYS::DMM::MCWCHit::MCWCHit(const MEMPHYS::DMM::MCWCHit& aMCWCHit)
13  :MEMPHYS::DMM::WCHit(aMCWCHit)
14  ,m_totalPE(aMCWCHit.m_totalPE)
15  ,m_PEtimes(aMCWCHit.m_PEtimes)
16{
17  std::cout << "Copy Create MCWCHit("<<this<<") from ("<< &aMCWCHit <<")" <<std::endl;
18}//CCtor
19//----------------------------------------------------------
20MEMPHYS::DMM::MCWCHit& MEMPHYS::DMM::MCWCHit::operator=(const MEMPHYS::DMM::MCWCHit& aMCWCHit) {
21  std::cout << "Assign ("<<&aMCWCHit<<") to (" << this << ")" <<std::endl;
22  if (&aMCWCHit != this) {
23    MEMPHYS::DMM::WCHit::operator=(aMCWCHit);
24    m_totalPE = aMCWCHit.m_totalPE;
25    m_PEtimes = aMCWCHit.m_PEtimes; 
26  }
27  return *this;
28}//op=
29//----------------------------------------------------------
30void* MEMPHYS::DMM::MCWCHit::cast(const std::string& aClass) const {
31  if(aClass=="Slash::Store::IStorable") {
32    return (void*)static_cast<const Slash::Store::IStorable*>(this);
33  } else if(aClass=="MEMPHYS::DMM::MCWCHit") {
34    return (void*)static_cast<const MEMPHYS::DMM::MCWCHit*>(this);
35  } else if(aClass=="MEMPHYS:DMM::WCHit") {
36    return (void*)static_cast<const MEMPHYS::DMM::BaseData*>(this);
37  } else if(aClass=="MEMPHYS:DMM::BaseData") {
38    return (void*)static_cast<const MEMPHYS::DMM::BaseData*>(this);
39  } else {
40    return 0;
41  } 
42}//cast
43//----------------------------------------------------------
44bool  MEMPHYS::DMM::MCWCHit::visit(Slash::Store::IConstVisitor&) const {
45  return true;
46}//visit
47//----------------------------------------------------------
48bool MEMPHYS::DMM::MCWCHit::read(Slash::Store::IVisitor&) {
49  return true;
50}//read
51//----------------------------------------------------------
52void MEMPHYS::DMM::MCWCHit::dump(std::ostream& f,
53                               const std::string& option) {
54  MEMPHYS::DMM::WCHit::dump(f,option);
55  f << "totalPE " << m_totalPE
56    << std::endl;
57  if(option == "deep") {
58    if( m_totalPE >0 ) {
59      //dump the time Container
60      std::vector<double>::const_iterator i;
61      f << "PEs < ";
62      for( i = m_PEtimes.begin(); i != m_PEtimes.end(); ++i) {
63        f << *i << " , ";
64      }
65      f << ">" << std::endl;
66    }//non-empty PE container
67  }//deep dump
68}//dump
69
70
Note: See TracBrowser for help on using the repository browser.