inc/MapsTrackManager.hh

Go to the documentation of this file.
00001 #ifndef MAPSTRACKMANAGER_HH_
00002 #define MAPSTRACKMANAGER_HH_
00003 
00004 #include "MapsTrack.hh"
00005 #include <vector>
00006 #include "TH2F.h"
00007 #include <map>
00008 #include "TString.h"
00009 #include "ToString.h"
00010 #include "MapsSensor.hh"
00011 
00012 #include "MapsException.hh"
00013 
00014 
00015 /** \mainpage The MapsTrack Library
00016  * 
00017  * An analysis and simple persistency library for tracking with MAPS sensors.
00018  * 
00019  * Jamie Ballin, Imperial College London
00020  *              Feburary 2008
00021  * 
00022  * \section Overview
00023  * Classes are provided to build candidate tracks from 3 or 4 hits in 3 or 4 sensors. Sensors are
00024  * placed (by the user) into a global coordinate system. The user specifies track quality cuts, and
00025  * tracks are interrogated for the likelihood that they are real tracks. The classes provide facilities 
00026  * for:
00027  *  - global sensor alignment and geometry
00028  *  - determination of hit "residuals"
00029  *  - efficiency calculation of sensors (as a function of time, spatial position, pixel architecture, 
00030  * and threshold)
00031  *  - persistency of the track data to a ROOT file
00032  *  - ability to quickly reprocess tracks without recreating them from "raw data"
00033  * 
00034  * Sensors are told when they are efficient, and when they are not for each track. Once all the tracks
00035  * have been processed, sensors may be queried for relevant plots.
00036  * 
00037  * The MapsTrackManager class provides simple persistency for track and sensors: once you've populated
00038  * an instance of the class with tracks (see MapsTrack) and sensors (see MapsSensor), it may persist them to a Root file. The data is
00039  * stored in the format of a Root TTree. A MapsTrackManager can recreate its state from the saved file.
00040  * 
00041  * <i>NOTE: the only truly persistent data are the raw pixel coordinates of the track and their assosciated
00042  * sensor IDs. Everything else can be readjusted. </i>
00043  * 
00044  * Various executables are supplied in tests/ for the user's delectation and enjoyment.
00045  * 
00046  * \section Usage  
00047  * The library is organised into two parts:
00048  *  - libMapsTrack.so contains the MapsTrack, MapsSensor and MapsTrackManager classes discussed above.
00049  *  - tests/ contains exectuables which are built and linked to libMapsTrack.so. Users should write 
00050  * their own executables following in this fashion.
00051  * 
00052  * Makefiles are supplied in the root directory to build the library, and in the tests/ directory
00053  * to build executables.
00054  * 
00055  * Make sure you export LD_LIBRARY_PATH=[path to maps tracks]/lib:$LD_LIBRARY_PATH otherwise your
00056  * executables won't work!
00057  * 
00058  * One should take advantage of the Root file that the MapsTrackManager class exports: the format of the
00059  * Root TTree contained therein allows you to explore the data extremely easily, and make dynamic cuts.
00060  * Having opened the file in a TBrowser, right-click on the tree and select "Open Viewer...". See the
00061  * Root documentation for further details.
00062  * 
00063  */
00064 
00065 /** MapsTrackManager.hh
00066  * 
00067  * Persistency class for libMapsTracks.so
00068  * 
00069  * \section Usage
00070  * \subsection export Track export
00071  * Construct an instance of this class, then add sensors to it, then add tracks to it. Set the most
00072  * left and most right sensors of the global coordinate system.
00073  * 
00074  * Then use exportToRootFile(char* rootFileName) to save the tracks to disk.
00075  * 
00076  * \subsection import Track import
00077  * Construct an instance of this class, then use recreateFromRootFile(char* rootFileName) to recreate
00078  * the sensors and tracks. You are advised to set the left and right most sensors before proceeding.
00079  * 
00080  */
00081 class MapsTrackManager {
00082 public:
00083         MapsTrackManager(std::vector<MapsSensor*> sensors);
00084 
00085         MapsTrackManager();
00086 
00087         //recreates the data content of a MapsTrackManager from a Root file!
00088         MapsTrackManager(char* rootFileName);
00089 
00090         virtual ~MapsTrackManager();
00091 
00092         //Add a track to the utility class
00093         void addTrack(MapsTrack* mt);
00094 
00095         void addSensor(MapsSensor*);
00096 
00097         /*
00098          * Overwrites known sensors with supplied sensors
00099          */
00100         void setSensors(std::vector<MapsSensor*> sensors);
00101 
00102         //Get a vector of track pointers
00103         std::vector<MapsTrack*>& getTracks();
00104 
00105         //Get the vector of sensor pointers
00106         std::vector<MapsSensor*>& getSensors();
00107 
00108         /*
00109          * Specify the most left sensor of the global coordinate system (z = 0 usually).
00110          * This is required for constructing alignments of the middle sensors.
00111          */
00112         void setRequiredLeftSensor(MapsSensor* left);
00113 
00114         /*
00115          * Specify the right most sensor of the global coordinate system.
00116          * This is required for constructing alignments of the middle sensors.
00117          */
00118         void setRequiredRightSensor(MapsSensor* right);
00119 
00120         void exportToRootFile(char* rootFileName);
00121 
00122         void recreateFromRootFile(char* rootFileName) throw(MapsException);
00123 
00124 private:
00125         std::vector<MapsTrack*> myTracks;
00126         std::vector<MapsSensor*> mySensors;
00127         std::vector<unsigned> mySensorIds;
00128 
00129         MapsSensor* myRequiredLeft;
00130         MapsSensor* myRequiredRight;
00131 
00132 };
00133 
00134 
00135 #endif /*MAPSTRACKMANAGER_HH_*/

Generated on Wed Mar 19 17:47:58 2008 for MapsTracks by  doxygen 1.5.2