#ifndef MAPSTRACKMANAGER_HH_ #define MAPSTRACKMANAGER_HH_ #include "MapsTrack.hh" #include #include "TH2F.h" #include #include "TString.h" #include "ToString.h" #include "MapsSensor.hh" #include "MapsException.hh" /** \mainpage The MapsTrack Library * * An analysis and simple persistency library for tracking with MAPS sensors. * * Jamie Ballin, Imperial College London * Feburary 2008 * * \section Overview * Classes are provided to build candidate tracks from 3 or 4 hits in 3 or 4 sensors. Sensors are * placed (by the user) into a global coordinate system. The user specifies track quality cuts, and * tracks are interrogated for the likelihood that they are real tracks. The classes provide facilities * for: * - global sensor alignment and geometry * - determination of hit "residuals" * - efficiency calculation of sensors (as a function of time, spatial position, pixel architecture, * and threshold) * - persistency of the track data to a ROOT file * - ability to quickly reprocess tracks without recreating them from "raw data" * * Sensors are told when they are efficient, and when they are not for each track. Once all the tracks * have been processed, sensors may be queried for relevant plots. * * The MapsTrackManager class provides simple persistency for track and sensors: once you've populated * an instance of the class with tracks (see MapsTrack) and sensors (see MapsSensor), it may persist them to a Root file. The data is * stored in the format of a Root TTree. A MapsTrackManager can recreate its state from the saved file. * * NOTE: the only truly persistent data are the raw pixel coordinates of the track and their assosciated * sensor IDs. Everything else can be readjusted. * * Various executables are supplied in tests/ for the user's delectation and enjoyment. * * \section Usage * The library is organised into two parts: * - libMapsTrack.so contains the MapsTrack, MapsSensor and MapsTrackManager classes discussed above. * - tests/ contains exectuables which are built and linked to libMapsTrack.so. Users should write * their own executables following in this fashion. * * Makefiles are supplied in the root directory to build the library, and in the tests/ directory * to build executables. * * Make sure you export LD_LIBRARY_PATH=[path to maps tracks]/lib:$LD_LIBRARY_PATH otherwise your * executables won't work! * * One should take advantage of the Root file that the MapsTrackManager class exports: the format of the * Root TTree contained therein allows you to explore the data extremely easily, and make dynamic cuts. * Having opened the file in a TBrowser, right-click on the tree and select "Open Viewer...". See the * Root documentation for further details. * */ /** MapsTrackManager.hh * * Persistency class for libMapsTracks.so * * \section Usage * \subsection export Track export * Construct an instance of this class, then add sensors to it, then add tracks to it. Set the most * left and most right sensors of the global coordinate system. * * Then use exportToRootFile(char* rootFileName) to save the tracks to disk. * * \subsection import Track import * Construct an instance of this class, then use recreateFromRootFile(char* rootFileName) to recreate * the sensors and tracks. You are advised to set the left and right most sensors before proceeding. * */ class MapsTrackManager { public: MapsTrackManager(std::vector sensors); MapsTrackManager(); //recreates the data content of a MapsTrackManager from a Root file! MapsTrackManager(char* rootFileName); virtual ~MapsTrackManager(); //Add a track to the utility class void addTrack(MapsTrack* mt); void addSensor(MapsSensor*); /* * Overwrites known sensors with supplied sensors */ void setSensors(std::vector sensors); //Get a vector of track pointers std::vector& getTracks(); //Get the vector of sensor pointers std::vector& getSensors(); /* * Specify the most left sensor of the global coordinate system (z = 0 usually). * This is required for constructing alignments of the middle sensors. */ void setRequiredLeftSensor(MapsSensor* left); /* * Specify the right most sensor of the global coordinate system. * This is required for constructing alignments of the middle sensors. */ void setRequiredRightSensor(MapsSensor* right); void exportToRootFile(char* rootFileName); void recreateFromRootFile(char* rootFileName) throw(MapsException); private: std::vector myTracks; std::vector mySensors; std::vector mySensorIds; MapsSensor* myRequiredLeft; MapsSensor* myRequiredRight; }; #endif /*MAPSTRACKMANAGER_HH_*/