Skip to content
Snippets Groups Projects
Commit 951d1ee0 authored by Stephen A. Wood's avatar Stephen A. Wood
Browse files

Make ascii art showing hit patterns in Shower Array

  Enable by defining HITPIC in THcShowerArray.h
parent f8f421ce
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
using namespace std; using namespace std;
ClassImp(THcShowerArray) ClassImp(THcShowerArray)
...@@ -104,6 +105,14 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date ) ...@@ -104,6 +105,14 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date )
fA = new Double_t[fNelem]; fA = new Double_t[fNelem];
fP = new Double_t[fNelem]; fP = new Double_t[fNelem];
#ifdef HITPIC
hitpic = new char*[fNRows];
for(Int_t row=0;row<fNRows;row++) {
hitpic[row] = new char[NPERLINE*(fNColumns+1)+2];
}
piccolumn=0;
#endif
return kOK; return kOK;
} }
...@@ -183,6 +192,8 @@ Int_t THcShowerArray::ProcessHits(TClonesArray* rawhits, Int_t nexthit) ...@@ -183,6 +192,8 @@ Int_t THcShowerArray::ProcessHits(TClonesArray* rawhits, Int_t nexthit)
Int_t ihit = nexthit; Int_t ihit = nexthit;
Int_t ngood = 0;
Int_t threshold = 100;
while(ihit < nrawhits) { while(ihit < nrawhits) {
THcRawShowerHit* hit = (THcRawShowerHit *) rawhits->At(ihit); THcRawShowerHit* hit = (THcRawShowerHit *) rawhits->At(ihit);
...@@ -194,11 +205,70 @@ Int_t THcShowerArray::ProcessHits(TClonesArray* rawhits, Int_t nexthit) ...@@ -194,11 +205,70 @@ Int_t THcShowerArray::ProcessHits(TClonesArray* rawhits, Int_t nexthit)
} else { } else {
fA[hit->fCounter-1] = hit->GetData(0); fA[hit->fCounter-1] = hit->GetData(0);
} }
if(fA[hit->fCounter-1] > threshold) {
ngood++;
}
// Do other stuff like comparison to thresholds, signal hits, energy sums // Do other stuff like comparison to thresholds, signal hits, energy sums
ihit++; ihit++;
} }
#if 0
if(ngood > 0) {
cout << "+";
for(Int_t column=0;column<fNColumns;column++) {
cout << "-";
}
cout << "+" << endl;
for(Int_t row=0;row<fNRows;row++) {
cout << "|";
for(Int_t column=0;column<fNColumns;column++) {
Int_t counter = column*fNRows + row;
if(fA[counter]>threshold) {
cout << "X";
} else {
cout << " ";
}
}
cout << "|" << endl;
}
}
#endif
#ifdef HITPIC
if(ngood > 0) {
for(Int_t row=0;row<fNRows;row++) {
if(piccolumn==0) {
hitpic[row][0] = '|';
}
for(Int_t column=0;column<fNColumns;column++) {
Int_t counter = column*fNRows+row;
if(fA[counter] > threshold) {
hitpic[row][piccolumn*(fNColumns+1)+column+1] = 'X';
} else {
hitpic[row][piccolumn*(fNColumns+1)+column+1] = ' ';
}
hitpic[row][(piccolumn+1)*(fNColumns+1)] = '|';
}
}
piccolumn++;
if(piccolumn==NPERLINE) {
cout << "+";
for(Int_t pc=0;pc<NPERLINE;pc++) {
for(Int_t column=0;column<fNColumns;column++) {
cout << "-";
}
cout << "+";
}
cout << endl;
for(Int_t row=0;row<fNRows;row++) {
hitpic[row][(piccolumn+1)*(fNColumns+1)+1] = '\0';
cout << hitpic[row] << endl;
}
piccolumn = 0;
}
}
#endif
return(ihit); return(ihit);
} }
......
#ifndef ROOT_THcShowerArray #ifndef ROOT_THcShowerArray
#define ROOT_THcShowerArray #define ROOT_THcShowerArray
//#define HITPIC 1
#ifdef HITPIC
#define NPERLINE 5
#endif
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// THcShowerArray // THcShowerArray
...@@ -54,6 +59,10 @@ public: ...@@ -54,6 +59,10 @@ public:
protected: protected:
#ifdef HITPIC
char **hitpic;
Int_t piccolumn;
#endif
Double_t* fA; // [fNelem] ADC amplitude of blocks Double_t* fA; // [fNelem] ADC amplitude of blocks
Double_t* fP; // [fNelem] Event by event pedestals Double_t* fP; // [fNelem] Event by event pedestals
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment