Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:15:11

0001 #include "FindBlobs.h"
0002 #include "groot.h"
0003 #include "ABlob.h"
0004 #include "AZigzag.h"
0005 
0006 #include "Quiver.h"
0007 
0008 #include "Riostream.h"
0009 #include <iostream>
0010 
0011 void FindBlobs()
0012 {
0013   groot* Tree = groot::instance();
0014   
0015   /* clear blobs */
0016   for(int i=0; i<Nr; i++)
0017     {
0018       Tree->theBlobs[i].clear();
0019     }
0020  
0021   vector<AZigzag*> ziggy;  
0022 
0023   //cout << "R"; 

0024   //cout << "\tPhi"; 

0025   //cout << "\tStart Q";

0026   //cout << "\tRight Q";

0027   //cout << "\tLeft Q";

0028   //cout << "\tX-cen";

0029   //cout << "\tY-cen";

0030   //cout << "\tZ-cen";

0031   //cout << "\tR-cen";

0032   //cout << "\tPhi-cen" << endl;

0033  
0034   for(int i=0; i<Nr; i++)
0035     {
0036       for(int j=1; j<Nphi-1; j++)
0037     {
0038       AZigzag* start = Tree->ZigzagMap2[i][j];
0039       AZigzag* right = Tree->ZigzagMap2[i][j-1];
0040       AZigzag* left  = Tree->ZigzagMap2[i][j+1];
0041       
0042       if( start && left && right ) //checks if Pads exist, only

0043         {
0044           if( start->IsHit() && start->T()>1.0 && start->T()<15.0 ) // Fits unstable if near edge

0045         {
0046           if( (start->Q() >  right->Q()) && 
0047               (start->Q() >= left->Q()) ) //finds center Zig

0048             {
0049               double TMAX = start->T();
0050               int PADDING = -1;
0051               int k=j;
0052               while (PADDING < Quiver::PaddingLimit && k>=0) //adds all hit Pads to the RIGHT, and PadLimit right-most empty Pads

0053             {
0054               if( Tree->ZigzagMap2[i][k] )
0055                 {
0056                   bool TIME_OK = true;
0057                   if (Quiver::BlobTimeCut)
0058                 {
0059                   double TIME = Tree->ZigzagMap2[i][k]->T();
0060                   double MINT = -1.1;
0061                   double MAXT =  0.3;
0062                   if ( (TIME-TMAX) < MINT) TIME_OK = false;
0063                   if ( (TIME-TMAX) > MAXT) TIME_OK = false;
0064                 }
0065                   if( Tree->ZigzagMap2[i][k]->IsHit() && TIME_OK)
0066                 {
0067                   ziggy.push_back( Tree->ZigzagMap2[i][k] );
0068                 }
0069                   else
0070                 {
0071                   PADDING++;
0072                   if ( PADDING < Quiver::PaddingLimit  && TIME_OK ) ziggy.push_back( Tree->ZigzagMap2[i][k] );
0073                 }
0074                 }
0075               k--;
0076             }
0077 
0078               PADDING = -1;
0079               k = j+1;
0080               while (PADDING < Quiver::PaddingLimit && k<Nphi) //adds all hit Pads to the LEFT, and right-most empty Pad

0081             {
0082               if( Tree->ZigzagMap2[i][k] )
0083                 {
0084                   bool TIME_OK = true;
0085                   if (Quiver::BlobTimeCut)
0086                 {
0087                   double TIME = Tree->ZigzagMap2[i][k]->T();
0088                   double MINT = -1.1;
0089                   double MAXT =  0.3;
0090                   if ( (TIME-TMAX) < MINT) TIME_OK = false;
0091                   if ( (TIME-TMAX) > MAXT) TIME_OK = false;
0092                 }
0093                   if( Tree->ZigzagMap2[i][k]->IsHit() && TIME_OK)
0094                 {
0095                   ziggy.push_back( Tree->ZigzagMap2[i][k] );
0096                 }
0097                   else
0098                 {
0099                   PADDING++;
0100                   if ( PADDING < Quiver::PaddingLimit  && TIME_OK ) ziggy.push_back( Tree->ZigzagMap2[i][k] );
0101                 }
0102                   
0103                 }
0104               k++;
0105             }
0106               //cout << ziggy.size() << endl;;

0107               if (ziggy.size()>0) Tree->theBlobs[i].push_back( new ABlob( ziggy ) );
0108               ziggy.clear();
0109               //cout << "got one" << endl;

0110             }
0111           
0112 
0113           //cout << "~~FIND-BLOBS REPORT~~" << endl;

0114           //cout << i; 

0115           //cout << "\t" << j; 

0116           //cout << "\t" << start->Q();

0117           //cout << "\t" << right->Q();

0118           //cout << "\t" << left->Q();

0119           //cout << "\t" << start->XCenter();

0120           //cout << "\t" << start->YCenter();

0121           //cout << "\t" << start->ZCenter();

0122           //cout << "\t" << start->RCenter();

0123           //cout << "\t" << start->PCenter();

0124           //cout << endl;

0125 
0126           //cout << Tree->theBlobs[i].size() << endl;

0127         }
0128         }
0129     }
0130     }
0131   //cout << "Blobs Done." << endl;

0132 }