All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
icarus::crt::CrtCalAnalyzer Class Reference
Inheritance diagram for icarus::crt::CrtCalAnalyzer:

Classes

struct  Config
 

Public Types

using Parameters = art::EDAnalyzer::Table< Config >
 

Public Member Functions

 CrtCalAnalyzer (Parameters const &config)
 
virtual ~CrtCalAnalyzer ()
 
virtual void beginJob ()
 
virtual void analyze (art::Event const &evt)
 
virtual void endJob ()
 

Private Attributes

art::ServiceHandle
< art::TFileService > 
tfs
 
vector< uint8_t > macs
 
map< uint8_t, vector< TH1F * > * > macToHistos
 
TTree * calTree
 
uint8_t fMac5
 
bool fActive [32]
 
float fGain [32]
 
float fGainErr [32]
 
float fGainXsqr [32]
 
short fGainNdf [32]
 
float fGainPed [32]
 
float fGainPedErr [32]
 
short fNpeak [32]
 
float fPed [32]
 
float fPedErr [32]
 
float fPedXsqr [32]
 
short fPedNdf [32]
 
float fPedSigma [32]
 
float fPedSigmaErr [32]
 
float fPedNorm [32]
 
float fPedNormErr [32]
 
int fThreshADC [32]
 
float fThreshPE [32]
 
int fNabove [32]
 
float fPeakNorm [32][5]
 
float fPeakNormErr [32][5]
 
float fPeakSigma [32][5]
 
float fPeakSigmaErr [32][5]
 
float fPeakMean [32][5]
 
float fPeakMeanErr [32][5]
 
float fPeakXsqr [32][5]
 
short fPeakNdf [32][5]
 

Detailed Description

Definition at line 57 of file CrtCalAnalysis_module.cc.

Member Typedef Documentation

using icarus::crt::CrtCalAnalyzer::Parameters = art::EDAnalyzer::Table<Config>

Definition at line 74 of file CrtCalAnalysis_module.cc.

Constructor & Destructor Documentation

icarus::crt::CrtCalAnalyzer::CrtCalAnalyzer ( Parameters const &  config)
explicit

Definition at line 124 of file CrtCalAnalysis_module.cc.

125  : EDAnalyzer(config) , macs(config().Mac())
126 {
127  fMac5 = 0;
128  for(int i=0; i<(int)macs.size(); i++){
129  macToHistos[macs[i]] = new vector<TH1F*>();
130  for(int ch=0; ch<32; ch++){
131  string hname = "hadc_"+to_string(macs[i])+"_"+to_string(ch);
132  string htitle = "raw charge: mac5 "+to_string(macs[i])+", ch. "+to_string(ch);
133  macToHistos[macs[i]]->push_back(tfs->make<TH1F>(hname.c_str(),htitle.c_str(),4100,0,4100));
134  }
135  }
136 
137  for(int i=0; i<32; i++) {
138  fActive[i] = false;
139  fGain[i] = FLT_MAX;
140  fGainErr[i] = FLT_MAX;
141  fGainXsqr[i] = FLT_MAX;
142  fGainNdf[i] = SHRT_MAX;
143  fGainPed[i] = FLT_MAX;
144  fGainPedErr[i] = FLT_MAX;
145  fNpeak[i] = SHRT_MAX;
146  fPed[i] = FLT_MAX;
147  fPedErr[i] = FLT_MAX;
148  fPedXsqr[i] = FLT_MAX;
149  fPedNdf[i] = SHRT_MAX;
150  fPedSigma[i] = FLT_MAX;
151  fPedSigmaErr[i] = FLT_MAX;
152  fPedNorm[i] = FLT_MAX;
153  fPedNormErr[i] = FLT_MAX;
154  fThreshADC[i] = INT_MAX;
155  fThreshPE[i] = FLT_MAX;
156  fNabove[i] = INT_MAX;
157 
158  for(size_t j=0; j<5; j++){
159  fPeakNorm[i][j] = FLT_MAX;
160  fPeakNormErr[i][j] = FLT_MAX;
161  fPeakSigma[i][j] = FLT_MAX;
162  fPeakSigmaErr[i][j] = FLT_MAX;
163  fPeakMean[i][j] = FLT_MAX;
164  fPeakMeanErr[i][j] = FLT_MAX;
165  fPeakXsqr[i][j] = FLT_MAX;
166  fPeakNdf[i][j] = SHRT_MAX;
167  }
168  }
169 
170 }
map< uint8_t, vector< TH1F * > * > macToHistos
std::string to_string(WindowPattern const &pattern)
art::ServiceHandle< art::TFileService > tfs
icarus::crt::CrtCalAnalyzer::~CrtCalAnalyzer ( )
virtual

Definition at line 172 of file CrtCalAnalysis_module.cc.

173 {
174 }

Member Function Documentation

void icarus::crt::CrtCalAnalyzer::analyze ( art::Event const &  evt)
virtual

Definition at line 211 of file CrtCalAnalysis_module.cc.

212 {
213  //WK 09/02/21. Update to BernCRTTranslator in sbndaq_artdaq_core
214  std::vector<icarus::crt::BernCRTTranslator> hit_vector;
215 
216  auto fragmentHandles = evt.getMany<artdaq::Fragments>();
217  for (auto handle : fragmentHandles) {
218  if (!handle.isValid() || handle->size() == 0)
219  continue;
220 
221  auto this_hit_vector = icarus::crt::BernCRTTranslator::getCRTData(*handle);
222 
223  hit_vector.insert(hit_vector.end(),this_hit_vector.begin(),this_hit_vector.end());
224 
225  }
226 
227  for(auto & hit : hit_vector) {
228 
229  fMac5 = hit.mac5;
230 
231  if(macToHistos.find(fMac5) == macToHistos.end()) return;
232 
233  for(int ch=0; ch<32; ch++) {
234  macToHistos[fMac5]->at(ch)->Fill( hit.adc[ch] );
235  }
236  }
237 }//end analyze
process_name hit
Definition: cheaterreco.fcl:51
map< uint8_t, vector< TH1F * > * > macToHistos
TCEvent evt
Definition: DataStructs.cxx:8
void icarus::crt::CrtCalAnalyzer::beginJob ( )
virtual

Definition at line 176 of file CrtCalAnalysis_module.cc.

176  {
177 
178  calTree = tfs->make<TTree>("calAnalyzerTree", "SiPM/FEB channel calibration data");
179 
180  calTree->Branch("mac5", &fMac5, "mac5/b");
181  calTree->Branch("active", fActive, "active[32]/O");
182  calTree->Branch("gain", fGain, "gain[32]/F");
183  calTree->Branch("gainErr", fGainErr, "gainErr[32]/F");
184  calTree->Branch("gainXsqr", fGainXsqr, "gainXsqr[32]/F");
185  calTree->Branch("gainNdf", fGainNdf, "gainNdf[32]/s");
186  calTree->Branch("gainPed", fGainPed, "gainPed[32]/F");
187  calTree->Branch("gainPedErr", fGainPedErr, "gainPedErr[32]/F");
188  calTree->Branch("nPeak", fNpeak, "nPeak[32]/s");
189  calTree->Branch("peakXsqr", fPeakXsqr, "peakXsqr[32][5]/F");
190  calTree->Branch("peakNdf", fPeakNdf, "peakNdf[32][5]/s");
191  calTree->Branch("peakMean", fPeakMean, "peakMean[32][5]/F");
192  calTree->Branch("peakMeanErr", fPeakMeanErr, "peakMeanErr[32][5]/F");
193  calTree->Branch("peakNorm", fPeakNorm, "peakNorm[32][5]/F");
194  calTree->Branch("peakNormErr", fPeakNormErr, "peakNormErr[32][5]/F");
195  calTree->Branch("peakSigma", fPeakSigma, "peakSigma[32][5]/F");
196  calTree->Branch("peakSigmaErr", fPeakSigmaErr, "peakSigmaErr[32][5]/F");
197  calTree->Branch("ped", fPed, "ped[32]/F");
198  calTree->Branch("pedErr", fPedErr, "pedErr[32]/F");
199  calTree->Branch("pedXsqr", fPedXsqr, "pedXsqr[32]/F");
200  calTree->Branch("pedNdf", fPedNdf, "pedNdf[32]/s");
201  calTree->Branch("pedSigma", fPedSigma, "pedSigma[32]/F");
202  calTree->Branch("pedSigmaErr", fPedSigmaErr, "pedSigmaErr[32]/F");
203  calTree->Branch("pedNorm", fPedNorm, "pedNorm[32]/F");
204  calTree->Branch("pedNormErr", fPedNormErr, "pedNormErr[32]/F");
205  calTree->Branch("threshAdc", fThreshADC, "threshAdc[32]/I");
206  calTree->Branch("threshPe", fThreshPE, "threshPe[32]/F");
207  calTree->Branch("nAbove", fNabove, "nAbove[32]/I");
208 
209 }
art::ServiceHandle< art::TFileService > tfs
void icarus::crt::CrtCalAnalyzer::endJob ( )
virtual

