Skip to content
Snippets Groups Projects
Commit aa38543f authored by Zafar Ahmed's avatar Zafar Ahmed Committed by Stephen A. Wood
Browse files

THcHodoscope and THcCherenkov FineProcess additions

  Adds tests to THcHodoscope fiducial tracking efficiency
  Adds tests to THcCherenkov for Cerenkov efficiency
parent daaa9221
No related branches found
No related tags found
No related merge requests found
......@@ -166,7 +166,7 @@ Int_t THcCherenkov::ReadDatabase( const TDatime& date )
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
fNPMT = new Int_t[fNelem];
fADC = new Double_t[fNelem];
......@@ -178,10 +178,40 @@ Int_t THcCherenkov::ReadDatabase( const TDatime& date )
fPedLimit = new Int_t[fNelem];
fPedMean = new Double_t[fNelem];
fNPMT = new Int_t[fNelem];
fADC = new Double_t[fNelem];
fADC_P = new Double_t[fNelem];
fNPE = new Double_t[fNelem];
fCerWidth = new Double_t[fNelem];
fGain = new Double_t[fNelem];
fPedLimit = new Int_t[fNelem];
fPedMean = new Double_t[fNelem];
fCerNRegions = 3; // This value should be in parameter file
fCerTrackCounter = new Int_t [fCerNRegions];
fCerFiredCounter = new Int_t [fCerNRegions];
for ( Int_t ireg = 0; ireg < fCerNRegions; ireg++ ) {
fCerTrackCounter[ireg] = 0;
fCerFiredCounter[ireg] = 0;
}
fCerRegionsValueMax = fCerNRegions * 8; // This value 8 should also be in paramter file
fCerRegionValue = new Double_t [fCerRegionsValueMax];
DBRequest list[]={
{"cer_adc_to_npe", fGain, kDouble, (UInt_t) fNelem}, // Ahmed
{"cer_ped_limit", fPedLimit, kInt, (UInt_t) fNelem}, // Ahmed
{"cer_width", fCerWidth, kDouble, (UInt_t) fNelem}, // Ahmed
{"cer_chi2max", &fCerChi2Max, kDouble}, // Ahmed
{"cer_beta_min", &fCerBetaMin, kDouble}, // Ahmed
{"cer_beta_max", &fCerBetaMax, kDouble}, // Ahmed
{"cer_et_min", &fCerETMin, kDouble}, // Ahmed
{"cer_et_max", &fCerETMax, kDouble}, // Ahmed
{"cer_mirror_zpos", &fCerMirrorZPos, kDouble}, // Ahmed
{"cer_region", &fCerRegionValue[0], kDouble, fCerRegionsValueMax}, // Ahmed
{"cer_threshold", &fCerThresh, kDouble}, // Ahmed
{0}
};
......@@ -189,6 +219,14 @@ Int_t THcCherenkov::ReadDatabase( const TDatime& date )
fIsInit = true;
for ( int i1 = 0; i1 < fCerNRegions; i1++ ) {
cout << "Region " << i1 << endl;
for ( int i2 = 0; i2 < 8; i2++ ) {
cout << fCerRegionValue[GetCerIndex( i1, i2 )] << " ";
}
cout <<endl;
}
// Create arrays to hold pedestal results
InitializePedestals();
......@@ -217,6 +255,8 @@ Int_t THcCherenkov::DefineVariables( EMode mode )
{"npe", "Number of Photo electrons", "fNPE"},
{"npesum", "Sum of Number of Photo electrons", "fNPEsum"},
{"ncherhit", "Number of Hits(Cherenkov)", "fNCherHit"},
{"certrackcounter", "Tracks inside Cherenkov region", "fCerTrackCounter"},
{"cerfiredcounter", "Tracks with engough Cherenkov NPEs ", "fCerFiredCounter"},
{ 0 }
};
......@@ -287,31 +327,6 @@ Int_t THcCherenkov::ApplyCorrections( void )
//_____________________________________________________________________________
Int_t THcCherenkov::CoarseProcess( TClonesArray& ) //tracks
{
/*
------------------------------------------------------------------------------------------------------------------
h_trans_cer.f code:
hcer_num_hits = 0 <--- clear event
do tube=1,hcer_num_mirrors
hcer_npe(tube) = 0. <--- clear event
hcer_adc(tube) = 0. <--- clear event
enddo
hcer_npe_sum = 0. <--- clear event
do nhit = 1, hcer_tot_hits <--- loop over total hits. Very first line of this method
tube = hcer_tube_num(nhit) <--- tube is number of PMT on either side and it is this
line: Int_t npmt = hit->fCounter - 1
hcer_adc(tube) = hcer_raw_adc(nhit) - hcer_ped(tube) <--- This is done above:
fA_Pos_p[npmt] = hit->fADC_pos - fPosPedMean[npmt];
fA_Neg_p[npmt] = hit->fADC_neg - fNegPedMean[npmt];
if (hcer_adc(tube) .gt. hcer_width(tube)) then <--- This needs to convert in hcana
hcer_num_hits = hcer_num_hits + 1
hcer_tube_num(hcer_num_hits) = tube
hcer_npe(tube) = hcer_adc(tube) * hcer_adc_to_npe(tube)
hcer_npe_sum = hcer_npe_sum + hcer_npe(tube)
endif
enddo
------------------------------------------------------------------------------------------------------------------
*/
for(Int_t ihit=0; ihit < fNhits; ihit++) {
THcCherenkovHit* hit = (THcCherenkovHit *) fRawHitList->At(ihit); // nhit = 1, hcer_tot_hits
......@@ -354,6 +369,65 @@ Int_t THcCherenkov::CoarseProcess( TClonesArray& ) //tracks
Int_t THcCherenkov::FineProcess( TClonesArray& tracks )
{
Double_t fCerX, fCerY;
if ( tracks.GetLast() > -1 ) {
THaTrack* theTrack = dynamic_cast<THaTrack*>( tracks.At(0) );
if (!theTrack) return -1;
if ( ( ( tracks.GetLast() + 1 ) == 1 ) &&
( theTrack->GetChi2()/theTrack->GetNDoF() > 0. ) &&
( theTrack->GetChi2()/theTrack->GetNDoF() < fCerChi2Max ) &&
( theTrack->GetBeta() > fCerBetaMin ) &&
( theTrack->GetBeta() < fCerBetaMax ) &&
( ( theTrack->GetEnergy() / theTrack->GetP() ) > fCerETMin ) &&
( ( theTrack->GetEnergy() / theTrack->GetP() ) < fCerETMax )
) {
fCerX = theTrack->GetX() + theTrack->GetTheta() * fCerMirrorZPos;
fCerY = theTrack->GetY() + theTrack->GetPhi() * fCerMirrorZPos;
for ( Int_t ir = 0; ir < fCerNRegions; ir++ ) {
// * hit must be inside the region in order to continue.
if ( ( TMath::Abs( fCerRegionValue[GetCerIndex( ir, 0 )] - fCerX ) <
fCerRegionValue[GetCerIndex( ir, 4 )] ) &&
( TMath::Abs( fCerRegionValue[GetCerIndex( ir, 1 )] - fCerY ) <
fCerRegionValue[GetCerIndex( ir, 5 )] ) &&
( TMath::Abs( fCerRegionValue[GetCerIndex( ir, 2 )] - theTrack->GetTheta() ) <
fCerRegionValue[GetCerIndex( ir, 6 )] ) &&
( TMath::Abs( fCerRegionValue[GetCerIndex( ir, 3 )] - theTrack->GetPhi() ) <
fCerRegionValue[GetCerIndex( ir, 7 )] )
) {
// * increment the 'should have fired' counters
fCerTrackCounter[ir] ++;
// * increment the 'did fire' counters
if ( fNPEsum > fCerThresh ) {
fCerFiredCounter[ir] ++;
}
}
// if ( fCerEvent > 5880 ) {
// cout << "Event = " << fCerEvent
// << " region = " << ir + 1
// << " track counter = " << fCerTrackCounter[ir]
// << " fired coutner = " << fCerFiredCounter[ir]
// << endl;
// }
} // loop over regions
// cout << endl;
}
}
return 0;
}
......@@ -431,6 +505,14 @@ void THcCherenkov::CalculatePedestals( )
// cout << " " << endl;
}
//_____________________________________________________________________________
Int_t THcCherenkov::GetCerIndex( Int_t nRegion, Int_t nValue ) {
return fCerNRegions * nValue + nRegion;
}
//_____________________________________________________________________________
void THcCherenkov::Print( const Option_t* opt) const {
THaNonTrackingDetector::Print(opt);
......
......@@ -36,6 +36,8 @@ class THcCherenkov : public THaNonTrackingDetector, public THcHitList {
virtual void Print(const Option_t* opt) const;
Int_t GetCerIndex(Int_t nRegion, Int_t nValue);
THcCherenkov(); // for ROOT I/O
protected:
Int_t fAnalyzePedestals;
......@@ -53,6 +55,19 @@ class THcCherenkov : public THaNonTrackingDetector, public THcHitList {
Double_t fNPEsum; // [fNelem] Array of ADC amplitudes
Double_t fNCherHit; // [fNelem] Array of ADC amplitudes
Double_t* fCerRegionValue;
Double_t fCerChi2Max;
Double_t fCerBetaMin;
Double_t fCerBetaMax;
Double_t fCerETMin;
Double_t fCerETMax;
Double_t fCerMirrorZPos;
Int_t fCerNRegions;
Int_t fCerRegionsValueMax;
Int_t* fCerTrackCounter; // [fCerNRegions] Array of Cher regions
Int_t* fCerFiredCounter; // [fCerNRegions] Array of Cher regions
Double_t fCerThresh;
// Hits
TClonesArray* fADCHits;
......
This diff is collapsed.
......@@ -18,6 +18,7 @@
#include "THaTrackingDetector.h"
#include "THcHitList.h"
#include "THcRawDCHit.h"
#include "THcSpacePoint.h"
#include "THcDriftChamberPlane.h"
#include "THcDriftChamber.h"
......@@ -70,7 +71,7 @@ public:
Int_t GetGoodRawPad(Int_t iii){return fTOFCalc[iii].good_raw_pad;}
Double_t GetNScinHits(Int_t iii){return fNScinHits[iii];}
UInt_t GetNPaddles(Int_t iii) { return fNPaddle[iii];}
Int_t GetNPaddles(Int_t iii) { return fNPaddle[iii];}
Double_t GetPlaneCenter(Int_t iii) { return fPlaneCenter[iii];}
Double_t GetPlaneSpacing(Int_t iii) { return fPlaneSpacing[iii];}
......@@ -104,15 +105,13 @@ protected:
// Per-event data
// Potential Hall C parameters. Mostly here for demonstration
Int_t fNPlanes;
UInt_t fMaxScinPerPlane,fMaxHodoScin; // number of planes; max number of scin/plane; product of the first two
Int_t fNPlanes,fMaxScinPerPlane,fMaxHodoScin; // number of planes; max number of scin/plane; product of the first two
Double_t fStartTimeCenter, fStartTimeSlop, fScinTdcToTime;
Double_t fTofTolerance;
Double_t fPathLengthCentral;
Double_t fScinTdcMin, fScinTdcMax; // min and max TDC values
char** fPlaneNames;
UInt_t* fNPaddle; // Number of paddles per plane
Int_t* fNPaddle; // Number of paddles per plane
Double_t* fHodoVelLight;
Double_t* fHodoPosSigma;
......@@ -162,7 +161,26 @@ protected:
Double_t* fPlaneCenter;
Double_t* fPlaneSpacing;
Double_t** fScinHit; // [fNPlanes] Array
Int_t fTestSum;
Int_t fTrackEffTestNScinPlanes;
Int_t fGoodScinHits;
Int_t* fxLoScin;
Int_t* fxHiScin;
Int_t* fyLoScin;
Int_t* fyHiScin;
Int_t fNHodoscopes;
Int_t fHitSweet1X;
Int_t fHitSweet1Y;
Int_t fHitSweet2X;
Int_t fHitSweet2Y;
Int_t fSweet1XScin;
Int_t fSweet1YScin;
Int_t fSweet2XScin;
Int_t fSweet2YScin;
// Double_t** fScinHit; // [fNPlanes] Array
Double_t* fFPTime; // [fNPlanes] Array
......@@ -232,9 +250,15 @@ protected:
// This doesn't work because we clear this structure each track
// Do we need an vector of vectors of structures?
// Start with a separate vector of vectors for now.
std::vector<std::vector<Double_t> > fdEdX; // Vector over track #
std::vector<Int_t > fNScinHit; // # scins hit for the track
std::vector<std::vector<Double_t> > fdEdX; // Vector over track #
std::vector<Int_t > fNScinHit; // # scins hit for the track
std::vector<std::vector<Double_t> > fScinHitPaddle; // Vector over hits in a plane #
std::vector<Int_t > fNClust; // # scins clusters for the plane
std::vector<Int_t > fThreeScin; // # scins three clusters for the plane
std::vector<Int_t > fGoodScinHitsX; // # hits in fid x range
// Could combine the above into a structure
//
void ClearEvent();
void DeleteArrays();
......
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