#include "PndTrkSttClusterFinder.h" #include "PndSttTube.h" #include "PndTrkVectors.h" #include "TClonesArray.h" #include "TVector3.h" #include #include #include using namespace std; /** Default constructor **/ PndTrkSttClusterFinder::PndTrkSttClusterFinder(){}; /** Destructor **/ PndTrkSttClusterFinder::~PndTrkSttClusterFinder(){}; //----------begin of function PndTrkSttClusterFinder::FindTrackPattern Short_t PndTrkSttClusterFinder::FindTrackPattern( bool * InclusionListStt, // input; in this list the Stt multiple hits are NOT included; Short_t *ListHitsinCluster, // output Short_t (*ListParContiguous)[6],// input, this is the list of contiguous TubeID ; Short_t MAXHITSINCLUSTER, // input; Short_t * nParContiguous, // input; number of contiguous Stt axial straws to a given Stt axial straw; Short_t number_straws, // input Short_t SeedHit, // input Short_t *SttStrawOn, // input; SttStrawOn[i] >= 0 --> it is the Stt hit // number corresponding to Stt i-th Tube ID; // SttStrawOn[i] == -1 --> i-th Stt straw NOT hit; Short_t *TubeID // input ) { Short_t ContiguousTube, CurrentTube, i; /* Short_t tCurrentListofTubes[ MAXHITSINCLUSTER ]; // current list of tubes forming the cluster; Vec CurrentListofTubes(tCurrentListofTubes,MAXHITSINCLUSTER , "CurrentListofTubes"); */ Short_t CurrentListofTubes[ MAXHITSINCLUSTER ]; // current list of tubes forming the cluster; // the following is a necessary initialization every time a new cluster is searched starting from a given seed hit; /* bool tAlreadyConsidered[ number_straws ] ; // for each Stt Straw; memset ( tAlreadyConsidered,false, sizeof( tAlreadyConsidered )); Vec AlreadyConsidered(tAlreadyConsidered,number_straws,"AlreadyConsidered"); */ bool AlreadyConsidered[ number_straws ] ; // for each Stt Straw; memset ( AlreadyConsidered,false, sizeof( AlreadyConsidered )); // algorithm of clusterization by proximity only; Short_t nHitsinCluster = 1; Short_t nHitsAnalyzed = 0; ListHitsinCluster[0] = SeedHit; CurrentListofTubes[0] = TubeID[ SeedHit ]; // the following variable is to make sure that the number of hits in the cluster // will be <= MAXHITSINCLUSTER; bool go = true; // nParContiguous[i] is the number of contiguous straws to the i-th straw (therefore the dimension // is nParContiguous[4542] since nParContiguous[4542-1] = contiguous of straw n. 4542; // ListParContiguous is the List in TubeID contiguous to a given Tube number; // it MUST be used as follows : ListParContiguous[ j-1 ][i] = the TubeID of the (i+1)th contiguous straw // to the j-th straw (tube number); therefore the dimension is ListParContiguous[4542][6]; while(nHitsAnalyzed < nHitsinCluster && go){ // main loop; CurrentTube = CurrentListofTubes[nHitsAnalyzed]; AlreadyConsidered[ CurrentTube-1 ] = true; nHitsAnalyzed++; for(i=0;i< nParContiguous[ CurrentTube-1 ] ; i++ ) { // SttStrawOn is -1 if the Tube was not hit, it is the Stt Hit number in opposite case; ContiguousTube = ListParContiguous[ CurrentTube-1 ][i]; if( AlreadyConsidered[ ContiguousTube-1 ])continue; if ( SttStrawOn[ ContiguousTube-1 ] > -1 ){ if(! InclusionListStt[ SttStrawOn[ ContiguousTube-1] ] ) continue; // CurrentListofHits is the List of Stt HIT numbers belonging to the present cluster; ListHitsinCluster[nHitsinCluster] = SttStrawOn[ ContiguousTube -1 ] ; CurrentListofTubes[nHitsinCluster] = ContiguousTube ; AlreadyConsidered[ ContiguousTube-1 ] = true; nHitsinCluster ++ ; if( nHitsinCluster == MAXHITSINCLUSTER){ go = false; break; } // end of if( nHitsinCluster } } // end of for(i=0;i< InOut->n ... } // end of while(nRemaining > 0) return nHitsinCluster; } //----------end of function PndTrkSttClusterFinder::FindTrackPattern //----------begin function PndTrkSttClusterFinder::GetClusters void PndTrkSttClusterFinder::GetClusters( bool* InclusionListStt, // input; this is the exclusion of Stt hits for Stt multiple hits; Short_t ListParContiguous[][6], // input list (axial Stt); first dimension is NUMBER_STRAWS; Short_t * ListSttParHits, // input Short_t *nParContiguous, // input; number of contiguous straws (axial Stt); // NUMBER_STRAWS even if the numbering scheme for the Stt straws goes // from 1 to NUMBER_STRAWS included; Short_t nSttParHit, // input; const Short_t MAXFOUNDCLUSTERS, // input; const Short_t MAXHITSINCLUSTER, // input; const Short_t MAXSTTHITS, // input; number of maximux allowed total Stt hits; const Short_t NUMBER_STRAWS, // input; number of Stt Straws in total; Short_t * StrawCode, // input; Short_t * StrawCode2, // input; Short_t *SttStrawOn, // input; TClonesArray *, // input; array of the Stt tubes; // SttTubeArray //[R.K.03/2017] unused variable(s) Short_t * TubeID, // input; Short_t * ListHitsinCluster, // output; Short_t & nFoundClusters, // output; Short_t * nHitsinCluster // output; ) { /* bool tinclusion_list_stt[MAXSTTHITS]; Vec inclusion_list_stt(tinclusion_list_stt,MAXSTTHITS,"inclusion_list_stt"); */ bool inclusion_list_stt[MAXSTTHITS]; Short_t i, iParHit, icode, icode2; for(i=0; i= 0 --> it is the Stt hit // number corresponding to Stt i-th Tube ID; // SttStrawOn[i] == -1 --> i-th Stt straw NOT hit; TubeID // input ); // the found hits cannot partecipate to the formation of any other connected cluster, so exclude them; for(i=0; i< nHitsinCluster[nFoundClusters]; i++) { inclusion_list_stt[ ListHitsinCluster[nFoundClusters*MAXHITSINCLUSTER + i] ]= false; } nFoundClusters++; if( nFoundClusters == MAXFOUNDCLUSTERS) break; } // end of for(iParHit=0; iParHit