/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Private Member Functions | Private Attributes
ValiNTuple Class Reference

#include <ValiNTuple.h>

List of all members.

Public Member Functions

 ValiNTuple (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~ValiNTuple ()
virtual StatusCode initialize ()
virtual StatusCode execute ()
virtual StatusCode finalize ()

Private Member Functions

StatusCode BookVertices ()

Private Attributes

std::string m_location
 Property: Location - TES path to the generated kinematics.
std::string m_volume
 Property: Volume - TDS path to the physical volume (detector element) used when generating kinematic vertex locations.
std::string m_filepath
 Property: FilePath - path to use when registering histograms.
double m_maxEnergy
 Property MaxEnergy - max value for energy histogram.
double m_energyUnits
 Property EnergyUnits - units for energy.
ITHistSvc * m_hsvc
TTree * m_outTree

Detailed Description

Definition at line 19 of file ValiNTuple.h.


Constructor & Destructor Documentation

ValiNTuple::ValiNTuple ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)
ValiNTuple::~ValiNTuple ( ) [virtual]

Definition at line 87 of file ValiNTuple.cc.

{
}

Member Function Documentation

StatusCode ValiNTuple::initialize ( ) [virtual]

Definition at line 91 of file ValiNTuple.cc.

{
    this->GaudiAlgorithm::initialize();

    // Get the histogram service
    if ( service("THistSvc", m_hsvc).isFailure()) {
        error() << " No THistSvc available." << endreq;
        return StatusCode::FAILURE;
    } 

    m_outTree = new TTree("nOutTree","Output from DetSim");
    string outstring= m_filepath+"nOutTree";
    if (m_hsvc->regTree(outstring,m_outTree).isFailure()) {
        error() << "Could not register " << m_filepath+"nOutTree" << endreq;
        delete m_outTree; m_outTree = 0;
        return StatusCode::FAILURE;
    }

    return StatusCode::SUCCESS;
}
StatusCode ValiNTuple::execute ( ) [virtual]

Definition at line 112 of file ValiNTuple.cc.

