|
// $Id: BrCalibrateTof.cxx,v 1.3 2002/01/03 19:52:23 cholm Exp $ //////////////////////////////////////////////////////////////// // // BrCalibrateTof // // Module class to take digitized data for time-of flight detectors // and generate TOF // //////////////////////////////////////////////////////////////// // #include "math.h" #include <stdlib.h> #include <iostream.h> // // Root includes // //ROOT Includes #ifndef ROOT_TMath #include "TMath.h" #endif #ifndef ROOT_TRandom #include "TRandom.h" #endif #include "BrTableNames.h" #include "BrCalibrateTof.h" #include "BrGeometryDbManager.h" #include "BrParameterDbManager.h" #include "BrDetectorParamsTof.h" #include "BrMath.h" #include "BrEventNode.h" #include "BrDataTable.h" #include "BrTofDig.h" #include "BrCalTof.h" ClassImp(BrCalibrateTof) BrCalibrateTof::BrCalibrateTof() { // Constructor. } BrCalibrateTof::BrCalibrateTof(Text_t *Name,Char_t *Title) :BrModule(Name,Title) { } void BrCalibrateTof::SetDetectorParamsTof(BrDetectorParamsTof* par) { // Set the Tof parameters with the values of the external parameters // referenced by pointer // Note that no owner ship is transferred. A copy is made. // // if( fParamsTof_p == NULL) fParamsTof_p = new BrDetectorParamsTof("Dummy","TofINT"); *fParamsTof_p = *par; } void BrCalibrateTof::SetDetectorParamsTof(const BrDetectorParamsTof& par) { // Set the Tof parameters with the values of the external parameters. // Note that no owner ship is transferred. A copy is made. // There is no real need for the copy code here. Both Name and Title // will be copied (it seems) if( fParamsTof_p == NULL) fParamsTof_p = new BrDetectorParamsTof("Dummy","ParamsTof"); *fParamsTof_p = par; } BrCalibrateTof::~BrCalibrateTof(){ if( fParamsTof_p != NULL) delete fParamsTof_p; }; void BrCalibrateTof::Init(){ // Initialize entry point. This is not called at creation time but // This would be a good place to setup histograms, statistics variables etc. // This could also be done at the time of the constructor. This might likely be more // Usefull since one has the opportunity to setup varibales before this call // (e.g. detector parameters or alike). fParamsTof_p = NULL; BrParameterDbManager *gParamDb = BrParameterDbManager::Instance(); cout << "Name = " << GetName() << endl; if (!strcmp(GetName(),"TOFW")) SetName("TFP1"); fParamsTof_p = (BrDetectorParamsTof*)gParamDb->GetDetectorParameters("BrDetectorParamsTof",GetName()); if (!strcmp(GetName(),"TFP1")) SetName("TOFW"); Char_t HistName[32]; sprintf(HistName,"hT1vsT2%s",GetName()); hT1vsT2 = new TH2F(HistName,"Tup vs Tdown",128,1000,2048,128,800,1400); } void BrCalibrateTof::Event(BrEventNode* InputTable, BrEventNode* OutputTable) { // // Event method to be called once per event. // if (DebugLevel() > 0) { cout << " ------------------ " << endl; cout << " CalibrateTof::Event of: " << GetName() << endl; cout << " ------------------ " << endl; InputTable->ListObjects(); } BrDataTable *DigitizedTof; BrDetectorParamsTof *par; BrDetectorVolume *vol; Int_t NumHits; BrTofDig *digtof_p; BrCalTof *caltof_p; // // Get simulation parameters // if(DebugLevel()>0 ) vol->ListParameters(); par = GetDetectorParamsTof(); if(par == NULL) { cout << "Parameters must be set " << endl; return ; } if( DebugLevel() > 2) { cout << " Getting Parameters" << endl; par->ListParameters(); cout << "here" << endl; } // // Decode the input table // The tof hits come from a table with e.g. the name "GeantHits H1" // Char_t TableName[32]; sprintf(TableName,"%s %s", BRTABLENAMES kDigTof, GetName()); DigitizedTof = (BrDataTable*)InputTable->GetObject(TableName); if(DigitizedTof == 0 ) { if(DebugLevel() > 0) cout << "No hits for " << GetName() << endl; return; } // // ObjectList returns TObjectArray // Prepare the output table // sprintf(TableName,"%s %s",BRTABLENAMES kCalibratedTof,GetName()); // BrDataTable *CalibratedTof = new BrDataTable(TableName); OutputTable->AddObject(CalibratedTof); // int noslats = fParamsTof_p->GetNoSlats(); NumHits = DigitizedTof->GetEntries(); Float_t slope,offset,propogation_time,transversal_time; Float_t tof,ypos; Int_t is,tdcTop,tdcBot; // also look at the adc signals, and their gain, offset: Int_t adcTop,adcBot,adcGain,adcOff; Int_t adcSum,adcAvg; slope = fParamsTof_p->GetTdcConv(); offset = fParamsTof_p->GetTdcOffset(); propogation_time = fParamsTof_p->GetSignalSpeed(); transversal_time = fParamsTof_p->GetScintLength() * propogation_time; for(is=0;is<NumHits;is++) { digtof_p = (BrTofDig*)DigitizedTof->At(is); tdcBot = digtof_p->GetTdcDown(); tdcTop = digtof_p->GetTdcUp(); adcTop = digtof_p->GetAdcUp(); adcBot = digtof_p->GetAdcDown(); adcGain = (Int_t)(fParamsTof_p->GetADCGainUp()); adcOff = (Int_t)(fParamsTof_p->GetADCGainDown()); hT1vsT2->Fill((Float_t)tdcTop,(Float_t)tdcBot); // Do simple way assuming there was only one hit on the slat. Trying to do // simple stuff here. kh 1/21/99 tof = (tdcBot + tdcTop - (Float_t)2.*offset) * slope/ (Float_t)2. - transversal_time; ypos = (tdcBot - tdcTop) * slope / ((Float_t)2. * propogation_time); // For first shot, just check that each ADC is above some // threshold, which I will set to zero at first, and then take // the average and write that to caltof_p. Note that this is // done in ADC channels, not MIPS! IGB 18FEB99 adcSum = adcTop + adcBot; // to get calibrated data, the above should be divided by gains. adcAvg = adcSum / 2 ; caltof_p = new BrCalTof(); CalibratedTof->Add(caltof_p); caltof_p->SetTof(tof); caltof_p->SetPosition(ypos); caltof_p->SetSlatno(digtof_p->GetSlatno()); caltof_p->SetSlEnergy(adcAvg); if (DebugLevel() > 0) { cout << "this is the slat,tof and position from BrCalibrateTof " << caltof_p->GetTitle() << ": " << endl; cout << caltof_p->GetSlatno() << ", " << caltof_p->GetTof() << ", " << caltof_p->GetPosition() << ", " << caltof_p->GetSlEnergy() << endl; } } } void BrCalibrateTof::ListDetectorParameters() const { // List the current value of the digitization parameters on // standard out. if( fParamsTof_p != NULL){ cout << "The name is " << GetName() <<"n"; fParamsTof_p->ListParameters(); } else cout << "No parameters set for this Digitisation module" << endl; } void BrCalibrateTof::Print(Option_t* option) const { // Standard information printout. // // Options: See BrModule::Print // TString opt(option); opt.ToLower(); BrModule::Print(option); if (opt.Contains("d")) cout << endl << " Quick and dirty module written by" << endl << " Original author: Kris Hagel" << endl << " Revisted by: $Author: cholm $" << endl << " Revision date: $Date: 2002/01/03 19:52:23 $" << endl << " Revision number: $Revision: 1.3 $ " << endl << endl << "*************************************************" << endl; } ///////////////////////////////////////////////////////////////////////////////////// // // $Log: BrCalibrateTof.cxx,v $ // Revision 1.3 2002/01/03 19:52:23 cholm // Prepared to use BrTableNames class (or perhaps BrDetectorList) for table names // // Revision 1.2 2001/06/22 17:41:32 cholm // Change names so that every data class has the same format, so that // we will not have to worry about that later on. The affected classes // are: // // BrDigBB -> BrBbDig // BrRdoBB -> BrBbRdo // BrDigZDC -> BrZdcDig // BrRdoZDC -> BrZdcRdo // BrDigRHIC -> BrRichDig // BrDigDC -> BrDcDig // BrDigC1 -> BrDcC1 // BrDigHit -> BrHitDig // BrDigTof -> BrTofDig // BrTPCSequence -> BrTpcSequence // BrTPCCluster -> BrTpcCluster // BrTPCClusterTable -> BrTpcClusterTable // // These changes has ofcourse been propegated to the modules as well, // giving the changes // // BrRdoModuleBB -> BrBbRdoModule // BrRdoModuleZDC -> BrZdcRdoModule // BrTPCClusterFinder -> BrTpcClusterFinder // BrTPCSequenceAdder -> BrTpcSequenceAdder // // Revision 1.1.1.1 2001/06/21 14:55:09 hagel // Initial revision of brat2 // // Revision 1.9 2001/03/07 12:25:26 cholm // * Made the method BrModule::Info() const obsolete in favour of // BrModule::Print(Option_t* option="B") const. Update in other classes. // // Revision 1.8 2000/11/22 21:17:50 videbaek // Moved parameter and geometry setup to Init() and/or removed Init() from constructor. // // Revision 1.7 2000/09/13 16:41:27 ouerdane // Removed TFPx panel tables. TOFW in simulation is now treated like raw data without any explicit splitting // // Revision 1.6 2000/09/04 15:03:20 videbaek // Remove include reference to <unistd.h> that does not exist for WIN32 // and is not needed. // // Revision 1.5 2000/05/17 10:28:47 ouerdane // see top of file // // Revision 1.5 2000/05/03 18:22:22 ouerdane // Minor changes // // Revision 1.4 2000/03/14 18:22:22 cholm // Use of BrTableNames.h in BrCalibrateTof::Event class // // Revision 1.3 1999/02/26 21:14:39 hagel // Minor changes to make compatible with BrFSTrackingModule // // Revision 1.2 1999/02/19 21:32:40 bearden // Added ADCs to Tof calibration, now returns ADC sum (top+bottom) in channels // Changed the way the hodoscope hit position is compared to the track position. This is now done in the "local coordinates" of the hodo. // // Revision 1.1 1999/02/04 22:04:35 hagel // Initial revision // // // $Id: BrCalibrateTof.cxx,v 1.3 2002/01/03 19:52:23 cholm Exp $ // // File BrCalibrateTof.cxx // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|