Definition at line 240 of file CrtCalAnalysis_module.cc.

240  {
241 
242  std::cout << "done filling histograms..." << std::endl;
243  std::cout << "found " << macToHistos.size() << " FEBs" << std::endl;
244  if(!macToHistos.begin()->second->empty()){
245  std::cout << "first histo size: " << macToHistos.begin()->second->at(0)->Integral()
246  << " entries" << std::endl;
247  }
248  else {
249  std::cout << "hist vect is empty!" << std::endl;
250  }
251 
252  for(auto const& macHist : macToHistos){
253 
254  uint8_t mac = macHist.first;
255  vector<TH1F*>* hvec = macHist.second;
256 
257  std::cout << "construct instance of CrtCal for mac5 " << (short)mac << std::endl;
258  CrtCal* cal = new CrtCal(hvec);
259  cal->Cal();
260 
261  std::cout << "retreiving cal data..." << std::endl;
262  fMac5 = macHist.first;
263  bool* ptrActive = cal->GetActive();
264  float* ptrGain = cal->GetGain();
265  float* ptrGainErr = cal->GetGainErr();
266  float* ptrGainXsqr = cal->GetGainXsqr();
267  short* ptrGainNdf = cal->GetGainNdf();
268  float* ptrGainPed = cal->GetGainPed();
269  float* ptrGainPedErr = cal->GetGainPedErr();
270  short* ptrNpeak = cal->GetNpeak();
271  float** ptrPeakNorm = cal->GetPeakNorm();
272  float** ptrPeakNormErr = cal->GetPeakNormErr();
273  float** ptrPeakSigma = cal->GetPeakSigma();
274  float** ptrPeakSigmaErr = cal->GetPeakSigmaErr();
275  float** ptrPeakMean = cal->GetPeakMean();
276  float** ptrPeakMeanErr = cal->GetPeakMeanErr();
277  float** ptrPeakXsqr = cal->GetPeakXsqr();
278  short** ptrPeakNdf = cal->GetPeakNdf();
279  float* ptrPed = cal->GetPed();
280  float* ptrPedErr = cal->GetPedErr();
281  float* ptrPedXsqr = cal->GetPedXsqr();
282  short* ptrPedNdf = cal->GetPedNdf();
283  float* ptrPedSigma = cal->GetPedSigma();
284  float* ptrPedSigmaErr = cal->GetPedSigmaErr();
285  float* ptrPedNorm = cal->GetPedNorm();
286  float* ptrPedNormErr = cal->GetPedNormErr();
287  int* ptrThreshADC = cal->GetThreshADC();
288  float* ptrThreshPE = cal->GetThreshPE();
289  int* ptrNabove = cal->GetNabove();
290 
291  //copy values to local arrays
292  for(size_t i=0; i<32; i++){
293  if(ptrActive!=nullptr) fActive[i] = ptrActive[i];
294  if(ptrGain!=nullptr) fGain[i] = ptrGain[i];
295  if(ptrGainErr!=nullptr) fGainErr[i] = ptrGainErr[i];
296  if(ptrGainXsqr!=nullptr) fGainXsqr[i] = ptrGainXsqr[i];
297  if(ptrGainNdf!=nullptr) fGainNdf[i] = ptrGainNdf[i];
298  if(ptrGainPed!=nullptr) fGainPed[i] = ptrGainPed[i];
299  if(ptrGainPedErr!=nullptr) fGainPedErr[i] = ptrGainPedErr[i];
300  if(ptrNpeak!=nullptr) fNpeak[i] = ptrNpeak[i];
301  if(ptrPed!=nullptr) fPed[i] = ptrPed[i];
302  if(ptrPedErr!=nullptr) fPedErr[i] = ptrPedErr[i];
303  if(ptrPedXsqr!=nullptr) fPedXsqr[i] = ptrPedXsqr[i];
304  if(ptrPedNdf!=nullptr) fPedNdf[i] = ptrPedNdf[i];
305  if(ptrPedSigma!=nullptr) fPedSigma[i] = ptrPedSigma[i];
306  if(ptrPedSigmaErr!=nullptr) fPedSigmaErr[i] = ptrPedSigmaErr[i];
307  if(ptrPedNorm!=nullptr) fPedNorm[i] = ptrPedNorm[i];
308  if(ptrPedNormErr!=nullptr) fPedNormErr[i] = ptrPedNormErr[i];
309  if(ptrThreshADC!=nullptr) fThreshADC[i] = ptrThreshADC[i];
310  if(ptrThreshPE!=nullptr) fThreshPE[i] = ptrThreshPE[i];
311  if(ptrNabove!=nullptr) fNabove[i] = ptrNabove[i];
312 
313  for(size_t j=0; j<5; j++){
314  if(ptrPeakNorm!=nullptr) fPeakNorm[i][j] = ptrPeakNorm[i][j];
315  if(ptrPeakNormErr!=nullptr) fPeakNormErr[i][j] = ptrPeakNormErr[i][j];
316  if(ptrPeakSigma!=nullptr) fPeakSigma[i][j] = ptrPeakSigma[i][j];
317  if(ptrPeakSigmaErr!=nullptr) fPeakSigmaErr[i][j] = ptrPeakSigmaErr[i][j];
318  if(ptrPeakMean!=nullptr) fPeakMean[i][j] = ptrPeakMean[i][j];
319  if(ptrPeakMeanErr!=nullptr) fPeakMeanErr[i][j] = ptrPeakMeanErr[i][j];
320  if(ptrPeakXsqr!=nullptr) fPeakXsqr[i][j] = ptrPeakXsqr[i][j];
321  if(ptrPeakNdf!=nullptr) fPeakNdf[i][j] = ptrPeakNdf[i][j];
322  }
323  }
324 
325  std::cout << "fill tree event" << std::endl;
326  calTree->Fill();
327 
328  delete cal;
329  }
330 
331  //calTree->Write();
332 
333 }
map< uint8_t, vector< TH1F * > * > macToHistos
BEGIN_PROLOG could also be cout

