larlight::event_hit Class Reference

A collection storage class of multiple hits. More...

#include <hit.hh>

Inheritance diagram for larlight::event_hit:
larlight::event_base larlight::data_base

List of all members.

Public Member Functions

 event_hit (DATA::DATA_TYPE type=DATA::Hit)
 Default constructor.
 event_hit (const event_hit &original)
 Default copy constructor.
 ~event_hit ()
 Default destructor.
virtual void clear_data ()
 Method to clear currently held data contents in the buffer.
void get_axis_range (std::vector< Double_t > &chmax, std::vector< Double_t > &chmin, std::vector< Double_t > &wiremax, std::vector< Double_t > &wiremin, std::vector< Double_t > &timemax, std::vector< Double_t > &timemin) const
 A utility function to obtain maximum & minimum of hits' vertex NOTE: the initial max/min values matter.
void get_axis_range (std::vector< Double_t > &chmax, std::vector< Double_t > &chmin, std::vector< Double_t > &wiremax, std::vector< Double_t > &wiremin, std::vector< Double_t > &timemax, std::vector< Double_t > &timemin, const std::vector< unsigned short > &hit_index) const
 Yet another utility function with an optional input to specify index of hits to be considered.
void set_run (UInt_t run)
 run number setter
void set_subrun (UInt_t run)
 sub-run number setter
void set_event_id (UInt_t id)
 event-id setter
UInt_t run () const
 run number getter
UInt_t subrun () const
 sub-run number getter
UInt_t event_id () const
 event-id getter
DATA::DATA_TYPE data_type () const
 data type getter
void add_association (DATA::DATA_TYPE type, const std::vector< unsigned short > ass)
 Adder for a set of association.
size_t size_association (DATA::DATA_TYPE type) const
 Getter for # of associations.
const std::vector< unsigned short > association (DATA::DATA_TYPE type, size_t index=0) const
 Getter of an association.

Protected Attributes

UInt_t fRunNumber
 Run number.
UInt_t fSubRunNumber
 Sub-Run number.
UInt_t fEventID
 Event ID.
DATA::DATA_TYPE _type
 DATA_TYPE.
std::map
< larlight::DATA::DATA_TYPE,
std::vector< std::vector
< unsigned short > > > 
_ass
 Association storage ... allow multiple set of associations.

Detailed Description

A collection storage class of multiple hits.

Definition at line 105 of file hit.hh.


Constructor & Destructor Documentation

larlight::event_hit::event_hit ( DATA::DATA_TYPE  type = DATA::Hit  ) 

Default constructor.

Definition at line 69 of file hit.cc.

References larlight::data_base::_type, larlight::DATA::APAHit, clear_data(), larlight::DATA::CrawlerHit, larlight::DATA::DATA_TREE_NAME, larlight::MSG::ERROR, larlight::DATA::FFTHit, larlight::DATA::GausHit, larlight::DATA::Hit, larlight::DATA::RFFHit, and larlight::Message::send().

00069                                          : std::vector<larlight::hit>(), 
00070                            event_base(type) 
00071   //#################################################################################
00072   {
00073     if( _type != DATA::Hit &&
00074     _type != DATA::CrawlerHit &&
00075     _type != DATA::GausHit &&
00076     _type != DATA::APAHit &&
00077     _type != DATA::FFTHit &&
00078     _type != DATA::RFFHit ) {
00079 
00080       Message::send(MSG::ERROR,__FUNCTION__,
00081             Form("Provided data type (%s) not supported! Reset to default.",DATA::DATA_TREE_NAME[_type].c_str()));
00082       
00083       _type = DATA::Hit;
00084     }
00085 
00086     clear_data();
00087 
00088   }

larlight::event_hit::event_hit ( const event_hit original  )  [inline]

Default copy constructor.

Definition at line 114 of file hit.hh.

00114                                          : std::vector<larlight::hit>(original), event_base(original)
00115     {}

larlight::event_hit::~event_hit (  )  [inline]

Default destructor.

Definition at line 118 of file hit.hh.

00118 {}


Member Function Documentation

void larlight::data_base::add_association ( DATA::DATA_TYPE  type,
const std::vector< unsigned short >  ass 
) [inherited]

Adder for a set of association.

Definition at line 9 of file data_base.cc.

References larlight::data_base::_ass.

00011   {
00012 
00013     if( _ass.find(type) == _ass.end() )
00014       
00015       _ass[type]=std::vector<std::vector<unsigned short> >();
00016     
00017     _ass[type].push_back(ass);
00018     
00019     
00020   }

const std::vector< unsigned short > larlight::data_base::association ( DATA::DATA_TYPE  type,
size_t  index = 0 
) const [inherited]

Getter of an association.

Definition at line 35 of file data_base.cc.

References larlight::DATA::DATA_TREE_NAME, larlight::MSG::ERROR, and larlight::Message::send().

