BRAT 2.4.5
Class index
Full class index
brahmlib
BRAHMS
ROOT page
// $Id: BrDCViewList.cxx,v 1.7 2002/02/20 13:57:41 ufstasze Exp $
//

#include "BrDCViewList.h"

#include "BrGeometryDbManager.h"
#include "BrParameterDbManager.h"

#include "BrMath.h"
#include "BrDCHit.h"

ClassImp(BrDCViewList);



////////////////////////////////////////////////////////////
//
//
////////////////////////////////////////////////////////////

 BrDCViewList::BrDCViewList()
{
}

 BrDCViewList::~BrDCViewList()
{
}

 BrDCViewList::BrDCViewList(const Char_t *Name,const Char_t *Title,
            const Int_t planeCombineMode, const Int_t mview, const Int_t sview) 
   : TNamed(Name,Title) {

  fPlaneCombineMode = planeCombineMode;
  fMainView         = mview;
  fSubView          = sview;
  fNumMainViews  = 0;
  fNumSubViews   = 0;
  fNumOtherViews = 0;

  Init();
}

 void BrDCViewList::Init() {
  // The init member function/method is used to define histograms
  // The histograms is added to the list of hist objects in this
  // module.
  BrParameterDbManager *gParamDb;
  
  //Create instance of data base manager
  gParamDb = BrParameterDbManager::Instance();
  
  fParams = 
    (BrDetectorParamsDC*)gParamDb->GetDetectorParameters("BrDetectorParamsDC",GetName());
  
}

 void BrDCViewList::Clear() {
//Clear all relevant arrays.
  Int_t i;

  for(i=0;i<fNumMainViews;i++)  fDetectorHitsMainView[i].Clear();
  for(i=0;i<fNumSubViews;i++)   fDetectorHitsSubView[i].Clear();
  for(i=0;i<fNumOtherViews;i++) fDetectorHitsOtherView[i].Clear();

  fNumMainViews  = 0;
  fNumSubViews   = 0;
  fNumOtherViews = 0;
  fNumViews      = 0;
}


 Int_t BrDCViewList::FindHitsInViews(BrClonesArray *detectorHits) {
  //Figure out the views
  Int_t nvv; //,nmv,nsv,nov,nview;
  Int_t idet,numplanes;
  Int_t i,j;
  Int_t Imod;

  BrDCPlane *dcpl;

  Int_t NumHitCMBMod[maxview];
  TObjArray HitCMBMod[maxview];

  Clear();

  for(idet=0;idet<3;idet++) {
     numplanes = fParams->GetNplane();
    
     if(numplanes == 0) {
        cout<<"numplanes = 0!!!, there is some problem with " 
              "parameters; check it out!!!"<<endl;
        return 1; //error return
        }
    
     // role of nview needs to investigated carefully
     if(fPlaneCombineMode == kPairsWhenTogether) {
        for(j=0;j<numplanes;j++) {
           dcpl = fParams->GetPlaneAt(j);
           if( fNumViews == 0 ) { 
              nvv   = 0;
	 //	     BrMath::Int appears to behave as FORTRAN NINT
              fViewList[fNumViews] = BrMath::Int(dcpl->GetWirang());
              fViewListID[idet][fNumViews] = fNumViews;
              Imod = (idet + 1)*100 + fNumViews + 1;
              HitCMBMod[0].Clear();
              GetHitCMBMod(Imod,detectorHits,&HitCMBMod[0]);
              NumHitCMBMod[0] = HitCMBMod[0].GetEntries();
              fNumViews = 1;
              }
           else if((BrMath::Int(dcpl->GetWirang()) != fViewList[fNumViews-1]) || j == 0) {
	 //        Come in here only if this wire has a different angle
	 //        than the one in front of it.  Also come in here if this is
	 //        the first plane  in a sub-module
	           if(j==0) {
	              nvv = 0;
	              }
	           else {
	              nvv++;
	              }
	           fViewList[fNumViews] = BrMath::Int(dcpl->GetWirang());
	           fViewListID[idet][nvv] = fNumViews;
	           if(fNumViews>maxview) 
	            cout<<"nview too large, it is "<<fNumViews<<endl;
	           Imod = (idet + 1)*100 + nvv + 1;
	           HitCMBMod[fNumViews].Clear();
	           GetHitCMBMod(Imod,detectorHits,&HitCMBMod[fNumViews]);
	           NumHitCMBMod[fNumViews] = HitCMBMod[fNumViews].GetEntries();
	           fNumViews++;
              }
           }
        }
     else if(fPlaneCombineMode == kAllSinglePlanes) {
        nvv = 0;
        for(j=0;j<numplanes;j++) {
	        dcpl = fParams->GetPlaneAt(j);
	        Int_t iplane = j;
	        fViewList[fNumViews] = BrMath::Int(dcpl->GetWirang());
	        fViewListID[idet][nvv] = fNumViews;
	        if(fNumViews>maxview) 
	          cout<<"nview too large, it is "<<fNumViews<<endl;
	        Imod = (idet + 1)*100 + iplane + 1;
	        HitCMBMod[fNumViews].Clear();
	        GetHitCMBMod(Imod,detectorHits,&HitCMBMod[fNumViews]);
	        NumHitCMBMod[fNumViews] = HitCMBMod[fNumViews].GetEntries();
	        fNumViews++;
           nvv++;
           }
        }
     }
  
  //Set up list of main and sub views.  Also keep track of how many there are.
  //Also, get the Combined views out of HitCMBMod and group them by view.
  for(i=0;i<fNumViews;i++) {
     if(fViewList[i] == fMainView) {
        fMainViewList[fNumMainViews] = i;
        fDetectorHitsMainView[fNumMainViews].Clear();
        for(j=0;j<HitCMBMod[i].GetEntries();j++) {
           fDetectorHitsMainView[fNumMainViews].Add(HitCMBMod[i].At(j));
           }
        fNumMainViews++;
        }
     else if(fViewList[i] == fSubView) {
        fSubViewList[fNumSubViews] = i;
        fDetectorHitsSubView[fNumSubViews].Clear();
        for(j=0;j<HitCMBMod[i].GetEntries();j++) {
           fDetectorHitsSubView[fNumSubViews].Add(HitCMBMod[i].At(j));
           }
        fNumSubViews++;
        }
     else {
        fOtherViewList[fNumOtherViews] = i;
        fDetectorHitsOtherView[fNumOtherViews].Clear();
        for(j=0;j<HitCMBMod[i].GetEntries();j++) {
           fDetectorHitsOtherView[fNumOtherViews].Add(HitCMBMod[i].At(j));
           }
        fNumOtherViews++;
        }

     //Clear this one because we are finished with it.
     HitCMBMod[i].Clear();
     }
  

  //Setup cutoff parameters based on actual plane configuration
  
  fNCutoff = fNumMainViews + fNumSubViews + fNumOtherViews;
  fNCutoff -= 10; 
  //fNCutoff -= 9; // Pawel: for April DC test this value looks to be much better

  return 0;
}