Member Data Documentation

TTree* icarus::crt::CrtCalAnalyzer::calTree
private

Definition at line 89 of file CrtCalAnalysis_module.cc.

bool icarus::crt::CrtCalAnalyzer::fActive[32]
private

Definition at line 94 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fGain[32]
private

Definition at line 95 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fGainErr[32]
private

Definition at line 96 of file CrtCalAnalysis_module.cc.

short icarus::crt::CrtCalAnalyzer::fGainNdf[32]
private

Definition at line 98 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fGainPed[32]
private

Definition at line 99 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fGainPedErr[32]
private

Definition at line 100 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fGainXsqr[32]
private

Definition at line 97 of file CrtCalAnalysis_module.cc.

uint8_t icarus::crt::CrtCalAnalyzer::fMac5
private

Definition at line 93 of file CrtCalAnalysis_module.cc.

int icarus::crt::CrtCalAnalyzer::fNabove[32]
private

Definition at line 112 of file CrtCalAnalysis_module.cc.

short icarus::crt::CrtCalAnalyzer::fNpeak[32]
private

Definition at line 101 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fPeakMean[32][5]
private

Definition at line 117 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fPeakMeanErr[32][5]
private

Definition at line 118 of file CrtCalAnalysis_module.cc.

short icarus::crt::CrtCalAnalyzer::fPeakNdf[32][5]
private

Definition at line 120 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fPeakNorm[32][5]
private

Definition at line 113 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fPeakNormErr[32][5]
private

Definition at line 114 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fPeakSigma[32][5]
private

Definition at line 115 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fPeakSigmaErr[32][5]
private

Definition at line 116 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fPeakXsqr[32][5]
private

Definition at line 119 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fPed[32]
private

Definition at line 102 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fPedErr[32]
private

Definition at line 103 of file CrtCalAnalysis_module.cc.

short icarus::crt::CrtCalAnalyzer::fPedNdf[32]
private

Definition at line 105 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fPedNorm[32]
private

Definition at line 108 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fPedNormErr[32]
private

Definition at line 109 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fPedSigma[32]
private

Definition at line 106 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fPedSigmaErr[32]
private

Definition at line 107 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fPedXsqr[32]
private

Definition at line 104 of file CrtCalAnalysis_module.cc.

int icarus::crt::CrtCalAnalyzer::fThreshADC[32]
private

Definition at line 110 of file CrtCalAnalysis_module.cc.

float icarus::crt::CrtCalAnalyzer::fThreshPE[32]
private

Definition at line 111 of file CrtCalAnalysis_module.cc.

vector<uint8_t> icarus::crt::CrtCalAnalyzer::macs
private

Definition at line 87 of file CrtCalAnalysis_module.cc.

map<uint8_t,vector<TH1F*>*> icarus::crt::CrtCalAnalyzer::macToHistos
private

Definition at line 88 of file CrtCalAnalysis_module.cc.

art::ServiceHandle<art::TFileService> icarus::crt::CrtCalAnalyzer::tfs
private

Definition at line 85 of file CrtCalAnalysis_module.cc.


The documentation for this class was generated from the following file: