// -*- mode: c++ -*- #ifndef BRAT_BrDetectorVolume #define BRAT_BrDetectorVolume // // $Id: BrDetectorVolume.h,v 1.8 2002/08/30 17:35:06 videbaek Exp $ /////////////////////////////////////////////////////////////////////// // // // BrDetectorVolume // // // The detector Volume class. This maintains the basic geometry // // of the detector i.e. global position, rotation matrices etc. // // // // This class in transition. Several of the old members are kept // until all the code using this is setup peoperly. Also for now the // initialization is done thorugh the older code. // The flag DETECTORVOLUMEOBSOLETE is used to isolate the old // behaviour. // // /////////////////////////////////////////////////////////////////////// // Root Classes #ifndef ROOT_TNamed #include "TNamed.h" #endif // BRAHMS Classes #ifndef BRAT_BrVector3D #include "BrVector3D.h" #endif #ifndef BRAT_BrLine3D #include "BrLine3D.h" #endif #ifndef BRAT_BrPlane3D #include "BrPlane3D.h" #endif #ifndef BRAT_BrCoordinateSystem #include "BrCoordinateSystem.h" #endif #ifndef BRAT_BrUnits #include "BrUnits.h" #endif class BrRunsDb; class BrRunInfoManager; class BrGeometriesDb; class TObjArray; class BrDbDetectorVolume; class BrDetectorVolume : public TNamed { public: BrDetectorVolume(); BrDetectorVolume(const Char_t *name, const Char_t *title); BrDetectorVolume(const Char_t *name, const Char_t *title, const Char_t *ASCIIFileName); BrDetectorVolume(const Char_t *name, const Char_t *title, Float_t sizeX, Float_t sizeY, Float_t sizeZ, BrVector3D& origin,BrRotMatrix& rotMatrix); BrDetectorVolume(const Char_t *name, TObjArray *asciiVolList); virtual void Print(Option_t* option="d") const; // *MENU* virtual ~BrDetectorVolume(); virtual Bool_t ReadASCIIFile(const Char_t *ASCIIFileName,const Char_t *name); virtual void ListParameters(); virtual Float_t *GetSize() {return fSize;} virtual BrVector3D GetPosition(); virtual BrVector3D GetPosVector3D(); // identical to GetPosition() !! virtual void GlobalToLocal(const Float_t* xg, Float_t* xl, Int_t iflag); virtual void LocalToGlobal(const Float_t xl[3],Float_t xg[3],Int_t iflag); virtual void GlobalToLocal(const BrVector3D&, BrVector3D& ,Int_t iflag); virtual void LocalToGlobal(const BrVector3D&, BrVector3D& ,Int_t iflag); virtual BrLine3D GlobalToLocal(const BrLine3D& line); virtual BrLine3D LocalToGlobal(const BrLine3D& line); virtual void SetCoordinateSystem(BrCoordinateSystem& system){fSystem = system;} virtual void SetVolumeParameters(Float_t sizeX, Float_t sizeY, Float_t sizeZ, BrVector3D origin,BrRotMatrix rotMatrix); void SetVolumeParameters(Float_t xl, Float_t yl, Float_t zl, Float_t angle, Float_t beta, Float_t xl_center, Float_t yl_center, Float_t zl_center, Char_t *type); void AddVerticalRotation(Float_t &theta2,Float_t &phi2, Float_t &theta3,Float_t &phi3, Float_t beta); virtual const BrCoordinateSystem* GetCoordinateSystem() const {return &fSystem;} virtual const BrRotMatrix* GetRotMatrix() const {return fSystem.GetRotMatrix();} virtual void SetVerbose(Bool_t verbose) { fVerbose = verbose; } virtual Bool_t Verbose() const { return fVerbose;} virtual BrPlane3D GetFrontPlane(); virtual BrPlane3D GetBackPlane(); virtual BrPlane3D GetMidPlane(); virtual void Update(); protected: Float_t fSize[3]; // Detector size (x,y,z) Char_t fType[4]; // Detector type (for classification) Bool_t fVerbose; // Verbose output flag BrCoordinateSystem fSystem; // Coordinate system definition. Bool_t fSetup; // //Needed for MySQL data access. Following set if manager in MySQL mode. Int_t fCurrentRunNo;//Current run number (used in update) BrRunsDb *fRunDb; //Pointer to run db. BrRunInfoManager *fRunManager; //Pointer to run manager BrGeometriesDb *fGeometryDb; //Pointer to geo db. TObjArray *fAsciiVolumeList; //List of vols to read in ASCII file Bool_t FillVolume(); //method to fill det vol BrDbDetectorVolume *GetDetectorVolumeWithCondition(const Char_t *name,Float_t specAngle,Int_t platformType); public: friend ostream& operator<< (ostream& os, BrDetectorVolume* volume_p); friend ostream& operator<< (ostream& os, BrDetectorVolume& volume_p); ClassDef(BrDetectorVolume,1) // BRAHMS detector volume class }; extern ostream& operator<< (ostream& os,BrDetectorVolume *volume_p); extern ostream& operator<< (ostream& os,BrDetectorVolume &volume_p); class BrAsciiVolumeMap: public TObject { //Utility class to keep information on volumes to be read in //from ascii files rather than the MySQL DB when in MySQL mode. public: BrAsciiVolumeMap(const Char_t *vol, const Char_t *file) { fVolumeName = vol; fFilename = file;} //TString GetVolumeName() {return fVolumeName;} TString GetFilename() {return fFilename;} Bool_t IsVolume(const Char_t *vol) {return(fVolumeName==vol);} private: TString fVolumeName; TString fFilename; public: ClassDef(BrAsciiVolumeMap,0) }; #endif /////////////////////////////////////////////////////////////////////////// // // $Log: BrDetectorVolume.h,v $ // Revision 1.8 2002/08/30 17:35:06 videbaek // Add Verbose getter method in DetectorVolume. // Corrected the checkswim status where the code was wrong for tracks that bends // left, as well as given Nan for straigt incidence tracks. // // Revision 1.7 2002/04/16 14:44:12 hagel // Implement Hall Probe reading from Db in ySQL mode. Major surgery on BrGeometryDbManager concerning building BrDetectorVolume and BrMagnetVolume // // Revision 1.6 2002/04/02 19:40:48 videbaek // Added method GetMidPlane // // Revision 1.5 2002/02/26 08:57:55 cholm // Added const'ness to many methods - needed by ISO C++ // // Revision 1.4 2002/02/22 21:49:15 videbaek // Add Print method, and give warning for ListParameters as becoming obsolete. // // Revision 1.3 2001/11/05 23:41:42 hagel // Changes to MySQL mode for Geometry DB manager // // Revision 1.2 2001/09/22 16:18:18 videbaek // Commit changes to BrDetectorVolume and BrMagnetVolume that // Pawel has made. Check out with test programs as well as reconstruction so declared ok. // // Revision 1.1.1.1 2001/06/21 14:55:18 hagel // Initial revision of brat2 // // Revision 1.26 2001/05/07 21:19:34 hagel // Changes to implement MySQL Db stuff // // Revision 1.25 2001/03/07 17:32:31 hagel // Changes to use with new MySQL DB access // // Revision 1.24 2000/11/23 01:30:22 brahmlib // Changed name/title types to const Char_t* instead of Char_t* in CTOR. // // Revision 1.23 2000/11/22 21:04:34 videbaek // BrMagnetVolume is now derived from BrDetectorVolume. Modified and uniform methods // now. // // Revision 1.22 2000/11/15 20:57:57 videbaek // Added SwimForward to magnet volume. Modified internals. The existing // Get methods are stillvalid. Some Set methods has been added. // // Revision 1.21 2000/10/24 21:10:53 videbaek // Remove from code source already skipped by pre-processor flags. // // Revision 1.20 2000/10/10 18:11:11 videbaek // Update to reflect change in BrRotMatrix // // Revision 1.19 2000/09/18 21:26:58 videbaek // Changed neede for Internal modifications to // BrDetectorVolume. // // Revision 1.18 2000/05/23 21:14:36 jhlee // Add GetFrontPlane and GetBackPlane // // Revision 1.17 2000/04/06 20:17:10 cholm // Added the classes BrAppOption, BrAppOptionManager, and // BrDetectorList. The first two are for command line processing, // the third for easy detector list, can be used for many purposes // // Revision 1.16 1999/04/21 14:47:39 videbaek // Added Methods SetHistOn() .. see comments // // Revision 1.15 1999/03/07 00:00:41 hagel // 1. Implemented BrFSTrackingModule. Started with BrMRSTrackingModule and made // appropriate changes to handle the forward spectrometer. It uses the new // track classes as well as extensively using geometry classes. It also uses // new methods and functionality as described below. // 2. Changed BrMagnetVolume // a. Added method SwimBack(BrLine3D &,Double_t momentum): takes a // track at the exit of magnet and given the momentum, calculates // where the track would come into the front of the magnet. // b. Added method GlobalToLocal(BrLine3D &): does a combination of // GlobalToLocal(BrVector3D &,BrVector3D&,0) and // GlobalToLocal(BrVector3D &,BrVector3D&,1) // c. Added method LocalToGlobal(BrLine3D &): does a combination of // LocalToGlobal(BrVector3D &,BrVector3D&,0) and // LocalToGlobal(BrVector3D &,BrVector3D&,1) // d. Changed BrDetectorVolume: same additions of methods GlobalToLocal // and LocalToGlobal as in BrMagnetVolume // 2. Added a parameter base class BrDetectorParamsBase: helps when reading // in database files. Declared ASCII reading routines to be virtual. // Has main ReadASCIIFile which decodes the ASCII parameter files, then // calls the detector specific methods SetASCIIParameter // 3. Implemented SetASCIIParameter in BrDetectorParamsDC, BrDetectorParamsTPC, // BrDetectorParamsTof, BrDetectorParamsBB // 4. Implemented BrParameterDbManager. It currently works similarly to // BrGeometryDbManager and creates the BrDetectorParamsXXX objects when // called. These objects then read in ASCII parameter files with a currently // "well defined" format using the above implemented routines using a constructor: // BrDetectorParamsXXX(Char_t *name, Char_t *title,Char_t *ASCIIFileName); // 5. If no parameter file is specified, it executes the constructor we // have been using so far, namely BrDetectorParamsXXX(Char_t *name,Char_t *title). // These constructors generate default parameters and are semi-intelligent // which means they generate approximately appropriate parameters depending // upon which detector they are. I should say that the parameters were // deemed appropriate at the time of writing the SetDefaultParams routine. // a. It is used in the same way as BrGeometryDbManager, that is: // BrParameterDbManager *gParamDb = BrParameterDbManager::Instance(); // gParamDb->SetDbParameterFileName("DetectorParameters.txt"); // 6. Added a new directory, params, in BRAT. This directory has the file // DetectorParameters.txt in it. If the BrParameterDbManager is started // and the DetectorParameter.txt file is specified, it will look in the // $BRATSYS/params directory if it cannot find the file in the directory // that the user has set default to. // 7. Implemented BrParameterDbManager in DC digitize and tracking code. The // SetDetectorParams methods have been moved to private and can no longer be // used from the macro or program. // 8. Implemented BrParameterDbManager in TPC digitize and tracking code. // 9. Implemented BrParameterDbManager in Tof Calibrate and GeneratePid code. // 10 Changed the GetEntries() in BrDataTable to use the GetLast()+1 method in // TObjArray. This should be much faster, but has the caveat that it assumes // that all slots in TObjArray are full. That seems to me to be the case // in how we use TObjArray at least in BrDataTable, but if problems arise due // to this change, it can always be easily changed back. It has been used a // fair amount before checking in and no problems were found. // // Modified Files: // base/inc/BrBase_LinkDef.h base/inc/BrDataTable.h // base/inc/BrDetectorVolume.h base/inc/BrMagnetVolume.h // base/inc/LinkDefBratBaseINC.h base/src/BrDataTable.cxx // base/src/BrDetectorVolume.cxx base/src/BrEventNode.cxx // base/src/BrMagnetVolume.cxx base/src/BrTableManager.cxx // base/src/Makefile bb/inc/BrDetectorParamsBB.h // bb/src/BrDetectorParamsBB.cxx db/inc/BrParameterDbManager.h // db/src/BrParameterDbManager.cxx dc/inc/BrDetectorParamsDC.h // dc/src/BrDetectorDC.cxx dc/src/BrDetectorParamsDC.cxx // dc/src/BrDigitizeDC.cxx dc/src/BrLocalTrackDC.cxx // geometry/inc/BrPlane3D.h geometry/src/BrPlane3D.cxx // params/DetectorParameters.txt tof/inc/BrDetectorParamsTof.h // tof/src/BrDetectorParamsTof.cxx tof/src/BrGeneratePid.cxx // tpc/inc/BrDetectorParamsTPC.h tpc/src/BrDetectorParamsTPC.cxx // tpc/src/BrDetectorTPC.cxx tpc/src/BrDigitizeTPC.cxx // tpc/src/BrLocalTrackTPC.cxx track/inc/BrDetectorTrack.h // track/inc/BrFSTrackingModule.h // track/inc/BrSpectrometerTracks.h track/src/BrDetectorTrack.cxx // track/src/BrFSTrackingModule.cxx // track/src/BrSpectrometerTracks.cxx // // Revision 1.14 1999/01/21 23:23:18 hagel // 1. Changed convention for checking includes. Current convention is: // BRAT_Br...... eg BRAT_BrModule ala ROOT. // 2. Added CVS logs to .h files that didnt have them. // 3. Moved checking of include definition to first line for easier reading // 4. Put checks before all includes in the include files as per BRAT specifications // 5. Added BrGeantHeader to Geant Makefile // 6. All changes have been checked to compile on NT ala Cygnus // // Revision 1.13 1999/01/15 15:32:13 videbaek // Updates to volume files. // Added member histon to BrModule, and member function HistOn(). // Added BrMath as standard math library. // // Revision 1.12 1998/12/21 20:17:58 videbaek // Added magnet voluems. Additional features for Modules. // // Revision 1.11 1998/12/16 23:51:41 hagel // Add constructor and ReadASCIIFile methods without fspec and mids since that // is not needed anymore. Keep other ones for time being for compatibility with // code that already exists. // // Revision 1.10 1998/12/04 21:33:11 videbaek // Modification for better geometry contnued. Nor complete yet // // Revision 1.9 1998/12/01 21:20:09 videbaek // Added refs in Detector volume to deal with BrVector3D // rather than only float* references. // // Revision 1.8 1998/10/05 21:01:54 videbaek // Add comments to member data // // Revision 1.7 1998/09/27 16:54:51 alv // made first argument of LocalToGlobal and GlobalToLocal const. // // Revision 1.6 1998/09/24 23:28:48 hagel // Added GetXpos, GetYpos, GetZpos to set detetctor positions: // // Revision 1.5 1998/06/20 23:20:47 hagel // Add basic ostream support to BrDetectorVolume // // Revision 1.4 1998/04/29 02:12:59 hagel // added GlobalToLocal for BrCombineTracks etc // // Revision 1.3 1998/04/06 21:11:47 videbaek // Clean up and additions for Win95 // // Revision 1.2 1998/04/01 22:22:03 hagel // Put Get()s in front of variables. Leave Others in for now for compatibility // // Revision 1.1.1.1 1998/03/04 21:32:48 brahmlib // Brat base // //