{

  DayaBay::SimHeader* shead = get<DayaBay::SimHeader>(m_location);

  // Get hit info 
  const DayaBay::SimHitHeader* shith = shead->hits();
  const DayaBay::SimHitHeader::hc_map& hcmap = shith->hitCollection();
  DayaBay::SimHitHeader::hc_map::const_iterator it, done = hcmap.end();

  
  // Get Primary Track Info.
  const DayaBay::SimParticleHistory* shist = shead->particleHistory();
  const std::list<const DayaBay::SimTrack*>& priTrks = shist->primaryTracks();
  std::list<const DayaBay::SimTrack*>::const_iterator priIt, priEnd=priTrks.end();

  //Get UnObservable Statistics info
  const DayaBay::SimUnobservableStatisticsHeader* unobSt = shead->unobservableStatistics();
  const DayaBay::SimUnobservableStatisticsHeader::stat_map& statmap = unobSt->stats();
  DayaBay::SimUnobservableStatisticsHeader::stat_map::const_iterator st, stdone = statmap.end();
  
  
  //  if(statmap.size()){
  for (st=statmap.begin(); st != stdone; ++st) {
    
    info () << " stat first " << st->first << " stat second sum " << st->second.sum() <<endreq;
  }
  //  }
  
  
  int hitsize(0),hitInCont(0);
  double trkLengInOws(0),trkLengInIws(0);
  
  hitsize=hcmap.size();
  info () << " Hit size " << hitsize <<endreq;

  //  hitStruct* hitCol[hitsize];

  hitStruct singleHit;

  //**** hit information**
  m_outTree->Branch("hitTime",&singleHit.hitTime,"hitTime/D");
  m_outTree->Branch("hitDetID",&singleHit.sensDetId,"hitDetID/I");
  m_outTree->Branch("hitWt",&singleHit.weight,"hitWt/F");
  m_outTree->Branch("hitancPDG",&singleHit.ancestorPdg,"hitancPDG/I");
  m_outTree->Branch("hitpX",&singleHit.PosX,"hitpX/D");
  m_outTree->Branch("hitpY",&singleHit.PosY,"hitpY/D");
  m_outTree->Branch("hitpZ",&singleHit.PosZ,"hitpZ/D");
  m_outTree->Branch("hitWavl",&singleHit.wavelt,"hitWavl/D");

  //***  ***
  m_outTree->Branch("hitsize",&hitsize,"hitsize/I");
  m_outTree->Branch("hitInCont",&hitInCont,"hitInCont/I");
  m_outTree->Branch("trkLengInOws",&trkLengInOws,"trkLengInOws/D");
  m_outTree->Branch("trkLengInIws",&trkLengInIws,"trkLengInIws/D");


  info () << " 01010101010101010 " << endreq;

  //  m_outTree.Branch("hitCol", &hitCol,"hitCol[hitsize]/F");
  
  info () << " 000000000 " << endreq;



  // Iterate to get the hit informatioin.
  for (it=hcmap.begin(); it != done; ++it) {
    DayaBay::Detector det(it->first);
    pair<int,string> bin = detector_bins[det.siteDetPackedData()];
    
    info () << "Got hit collection from " << det.detName() 
            << " in bin " << bin.first << endreq;
    
    size_t siz = it->second->collection().size();
    info () << " #hits in this Det " << siz << endreq;
    
    //    const DayaBay::SimHitCollection::hit_container hitcont=it->second->collection();
    //    DayaBay::SimHitCollection::hit_container::const_iterator ithit;

    const std::vector<DayaBay::SimHit*>&  hitcont=it->second->collection();
    std::vector<DayaBay::SimHit*>::const_iterator ithit;

    hitInCont=siz;
    
    if(siz!=0){
      for(ithit=hitcont.begin(); ithit !=hitcont.end();++ithit) {
        singleHit.hitTime=(*ithit)->hitTime();
        //      info () << " Hit time "<< singleHit.hitTime << endreq;
        singleHit.sensDetId=(*ithit)->sensDetId();
        singleHit.weight=(*ithit)->weight();
        if((*ithit)->ancestor().track()){
          singleHit.ancestorPdg=(*ithit)->ancestor().track()->particle(); //particle PDG//generate error
        }
        singleHit.PosX=(*ithit)->localPos().x();
        singleHit.PosY=(*ithit)->localPos().y();
        singleHit.PosZ=(*ithit)->localPos().z();
        //      info () << " x: "<< singleHit.PosX <<singleHit.PosY << singleHit.PosZ << endreq;
        
        const DayaBay::SimPmtHit* pmthit = static_cast<const DayaBay::SimPmtHit*>(*ithit);
        
        //      info () << " 22222222 " << endreq;
        
        //      singleHit.wavelt=(*pmthit).wavelength();
        //      m_outTree->Fill();
      }
    }
    else m_outTree->Fill();
  }



  
  //  m_outTree->Write();
  return StatusCode::SUCCESS;
}
StatusCode ValiNTuple::finalize ( ) [virtual]

Definition at line 228 of file ValiNTuple.cc.

{

    return this->GaudiAlgorithm::finalize();
}
StatusCode ValiNTuple::BookVertices ( ) [private]

Member Data Documentation

std::string ValiNTuple::m_location [private]

Property: Location - TES path to the generated kinematics.

Defaults to DayaBay::HepMCEventLocation::Default

Definition at line 35 of file ValiNTuple.h.

std::string ValiNTuple::m_volume [private]

Property: Volume - TDS path to the physical volume (detector element) used when generating kinematic vertex locations.

Definition at line 39 of file ValiNTuple.h.

std::string ValiNTuple::m_filepath [private]

Property: FilePath - path to use when registering histograms.

Must end in "/". Default "/file1/gen/"

Definition at line 43 of file ValiNTuple.h.

double ValiNTuple::m_maxEnergy [private]

Property MaxEnergy - max value for energy histogram.

Definition at line 46 of file ValiNTuple.h.

double ValiNTuple::m_energyUnits [private]

Property EnergyUnits - units for energy.

Definition at line 49 of file ValiNTuple.h.

ITHistSvc* ValiNTuple::m_hsvc [private]

Definition at line 57 of file ValiNTuple.h.

TTree* ValiNTuple::m_outTree [private]

Definition at line 63 of file ValiNTuple.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:19:12 for DetSimValidation by doxygen 1.7.4