Skip to content
Snippets Groups Projects
Commit 3d575230 authored by Vardan Tadevosyan's avatar Vardan Tadevosyan Committed by Stephen A. Wood
Browse files

Edit debug outputs in the Shower code.

     Edit debug outputs in THcSHower and THcShowerPlane classes. Group
     outputs preferably by the end of methods, for smooth code
     flow. Structure tests of outputs for easy reading.
parent b3bc27b2
No related branches found
No related tags found
No related merge requests found
#include "PARAM/hcana.param" #include "PARAM/hcana.param"
# New calorimeter debug parameter.
hdbg_init_cal = 0
This diff is collapsed.
...@@ -70,9 +70,6 @@ THaAnalysisObject::EStatus THcShowerPlane::Init( const TDatime& date ) ...@@ -70,9 +70,6 @@ THaAnalysisObject::EStatus THcShowerPlane::Init( const TDatime& date )
{ {
// Extra initialization for shower layer: set up DataDest map // Extra initialization for shower layer: set up DataDest map
if ( ((THcShower*) GetParent())->fdbg_init_cal )
cout << "THcShowerPlane::Init called " << GetName() << endl;
if( IsZombie()) if( IsZombie())
return fStatus = kInitError; return fStatus = kInitError;
...@@ -91,35 +88,15 @@ THaAnalysisObject::EStatus THcShowerPlane::Init( const TDatime& date ) ...@@ -91,35 +88,15 @@ THaAnalysisObject::EStatus THcShowerPlane::Init( const TDatime& date )
//_____________________________________________________________________________ //_____________________________________________________________________________
Int_t THcShowerPlane::ReadDatabase( const TDatime& date ) Int_t THcShowerPlane::ReadDatabase( const TDatime& date )
{ {
// See what file it looks for
// static const char* const here = "ReadDatabase()";
char prefix[2];
char parname[100];
prefix[0]=tolower(GetParent()->GetPrefix()[0]);
prefix[1]='\0';
strcpy(parname,prefix);
strcat(parname,"cal_");
strcat(parname,GetName());
strcat(parname,"_nr");
// Retrieve parameters we need from parent class // Retrieve parameters we need from parent class
//
THcShower* fParent; THcShower* fParent;
fParent = (THcShower*) GetParent(); fParent = (THcShower*) GetParent();
if (fParent->fdbg_init_cal) // Find the number of elements
cout << " Getting value of SHOWER!!!" << parname << endl;
fNelem = fParent->GetNBlocks(fLayerNum-1); fNelem = fParent->GetNBlocks(fLayerNum-1);
if (fParent->fdbg_init_cal)
cout << "THcShowerPlane::ReadDatabase: fLayerNum=" << fLayerNum
<< " fNelem=" << fNelem << endl;
// Origin of the plane: // Origin of the plane:
// //
// X is average of top X coordinates of the top and bottom blocks // X is average of top X coordinates of the top and bottom blocks
...@@ -140,28 +117,8 @@ Int_t THcShowerPlane::ReadDatabase( const TDatime& date ) ...@@ -140,28 +117,8 @@ Int_t THcShowerPlane::ReadDatabase( const TDatime& date )
fOrigin.SetXYZ(xOrig, yOrig, zOrig); fOrigin.SetXYZ(xOrig, yOrig, zOrig);
if (fParent->fdbg_init_cal)
cout << "Origin of Layer " << fLayerNum << ": "
<< fOrigin.X() << " " << fOrigin.Y() << " " << fOrigin.Z() << endl;
// Detector axes. Assume no rotation.
//
// DefineAxes(0.); Do not work for subdetector
// fNelem = *(Int_t *)gHcParms->Find(parname)->GetValuePointer();
//
// parname[plen]='\0';
// strcat(parname,"_spacing");
//
// fSpacing = gHcParms->Find(parname)->GetValue(0);
// First letter of GetParent()->GetPrefix() tells us what prefix to
// use on parameter names.
// Find the number of elements
// Create arrays to hold results here // Create arrays to hold results here
//
// Pedestal limits per channel. // Pedestal limits per channel.
...@@ -173,17 +130,7 @@ Int_t THcShowerPlane::ReadDatabase( const TDatime& date ) ...@@ -173,17 +130,7 @@ Int_t THcShowerPlane::ReadDatabase( const TDatime& date )
fNegPedLimit[i] = fParent->GetPedLimit(i,fLayerNum-1,1); fNegPedLimit[i] = fParent->GetPedLimit(i,fLayerNum-1,1);
} }
if (fParent->fdbg_init_cal) {
cout << " fPosPedLimit:";
for(Int_t i=0;i<fNelem;i++) cout << " " << fPosPedLimit[i];
cout << endl;
cout << " fNegPedLimit:";
for(Int_t i=0;i<fNelem;i++) cout << " " << fNegPedLimit[i];
cout << endl;
}
fMinPeds = fParent->GetMinPeds(); fMinPeds = fParent->GetMinPeds();
if (fParent->fdbg_init_cal) cout << " fMinPeds = " << fMinPeds << endl;
InitializePedestals(); InitializePedestals();
...@@ -200,6 +147,29 @@ Int_t THcShowerPlane::ReadDatabase( const TDatime& date ) ...@@ -200,6 +147,29 @@ Int_t THcShowerPlane::ReadDatabase( const TDatime& date )
fEneg = new Double_t[fNelem]; fEneg = new Double_t[fNelem];
fEmean= new Double_t[fNelem]; fEmean= new Double_t[fNelem];
// Debug output.
if (fParent->fdbg_init_cal) {
cout << "---------------------------------------------------------------\n";
cout << "Debug output from THcShowerPlane::ReadDatabase\n";
cout << " Layer #" << fLayerNum << ", number of elements " << fNelem
<< endl;
cout << " Origin of Layer at X = " << fOrigin.X()
<< " Y = " << fOrigin.Y() << " Z = " << fOrigin.Z() << endl;
cout << " fPosPedLimit:";
for(Int_t i=0;i<fNelem;i++) cout << " " << fPosPedLimit[i];
cout << endl;
cout << " fNegPedLimit:";
for(Int_t i=0;i<fNelem;i++) cout << " " << fNegPedLimit[i];
cout << endl;
cout << " fMinPeds = " << fMinPeds << endl;
cout << "---------------------------------------------------------------\n";
}
return kOK; return kOK;
} }
...@@ -208,9 +178,6 @@ Int_t THcShowerPlane::DefineVariables( EMode mode ) ...@@ -208,9 +178,6 @@ Int_t THcShowerPlane::DefineVariables( EMode mode )
{ {
// Initialize global variables and lookup table for decoder // Initialize global variables and lookup table for decoder
if ( ((THcShower*) GetParent())->fdbg_init_cal )
cout << "THcShowerPlane::DefineVariables called " << GetName() << endl;
if( mode == kDefine && fIsSetup ) return kOK; if( mode == kDefine && fIsSetup ) return kOK;
fIsSetup = ( mode == kDefine ); fIsSetup = ( mode == kDefine );
...@@ -237,20 +204,31 @@ Int_t THcShowerPlane::DefineVariables( EMode mode ) ...@@ -237,20 +204,31 @@ Int_t THcShowerPlane::DefineVariables( EMode mode )
//_____________________________________________________________________________ //_____________________________________________________________________________
void THcShowerPlane::Clear( Option_t* ) void THcShowerPlane::Clear( Option_t* )
{ {
if ( ((THcShower*) GetParent())->fdbg_decoded_cal )
cout << " Calling THcShowerPlane::Clear " << GetName() << endl;
// Clears the hit lists // Clears the hit lists
fPosADCHits->Clear(); fPosADCHits->Clear();
fNegADCHits->Clear(); fNegADCHits->Clear();
// Debug output.
if ( ((THcShower*) GetParent())->fdbg_decoded_cal ) {
cout << "---------------------------------------------------------------\n";
cout << "Debug output from THcShowerPlane::Clear\n";
cout << " Cleared ADC hits for plane " << GetName() << endl;
cout << "---------------------------------------------------------------\n";
}
} }
//_____________________________________________________________________________ //_____________________________________________________________________________
Int_t THcShowerPlane::Decode( const THaEvData& evdata ) Int_t THcShowerPlane::Decode( const THaEvData& evdata )
{ {
// Doesn't actually get called. Use Fill method instead // Doesn't actually get called. Use Fill method instead
if ( ((THcShower*) GetParent())->fdbg_decoded_cal )
cout << " Calling THcShowerPlane::Decode " << GetName() << endl; //Debug output.
if ( ((THcShower*) GetParent())->fdbg_decoded_cal ) {
cout << "---------------------------------------------------------------\n";
cout << "Debug output from THcShowerPlane::Decode\n";
cout << " Called for plane " << GetName() << endl;
cout << "---------------------------------------------------------------\n";
}
return 0; return 0;
} }
...@@ -262,9 +240,6 @@ Int_t THcShowerPlane::CoarseProcess( TClonesArray& tracks ) ...@@ -262,9 +240,6 @@ Int_t THcShowerPlane::CoarseProcess( TClonesArray& tracks )
// Nothing is done here. See ProcessHits method instead. // Nothing is done here. See ProcessHits method instead.
// //
if ( ((THcShower*) GetParent())->fdbg_tracks_cal )
cout << "THcShowerPlane::CoarseProcess called --------------------" << endl;
return 0; return 0;
} }
...@@ -284,10 +259,7 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) ...@@ -284,10 +259,7 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit)
THcShower* fParent; THcShower* fParent;
fParent = (THcShower*) GetParent(); fParent = (THcShower*) GetParent();
if (fParent->fdbg_decoded_cal) // Initialize variables.
cout << "THcShowerPlane::ProcessHits called ----" << endl;
// Initialize variable.
Int_t nPosADCHits=0; Int_t nPosADCHits=0;
Int_t nNegADCHits=0; Int_t nNegADCHits=0;
...@@ -315,18 +287,9 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) ...@@ -315,18 +287,9 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit)
Int_t ihit = nexthit; Int_t ihit = nexthit;
if (fParent->fdbg_decoded_cal)
{
cout << " nrawhits = " << nrawhits << endl;
cout << " nexthit = " << nexthit << endl;
}
while(ihit < nrawhits) { while(ihit < nrawhits) {
THcRawShowerHit* hit = (THcRawShowerHit *) rawhits->At(ihit); THcRawShowerHit* hit = (THcRawShowerHit *) rawhits->At(ihit);
if (fParent->fdbg_decoded_cal)
cout << " fplane = " << hit->fPlane << " Num = " << fLayerNum << endl;
// This is OK as far as the hit list is sorted by layer. // This is OK as far as the hit list is sorted by layer.
// //
if(hit->fPlane > fLayerNum) { if(hit->fPlane > fLayerNum) {
...@@ -382,8 +345,44 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) ...@@ -382,8 +345,44 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit)
ihit++; ihit++;
} }
if (fParent->fdbg_decoded_cal) //Debug output.
cout << "THcShowerPlane::ProcessHits return ----" << endl;
if (fParent->fdbg_decoded_cal) {
cout << "---------------------------------------------------------------\n";
cout << "Debug output from THcShowerPlane::ProcessHits\n";
cout << " nrawhits = " << nrawhits << " nexthit = " << nexthit << endl;
cout << " Sparsified hits for HMS calorimeter plane #" << fLayerNum
<< ", " << GetName() << ":" << endl;
Int_t nspar = 0;
for (Int_t jhit = nexthit; jhit < nrawhits; jhit++) {
THcRawShowerHit* hit = (THcRawShowerHit *) rawhits->At(jhit);
if(hit->fPlane > fLayerNum) {
break;
}
if(hit->fADC_pos > fPosThresh[hit->fCounter -1] ||
hit->fADC_neg > fNegThresh[hit->fCounter -1]) {
cout << " plane = " << hit->fPlane
<< " counter = " << hit->fCounter
<< " Emean = " << fEmean[hit->fCounter-1]
<< " Epos = " << fEpos[hit->fCounter-1]
<< " Eneg = " << fEneg[hit->fCounter-1]
<< endl;
nspar++;
}
}
if (nspar == 0) cout << " No hits\n";
cout << " Eplane = " << fEplane
<< " Eplane_pos = " << fEplane_pos
<< " Eplane_neg = " << fEplane_neg
<< endl;
cout << "---------------------------------------------------------------\n";
}
return(ihit); return(ihit);
} }
...@@ -396,18 +395,11 @@ Int_t THcShowerPlane::AccumulatePedestals(TClonesArray* rawhits, Int_t nexthit) ...@@ -396,18 +395,11 @@ Int_t THcShowerPlane::AccumulatePedestals(TClonesArray* rawhits, Int_t nexthit)
Int_t nrawhits = rawhits->GetLast()+1; Int_t nrawhits = rawhits->GetLast()+1;
if ( ((THcShower*) GetParent())->fdbg_raw_cal )
cout << "THcShowerPlane::AcculatePedestals " << fLayerNum << " "
<< nexthit << "/" << nrawhits << endl;
Int_t ihit = nexthit; Int_t ihit = nexthit;
while(ihit < nrawhits) { while(ihit < nrawhits) {
THcRawShowerHit* hit = (THcRawShowerHit *) rawhits->At(ihit); THcRawShowerHit* hit = (THcRawShowerHit *) rawhits->At(ihit);
if ( ((THcShower*) GetParent())->fdbg_raw_cal )
cout << "fPlane = " << hit->fPlane << " Limit = " << fLayerNum << endl;
// OK for hit list sorted by layer. // OK for hit list sorted by layer.
if(hit->fPlane > fLayerNum) { if(hit->fPlane > fLayerNum) {
break; break;
...@@ -437,6 +429,35 @@ Int_t THcShowerPlane::AccumulatePedestals(TClonesArray* rawhits, Int_t nexthit) ...@@ -437,6 +429,35 @@ Int_t THcShowerPlane::AccumulatePedestals(TClonesArray* rawhits, Int_t nexthit)
fNPedestalEvents++; fNPedestalEvents++;
// Debug output.
if ( ((THcShower*) GetParent())->fdbg_raw_cal ) {
cout << "---------------------------------------------------------------\n";
cout << "Debug output from THcShowerPlane::AcculatePedestals\n";
cout << "Processed hit list for plane " << GetName() << ":\n";
for (Int_t ih=nexthit; ih<nrawhits; ih++) {
THcRawShowerHit* hit = (THcRawShowerHit *) rawhits->At(ih);
// OK for hit list sorted by layer.
if(hit->fPlane > fLayerNum) {
break;
}
cout << " hit " << ih << ":"
<< " plane = " << hit->fPlane
<< " counter = " << hit->fCounter
<< " ADCpos = " << hit->fADC_pos
<< " ADCneg = " << hit->fADC_neg
<< endl;
}
cout << "---------------------------------------------------------------\n";
}
return(ihit); return(ihit);
} }
...@@ -460,12 +481,27 @@ void THcShowerPlane::CalculatePedestals( ) ...@@ -460,12 +481,27 @@ void THcShowerPlane::CalculatePedestals( )
- fNegPed[i]*fNegPed[i]); - fNegPed[i]*fNegPed[i]);
fNegThresh[i] = fNegPed[i] + TMath::Min(50., TMath::Max(10., 3.*fNegSig[i])); fNegThresh[i] = fNegPed[i] + TMath::Min(50., TMath::Max(10., 3.*fNegSig[i]));
if ( ((THcShower*) GetParent())->fdbg_raw_cal )
cout << "Ped&Thr: " << fPosPed[i] << " " << fPosThresh[i] << " "
<< fNegPed[i] << " " << fNegThresh[i] << " " << i+1 << endl;
} }
// if ( ((THcShower*) GetParent())->fdbg_raw_cal ) cout << " " << endl; // Debug output.
if ( ((THcShower*) GetParent())->fdbg_raw_cal ) {
cout << "---------------------------------------------------------------\n";
cout << "Debug output from THcShowerPlane::CalculatePedestals\n";
cout << " ADC pedestals and thresholds for HMS calorimeter plane "
<< GetName() << endl;
for(Int_t i=0; i<fNelem;i++) {
cout << " element " << i << ": "
<< " Pos. pedestal = " << fPosPed[i]
<< " Pos. threshold = " << fPosThresh[i]
<< " Neg. pedestal = " << fNegPed[i]
<< " Neg. threshold = " << fNegThresh[i]
<< endl;
}
cout << "---------------------------------------------------------------\n";
}
} }
......
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