//_____________________________________________________________________________
 void BrDCViewList::GetHitCMBMod
// Fill selector i.e. TObjArray with the hits 

Int_t i;
Int_t numDetectorHits;
BrDCHit *hit_p;

numDetectorHits = detectorHits->GetEntries();
for(i=0;i<numDetectorHits;i++) {
   hit_p = (BrDCHit*)detectorHits->At(i);
   if(( hit_p->GetImod()  == imod  ) || ( imod  == IANY ) ) {
      selectedHits->Add(hit_p);
	  }
   }

#ifdef SORT_HITCMB
selectedHits->Sort();
#endif
}

 Int_t BrDCViewList::GetNumPlaneViews(const Int_t iv) {
//Return the number of main views or sub views depending on iv
//iv = 0 return number of main views
//iv = 1 return number of sub views
if(iv == 0) return fNumMainViews;
if(iv == 1) return fNumSubViews;
if(iv == 2) return fNumOtherViews;
cout<<"BrDCViewList::GetNumViews Warning!!! returning wrong number of views"<<endl;
return 0;
}

 Float_t BrDCViewList::GetViewPlaneAngle(const Int_t iv,const Int_t iview) {
//Return angle of main views or sub views depending on iv
//iv = 0 return angle of view iview of main view
//iv = 1 return angle of view iview of sub view
//iv = 2 return angle of view iview of other views
Int_t i1;
if(iv == 0) {
   if(iview < 1 || iview > fNumMainViews) cout<<"1 Index iview out of bounds"<<endl;
   i1 = fMainViewList[iview-1];
   }
if(iv == 1) {
   if(iview < 1 || iview > fNumSubViews) cout<<"2 Index iview out of bounds"<<endl;
   i1 = fSubViewList[iview-1];
   }
if(iv == 2) {
   if(iview < 1 || iview > fNumOtherViews) cout<<"3 Index iview out of bounds"<<endl;
   i1 = fOtherViewList[iview-1];
   }
return (Float_t)fViewList[i1];
}

 TObjArray *BrDCViewList::GetDetectorHits(const Int_t iv,const Int_t iview) {
//Return detector hit list of main views or sub views depending on iv
//iv = 0 return combined hits of view iview of main view
//iv = 1 return combined hits of view iview of sub view
//iv = 2 return combined hits of view iview of other views
if(iv == 0) {
   if(iview < 1 || iview > fNumMainViews) cout<<"1 Index iview out of bounds"<<endl;
   return &fDetectorHitsMainView[iview-1];
   }
if(iv == 1) {
   if(iview < 1 || iview > fNumSubViews) cout<<"2 Index iview out of bounds"<<endl;
   return &fDetectorHitsSubView[iview-1];
   }
if(iv == 2) {
   if(iview < 1 || iview > fNumOtherViews) cout<<"3 Index iview out of bounds"<<endl;
   return &fDetectorHitsOtherView[iview-1];
   }

cout<<"BrDCViewList::GetCombinedHits Warning!!! returning wrong number of views"<<endl;
return 0;
}

