MarlinTPC  1.2.0
Public Member Functions | List of all members
marlintpc::PhotoelectricXMLFile Class Reference

This provides some tools on handling the xml file used to store information on the Photoelectric analysis. More...

#include <PhotoelectricXMLHelper.h>

Public Member Functions

 PhotoelectricXMLFile (std::string xmlFile)
 Constructor expecting a xml file with the true photodot positions stored as follows: More...
 
std::vector< std::pair< double,
std::vector< Photodot >
::const_iterator > > 
GetSortedPhotodots (double center_x, double center_y)
 This methods sorts the photodots from the photodot file. More...
 
std::vector< std::vector
< Photodot >::const_iterator > 
GetPhotodots ()
 Photodots are sorted by the index found in the xml file. More...
 
std::vector< std::vector
< Photoline >::const_iterator > 
GetPhotolines ()
 Photodots are sorted by the index found in the xml file. More...
 
void SetTimeInfo (float start, float end)
 This adds the time information to the xml file. More...
 
bool GetTimeInfo (float &start, float &end)
 This reads the time information from the xml file. More...
 
void SaveFile (std::string fileName)
 Save the internal xml file. More...
 
gear::TiXmlElement * GetPhotoElectricElement ()
 This return the main element in the xml file. More...
 
void AddPhotodotProjection (int photodot_id, const CLHEP::Hep2Vector centroid, const std::set< gear::GlobalPadIndex > &pads)
 Add information about the associated pads to a photodot. More...
 
void AddPhotodotProjection (const CLHEP::Hep2Vector centroid, const std::set< gear::GlobalPadIndex > &pads)
 Add information about pads in a cluster not connected to a photodot. More...
 
std::map< int, std::set
< gear::GlobalPadIndex > > 
GetPhotodotPads ()
 Get pads associated to each photodot. More...
 
std::map< int, std::set
< gear::GlobalPadIndex > > 
GetPhotolinePads ()
 Get pads associated to each photoline. More...
 
void AddPhotolineProjection (int module_id, const std::set< gear::GlobalPadIndex > &pads)
 Add pads associated to each photoline. More...
 

Detailed Description

This provides some tools on handling the xml file used to store information on the Photoelectric analysis.

Author
K. Zenker (DESY)

Up to now it allows to:

  1. Read photodot/line positions from a xml file and sort them by the distance to the center.
    This is useful if clusters should be connected to the true photodot position, since in the center of the magnet distortions are at minimum. Therefore one can start in the center.
  2. Add information about clusters connected to photodots.
  3. Add information about clusters not connected to photodots.
  4. Add start and end time to be used by processors to do a time cut on pulses.
    Remarks
    Keep in mind that most of the function return only pointers or iterators to internal stored information. Thus you should not delete the PhotoelectricXMLFile object as long as you want to use these information!

Constructor & Destructor Documentation

PhotoelectricXMLFile::PhotoelectricXMLFile ( std::string  xmlFile)

Constructor expecting a xml file with the true photodot positions stored as follows:

<photoelectric_geometry>
< photodot>
<centroid>1256.77,-171.959</centroid>
</photodot>
</photoelectric_geometry>
Parameters
xmlFilePhotodot file name including the path

Member Function Documentation

void marlintpc::PhotoelectricXMLFile::AddPhotodotProjection ( int  photodot_id,
const CLHEP::Hep2Vector  centroid,
const std::set< gear::GlobalPadIndex > &  pads 
)

Add information about the associated pads to a photodot.

<photoelectric_geometry>
<photodot>
<centroid x="192.1" y="12" />
<projection>
<pad pad_index="1769614" module_id="5" />
</projection>
</photodot>
</photoelectric_geometry>
void marlintpc::PhotoelectricXMLFile::AddPhotodotProjection ( const CLHEP::Hep2Vector  centroid,
const std::set< gear::GlobalPadIndex > &  pads 
)

Add information about pads in a cluster not connected to a photodot.

<photoelectric_geometry>
<centroid x="192.1" y="12" />
<projection>
<pad pad_index="1769614" module_id="5" />
</projection>
</photoelectric_geometry>
void PhotoelectricXMLFile::AddPhotolineProjection ( int  module_id,
const std::set< gear::GlobalPadIndex > &  pads 
)

Add pads associated to each photoline.

Parameters
module_idGive the module where the line belongs to.
padsGlobal pad indices of the associated pads.
std::map< int, std::set< gear::GlobalPadIndex > > PhotoelectricXMLFile::GetPhotodotPads ( )

Get pads associated to each photodot.

If no pads are associated the set size is 0.

Returns
Map holding for each photodot a set of pads.
vector< vector< Photodot >::const_iterator > PhotoelectricXMLFile::GetPhotodots ( )

Photodots are sorted by the index found in the xml file.

Returns
A vector of iterators to the internal photodots.

Referenced by marlintpc::PhotoelectricPulseProcessor::init().

gear::TiXmlElement * PhotoelectricXMLFile::GetPhotoElectricElement ( )

This return the main element in the xml file.

It can be used to add additional information to the main (photoelectric_geometry) element.

<photoelectric_geometry>
<!-- add stuff here -->
</photoelectric_geometry>
std::map< int, std::set< gear::GlobalPadIndex > > PhotoelectricXMLFile::GetPhotolinePads ( )

Get pads associated to each photoline.

If no pads are associated the set size is 0.

Returns
Map holding for each photoline a set of pads.
vector< vector< Photoline >::const_iterator > PhotoelectricXMLFile::GetPhotolines ( )

Photodots are sorted by the index found in the xml file.

Returns
A vector of iterators to the internal photolines.

Referenced by marlintpc::PhotoelectricPulseProcessor::init().

vector< pair< double, vector< Photodot >::const_iterator > > PhotoelectricXMLFile::GetSortedPhotodots ( double  center_x,
double  center_y 
)

This methods sorts the photodots from the photodot file.

The distance to the given point (center_x,center_y) is calculated and than all dots are sorted by this distance. Shortest distance is at the beginning. The corresponding dot should be used to assign the clusters to the true position. This assumes that the distortions of the magnetic field are minimal in the center of the magnet/the given point.

Parameters
center_xx coordinate of the point with the most homogeneous magnetic field
center_yy coordinate of the point with the most homogeneous magnetic field
Returns
Returns sorted iterators to the photodot map.
The map key is the id of each photodot. The pair consists of the xml element of this photodot and its position.
bool PhotoelectricXMLFile::GetTimeInfo ( float &  start,
float &  end 
)

This reads the time information from the xml file.

Expected xml format:

<photoelectric_geometry>
<arrival_time start="1.400000000e+04" end="1.425000000e+04" />
</photoelectric_geometry>
Parameters
startThe start time.
endThe end time.
Returns
true in case of success
void marlintpc::PhotoelectricXMLFile::SaveFile ( std::string  fileName)
inline

Save the internal xml file.

It consists of the information from the original photodot file and possibly additional information (pulse time cut, cluster connected to each dot,...).

Parameters
fileNameThe file name of the xml file including the path.
void PhotoelectricXMLFile::SetTimeInfo ( float  start,
float  end 
)

This adds the time information to the xml file.

This can be later on be used by processors to apply a time cut on pulses to reduce noise pulses. Will look like this:

<photoelectric_geometry>
<arrival_time start="1.400000000e+04" end="1.425000000e+04" />
</photoelectric_geometry>
Parameters
startThe start time.
endThe end time.

The documentation for this class was generated from the following files: