20 #include "THaTrackProj.h"
38 const
char* description,
40 THaDetectorBase* parent )
41 : THaSubDetector(name,description,parent)
117 return fStatus = kInitError;
124 !(
fglHod = dynamic_cast<THcHodoscope*>(app->GetDetector(
"hod"))) ) {
125 static const char*
const here =
"ReadDatabase()";
126 Warning(Here(here),
"Hodoscope \"%s\" not found. ",
"hod");
130 if( (status=THaSubDetector::Init( date )) )
131 return fStatus = status;
133 return fStatus = kOK;
142 prefix[0]=tolower(GetParent()->GetPrefix()[0]);
158 {
"cal_arr_nrows", &
fNRows, kInt},
160 {
"cal_arr_front_x", &
fXFront, kDouble},
161 {
"cal_arr_front_y", &
fYFront, kDouble},
162 {
"cal_arr_front_z", &
fZFront, kDouble},
163 {
"cal_arr_xstep", &
fXStep, kDouble},
164 {
"cal_arr_ystep", &
fYStep, kDouble},
165 {
"cal_arr_zsize", &
fZSize, kDouble},
167 {
"cal_arr_ADCMode", &
fADCMode, kInt, 0, 1},
174 {
"cal_debug_adc", &
fDebugAdc, kInt, 0, 1},
176 {
"stat_slop_array", &
fStatSlop, kDouble, 0, 1},
214 if (static_cast<THcShower*>(
fParent)->fdbg_init_cal) {
215 cout <<
"---------------------------------------------------------------\n";
216 cout <<
"Debug output from THcShowerArray::ReadDatabase for "
217 << GetParent()->GetPrefix() <<
":" << endl;
219 cout <<
" Layer #" <<
fLayerNum <<
", number of elements " << dec << fNelem
221 cout <<
" Columns " << fNColumns <<
", Rows " << fNRows << endl;
226 cout <<
" Block to block X and Y distances: " <<
fXStep <<
", " <<
fYStep
229 cout <<
" Block size along Z: " <<
fZSize <<
" cm" << endl;
231 cout <<
"Block X coordinates:" << endl;
234 cout <<
fXPos[i][j] <<
" ";
240 cout <<
"Block Y coordinates:" << endl;
243 cout <<
fYPos[i][j] <<
" ";
249 cout <<
"Block Z coordinates:" << endl;
252 cout <<
fZPos[i][j] <<
" ";
258 cout <<
" Origin of Array:" << endl;
259 cout <<
" Xorig = " << GetOrigin().X() << endl;
260 cout <<
" Yorig = " << GetOrigin().Y() << endl;
261 cout <<
" Zorig = " << GetOrigin().Z() << endl;
266 cout <<
" FADC pedestal sample low = " <<
fPedSampLow <<
", high = "
268 cout <<
" FADC data sample low = " <<
fDataSampLow <<
", high = "
288 {
"cal_arr_cal_const", cal_arr_cal_const, kDouble,
static_cast<UInt_t>(fNelem)},
289 {
"cal_arr_gain_cor", cal_arr_gain_cor, kDouble,
static_cast<UInt_t>(fNelem)},
296 for(
Int_t ip=0;ip<fNelem;ip++) {
305 if (static_cast<THcShower*>(
fParent)->fdbg_init_cal) {
307 cout <<
" fPedLimit:" << endl;
317 cout <<
" cal_arr_cal_const:" << endl;
322 cout << cal_arr_cal_const[el++] <<
" ";
327 cout <<
" cal_arr_gain_cor:" << endl;
332 cout << cal_arr_gain_cor[el++] <<
" ";
341 for (
Int_t i=0; i<fNelem; i++) {
342 fGain[i] = cal_arr_cal_const[i] * cal_arr_gain_cor[i];
346 if (static_cast<THcShower*>(
fParent)->fdbg_init_cal) {
348 cout <<
" fGain:" << endl;
353 cout <<
fGain[el++] <<
" ";
369 fE = vector<Double_t> (fNelem, 0.0);
394 hitpic =
new char*[
fNRows];
396 hitpic[row] =
new char[NPERLINE*(fNColumns+1)+2];
403 if (static_cast<THcShower*>(
fParent)->fdbg_init_cal) {
405 cout <<
" fMinPeds = " <<
fMinPeds << endl;
407 cout <<
"---------------------------------------------------------------\n";
418 if( mode == kDefine && fIsSetup )
return kOK;
419 fIsSetup = ( mode == kDefine );
432 {
"adcPedRaw",
"List of raw ADC pedestals",
"frAdcPedRaw.THcSignalHit.GetData()"},
433 {
"adcPulseIntRaw",
"List of raw ADC pulse integrals.",
"frAdcPulseIntRaw.THcSignalHit.GetData()"},
434 {
"adcPulseAmpRaw",
"List of raw ADC pulse amplitudes.",
"frAdcPulseAmpRaw.THcSignalHit.GetData()"},
435 {
"adcPulseTimeRaw",
"List of raw ADC pulse times.",
"frAdcPulseTimeRaw.THcSignalHit.GetData()"},
437 {
"adcPed",
"List of ADC pedestals",
"frAdcPed.THcSignalHit.GetData()"},
438 {
"adcPulseInt",
"List of ADC pulse integrals.",
"frAdcPulseInt.THcSignalHit.GetData()"},
439 {
"adcPulseAmp",
"List of ADC pulse amplitudes.",
"frAdcPulseAmp.THcSignalHit.GetData()"},
440 {
"adcPulseTime",
"List of ADC pulse times.",
"frAdcPulseTime.THcSignalHit.GetData()"},
443 DefineVarsFromList( vars, mode);
449 {
"adcErrorFlag",
"Error Flag When FPGA Fails",
"frAdcErrorFlag.THcSignalHit.GetData()"},
451 {
"adcCounter",
"List of ADC counter numbers.",
"frAdcPulseIntRaw.THcSignalHit.GetPaddleNumber()"},
452 {
"numGoodAdcHits",
"Number of Good ADC Hits per PMT",
"fNumGoodAdcHits" },
454 {
"totNumAdcHits",
"Total Number of ADC Hits",
"fTotNumAdcHits" },
455 {
"totNumGoodAdcHits",
"Total Number of Good ADC Hits",
"fTotNumGoodAdcHits" },
458 {
"goodAdcPulseIntRaw",
"Good Raw ADC Pulse Integrals",
"fGoodAdcPulseIntRaw"},
459 {
"goodAdcPed",
"Good ADC Pedestals",
"fGoodAdcPed"},
460 {
"goodAdcMult",
"Good ADC Multiplicity",
"fGoodAdcMult"},
461 {
"goodAdcPulseInt",
"Good ADC Pulse Integrals",
"fGoodAdcPulseInt"},
462 {
"goodAdcPulseAmp",
"Good ADC Pulse Amplitudes",
"fGoodAdcPulseAmp"},
463 {
"goodAdcPulseTime",
"Good ADC Pulse Times",
"fGoodAdcPulseTime"},
464 {
"goodAdcTdcDiffTime",
"Good Hodo Starttime - ADC Pulse Times",
"fGoodAdcTdcDiffTime"},
467 {
"e",
"Energy Depositions per block",
"fE"},
468 {
"earray",
"Energy Deposition in Shower Array",
"fEarray"},
470 {
"nclust",
"Number of clusters",
"fNclust" },
471 {
"block_clusterID",
"Cluster ID number",
"fBlock_ClusterID"},
472 {
"ntracks",
"Number of shower tracks",
"fNtracks" },
476 return DefineVarsFromList(vars, mode );
496 Podd::DeleteContainer(**i);
562 if (static_cast<THcShower*>(
fParent)->fdbg_clusters_cal) {
563 cout <<
"---------------------------------------------------------------\n";
564 cout <<
"Debug output from THcShowerArray::CoarseProcess for " <<
GetName()
567 cout <<
" List of unclustered hits. Total hits: " <<
fTotNumAdcHits << endl;
570 cout <<
" hit " << i <<
": ";
587 assert( HitSet.empty() );
589 fNclust = (*fClusterList).size();
595 ppcl != (*fClusterList).end(); ++ppcl) {
598 block = ((**pph).hitColumn())*fNRows + (**pph).hitRow()+1;
606 if (static_cast<THcShower*>(
fParent)->fdbg_clusters_cal) {
608 cout <<
" Clustered hits. Number of clusters: " << fNclust << endl;
612 ppcl != (*fClusterList).end(); ++ppcl) {
614 cout <<
" Cluster #" << i++
615 <<
": E=" <<
clE(*ppcl)
616 <<
" Epr=" <<
clEpr(*ppcl)
617 <<
" X=" <<
clX(*ppcl)
618 <<
" Y=" <<
clY(*ppcl)
619 <<
" Z=" <<
clZ(*ppcl)
620 <<
" size=" << (**ppcl).size()
626 cout <<
" hit " << j++ <<
": ";
632 cout <<
"---------------------------------------------------------------\n";
653 fOrigin = GetOrigin();
655 static_cast<THcShower*
>(
fParent)->CalcTrackIntercept(Track, pathl, XTrFront, YTrFront);
659 XTrFront += GetOrigin().X();
660 YTrFront += GetOrigin().Y();
666 if (static_cast<THcShower*>(
fParent)->fvTest) {
673 fOrigin.
SetXYZ(GetOrigin().X(), GetOrigin().Y(), GetOrigin().Z() +
fZSize);
678 static_cast<THcShower*
>(
fParent)->CalcTrackIntercept(Track, pathl, XTrBack, YTrBack);
680 XTrBack += GetOrigin().X();
681 YTrBack += GetOrigin().Y();
708 if (static_cast<THcShower*>(
fParent)->fdbg_tracks_cal) {
709 cout <<
" match clust = " << i <<
" clX = " <<
clX(cluster)<<
" clY = " <<
clY(cluster) <<
" distacne = " << distance <<
" test = " << (0.5*(
fXStep +
fYStep) + static_cast<THcShower*>(
fParent)->fSlop) << endl;
716 if (distance < Delta) {
729 if (static_cast<THcShower*>(
fParent)->fdbg_tracks_cal) {
730 cout <<
"---------------------------------------------------------------\n";
731 cout <<
"Debug output from THcShowerArray::MatchCluster for " <<
GetName()
734 cout <<
" Track at DC:"
735 <<
" X = " << Track->GetX()
736 <<
" Y = " << Track->GetY()
737 <<
" Theta = " << Track->GetTheta()
738 <<
" Phi = " << Track->GetPhi()
740 cout <<
" Track at the front of Array:"
741 <<
" X = " << XTrFront
742 <<
" Y = " << YTrFront
743 <<
" Pathl = " << pathl
745 if (static_cast<THcShower*>(
fParent)->fvTest)
746 cout <<
" Fiducial volume test: inFidVol = " << inFidVol << endl;
748 cout <<
" Matched cluster #" << mclust <<
", Delta = " << Delta << endl;
749 cout <<
"---------------------------------------------------------------\n";
784 if (static_cast<THcShower*>(
fParent)->fdbg_tracks_cal) {
785 cout <<
"---------------------------------------------------------------\n";
786 cout <<
"Debug output from THcShowerArray::GetShEnergy for "
789 cout <<
" Track at Array: X = " << Xtr <<
" Y = " << Ytr;
791 cout <<
", matched cluster #" << mclust <<
"." << endl;
793 cout <<
", no matched cluster found." << endl;
795 cout <<
" Track's Array energy = " << Etrk <<
"." << endl;
796 cout <<
"---------------------------------------------------------------\n";
822 if (static_cast<THcShower*>(
fParent)->fdbg_decoded_cal) {
824 cout <<
"---------------------------------------------------------------\n";
825 cout <<
"Debug output from THcShowerArray::ProcessHits for "
828 cout <<
" Sparsified hits for shower array, plane #" <<
fLayerNum
829 <<
", " <<
GetName() <<
":" << endl;
836 cout <<
" counter = " << k
845 if (nspar == 0) cout <<
" No hits\n";
847 cout <<
" Earray = " <<
fEarray << endl;
848 cout <<
"---------------------------------------------------------------\n";
890 Double_t adctdcdiffTime = StartTime-pulseTime+OffsetTime;
938 for(
Int_t i=0;i<fNelem;i++) {
953 Int_t ihit = nexthit;
957 while(ihit < nrawhits) {
1015 cout <<
"+" << endl;
1019 Int_t counter = column*fNRows + row;
1026 cout <<
"|" << endl;
1034 hitpic[row][0] =
'|';
1037 Int_t counter = column*fNRows+row;
1039 hitpic[row][piccolumn*(fNColumns+1)+column+1] =
'X';
1041 hitpic[row][piccolumn*(fNColumns+1)+column+1] =
' ';
1043 hitpic[row][(piccolumn+1)*(fNColumns+1)] =
'|';
1047 if(piccolumn==NPERLINE) {
1049 for(
Int_t pc=0;pc<NPERLINE;pc++) {
1057 hitpic[row][(piccolumn+1)*(fNColumns+1)+1] =
'\0';
1058 cout << hitpic[row] << endl;
1078 Int_t ihit = nexthit;
1080 while(ihit < nrawhits) {
1115 if ( static_cast<THcShower*>(
fParent)->fdbg_raw_cal ) {
1117 cout <<
"---------------------------------------------------------------\n";
1118 cout <<
"Debug output from THcShowerArray::AcculatePedestals for "
1119 <<
fParent->GetPrefix() <<
":" << endl;
1121 cout <<
"Processed hit list for plane " <<
GetName() <<
":\n";
1123 for (
Int_t ih=nexthit; ih<nrawhits; ih++) {
1141 cout <<
" hit " << ih <<
":"
1142 <<
" plane = " << hit->
fPlane
1148 cout <<
"---------------------------------------------------------------\n";
1160 for(
Int_t i=0; i<fNelem;i++) {
1171 if ( static_cast<THcShower*>(
fParent)->fdbg_raw_cal ) {
1173 cout <<
"---------------------------------------------------------------\n";
1174 cout <<
"Debug output from THcShowerArray::CalculatePedestals for "
1175 <<
fParent->GetPrefix() <<
":" << endl;
1177 cout <<
" ADC pedestals and thresholds for calorimeter plane "
1179 for(
Int_t i=0; i<fNelem;i++) {
1180 cout <<
" element " << i <<
": "
1181 <<
" Pedestal = " <<
fPed[i]
1182 <<
" threshold = " <<
fThresh[i]
1185 cout <<
"---------------------------------------------------------------\n";
1203 for(
Int_t i=0;i<fNelem;i++) {
1233 if ( (**it).hitE() > max_energy ) {
1234 max_energy = (**it).hitE();
1235 max_block = ((**it).hitColumn())*fNRows + (**it).hitRow()+1;
1253 THaTrack* BestTrack =
static_cast<THaTrack*
>( tracks[0]);
1254 if (BestTrack->GetChi2()/BestTrack->GetNDoF() >
fStatMaxChi2)
return 0;
1259 if (
fParent->GetPrefix()[0] ==
'P')
1260 detc = app->GetDetector(
"hgcer");
1262 detc = app->GetDetector(
"cer");
1266 cout <<
"****** THcShowerArray::AccumulateStat: HGCer not found! ******"
1280 fOrigin = GetOrigin();
1281 static_cast<THcShower*
>(
fParent)->CalcTrackIntercept(BestTrack, pathl, XTrk, YTrk);
1284 XTrk += GetOrigin().X();
1285 YTrk += GetOrigin().Y();
1287 for (
Int_t i=0; i<fNelem; i++) {
1307 if (static_cast<THcShower*>(
fParent)->fdbg_tracks_cal ) {
1308 cout <<
"---------------------------------------------------------------\n";
1309 cout <<
"THcShowerArray::AccumulateStat:" << endl;
1310 cout <<
" Chi2/NDF = " <<BestTrack->GetChi2()/BestTrack->GetNDoF() <<endl;
1311 cout <<
" HGCER Npe = " << hgcer->
GetCerNPE() << endl;
1312 cout <<
" XTrk, YTrk = " << XTrk <<
" " << YTrk << endl;
1313 for (
Int_t i=0; i<fNelem; i++) {
1329 cout <<
"---------------------------------------------------------------\n";
Double_t GetData(UInt_t iPedLow, UInt_t iPedHigh, UInt_t iIntLow, UInt_t iIntHigh) const
Gets pedestal subtracted integral of samples. In channels.
Double_t GetF250_PeakPedestalRatio()
std::string GetName(const std::string &scope_name)
virtual EStatus Init(const TDatime &run_time)
static const Int_t kADCSampIntDynPed
virtual void FillADC_SampleIntegral()
TClonesArray * frAdcPulseAmp
vector< Int_t > fNumGoodAdcHits
vector< Double_t > fGoodAdcPed
TClonesArray * frAdcPulseTime
Fly's eye array of shower blocks.
Class for gas Cherenkov detectors.
THcShowerClusterList::iterator THcShowerClusterListIt
TClonesArray * frAdcErrorFlag
Double_t clMaxEnergyBlock(THcShowerCluster *cluster)
virtual void InitializePedestals()
vector< Int_t > fStatNumHit
vector< Double_t > fGoodAdcMult
vector< THcShowerCluster * > THcShowerClusterList
Double_t GetOffsetTime() const
vector< Double_t > fGoodAdcPulseAmp
Int_t GetPulseTimeRaw(UInt_t iPulse=0) const
Gets raw pulse time. In subsamples.
Short_t Min(Short_t a, Short_t b)
vector< Double_t > fGoodAdcTdcDiffTime
UInt_t threshold[NUMSLOTS][NADCCHAN]
THcShowerCluster::iterator THcShowerClusterIt
virtual void FillADC_DynamicPedestal()
virtual Int_t FineProcess(TClonesArray &tracks)
vector< Double_t > fGoodAdcPulseIntRaw
virtual Int_t GetData(Int_t signal)
Double_t clEpr(THcShowerCluster *cluster)
TObject * ConstructedAt(Int_t idx)
virtual void FillADC_SampIntDynPed()
virtual Int_t CoarseProcessHits()
Double_t fMatchClMaxEnergyBlock
void SetXYZ(Double_t x, Double_t y, Double_t z)
Int_t MatchCluster(THaTrack *, Double_t &, Double_t &)
Float_t GetShEnergy(THaTrack *)
TClonesArray * frAdcPedRaw
virtual Int_t DefineVariables(EMode mode=kDefine)
virtual Int_t ProcessHits(TClonesArray *rawhits, Int_t nexthit)
Double_t GetPed() const
Gets sample pedestal. In channels.
Double_t clZ(THcShowerCluster *cluster)
VecExpr< UnaryOp< Sqrt< T >, SVector< T, D >, T >, T, D > sqrt(const SVector< T, D > &rhs)
virtual void Clear(Option_t *option="")
Double_t clY(THcShowerCluster *cluster)
THcRawAdcHit & GetRawAdcHitPos()
Int_t GetPulseAmpRaw(UInt_t iPulse=0) const
Gets raw pulse amplitude. In channels.
virtual void FillADC_Standard()
Double_t GetPulseAmp(UInt_t iPulse=0) const
Gets pedestal subtracted pulse amplitude. In channels.
Double_t GetPulseInt(UInt_t iPulse=0) const
Gets pedestal subtracted pulse integral. In channels.
char * Form(const char *fmt,...)
static const Int_t kADCSampleIntegral
Double_t GetStartTime() const
void Warning(const char *location, const char *msgfmt,...)
vector< Double_t > fGoodAdcPulseInt
TClonesArray * frAdcPulseTimeRaw
virtual void Clear(Option_t *opt="")
Int_t GetPulseIntRaw(UInt_t iPulse=0) const
Gets raw pulse integral. In channels.
THcShowerHitSet THcShowerCluster
Int_t AccumulateStat(TClonesArray &tracks)
ClassImp(THcShowerArray) THcShowerArray
virtual void CalculatePedestals()
Int_t LoadParmValues(const DBRequest *list, const char *prefix="")
Retrieve parameter values from the parameter cache.
TClonesArray * frAdcPulseAmpRaw
UInt_t GetNPulses() const
Gets number of set pulses.
vector< Double_t > fGoodAdcPulseTime
TClonesArray * frAdcPulseIntRaw
virtual ~THcShowerArray()
Double_t clX(THcShowerCluster *cluster)
Double_t * fAdcTimeWindowMax
vector< Int_t > fStatNumTrk
Class representing a single raw hit for a shower paddle.
Generic segmented shower detector.
virtual Int_t AccumulatePedestals(TClonesArray *rawhits, Int_t nexthit)
virtual Int_t Decode(const THaEvData &)
Int_t GetPedRaw() const
Gets raw signal pedestal. In channels.
Short_t Max(Short_t a, Short_t b)
set< THcShowerHit * > THcShowerHitSet
static const Int_t kADCDynamicPedestal
Double_t GetPulseTime(UInt_t iPulse=0) const
THcShowerClusterList * fClusterList
TClonesArray * frAdcPulseInt
R__EXTERN class THcParmList * gHcParms
Double_t Sqrt(Double_t x)
TObject * At(Int_t idx) const
Int_t GetF250_NPedestalSamples()
void GetData(std::string s, double *x, double *y, double *ey)
Double_t clE(THcShowerCluster *cluster)
Double_t GetAdcTopC() const
virtual Int_t ReadDatabase(const TDatime &date)
Class representing a single raw ADC hit.
THaDetectorBase * fParent
Double_t * fAdcTimeWindowMin
virtual Int_t CoarseProcess(TClonesArray &tracks)
Double_t GetAdcTomV() const
THcShowerHitSet::iterator THcShowerHitIt
A standard Hall C spectrometer apparatus.