// $Log: BrDCViewList.cxx,v $
// Revision 1.7  2002/02/20 13:57:41  ufstasze
// fCutoff parameter decreased by 1.
//
// Revision 1.6  2002/02/06 18:46:42  ufstasze
// fNCutoff set to fTotPlanes-9
//
// Revision 1.5  2001/11/26 14:38:45  ufstasze
// Changed value of fNCutoff parameter (by -2) to reduce number
// of ghosts.
//
// Revision 1.4  2001/10/25 21:23:50  videbaek
// Make volume listing dependent of DebugLevel.
// Initialize the fNumView private memberrs in constructor.
// The Clear() method could randomly fail.
//
// Revision 1.3  2001/10/12 08:32:12  staszel
// fNcutoff change from NumPlane-5 to NumPlanes-6.
//
// Revision 1.2  2001/08/10 16:27:49  staszel
// minor changes
//
// Revision 1.1.1.1  2001/06/21 14:55:12  hagel
// Initial revision of brat2
//
// Revision 1.6  2001/06/20 12:12:57  staszel
// BrDetectorHit replaced by BrDCHit.
//
// Revision 1.5  2001/06/13 13:21:49  staszel
// father development of dc tracking
//
// Revision 1.4  2001/01/19 17:47:53  staszel
// Changes having to do with development of BrDCTrackingModule
//
// Revision 1.3  2000/10/05 02:21:31  hagel
// Further development of BrDCTrackingModule
//
// Revision 1.2  2000/09/29 02:15:59  hagel
// Changes having to do with development of BrDCTrackingModule
//
// Revision 1.1  2000/09/19 21:10:55  hagel
// Initial placeholder revision
//

This page automatically generated by script docBrat by Christian Holm

Copyright ; 2002 BRAHMS Collaboration <brahmlib@rcf.rhic.bnl.gov>
Last Update on by

Validate HTML
Validate CSS