00037   {
00038     
00039     size_t ass_length = size_association(type);
00040     
00041     if( !(ass_length) ) {
00042       
00043       Message::send(MSG::ERROR,__FUNCTION__,
00044             Form("There is no association to %s",DATA::DATA_TREE_NAME[type].c_str()));
00045       
00046       return std::vector<unsigned short>();
00047       
00048     }
00049     
00050     if( ass_length <= index ) {
00051       
00052       Message::send(MSG::ERROR,__FUNCTION__,
00053             Form("There are only %zu associations. No association @ index=%zu",ass_length,index));
00054       
00055       return std::vector<unsigned short>();
00056       
00057     }
00058     
00059     return ((_ass.find(type))->second).at(index);
00060   }

virtual void larlight::event_hit::clear_data (  )  [inline, virtual]

Method to clear currently held data contents in the buffer.

Reimplemented from larlight::event_base.

Definition at line 121 of file hit.hh.

Referenced by event_hit().

00121 {event_base::clear_data(); clear();}

DATA::DATA_TYPE larlight::event_base::data_type (  )  const [inline, inherited]

data type getter

Reimplemented from larlight::data_base.

Definition at line 112 of file data_base.hh.

References larlight::data_base::_type.

00112 {return _type; }

UInt_t larlight::event_base::event_id (  )  const [inline, inherited]

event-id getter

Definition at line 110 of file data_base.hh.

References larlight::event_base::fEventID.

Referenced by main(), and larlight::storage_manager::read_event().

00110 { return fEventID;      }

void larlight::event_hit::get_axis_range ( std::vector< Double_t > &  chmax,
std::vector< Double_t > &  chmin,
std::vector< Double_t > &  wiremax,
std::vector< Double_t > &  wiremin,
std::vector< Double_t > &  timemax,
std::vector< Double_t > &  timemin,
const std::vector< unsigned short > &  hit_index 
) const

Yet another utility function with an optional input to specify index of hits to be considered.

Definition at line 132 of file hit.cc.

References larlight::MSG::ERROR, larlight::GEO::kW, larlight::Message::send(), and larlight::DATA::Wire.

00140   {
00141     
00142     // Make sure input vector is of size wire plane with initial value -1 (if not yet set)
00143     chmax.resize((GEO::kW+1),-1);
00144     wiremax.resize((GEO::kW+1),-1);
00145     timemax.resize((GEO::kW+1),-1);
00146     chmin.resize((GEO::kW+1),-1);
00147     wiremin.resize((GEO::kW+1),-1);
00148     timemin.resize((GEO::kW+1),-1);
00149 
00150     //vtx is a vector of hits for one cluster?
00151     for(std::vector<unsigned short>::const_iterator iter(hit_index.begin());
00152     iter!=hit_index.end();
00153     ++iter) {
00154       
00155       unsigned short index = (*iter);
00156 
00157       if( index < this->size() ) {
00158 
00159     GEO::View_t  view    =  (this->at(index)).View();
00160     Double_t     wire    =  (Double_t)((this->at(index)).Wire());
00161     Double_t     ch      =  (Double_t)((this->at(index)).Channel());
00162     Double_t     tstart  =  (this->at(index)).StartTime();
00163     Double_t     tend    =  (this->at(index)).EndTime();
00164     
00165     if( wiremax[view] < 0 || wiremax[view] < wire )  wiremax[view] = wire;
00166     if( chmax[view]   < 0 || chmax[view]   < ch   )  chmax[view]   = ch;
00167     if( timemax[view] < 0 || timemax[view] < tend )  timemax[view] = tend;
00168     
00169     if( wiremin[view] < 0 || wiremin[view] > wire   )  wiremin[view] = wire;
00170     if( chmin[view]   < 0 || chmin[view]   > ch     )  chmin[view]   = ch;
00171     if( timemin[view] < 0 || timemin[view] > tstart )  timemin[view] = tstart;
00172       }else{
00173     
00174     Message::send(MSG::ERROR,__FUNCTION__,
00175               Form("Hit index %d does not exist!",index));
00176     continue;
00177       }
00178     }
00179 
00180     return;
00181   }

void larlight::event_hit::get_axis_range ( std::vector< Double_t > &  chmax,
std::vector< Double_t > &  chmin,
std::vector< Double_t > &  wiremax,
std::vector< Double_t > &  wiremin,
std::vector< Double_t > &  timemax,
std::vector< Double_t > &  timemin 
) const

A utility function to obtain maximum & minimum of hits' vertex NOTE: the initial max/min values matter.

It only modifies max/min if it finds values that is above/below those initial values.

Definition at line 92 of file hit.cc.

References larlight::GEO::kW.

