Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FindBlobs.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FindBlobs.C
1 #include "FindBlobs.h"
2 #include "groot.h"
3 #include "ABlob.h"
4 #include "AZigzag.h"
5 
6 #include "Quiver.h"
7 
8 #include "Riostream.h"
9 #include <iostream>
10 
11 void FindBlobs()
12 {
13  groot* Tree = groot::instance();
14 
15  /* clear blobs */
16  for(int i=0; i<Nr; i++)
17  {
18  Tree->theBlobs[i].clear();
19  }
20 
21  vector<AZigzag*> ziggy;
22 
23  //cout << "R";
24  //cout << "\tPhi";
25  //cout << "\tStart Q";
26  //cout << "\tRight Q";
27  //cout << "\tLeft Q";
28  //cout << "\tX-cen";
29  //cout << "\tY-cen";
30  //cout << "\tZ-cen";
31  //cout << "\tR-cen";
32  //cout << "\tPhi-cen" << endl;
33 
34  for(int i=0; i<Nr; i++)
35  {
36  for(int j=1; j<Nphi-1; j++)
37  {
38  AZigzag* start = Tree->ZigzagMap2[i][j];
39  AZigzag* right = Tree->ZigzagMap2[i][j-1];
40  AZigzag* left = Tree->ZigzagMap2[i][j+1];
41 
42  if( start && left && right ) //checks if Pads exist, only
43  {
44  if( start->IsHit() && start->T()>1.0 && start->T()<15.0 ) // Fits unstable if near edge
45  {
46  if( (start->Q() > right->Q()) &&
47  (start->Q() >= left->Q()) ) //finds center Zig
48  {
49  double TMAX = start->T();
50  int PADDING = -1;
51  int k=j;
52  while (PADDING < Quiver::PaddingLimit && k>=0) //adds all hit Pads to the RIGHT, and PadLimit right-most empty Pads
53  {
54  if( Tree->ZigzagMap2[i][k] )
55  {
56  bool TIME_OK = true;
58  {
59  double TIME = Tree->ZigzagMap2[i][k]->T();
60  double MINT = -1.1;
61  double MAXT = 0.3;
62  if ( (TIME-TMAX) < MINT) TIME_OK = false;
63  if ( (TIME-TMAX) > MAXT) TIME_OK = false;
64  }
65  if( Tree->ZigzagMap2[i][k]->IsHit() && TIME_OK)
66  {
67  ziggy.push_back( Tree->ZigzagMap2[i][k] );
68  }
69  else
70  {
71  PADDING++;
72  if ( PADDING < Quiver::PaddingLimit && TIME_OK ) ziggy.push_back( Tree->ZigzagMap2[i][k] );
73  }
74  }
75  k--;
76  }
77 
78  PADDING = -1;
79  k = j+1;
80  while (PADDING < Quiver::PaddingLimit && k<Nphi) //adds all hit Pads to the LEFT, and right-most empty Pad
81  {
82  if( Tree->ZigzagMap2[i][k] )
83  {
84  bool TIME_OK = true;
86  {
87  double TIME = Tree->ZigzagMap2[i][k]->T();
88  double MINT = -1.1;
89  double MAXT = 0.3;
90  if ( (TIME-TMAX) < MINT) TIME_OK = false;
91  if ( (TIME-TMAX) > MAXT) TIME_OK = false;
92  }
93  if( Tree->ZigzagMap2[i][k]->IsHit() && TIME_OK)
94  {
95  ziggy.push_back( Tree->ZigzagMap2[i][k] );
96  }
97  else
98  {
99  PADDING++;
100  if ( PADDING < Quiver::PaddingLimit && TIME_OK ) ziggy.push_back( Tree->ZigzagMap2[i][k] );
101  }
102 
103  }
104  k++;
105  }
106  //cout << ziggy.size() << endl;;
107  if (ziggy.size()>0) Tree->theBlobs[i].push_back( new ABlob( ziggy ) );
108  ziggy.clear();
109  //cout << "got one" << endl;
110  }
111 
112 
113  //cout << "~~FIND-BLOBS REPORT~~" << endl;
114  //cout << i;
115  //cout << "\t" << j;
116  //cout << "\t" << start->Q();
117  //cout << "\t" << right->Q();
118  //cout << "\t" << left->Q();
119  //cout << "\t" << start->XCenter();
120  //cout << "\t" << start->YCenter();
121  //cout << "\t" << start->ZCenter();
122  //cout << "\t" << start->RCenter();
123  //cout << "\t" << start->PCenter();
124  //cout << endl;
125 
126  //cout << Tree->theBlobs[i].size() << endl;
127  }
128  }
129  }
130  }
131  //cout << "Blobs Done." << endl;
132 }