|
// // $Id: BrTpcSequence.cxx,v 1.2 2001/07/06 10:12:07 pchristi Exp $ // $Author: pchristi $ // $Date: 2001/07/06 10:12:07 $ // //________________________________________________________________________ // // The BrTpcSequence class is an internal description of time sequences from // a given pad and row from the TPC. The raw data format should map quite well // onto this internal format. Much better than the previously used BrDigTPC // objects. // // At least for a time the BrDigitizeTPC module can optionally create both // kind of objects. // #ifndef BRAT_BrTpcSequence #include "BrTpcSequence.h" #endif #ifndef ROOT_TString #include "TString.h" #endif #ifndef WIN32 #include <iostream> #include <iomanip> #else #include <iostream.h> #include <iomanip.h> #endif //________________________________________________________________________ ClassImp(BrTpcSequence); //________________________________________________________________________ BrTpcSequence::BrTpcSequence(){ // Default constructor, normally used only by ROOT // Brat code will always use the BrTpcSequence(int) constructor. // fAdc = 0; fClustNum=-1; } //________________________________________________________________________ BrTpcSequence::BrTpcSequence(Int_t nseq){ // Constructor. Create object and allocate space for nseq data // values. // if(nseq > 0){ fNseq = nseq; fAdc = new Short_t [nseq]; } else { fNseq =0; fAdc = 0; Warning("BrTpcSequence","Illegal value of Nseq %d ",nseq); } fClustNum=-1; } //____________________________________________________________________ BrTpcSequence::BrTpcSequence( const BrTpcSequence &seq){ // copy constructor fRow = seq.fRow; fPad = seq.fPad; fTime = seq.fTime; fClustNum = seq.fClustNum; fNseq = seq.fNseq; if(fNseq>0){ fAdc = new Short_t [fNseq]; for(int i=0;i<fNseq;i++) fAdc[i]=seq.fAdc[i]; } else fAdc=0; } //____________________________________________________________________ Bool_t BrTpcSequence::IsEqual( TObject *obj ) { BrTpcSequence *objClust = (BrTpcSequence*)obj; if( !objClust ) return kFALSE; if(fRow == objClust->GetRow() && fPad == objClust->GetPad() && fTime == objClust->GetTime() && // fClustNum == objClust->GetClustNum() && fNseq == objClust->GetNseq() && fNseq > 0 ) { // could also be an ADC check, but I think this is enough for now return kTRUE; } else return kFALSE; } //____________________________________________________________________ Bool_t BrTpcSequence::IsEqual( const TObject *obj ) const { // // For root v3 an and higher // BrTpcSequence *objClust = (BrTpcSequence*)obj; if( !objClust ) return kFALSE; if(fRow == objClust->GetRow() && fPad == objClust->GetPad() && fTime == objClust->GetTime() && // fClustNum == objClust->GetClustNum() && fNseq == objClust->GetNseq() && fNseq > 0 ) { // could also be an ADC check, but I think this is enough for now return kTRUE; } else return kFALSE; } //________________________________________________________________________ BrTpcSequence::~BrTpcSequence(){ if(fAdc) delete [] fAdc; } //________________________________________________________________________ Short_t BrTpcSequence::GetAdc(Int_t i) const { // Return the i'th adc value counting 0,1,... // Returns 0 if out of range as well as Warning. if(i<0 || i >=fNseq){ Warning("GetAdc","Index out of Range %d",i); return 0; } else return fAdc[i]; } //________________________________________________________________________ void BrTpcSequence::SetAdc(int i, Short_t value){ // Return the i'th adc value counting 0,1,... // Returns 0 if out of range as well as Warning. if(i<0 || i >=fNseq){ Warning("SetAdc","Index out of Range %d",i); } else fAdc[i]=value; } //______________________________________________ Int_t BrTpcSequence::Compare(const TObject *seq_o) const { // This routine overloads TObject::Compare(TObject *object) // For BRAHMS, this routine is typically called by QSort // It needs to return 1 if you want seq to be earlier // in the list and -1 if you want seq to be later in // the list. // Used as prequisite for the BrTPCClusterFinder method. // Order by Row and Pad. No ordering by start time. // // BrTpcSequence * seq = (BrTpcSequence*) seq_o; if( fRow < seq->fRow ) return -1; if( fRow > seq->fRow ) return 1; if( fPad < seq->fPad ) return -1; if( fPad > seq->fPad ) return 1; return 0; } //______________________________________________ Int_t BrTpcSequence::Compare( TObject *seq_o) { // This routine overloads TObject::Compare(TObject *object) // For BRAHMS, this routine is typically called by QSort // It needs to return 1 if you want seq to be earlier // in the list and -1 if you want seq to be later in // the list. // Used as prequisite for the BrTPCClusterFinder method. // Order by Row and Pad. No ordering by start time. // // BrTpcSequence * seq = (BrTpcSequence*) seq_o; if( fRow < seq->fRow ) return -1; if( fRow > seq->fRow ) return 1; if( fPad < seq->fPad ) return -1; if( fPad > seq->fPad ) return 1; return 0; } //____________________________________________________________________ void BrTpcSequence::Print(Option_t* option) const { // Print module information // See BrModule::Print for options. // In addition this module defines the Option: // d - print original author and who, when modified last TString opt(option); opt.ToLower(); TObject::Print(option); if (opt.Contains("d")) cout << endl << " Original author: Flemming Videbęk" << endl << " Last Modifications: " << endl << " $Author: pchristi $" << endl << " $Date: 2001/07/06 10:12:07 $" << endl << " $Revision: 1.2 $ " << endl << endl << "-------------------------------------------------" << endl; cout << "Row : " << setw(3) << fRow << "Pad : " << setw(3) << fPad << endl << "Time :"; for(Int_t i = 0; i < fNseq; i++) cout << setw(4) << fTime+i; cout << endl << "Adc : "; for(Int_t i = 0; i < fNseq; i++) cout << setw(4) << GetAdc(i); cout << endl << endl; } ///////////////////////////////////////////////////////////////////////////// // // $Log: BrTpcSequence.cxx,v $ // Revision 1.2 2001/07/06 10:12:07 pchristi // Added Print method and made GetAdc(index) const // // Revision 1.1 2001/06/22 17:33:19 cholm // Change names so that every data class has the same format so that // we have that down from the very beginning, so that we will not have to // worry about that later on. The // affected classes are: // // BrDigBB -> BrBbDig // BrDigZDC -> BrZdcDig // BrDigRHIC -> BrRichDig // BrDigDC -> BrDcDig // BrDigC1 -> BrDcC1 // BrDigHit -> BrHitDig // BrDigTof -> BrTofDig // BrTPCSequence -> BrTpcSequence // // Revision 1.2 2001/06/22 11:08:42 cholm // Removed Custom streamer in favour of schema evolution. // // Revision 1.1.1.1 2001/06/21 14:55:01 hagel // Initial revision of brat2 // // Revision 1.8 2001/06/17 17:20:37 pchristi // Added print method, comments, and changed fBuild to non-persistent in cluster. // GetAdc() in sequence now returns Short_t. // // Revision 1.7 2001/04/14 22:14:31 videbaek // added const Compare method // // Revision 1.6 2000/10/02 17:08:03 pchristi // Cleaned up headers and source files in the tpc dir // // Revision 1.5 2000/10/02 12:35:21 pchristi // Update of the clustering algorithm and related classes. // // Revision 1.4 2000/08/28 18:05:55 videbaek // Move CVS log to end of file // // Revision 1.3 2000/03/08 20:18:02 videbaek // Change clustering algorithms by adding a new method. BrTPCCluster is redefined. // Tracking reorganized with updates by Alv, Peter and Flemming // // Revision 1.2 1999/02/25 14:53:17 videbaek // Inserted code for using BrTPCSequnece instead of BrDigTPC for both // TPC digitization and the TPC local track reconstruction. // // Revision 1.1 1999/01/28 21:28:15 videbaek // Added BrTPSSqquences to libraries. Not yet in use, though. Expected to // replace BrDigTPC objects // Added cvs flags // Changed name of BrDigTPC data tables. // // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|