00099   {
00100     
00101     // Make sure input vector is of size wire plane with initial value -1 (if not yet set)
00102     chmax.resize((GEO::kW+1),-1);
00103     wiremax.resize((GEO::kW+1),-1);
00104     timemax.resize((GEO::kW+1),-1);
00105     chmin.resize((GEO::kW+1),-1);
00106     wiremin.resize((GEO::kW+1),-1);
00107     timemin.resize((GEO::kW+1),-1);
00108 
00109     //vtx is a vector of hits for one cluster?
00110     for(event_hit::const_iterator iter(this->begin()); iter!=this->end(); ++iter) {
00111 
00112       GEO::View_t  view    =  (*iter).View();
00113       Double_t     wire    =  (Double_t)((*iter).Wire());
00114       Double_t     ch      =  (Double_t)((*iter).Channel());
00115       Double_t     tstart  =  (*iter).StartTime();
00116       Double_t     tend    =  (*iter).EndTime();
00117 
00118       if( wiremax[view] < 0 || wiremax[view] < wire )  wiremax[view] = wire;
00119       if( chmax[view]   < 0 || chmax[view]   < ch   )  chmax[view]   = ch;
00120       if( timemax[view] < 0 || timemax[view] < tend )  timemax[view] = tend;
00121 
00122       if( wiremin[view] < 0 || wiremin[view] > wire   )  wiremin[view] = wire;
00123       if( chmin[view]   < 0 || chmin[view]   > ch     )  chmin[view]   = ch;
00124       if( timemin[view] < 0 || timemin[view] > tstart )  timemin[view] = tstart;
00125       
00126     }
00127 
00128     return;
00129   }

UInt_t larlight::event_base::run (  )  const [inline, inherited]

run number getter

Definition at line 106 of file data_base.hh.

References larlight::event_base::fRunNumber.

00106 { return fRunNumber;    }

void larlight::event_base::set_event_id ( UInt_t  id  )  [inline, inherited]

event-id setter

Definition at line 103 of file data_base.hh.

References larlight::event_base::fEventID.

Referenced by main().

00103 { fEventID      = id;  }

void larlight::event_base::set_run ( UInt_t  run  )  [inline, inherited]

run number setter

Definition at line 99 of file data_base.hh.

References larlight::event_base::fRunNumber.

Referenced by main().

00099 { fRunNumber    = run; }

void larlight::event_base::set_subrun ( UInt_t  run  )  [inline, inherited]

sub-run number setter

Definition at line 101 of file data_base.hh.

References larlight::event_base::fSubRunNumber.

Referenced by main().

00101 { fSubRunNumber = run; }

size_t larlight::data_base::size_association ( DATA::DATA_TYPE  type  )  const [inherited]

Getter for # of associations.

Definition at line 23 of file data_base.cc.

Referenced by larlight::cluster::get_hit_type().

00025   {
00026     
00027     if( _ass.find(type) == _ass.end() ) return 0;
00028     
00029     return ((_ass.find(type))->second).size();
00030     //return _ass[type].size();
00031     
00032   }

UInt_t larlight::event_base::subrun (  )  const [inline, inherited]

sub-run number getter

Definition at line 108 of file data_base.hh.

References larlight::event_base::fSubRunNumber.

00108 { return fSubRunNumber; }


Member Data Documentation

std::map<larlight::DATA::DATA_TYPE,std::vector<std::vector<unsigned short> > > larlight::data_base::_ass [protected, inherited]

Association storage ... allow multiple set of associations.

Definition at line 65 of file data_base.hh.

Referenced by larlight::data_base::add_association(), and larlight::data_base::clear_data().

DATA_TYPE.

Definition at line 62 of file data_base.hh.

Referenced by larlight::calorimetry::calorimetry(), larlight::cluster::cluster(), larlight::data_base::data_base(), larlight::event_base::data_type(), larlight::data_base::data_type(), larlight::endpoint2d::endpoint2d(), larlight::event_calorimetry::event_calorimetry(), larlight::event_cluster::event_cluster(), larlight::event_endpoint2d::event_endpoint2d(), larlight::event_fifo::event_fifo(), event_hit(), larlight::event_mcpart::event_mcpart(), larlight::event_mcshower::event_mcshower(), larlight::event_mctruth::event_mctruth(), larlight::event_pulse::event_pulse(), larlight::event_shower::event_shower(), larlight::event_simch::event_simch(), larlight::event_sps::event_sps(), larlight::event_track::event_track(), larlight::event_user::event_user(), larlight::event_vertex::event_vertex(), larlight::event_wire::event_wire(), larlight::fifo::fifo(), larlight::hit::hit(), larlight::mcnu::mcnu(), larlight::mcpart::mcpart(), larlight::mcshower::mcshower(), larlight::mctrajectory::mctrajectory(), larlight::mctruth::mctruth(), larlight::pmtfifo::pmtfifo(), larlight::pulse::pulse(), larlight::fifo::readout_sample_number_16MHz(), larlight::fifo::readout_sample_number_2MHz(), larlight::fifo::readout_sample_number_64MHz(), larlight::shower::shower(), larlight::simch::simch(), larlight::spacepoint::spacepoint(), larlight::tpcfifo::tpcfifo(), larlight::track::track(), larlight::trigger::trigger(), larlight::user_info::user_info(), larlight::vertex::vertex(), and larlight::wire::wire().

UInt_t larlight::event_base::fEventID [protected, inherited]
UInt_t larlight::event_base::fRunNumber [protected, inherited]
UInt_t larlight::event_base::fSubRunNumber [protected, inherited]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator

Generated on 3 Jun 2014 for MyProject by  doxygen 1.6.1