Skip to content
Snippets Groups Projects
Commit 58a27103 authored by Eric Pooser's avatar Eric Pooser Committed by Stephen A. Wood
Browse files

Modify Cherenkov class to allow for multiple Cherenkovs to exist for SHMS replay work

parent 24a8f97e
No related branches found
No related tags found
No related merge requests found
...@@ -26,10 +26,12 @@ Class for an Cherenkov detector consisting of two PMT's ...@@ -26,10 +26,12 @@ Class for an Cherenkov detector consisting of two PMT's
#include "THaTrackProj.h" #include "THaTrackProj.h"
#include <algorithm>
#include <cstring> #include <cstring>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <iostream> #include <iostream>
#include <string>
using namespace std; using namespace std;
...@@ -141,11 +143,11 @@ THaAnalysisObject::EStatus THcCherenkov::Init( const TDatime& date ) ...@@ -141,11 +143,11 @@ THaAnalysisObject::EStatus THcCherenkov::Init( const TDatime& date )
{ {
cout << "THcCherenkov::Init " << GetName() << endl; cout << "THcCherenkov::Init " << GetName() << endl;
char EngineDID[] = "xCER"; string EngineDID = string(GetApparatus()->GetName()).substr(0, 1) + GetName();
EngineDID[0] = toupper(GetApparatus()->GetName()[0]); std::transform(EngineDID.begin(), EngineDID.end(), EngineDID.begin(), ::toupper);
if( gHcDetectorMap->FillMap(fDetMap, EngineDID) < 0 ) { if( gHcDetectorMap->FillMap(fDetMap, EngineDID.c_str()) < 0 ) {
static const char* const here = "Init()"; static const char* const here = "Init()";
Error( Here(here), "Error filling detectormap for %s.", EngineDID ); Error(Here(here), "Error filling detectormap for %s.", EngineDID.c_str());
return kInitError; return kInitError;
} }
...@@ -168,15 +170,12 @@ Int_t THcCherenkov::ReadDatabase( const TDatime& date ) ...@@ -168,15 +170,12 @@ Int_t THcCherenkov::ReadDatabase( const TDatime& date )
cout << "THcCherenkov::ReadDatabase " << GetName() << endl; // Ahmed cout << "THcCherenkov::ReadDatabase " << GetName() << endl; // Ahmed
char prefix[2]; string prefix = string(GetApparatus()->GetName()).substr(0, 1) + GetName();
char parname[100]; std::transform(prefix.begin(), prefix.end(), prefix.begin(), ::tolower);
prefix[0]=tolower(GetApparatus()->GetName()[0]); string parname = prefix + "_tot_pmts";
prefix[1]='\0';
strcpy(parname,prefix); // This is taken from fNelem = (Int_t)gHcParms->Find(parname.c_str())->GetValue(); // class.
strcat(parname,"cer_tot_pmts"); // THcScintillatorPlane
fNelem = (Int_t)gHcParms->Find(parname)->GetValue(); // class.
// fNelem = 2; // Default if not defined // fNelem = 2; // Default if not defined
fCerNRegions = 3; fCerNRegions = 3;
...@@ -212,22 +211,22 @@ Int_t THcCherenkov::ReadDatabase( const TDatime& date ) ...@@ -212,22 +211,22 @@ Int_t THcCherenkov::ReadDatabase( const TDatime& date )
fCerRegionValue = new Double_t [fCerRegionsValueMax]; fCerRegionValue = new Double_t [fCerRegionsValueMax];
DBRequest list[]={ DBRequest list[]={
{"cer_adc_to_npe", fGain, kDouble, (UInt_t) fNelem}, {"_adc_to_npe", fGain, kDouble, (UInt_t) fNelem},
{"cer_ped_limit", fPedLimit, kInt, (UInt_t) fNelem}, {"_ped_limit", fPedLimit, kInt, (UInt_t) fNelem},
{"cer_width", fCerWidth, kDouble, (UInt_t) fNelem}, {"_width", fCerWidth, kDouble, (UInt_t) fNelem},
{"cer_chi2max", &fCerChi2Max, kDouble}, {"_chi2max", &fCerChi2Max, kDouble},
{"cer_beta_min", &fCerBetaMin, kDouble}, {"_beta_min", &fCerBetaMin, kDouble},
{"cer_beta_max", &fCerBetaMax, kDouble}, {"_beta_max", &fCerBetaMax, kDouble},
{"cer_et_min", &fCerETMin, kDouble}, {"_et_min", &fCerETMin, kDouble},
{"cer_et_max", &fCerETMax, kDouble}, {"_et_max", &fCerETMax, kDouble},
{"cer_mirror_zpos", &fCerMirrorZPos, kDouble}, {"_mirror_zpos", &fCerMirrorZPos, kDouble},
{"cer_region", &fCerRegionValue[0], kDouble, (UInt_t) fCerRegionsValueMax}, {"_region", &fCerRegionValue[0], kDouble, (UInt_t) fCerRegionsValueMax},
{"cer_threshold", &fCerThresh, kDouble}, {"_threshold", &fCerThresh, kDouble},
// {"cer_regions", &fCerNRegions, kInt}, // {"cer_regions", &fCerNRegions, kInt},
{0} {0}
}; };
gHcParms->LoadParmValues((DBRequest*)&list,prefix); gHcParms->LoadParmValues((DBRequest*)&list,prefix.c_str());
fIsInit = true; fIsInit = true;
...@@ -395,8 +394,8 @@ Int_t THcCherenkov::CoarseProcess( TClonesArray& ) //tracks ...@@ -395,8 +394,8 @@ Int_t THcCherenkov::CoarseProcess( TClonesArray& ) //tracks
// be assigned NPE = 100.0. // be assigned NPE = 100.0.
Int_t npmt = hit->fCounter - 1; // tube = hcer_tube_num(nhit) Int_t npmt = hit->fCounter - 1; // tube = hcer_tube_num(nhit)
// Should probably check that npmt is in range // Should probably check that npmt is in range
if ( ihit != npmt ) // if ( ihit != npmt )
cout << "ihit != npmt " << endl; // cout << "ihit != npmt, ihit = " << ihit << ", npmt = " << npmt << ", fNhits = " << fNhits << endl;
fNPMT[npmt] = hit->fCounter; fNPMT[npmt] = hit->fCounter;
fADC[npmt] = hit->GetRawAdcHitPos().GetPulseIntRaw(); fADC[npmt] = hit->GetRawAdcHitPos().GetPulseIntRaw();
......
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