|
//____________________________________________________________________ // // Base class for a calibration module // Register the parameter element in the manager at init time // //____________________________________________________________________ // // $Id: BrTofCalModule.cxx,v 1.12 2002/08/30 16:13:25 hagel Exp $ // $Author: hagel $ // $Date: 2002/08/30 16:13:25 $ // $Copyright: (C) 2001 BRAHMS Collaboration <brahmlib@rhic.bnl.gov> // #ifndef BRAT_BrTofCalModule #include "BrTofCalModule.h" #endif #ifndef ROOT_TDirectory #include "TDirectory.h" #endif #ifndef ROOT_TSystem #include "TSystem.h" #endif #ifndef WIN32 #include <iostream> #else #include <iostream.h> #endif #ifndef BRAT_BrParameterDbManager #include "BrParameterDbManager.h" #endif #ifndef BRAT_BrRunInfoManager #include "BrRunInfoManager.h" #endif #ifndef BRAT_BrGeometryDbManager #include "BrGeometryDbManager.h" #endif #ifndef BRAT_BrCalibrationManager #include "BrCalibrationManager.h" #endif //____________________________________________________________________ ClassImp(BrTofCalModule); //____________________________________________________________________ BrTofCalModule::BrTofCalModule() : BrModule() { // Default constructor. DO NOT USE SetState(kSetup); fParamsTof = 0; fCalibration = 0; fTpc1Vol = 0; fTpc2Vol = 0; fMag1Vol = 0; fMag2Vol = 0; fTofVol = 0; fCalibFile = '0'; fComment = '0'; fMatchName = '0'; SetDefaultParameters(); } //____________________________________________________________________ BrTofCalModule::BrTofCalModule(const Char_t* name, const Char_t* title) : BrModule(name, title) { // Named Constructor SetState(kSetup); fParamsTof = 0; fCalibration = 0; fTpc1Vol = 0; fTpc2Vol = 0; fMag1Vol = 0; fMag2Vol = 0; fTofVol = 0; SetDefaultParameters(); fCalibFile = '0'; fComment = '0'; if (strcmp(name, "TOF1")==0) { fInFfs = kTRUE; fMatchName = "FFS Matching"; fNominalL = 900; } else if (strcmp(name, "TOF2")==0) { fInBfs = kTRUE; fMatchName = "BFS Matching"; fNominalL = 1800; } else if (strcmp(name, "TOFW")==0) { fInMrs = kTRUE; fMatchName = "MRS Matching"; fNominalL = 450; } else if (strcmp(name, "TOFWCal")==0) { fInMrs = kTRUE; fMatchName = '0'; } else if (strcmp(name, "H1Cal")==0) { fInFfs = kTRUE; fMatchName = '0'; } else if (strcmp(name, "TD1")==0) { fInFfs = kTRUE; fMatchName = '0'; fNominalL = 204; } else if (strcmp(name, "TMrsF")==0) { fMatchName = '0'; fNominalL = 50; } else if (strcmp(name, "TMrsB")==0) { // fInMrs = kTRUE; fMatchName = '0'; fNominalL = 450; } else { Abort("BrTofCalModule", "Wrong detector name!! " "Should be TOF1 TOF2 TOFW H1Cal TOFWCal TD1 TMrsF or TMrsB-- is %s",name); return; } } //____________________________________________________________________ void BrTofCalModule::SetDefaultParameters() { // default params SetCommitAscii(); // default is false SetSaveAscii(); // default is false SetLoadAscii(); // default is false SetNoPedWidth(); // default is 50 (for matching between hit and tracks) SetEnergyThreshold(); // default is 0.7 SetMinTdcLimit(); // default is 10 SetMaxTdcLimit(); // default is 3500 SetNtuple(); // default is false fInFfs = kFALSE; fInMrs = kFALSE; fInBfs = kFALSE; fFsLined = kFALSE; } //____________________________________________________________________ void BrTofCalModule::Init() { // Job-level initialisation SetState(kInit); if (Verbose() > 10) { if (fInFfs) cout << " ******** We deal with the FFS arm ******* " << endl; if (fInBfs) cout << " ******** We deal with the BFS arm ******* " << endl; if (fInMrs) cout << " ******** We deal with the MRS arm ******* " << endl; } if (fInBfs) CheckFsAngles(); // ------------------------------------------- // calibration parameters BrParameterDbManager* parMan = BrParameterDbManager::Instance(); fParamsTof = (BrDetectorParamsTof*)parMan->GetDetectorParameters("BrDetectorParamsTof", GetName()); if (fInMrs) { fPanelPar = new BrDetectorParamsTof * [fParamsTof->GetNoPanels()]; for (Int_t p = 0; p < fParamsTof->GetNoPanels(); p++) fPanelPar[p] = (BrDetectorParamsTof*)parMan-> GetDetectorParameters("BrDetectorParamsTof", Form("TFP%d", p+1)); } // initialize all slat to good (let's be optimistic :) fValidSlat = new Bool_t [fParamsTof->GetNoSlats()]; for (Int_t i = 1; i < fParamsTof->GetNoSlats(); i++) fValidSlat[i - 1] = kTRUE; // getting calibration parameter element BrCalibrationManager* calMan = BrCalibrationManager::Instance(); if (!calMan) { Abort("Init", "could not get calibration manager"); return; } fCalibration = (BrTofCalibration*)calMan->Register("BrTofCalibration", GetName()); if (!fCalibration) { Abort("Init", "could not get calibration parameter element"); return; } // check calibration mode if (fCommitAscii) { fLoadAscii = kFALSE; fSaveAscii = kFALSE; if (Verbose() > 1) cout << " ----> Will COMMIT ascii calibration from file " << fCalibFile.Data() << endl; } if (fSaveAscii) { fLoadAscii = kFALSE; fCommitAscii = kFALSE; if (Verbose() > 1) cout << " ----> Will SAVE calibration to ascii file " << fCalibFile.Data() << endl; } if (fLoadAscii) { fSaveAscii = kFALSE; fCommitAscii = kFALSE; if (Verbose() > 1) cout << " ----> LOADING calibration from ascii file " << fCalibFile.Data() << endl; } if (!fSaveAscii && !fCommitAscii && !fLoadAscii) if (Verbose() > 1) Warning("Init", " * No ascii calibration loaded or " "saved or committed *"); } //____________________________________________________________________ void BrTofCalModule::InitGeo() { // protected method // ------------------------- // initialize geometry only // ------------------------- // pedestal and tdc gain calibrations doean't need that // geometry BrGeometryDbManager* geoDb = BrGeometryDbManager::Instance(); if (fInFfs) { fTpc1Vol = (BrDetectorVolume*)geoDb->GetDetectorVolume("BrDetectorVolume","T1"); fTpc2Vol = (BrDetectorVolume*)geoDb->GetDetectorVolume("BrDetectorVolume","T2"); fMag1Vol = (BrMagnetVolume*)geoDb->GetDetectorVolume("BrMagnetVolume","D1"); fMag2Vol = (BrMagnetVolume*)geoDb->GetDetectorVolume("BrMagnetVolume","D2"); fTofVol = (BrDetectorVolume*)geoDb->GetDetectorVolume("BrDetectorVolume","TOF1"); } else if (fInBfs) { fTpc1Vol = (BrDetectorVolume*)geoDb->GetDetectorVolume("BrDetectorVolume","T4"); fTpc2Vol = (BrDetectorVolume*)geoDb->GetDetectorVolume("BrDetectorVolume","T5"); fMag1Vol = (BrMagnetVolume*)geoDb->GetDetectorVolume("BrMagnetVolume","D3"); fMag2Vol = (BrMagnetVolume*)geoDb->GetDetectorVolume("BrMagnetVolume","D4"); fTofVol = (BrDetectorVolume*)geoDb->GetDetectorVolume("BrDetectorVolume","TOF2"); } else if (fInMrs) { fPanelVol = new BrDetectorVolume * [fParamsTof->GetNoPanels()]; for (Int_t p = 0; p < fParamsTof->GetNoPanels(); p++) fPanelVol[p] = (BrDetectorVolume*)geoDb-> GetDetectorVolume("BrDetectorVolume", Form("TFP%d", p+1)); fMag2Vol = (BrMagnetVolume*)geoDb-> GetDetectorVolume("BrMagnetVolume", "D5"); fTpc1Vol = (BrDetectorVolume*)geoDb-> GetDetectorVolume("BrDetectorVolume", "TPM1"); fTpc2Vol = (BrDetectorVolume*)geoDb-> GetDetectorVolume("BrDetectorVolume", "TPM2"); } } //____________________________________________________________________ void BrTofCalModule::SaveAscii() { if (fCalibFile == "") { cout << " You forgot to set a calibration file for " << GetName() << ".n Please provide it now: " << flush; cin >> fCalibFile; cout << endl; } } //____________________________________________________________________ void BrTofCalModule::CheckFsAngles() { // check if FFS and BFS are aligned BrRunInfoManager* runMan = BrRunInfoManager::Instance(); const BrRunInfo* run = runMan->GetCurrentRun(); if (run->GetRunNo() == -1) { Abort("Begin", "Current run number is -1. Aborting..."); return; } if (Verbose()) cout << " ---> FFS at " << run->GetFFSAngle() << " deg. " << " and BFS at " << run->GetBFSAngle() << " deg. " << endl; if (run->GetFFSAngle() == run->GetBFSAngle()) fFsLined = kTRUE; if (Verbose()) cout << " ---> FS lined up " << endl; } //____________________________________________________________________ void BrTofCalModule::Begin() { if (fInBfs) CheckFsAngles(); } //____________________________________________________________________ void BrTofCalModule::ReadAscii() { if (fCalibFile == "") { cout << " You forgot to set a calibration file for " << GetName() << ".n Please provide it now: " << flush; cin >> fCalibFile; cout << endl; } if(gSystem->AccessPathName(fCalibFile.Data(),kFileExists)) { Fatal("ReadAscii","Ascii file %s to be opened from %s does not exist; bombing",fCalibFile.Data(),GetName()); } if (fCommitAscii) if (fComment == "") { cout << " You forgot to give some valid comments on your actual calibration" << ".n Please do it now (at least 15 characters) : " << flush; cin >> fComment; cout << endl; } } //____________________________________________________________________ void BrTofCalModule::Event(BrEventNode* inNode, BrEventNode* outNode) { // temporary: before a production mode, I prefer committing from a // file with parameters saved in a previous pass. if (fCommitAscii || fLoadAscii) { if (Verbose() > 10) Warning("Event", "No need to scan event nodes, you only want to " "commit or load from ascii file"); return; } } //____________________________________________________________________ // // $Log: BrTofCalModule.cxx,v $ // Revision 1.12 2002/08/30 16:13:25 hagel // Added projection against trying to open a non-existent ASCII file // // Revision 1.11 2002/04/02 19:45:18 videbaek // Add TMrs detectors // // Revision 1.10 2002/03/21 15:04:25 ouerdane // added fComment member to base class module and method SetComment so that the user can set comments about the calibration at commit time. Removed mean momentum stuff in slewing cal module // // Revision 1.9 2002/02/14 21:42:36 videbaek // Add TD1 to classes of valid TOF modules // // Revision 1.8 2001/11/07 10:30:55 ouerdane // updated module for H2 cal. and PID // // Revision 1.7 2001/11/05 06:59:43 ouerdane // changed to deal with new track classes and fixed some bugs // // Revision 1.6 2001/10/20 00:07:17 ouerdane // removed useless old member fNoPanel // // Revision 1.5 2001/10/08 11:27:52 cholm // Changed to use new DB access classes // // Revision 1.4 2001/10/03 10:10:59 ouerdane // minor updates (cosmetic) // // Revision 1.3 2001/10/02 01:53:28 ouerdane // Added SetSaveAscii, SetLoadAscii, SetCommitAscii and updated the way parameters are tagged for Use // // Revision 1.2 2001/07/31 09:21:28 ouerdane // Removed all references to a TList member, replaced // by histogram members, declare ntuple if fNtuple is true (set // via SetNtuple) // // Revision 1.1.1.1 2001/06/21 14:55:05 hagel // Initial revision of brat2 // // Revision 1.3 2001/06/21 12:58:48 ouerdane // Updated to take into account the modifications in BrTofCalibration // and changed some method names in BrTofCalModule // // Revision 1.2 2001/06/20 09:12:41 ouerdane // Changed value of BrTofCalibration::kCalException to 999999 // Removed the old exception in BrTofCalModule // // Revision 1.1 2001/06/19 12:46:33 ouerdane // Added calibration classes and reconstruction classes. // Brat compiles but these classes haven't been tested in this // context. Be careful if you use them before I (DO) check if // all is ok. // // Note: some classes are still not included (BrTofSlewingModule, // BrTofCscintCalModule, BrTofTdcOffsetModule). Will do that after // Brat2 is available // // Revision 1.1 2001/06/01 10:07:01 ouerdane // Made a base class for TOF calibration modules. // It basically contains the calibration and parameter objects // and methods for reading from or saving to ascii files // // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|