10 #ifndef ADD_BXAnalyzer
11 #define ADD_BXAnalyzer
17 std::vector<std::vector<ConvertedHit>>
GroupBX(std::vector<ConvertedHit> ConvHits){
19 std::vector<ConvertedHit>
tmp;
20 std::vector<std::vector<ConvertedHit>>
output (3,tmp);
22 const int CentralBX = 6;
24 for(std::vector<ConvertedHit>::iterator
i = ConvHits.begin();
i != ConvHits.end();
i++){
26 int diff =
i->BX() - CentralBX;
28 if((diff > -3) && (diff < 1))
29 output[0].push_back(*
i);
31 if((diff < 3) && (diff > -1))
32 output[2].push_back(*
i);
35 output[1].push_back(*
i);
38 for (
int i = 1;
i < 3;
i++) {
39 unsigned int HasAllInNext = 0;
40 for (
unsigned int it = 0; it != output[
i-1].size(); it++) {
42 for (
unsigned int it2 = 0; it2 != output[
i].size(); it2++) {
43 if( output[
i-1][it].
Phi() == output[
i][it2].Phi() &&
44 output[
i-1][it].Theta() == output[
i][it2].Theta() &&
45 output[
i-1][it].Ph_hit() == output[
i][it2].Ph_hit() &&
46 output[
i-1][it].Phzvl() == output[
i][it2].Phzvl() &&
47 output[
i-1][it].Station() == output[
i][it2].Station() &&
48 output[
i-1][it].Sub() == output[
i][it2].Sub() &&
49 output[
i-1][it].Id() == output[
i][it2].Id() &&
50 output[
i-1][it].Quality() == output[
i][it2].Quality() &&
51 output[
i-1][it].Pattern() == output[
i][it2].Pattern() &&
52 output[
i-1][it].Wire() == output[
i][it2].Wire() &&
53 output[
i-1][it].Strip() == output[
i][it2].Strip() &&
54 output[
i-1][it].BX() == output[
i][it2].BX() ) InNext =
true;
56 if (InNext) HasAllInNext++;
58 if (HasAllInNext == output[
i-1].
size()) output[
i-1].
clear();
63 for(std::vector<ConvertedHit>::iterator it = output[
i].
begin();it != output[
i].end();it++){
64 for(std::vector<ConvertedHit>::iterator it2 = it;it2 != output[
i].end();it2++){
66 if(it == it2)
continue;
69 if(it->Station() == it2->Station() && it->Id() == it2->Id() && it->IsNeighbor() == it2->IsNeighbor()){
71 it->SetTheta2(it2->Theta());
72 it2->SetTheta2(it->Theta());
74 it->AddTheta(it2->Theta());
75 it2->AddTheta(it->Theta());
88 std::vector<int>
tmp (192,0);
89 std::vector<std::vector<int>> rank (4,tmp), layer(4,tmp),straightness(4,tmp),bxgroup(4,tmp);
90 std::vector<ConvertedHit> Hits;
96 for(
int zone=0;zone<4;zone++){
97 for(
int strip=0;strip<192;strip++){
99 if(Pout[
i].detected.rank[zone][strip] > rank[zone][strip]){
101 rank[zone][strip] = Pout[
i].detected.rank[zone][strip];
102 layer[zone][strip] = Pout[
i].detected.layer[zone][strip];
103 straightness[zone][strip] = Pout[
i].detected.straightness[zone][strip];
104 bxgroup[zone][strip] =
i+1;
112 std::vector<ConvertedHit>
test = Pout[
i].hits;
114 for(std::vector<ConvertedHit>::iterator it = test.begin();it != test.end();it++){
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
std::vector< std::vector< double > > tmp
PatternOutput DeleteDuplicatePatterns(std::vector< PatternOutput > Pout)
std::vector< std::vector< ConvertedHit > > GroupBX(std::vector< ConvertedHit > ConvHits)
std::vector< ConvertedHit > hits
tuple size
Write out results.