diff --git a/examples/hitmaps.C b/examples/hitmaps_hms.C similarity index 100% rename from examples/hitmaps.C rename to examples/hitmaps_hms.C diff --git a/examples/hitmaps_sos.C b/examples/hitmaps_sos.C new file mode 100644 index 0000000000000000000000000000000000000000..2e7f220bbfd77141423f860348b00a76bcd0da21 --- /dev/null +++ b/examples/hitmaps_sos.C @@ -0,0 +1,39 @@ +{ + TFile* f = new TFile("hodtest.root"); + + TCanvas *c1 = new TCanvas("c1", "SOS Scintillator Hit Maps", 800, 800); + c1->Divide(2, 4); + + TH1F* h[16]; + + h[0] = spostdc1; + h[1] = snegtdc1; + h[4] = spostdc2; + h[5] = snegtdc2; + h[8] = spostdc3; + h[9] = snegtdc3; + h[12] = spostdc4; + h[13] = snegtdc4; + + h[2] = sposadc1; + h[3] = snegadc1; + h[6] = sposadc2; + h[7] = snegadc2; + h[10] = sposadc3; + h[11] = snegadc3; + h[14] = sposadc4; + h[15] = snegadc4; + + for(Int_t ipad=1;ipad<=8;ipad++) { + TPad *pt = c1->cd(ipad); + Int_t ihp = 2*(ipad-1); + Int_t ihn = ihp+1; + h[ihp]->SetFillColor(kGreen); + h[ihp]->SetFillStyle(3345); + h[ihp]->Draw(); + h[ihn]->SetFillColor(kBlue); + h[ihn]->SetFillStyle(3354); + h[ihn]->Draw("same"); + } + +} diff --git a/examples/hodtest.C b/examples/hodtest.C index dcf776a5d6a3e067cd6d3eb4296829624ed51cf0..9a09d917c57cc757ae4bf717e62b81826ac6d5bb 100644 --- a/examples/hodtest.C +++ b/examples/hodtest.C @@ -72,7 +72,7 @@ // Eventually need to learn to skip over, or properly analyze // the pedestal events - run->SetEventRange(1,5000);// Physics Event number, does not + run->SetEventRange(1,100000);// Physics Event number, does not // include scaler or control events // Define the analysis parameters diff --git a/examples/output.def b/examples/output.def index 1f5853b69544d0e7997f44aa39ee3a6e88edba8c..39c60f174f0a828985af15839ba75e83e7a0b73f 100644 --- a/examples/output.def +++ b/examples/output.def @@ -177,6 +177,26 @@ TH1F hs2yfptime 'HODO s2y fptime' H.hod.2y.fptime 80 0 80 H.hod.hgoodstarttime TH1F starttime 'HODO start time' H.hod.starttime 80 0 80 H.hod.hgoodstarttime #SOS +# TDC hits per paddle +TH1F spostdc1 'SOS s1x+ TDC hits' S.hod.1x.postdchits 9 0.5 9.5 +TH1F snegtdc1 'SOS s1x- TDC hits' S.hod.1x.negtdchits 9 0.5 9.5 +TH1F spostdc2 'SOS s1y+ TDC hits' S.hod.1y.postdchits 9 0.5 9.5 +TH1F snegtdc2 'SOS s1y- TDC hits' S.hod.1y.negtdchits 9 0.5 9.5 +TH1F spostdc3 'SOS s2x+ TDC hits' S.hod.2x.postdchits 16 0.5 16.5 +TH1F snegtdc3 'SOS s2x- TDC hits' S.hod.2x.negtdchits 16 0.5 16.5 +TH1F spostdc4 'SOS s2y+ TDC hits' S.hod.2y.postdchits 9 0.5 9.5 +TH1F snegtdc4 'SOS s2y- TDC hits' S.hod.2y.negtdchits 9 0.5 9.5 + +# ADC hits per paddle +TH1F sposadc1 'SOS s1x+ ADC hits' S.hod.1x.posadchits 9 0.5 9.5 +TH1F snegadc1 'SOS s1x- ADC hits' S.hod.1x.negadchits 9 0.5 9.5 +TH1F sposadc2 'SOS s1y+ ADC hits' S.hod.1y.posadchits 9 0.5 9.5 +TH1F snegadc2 'SOS s1y- ADC hits' S.hod.1y.negadchits 9 0.5 9.5 +TH1F sposadc3 'SOS s2x+ ADC hits' S.hod.2x.posadchits 16 0.5 16.5 +TH1F snegadc3 'SOS s2x- ADC hits' S.hod.2x.negadchits 16 0.5 16.5 +TH1F sposadc4 'SOS s2y+ ADC hits' S.hod.2y.posadchits 9 0.5 9.5 +TH1F snegadc4 'SOS s2y- ADC hits' S.hod.2y.negadchits 9 0.5 9.5 + TH1F sdc1u1_wm 'SDC 1U1 Wiremap' S.dc.1u1.tdchits 48 0.5 48.5 TH1F sdc1u2_wm 'SDC 1U2 Wiremap' S.dc.1u2.tdchits 48 0.5 48.5 TH1F sdc1x1_wm 'SDC 1X1 Wiremap' S.dc.1x1.tdchits 64 0.5 64.5 diff --git a/src/THcAerogel.cxx b/src/THcAerogel.cxx index 60f92df71cdd542ce9652b29b1cad7329a510012..8d5e47b6672a4693fe11cfb07256e0d4ae7fe2ca 100644 --- a/src/THcAerogel.cxx +++ b/src/THcAerogel.cxx @@ -80,7 +80,7 @@ THaAnalysisObject::EStatus THcAerogel::Init( const TDatime& date ) // Should probably put this in ReadDatabase as we will know the // maximum number of hits after setting up the detector map - THcHitList::InitHitList(fDetMap, "THcAerogelHit", 100); + InitHitList(fDetMap, "THcAerogelHit", 100); EStatus status; if( (status = THaNonTrackingDetector::Init( date )) ) @@ -237,7 +237,7 @@ void THcAerogel::Clear(Option_t* opt) Int_t THcAerogel::Decode( const THaEvData& evdata ) { // Get the Hall C style hitlist (fRawHitList) for this event - fNhits = THcHitList::DecodeToHitList(evdata); + fNhits = DecodeToHitList(evdata); if(gHaCuts->Result("Pedestal_event")) { diff --git a/src/THcAerogelHit.h b/src/THcAerogelHit.h index 0c8ac63327be3dcfbcbe809f055da216e86c0b0d..49ddd246adb84eecf18c6214fb2e12e05bb2026d 100644 --- a/src/THcAerogelHit.h +++ b/src/THcAerogelHit.h @@ -6,12 +6,13 @@ class THcAerogelHit : public THcHodoscopeHit { public: + friend class THcAerogel; protected: private: - ClassDef(THcAerogelHit,0); // Aerogel hit class + ClassDef(THcAerogelHit,0); // Raw Aerogel hit }; #endif diff --git a/src/THcAnalyzer.cxx b/src/THcAnalyzer.cxx index 6c97bba481b5793e99d0a1a9568d61d7053fee0e..6d3f0c9fd92b9d609b5c47cc239b4ea7d5708b0c 100644 --- a/src/THcAnalyzer.cxx +++ b/src/THcAnalyzer.cxx @@ -61,8 +61,10 @@ THcAnalyzer::~THcAnalyzer() //_____________________________________________________________________________ void THcAnalyzer::PrintReport(const char* templatefile, const char* ofile) { - // Copy template to ofile, replacing {stuff} with the evaluated - // value of stuff. + // Generate "reports" such as end of run scaler/efficiency sheets + // Reads a template file, copying that file to the output, replacing + // variables and expressions inside of braces ({}) with evaluated values. + // Similar but not identical to ENGINE/CTP report templates. ifstream ifile; ifile.open(templatefile); @@ -139,9 +141,12 @@ void THcAnalyzer::PrintReport(const char* templatefile, const char* ofile) //_____________________________________________________________________________ void THcAnalyzer::LoadInfo() { - // Copy some run information into gHcParms variables so that in can - // be used in reports. - // For example run number, first event analyzed, number of events, etc. + // Create several THcParms variables in gHcParms containing + // run information such as + // run number, first event analyzed, number of events, etc. + // gen_run_number - Current run + // gen_run_starting_event - Id of first event analyzed + // gen_event_id_number - Id of last event analyzed Int_t* runnum; Int_t* firstevent; Int_t* lastevent; diff --git a/src/THcCherenkov.cxx b/src/THcCherenkov.cxx index c486b2a2108852e7444590d093a0b8a12dd176a3..5587a54c3a50baaa1a4e345c350cea433e37cb35 100644 --- a/src/THcCherenkov.cxx +++ b/src/THcCherenkov.cxx @@ -4,7 +4,14 @@ // // // Class for an Cherenkov detector consisting of onw pair of PMT's // // // -// Zafar Ahmed. Second attempt. November 14 2013. // +// Zafar Ahmed. Updated on December 24 2013. // +// Four more variables are added. // +// // +// npe Total Number of photo electrons // +// hit_1 Total hits in adc 1 // +// hit_2 Total hits in adc 2 // +// hit Total hits in adc 1 and 2 // +// // // Comment:No need to cahnge the Map file but may need to change the parameter file // // // // This code is written for following variables: // @@ -88,7 +95,7 @@ THaAnalysisObject::EStatus THcCherenkov::Init( const TDatime& date ) // Should probably put this in ReadDatabase as we will know the // maximum number of hits after setting up the detector map - THcHitList::InitHitList(fDetMap, "THcCherenkovHit", 100); // 100 is max hits + InitHitList(fDetMap, "THcCherenkovHit", 100); // 100 is max hits EStatus status; if( (status = THaNonTrackingDetector::Init( date )) ) @@ -155,12 +162,16 @@ Int_t THcCherenkov::DefineVariables( EMode mode ) // No. They show up in tree as Ndata.H.aero.postdchits for example RVarDef vars[] = { - {"adc_1", "Raw First ADC Amplitudes", "fA_1"}, - {"adc_2", "Raw Second ADC Amplitudes", "fA_2"}, - {"adc_p_1", "Raw First ADC Amplitudes", "fA_p_1"}, - {"adc_p_2", "Raw Second ADC Amplitudes", "fA_p_2"}, - {"npe_1","PEs First Tube", "fNpe_1"}, - {"npe_2","PEs Second Tube","fNpe_2"}, + {"adc_1", "Raw First ADC Amplitude", "fA_1"}, + {"adc_2", "Raw Second ADC Amplitude", "fA_2"}, + {"adc_p_1", "Pedestal Subtracted First ADC Amplitude", "fA_p_1"}, + {"adc_p_2", "Pedestal Subtracted Second ADC Amplitude", "fA_p_2"}, + {"npe_1", "PEs of First Tube", "fNpe_1"}, + {"npe_2", "PEs of Second Tube", "fNpe_2"}, + {"npe", "Total number of PEs", "fNpe"}, + {"hit_1", "ADC hits First Tube", "fNHits_1"}, + {"hit_2", "ADC hits Second Tube", "fNHits_2"}, + {"hit", "Total ADC hits", "fNHits"}, {"posadchits", "List of Positive ADC hits","fPosADCHits.THcSignalHit.GetPaddleNumber()"}, { 0 } }; @@ -184,6 +195,10 @@ void THcCherenkov::Clear(Option_t* opt) fA_p_2 = 0; fNpe_1 = 0; fNpe_2 = 0; + fNpe = 0; + fNHits_1 = 0; + fNHits_2 = 0; + fNHits = 0; } @@ -191,7 +206,7 @@ void THcCherenkov::Clear(Option_t* opt) Int_t THcCherenkov::Decode( const THaEvData& evdata ) { // Get the Hall C style hitlist (fRawHitList) for this event - fNhits = THcHitList::DecodeToHitList(evdata); + fNhits = DecodeToHitList(evdata); if(gHaCuts->Result("Pedestal_event")) { @@ -259,6 +274,7 @@ Int_t THcCherenkov::CoarseProcess( TClonesArray& ) //tracks enddo ------------------------------------------------------------------------------------------------------------------ */ + for(Int_t ihit=0; ihit < fNhits; ihit++) { THcCherenkovHit* hit = (THcCherenkovHit *) fRawHitList->At(ihit); // nhit = 1, hcer_tot_hits @@ -280,6 +296,7 @@ Int_t THcCherenkov::CoarseProcess( TClonesArray& ) //tracks fA_p_1 = hit->fADC_pos - fPosPedMean[npmt]; if ( ( fA_p_1 > 50 ) && ( hit->fADC_pos < 8000 ) ) { fNpe_1 = fPosGain[npmt]*fA_p_1; + fNHits_1 ++; } else if ( hit->fADC_pos > 8000 ) { fNpe_1 = 100.0; } else { @@ -292,14 +309,26 @@ Int_t THcCherenkov::CoarseProcess( TClonesArray& ) //tracks fA_p_2 = hit->fADC_pos - fPosPedMean[npmt]; if ( ( fA_p_2 > 50 ) && ( hit->fADC_pos < 8000 ) ) { fNpe_2 = fPosGain[npmt]*fA_p_2; + fNHits_2 ++; } else if ( hit->fADC_pos > 8000 ) { fNpe_2 = 100.0; } else { fNpe_2 = 0.0; } } + + if ( npmt == 0 ) { + fNpe += fNpe_1; + fNHits += fNHits_1; + } + + if ( npmt == 1 ) { + fNpe += fNpe_2; + fNHits += fNHits_2; + } + } - + ApplyCorrections(); return 0; diff --git a/src/THcCherenkov.h b/src/THcCherenkov.h index 135a8b6705f26706096b8dc9806f90df460272ed..4040a56e54056154d27831e17dd32c1e4e026c10 100644 --- a/src/THcCherenkov.h +++ b/src/THcCherenkov.h @@ -52,14 +52,16 @@ class THcCherenkov : public THaNonTrackingDetector, public THcHitList { Float_t* fT_Pos; // [fNelem] Array of TDCs Float_t* fT_Neg; // [fNelem] Array of TDCs - Float_t fA_1; // Ahmed - Float_t fA_2; // Ahmed - Float_t fA_p_1; // Ahmed - Float_t fA_p_2; // Ahmed - Double_t fNpe_1; // Ahmed - Double_t fNpe_2; // Ahmed - Int_t fNHits_1; // Ahmed - Int_t fNHits_2; // Ahmed + Double_t fA_1; // Ahmed + Double_t fA_2; // Ahmed + Double_t fNHits_1; // Ahmed + Double_t fNHits_2; // Ahmed + Double_t fNHits; // Ahmed + Double_t fA_p_1; // Ahmed + Double_t fA_p_2; // Ahmed + Double_t fNpe_1; // Ahmed + Double_t fNpe_2; // Ahmed + Double_t fNpe; // Ahmed Double_t fPosNpeSum; Double_t fNegNpeSum; diff --git a/src/THcCherenkovHit.h b/src/THcCherenkovHit.h index 67ef4c13c1e0a344a06803a581d81b869d79e426..63a0aab95b7faf61220b5709bfc5d50f7eed1919 100644 --- a/src/THcCherenkovHit.h +++ b/src/THcCherenkovHit.h @@ -6,12 +6,13 @@ class THcCherenkovHit : public THcHodoscopeHit { public: + friend class THcCherenkov; protected: private: - ClassDef(THcCherenkovHit,0); // Cherenkov hit class + ClassDef(THcCherenkovHit,0); // Raw Cherenkov hit }; #endif diff --git a/src/THcDC.cxx b/src/THcDC.cxx index be89cfc5f2c3f65137b51c0336d7a99c5b06a37e..63199d525b6b534a8fafb6e4f1531ff6931fdd15 100644 --- a/src/THcDC.cxx +++ b/src/THcDC.cxx @@ -170,7 +170,7 @@ THaAnalysisObject::EStatus THcDC::Init( const TDatime& date ) // Should probably put this in ReadDatabase as we will know the // maximum number of hits after setting up the detector map - THcHitList::InitHitList(fDetMap, "THcRawDCHit", 1000); + InitHitList(fDetMap, "THcRawDCHit", 1000); EStatus status; // This triggers call of ReadDatabase and DefineVariables @@ -427,7 +427,7 @@ Int_t THcDC::Decode( const THaEvData& evdata ) Int_t num_event = evdata.GetEvNum(); if (fdebugprintrawdc ||fdebugprintdecodeddc || fdebuglinkstubs || fdebugtrackprint) cout << " event num = " << num_event << endl; // Get the Hall C style hitlist (fRawHitList) for this event - fNhits = THcHitList::DecodeToHitList(evdata); + fNhits = DecodeToHitList(evdata); // Let each plane get its hits Int_t nexthit = 0; @@ -1017,6 +1017,7 @@ Double_t THcDC::DpsiFun(Double_t ray[4], Int_t plane) Int_t THcDC::End(THaRunBase* run) { // EffCalc(); + return 0; } //_____________________________________________________________________________ diff --git a/src/THcDC.h b/src/THcDC.h index 68ea8072538fb3fa7112d25aac64a30987c23bfc..05d5def06181cd6bed17bdba9c9716f418e0e693 100644 --- a/src/THcDC.h +++ b/src/THcDC.h @@ -173,7 +173,7 @@ protected: void Setup(const char* name, const char* description); void PrintSpacePoints(); - ClassDef(THcDC,0) // Drift Chamber class + ClassDef(THcDC,0) // Set of Drift Chambers detector }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/THcDCHit.h b/src/THcDCHit.h index 80302bd549954fb18dd65c1dd315d0b6ffcef71b..c5ca7a74d3e14038ab2fc037cfd7bc31be6adee5 100644 --- a/src/THcDCHit.h +++ b/src/THcDCHit.h @@ -78,7 +78,7 @@ private: THcDCHit( const THcDCHit& ); THcDCHit& operator=( const THcDCHit& ); - ClassDef(THcDCHit,2) // VDCHit class + ClassDef(THcDCHit,2) // Drift Chamber Hit }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/THcDCLookupTTDConv.h b/src/THcDCLookupTTDConv.h index e1bbea121d91a039e4b477ceabc0c75895bc438e..3d6157436ddca4ab5150af81744fa6e831ef7b23 100644 --- a/src/THcDCLookupTTDConv.h +++ b/src/THcDCLookupTTDConv.h @@ -29,7 +29,7 @@ protected: Int_t fNumBins; Double_t* fTable; - ClassDef(THcDCLookupTTDConv,0) // VDC Analytic TTD Conv class + ClassDef(THcDCLookupTTDConv,0) // Time to Distance conversion lookup }; diff --git a/src/THcDCTimeToDistConv.h b/src/THcDCTimeToDistConv.h index 960a5c373c8396a57c593c8657df78430d70bc2d..2ff706206455a2e40d4ed6b8cfa574fc1145b800 100644 --- a/src/THcDCTimeToDistConv.h +++ b/src/THcDCTimeToDistConv.h @@ -24,7 +24,7 @@ private: THcDCTimeToDistConv( const THcDCTimeToDistConv& ); THcDCTimeToDistConv& operator=( const THcDCTimeToDistConv& ); - ClassDef(THcDCTimeToDistConv,0) // DCTimeToDistConv class + ClassDef(THcDCTimeToDistConv,0) // Time to Distance conversion base class }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/THcDCTrack.h b/src/THcDCTrack.h index a9b84c6fbf4ee6ab8392baf357fbfdd44e2cd81f..cc97ff1c03c7e924bef06e537b78be51417e3c43 100644 --- a/src/THcDCTrack.h +++ b/src/THcDCTrack.h @@ -85,6 +85,6 @@ private: THcDCTrack( const THcDCTrack& ); THcDCTrack& operator=( const THcDCTrack& ); - ClassDef(THcDCTrack,0) // DCTrack class + ClassDef(THcDCTrack,0) // Full Drift Chamber track }; #endif diff --git a/src/THcDCWire.h b/src/THcDCWire.h index 0e3ce6dce6122392e1e54f4e965b7b797861b529..53f6fcbe39e317c450dfb8440b59c72cfd14c027 100644 --- a/src/THcDCWire.h +++ b/src/THcDCWire.h @@ -43,7 +43,7 @@ private: THcDCWire( const THcDCWire& ); THcDCWire& operator=( const THcDCWire& ); - ClassDef(THcDCWire,0) // VDCWire class + ClassDef(THcDCWire,0) // Drift Chamber Wire class }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/THcDetectorMap.cxx b/src/THcDetectorMap.cxx index 187c465db60946ed96919af5618a3ad64b04bf61..a4ff120c9cc6dfe477596163af65859494b52acd 100644 --- a/src/THcDetectorMap.cxx +++ b/src/THcDetectorMap.cxx @@ -4,12 +4,8 @@ // // THcDetectorMap // -// Class to read and hold Hall C style detector map -// -// Will need method to retrieve all map entries for a given -// detector id. -// -// Not sure we will keep this class, but still need the parsing of the map file +// Class to read and Hall C style detector map +// FillMap method builds a map for a specific detector // ////////////////////////////////////////////////////////////////////////// @@ -54,8 +50,11 @@ struct Functor }; //_____________________________________________________________________________ Int_t THcDetectorMap::FillMap(THaDetMap *detmap, const char *detectorname) -// Should probably return a status { + // Build a DAQ hardware to detector element map for detector detectorname + // Reads through the entire list of mappings, adding one element to + // detmap for each electronics channel that maps to detectorname. + list<ModChanList>::iterator imod; list<ChaninMod>::iterator ichan; ChaninMod Achan; @@ -171,8 +170,35 @@ Int_t THcDetectorMap::FillMap(THaDetMap *detmap, const char *detectorname) return(0); } +//_____________________________________________________________________________ void THcDetectorMap::Load(const char *fname) { +// Load a Hall C ENGINE style detector map file. The map file maps +// a given roc, slot/module, and channel # into a given detector id#, plane +// number, counter number and signal type. The mapping between detector +// names and ids is found in the comments at the begging of the map file. +// This method looks for those comments, of the form: +// XXX_ID = n +// to establish that mapping between detector name and detector ID. +// +// Lines of the form +// DETECTOR = n +// ROC = n +// SLOT = n +// are used to establish the module (roc and slot) and the detector +// for the mapping lines that follow. +// The actual mappings are of the form +// subadd, plane, counter [, signal] +// Each of these lines, combined with the detector, roc, slot values +// establish the roc, slot, subadess -> detector, plane, counter#, sigtype map +// Other lines that may be in the map file are +// NSUBADD = n +// BSUB = n +// MASK = hex value +// These define characteristics of the electronics module (# channels, +// The bit number specifying the location of the subaddress in a data word +// and hex mask that the data word is anded with to retrieve data) + static const char* const whtspc = " \t"; ifstream ifile; diff --git a/src/THcDetectorMap.h b/src/THcDetectorMap.h index 1dd95b2471267ffd7dee8ef096caf6e381b2091b..420f7de84400227c5352079a1a88d4b938e5d8de 100644 --- a/src/THcDetectorMap.h +++ b/src/THcDetectorMap.h @@ -60,7 +60,7 @@ class THcDetectorMap : public TObject { protected: - ClassDef(THcDetectorMap,0); + ClassDef(THcDetectorMap,0); // Map electronics channels to Detector, Plane, Counter, Signal }; #endif diff --git a/src/THcDriftChamber.cxx b/src/THcDriftChamber.cxx index 69f0c75cbded9475653eec9b4958d992a1d834e5..9d7f93612fcd16844da7d837cf9eca983230b6ec 100644 --- a/src/THcDriftChamber.cxx +++ b/src/THcDriftChamber.cxx @@ -309,7 +309,8 @@ Int_t THcDriftChamber::FindSpacePoints( void ) if(fHMSStyleChambers) { if(fRemove_Sppt_If_One_YPlane == 1) { // The routine is specific to HMS - Int_t ndest=DestroyPoorSpacePoints(); // Only for HMS? + //Int_t ndest= + DestroyPoorSpacePoints(); // Only for HMS? // Loop over space points and remove those with less than 4 planes // hit and missing hits in Y,Y' planes } @@ -855,7 +856,7 @@ void THcDriftChamber::ChooseSingleHit() // Gather the remaining hits Int_t finalnum = 0; for(Int_t ihit=0;ihit<startnum;ihit++) { - THcDCHit* hit = sp->GetHit(ihit); + //THcDCHit* hit = sp->GetHit(ihit); // if (fhdebugflagpr) cout << " good hit = "<< ihit << " " << goodhit[ihit] << " time = " << hit->GetTime() << endl; if(goodhit[ihit] > 0) { // Keep this hit if (ihit > finalnum) { // Move hit @@ -910,7 +911,7 @@ void THcDriftChamber::SelectSpacePoints() //if (fhdebugflagpr) cout << " sp pt = " << isp+1 << " # of hits = " << sp->GetNHits() << endl; for(Int_t ihit=0;ihit<sp->GetNHits();ihit++) { THcDCHit* hit = sp->GetHit(ihit); - THcDriftChamberPlane* plane=hit->GetWirePlane(); + //THcDriftChamberPlane* plane=hit->GetWirePlane(); // if (fhdebugflagpr) cout << ihit+1 << "selecting " << plane->GetPlaneNum() << " " << plane->GetChamberNum() << " " << hit->GetTime() << " " << hit->GetDist() << " " << plane->GetCentralTime() << " " << plane->GetDriftTimeSign() << endl; } } diff --git a/src/THcDriftChamber.h b/src/THcDriftChamber.h index b77fca45ed75f682d81e0de0737e9201216f16b1..a7884461cb2e337027420deb215fc2692d7c8f77 100644 --- a/src/THcDriftChamber.h +++ b/src/THcDriftChamber.h @@ -134,7 +134,7 @@ protected: Double_t* stubcoef[4]; std::map<int,TMatrixD*> fAA3Inv; - ClassDef(THcDriftChamber,0) // Drift Chamber class + ClassDef(THcDriftChamber,0) // A single drift chamber }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/THcDriftChamberPlane.h b/src/THcDriftChamberPlane.h index d6aa10c896ab37b1bb7349a8deeab219c3ffd4ea..b7aac91b7f1b5b9f18b2ca562b8dc91a0cac3cb0 100644 --- a/src/THcDriftChamberPlane.h +++ b/src/THcDriftChamberPlane.h @@ -109,7 +109,7 @@ protected: THcHodoscope* fglHod; // Hodoscope to get start time - ClassDef(THcDriftChamberPlane,0) + ClassDef(THcDriftChamberPlane,0); // A single plane within a THcDriftChamber }; #endif diff --git a/src/THcHallCSpectrometer.h b/src/THcHallCSpectrometer.h index 19826c076097e3aef7867211e542c3c3aa2cc18c..f906546ec9c187e94ec3f607d90b2089420ae0ad 100644 --- a/src/THcHallCSpectrometer.h +++ b/src/THcHallCSpectrometer.h @@ -57,7 +57,7 @@ protected: // Flag for fProperties indicating that tracks are to be sorted by chi2 static const UInt_t kSortTracks = BIT(16); - ClassDef(THcHallCSpectrometer,0) //A Hall A High Resolution Spectrometer + ClassDef(THcHallCSpectrometer,0) //A Hall C Spectrometer }; #endif diff --git a/src/THcHitList.cxx b/src/THcHitList.cxx index 4659785a0495a78dc04e5fe89c67c1d5653d0700..c133fbfbcbdd65ec5b6da0cb960460125c33af1c 100644 --- a/src/THcHitList.cxx +++ b/src/THcHitList.cxx @@ -4,9 +4,9 @@ // // THcHitList // -// Add hitlist to the Hall A detector base -// May not need to inherit from THaDetectorBase since we may end up -// replacing most of the methods +// Class to build a Hall C ENGINE style list of raw hits from the raw data. +// Detectors that use hit lists need to inherit from this class +// as well as THaTrackingDetector or THaNonTrackingDetector // ////////////////////////////////////////////////////////////////////////// @@ -30,7 +30,8 @@ THcHitList::~THcHitList() { void THcHitList::InitHitList(THaDetMap* detmap, const char *hitclass, Int_t maxhits) { - // Probably called by ReadDatabase + // Save the electronics to detector mapping + // Initialize a hit array of hits of class hitclass fRawHitList = new TClonesArray(hitclass, maxhits); fRawHitClass = fRawHitList->GetClass(); @@ -44,6 +45,14 @@ void THcHitList::InitHitList(THaDetMap* detmap, } Int_t THcHitList::DecodeToHitList( const THaEvData& evdata ) { + // Clear the hit list + // Find all populated channels belonging to the detector and add + // the data to the hitlist. A given counter in the detector can have + // at most one entry in the hit list. However, the raw "hit" can contain + // multiple signal types (e.g. ADC+, ADC-, TDC+, TDC-), or multiple + // hits for multihit tdcs. + // The hit list is sorted (by plane, counter) after filling. + THcRawHit* rawhit; // cout << " Clearing TClonesArray " << endl; fRawHitList->Clear( ); diff --git a/src/THcHitList.h b/src/THcHitList.h index 494866bcb875b326dc40d246e126a7dbc25c3383..040d4c061a70c19ef2106e06c34eaf35d1842f47 100644 --- a/src/THcHitList.h +++ b/src/THcHitList.h @@ -41,6 +41,6 @@ public: protected: - ClassDef(THcHitList,0) + ClassDef(THcHitList,0); // List of raw hits sorted by plane, counter }; #endif diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index ec2ae404beeec901017f62ce8052573a17cc4812..202b97c3944f7c6b3c6e79efbc32c99f43c877bb 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -142,7 +142,7 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date ) // But it needs to happen before the sub detectors are initialized // so that they can get the pointer to the hitlist. - THcHitList::InitHitList(fDetMap, "THcHodoscopeHit", 100); + InitHitList(fDetMap, "THcHodoscopeHit", 100); EStatus status; // This triggers call of ReadDatabase and DefineVariables @@ -162,12 +162,12 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date ) // }; // memcpy( fDataDest, tmp, NDEST*sizeof(DataDest) ); - // Will need to determine which apparatus it belongs to and use the - // appropriate detector ID in the FillMap call - if( gHcDetectorMap->FillMap(fDetMap, "HSCIN") < 0 ) { + char EngineDID[]="xSCIN"; + EngineDID[0] = toupper(GetApparatus()->GetName()[0]); + if( gHcDetectorMap->FillMap(fDetMap, EngineDID) < 0 ) { static const char* const here = "Init()"; Error( Here(here), "Error filling detectormap for %s.", - "HSCIN"); + EngineDID); return kInitError; } @@ -596,7 +596,7 @@ Int_t THcHodoscope::Decode( const THaEvData& evdata ) { // Get the Hall C style hitlist (fRawHitList) for this event - Int_t nhits = THcHitList::DecodeToHitList(evdata); + Int_t nhits = DecodeToHitList(evdata); if(gHaCuts->Result("Pedestal_event")) { Int_t nexthit = 0; diff --git a/src/THcHodoscope.h b/src/THcHodoscope.h index 7d18bc8d808b8ea6cead145c8c615e79544b0504..2c90d460172b2d0f00090210ff900c64502c9fe5 100644 --- a/src/THcHodoscope.h +++ b/src/THcHodoscope.h @@ -131,7 +131,7 @@ protected: void Setup(const char* name, const char* description); - ClassDef(THcHodoscope,0) // Generic hodoscope class + ClassDef(THcHodoscope,0) // Hodoscope detector }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/THcHodoscopeHit.h b/src/THcHodoscopeHit.h index 0bac2d1a1f9a231325dfb83a2a31e58f1ef95e67..ef88875d11635a8a696bc1ac4ffdfb6a2439e0b1 100644 --- a/src/THcHodoscopeHit.h +++ b/src/THcHodoscopeHit.h @@ -6,8 +6,9 @@ class THcHodoscopeHit : public THcRawHit { public: + friend class THcScintillatorPlane; - THcHodoscopeHit(Int_t plane=0, Int_t counter=0) : THcRawHit(plane, counter), + THcHodoscopeHit(Int_t plane=0, Int_t counter=0) : THcRawHit(plane, counter), fADC_pos(-1), fADC_neg(-1), fTDC_pos(-1), fTDC_neg(-1) { } @@ -23,16 +24,15 @@ class THcHodoscopeHit : public THcRawHit { // virtual Bool_t IsSortable () const {return kTRUE; } // virtual Int_t Compare(const TObject* obj) const; + protected: Int_t fADC_pos; Int_t fADC_neg; Int_t fTDC_pos; Int_t fTDC_neg; - protected: - private: - ClassDef(THcHodoscopeHit, 0); // Hodoscope hit class + ClassDef(THcHodoscopeHit, 0); // Raw Hodoscope hit }; #endif diff --git a/src/THcParmList.cxx b/src/THcParmList.cxx index d75c690c11fa07a916eed61a8f1867af33b24579..a645b9328ccfc58f65b410704299da7c003e122a 100644 --- a/src/THcParmList.cxx +++ b/src/THcParmList.cxx @@ -42,6 +42,17 @@ inline static bool IsComment( const string& s, string::size_type pos ) void THcParmList::Load( const char* fname, Int_t RunNumber ) { + // Read a CTP style parameter file. + // + // Parameter values and arrays of values are cached in a THaVarList + // and are available for use elsewhere in the analyzer. + // Text strings are saved in a THaTextvars list. + // Parameter files can contain "include" statements of the form + // #include "filename" + // + // If a run number is given, ignore input until a line with a matching + // run number or run number range is found. All parameters following + // the are read until a non matching run number or range is encountered. static const char* const whtspc = " \t"; @@ -420,6 +431,8 @@ Int_t THcParmList::LoadParmValues(const DBRequest* list, const char* prefix) // must be given, and the memory already allocated // NOTE: initial code taken wholesale from THaDBFile. // GN 2012 + // If prefix is specified, prepend each requested parameter name with + // the prefix. const DBRequest *ti = list; Int_t cnt=0; @@ -561,6 +574,8 @@ Int_t THcParmList::ReadArray(const char* attrC, T* array, Int_t size) //_____________________________________________________________________________ void THcParmList::PrintFull( Option_t* option ) const { + // Print all the numeric parameter desciptions and values. + // Print all the text parameters THaVarList::PrintFull(option); TextList->Print(); } diff --git a/src/THcRawDCHit.h b/src/THcRawDCHit.h index 4eb2c55ad9755ce6a179807c415e38bd8dbe408f..5e077878e66b710a68183ce8618a465d0ba98ffb 100644 --- a/src/THcRawDCHit.h +++ b/src/THcRawDCHit.h @@ -8,6 +8,8 @@ class THcRawDCHit : public THcRawHit { public: + friend class THcDriftChamberPlane; + friend class THcDC; THcRawDCHit(Int_t plane=0, Int_t counter=0) : THcRawHit(plane, counter), fNHits(0) { @@ -24,14 +26,14 @@ public: virtual Bool_t IsSortable () const {return kTRUE; } virtual Int_t Compare(const TObject* obj) const; - Int_t fNHits; - Int_t fTDC[MAXHITS]; protected: + Int_t fNHits; + Int_t fTDC[MAXHITS]; private: - ClassDef(THcRawDCHit, 0); // DC hit class + ClassDef(THcRawDCHit, 0); // Raw Drift Chamber hit }; #endif diff --git a/src/THcRawHit.cxx b/src/THcRawHit.cxx index 3e37972a189932d7dd987a50bcbdf8ec59388f37..e2cd54e6116145954a70011f6c9888519cec4dd6 100644 --- a/src/THcRawHit.cxx +++ b/src/THcRawHit.cxx @@ -10,12 +10,10 @@ #include "THcRawHit.h" -//THcRawHit::~THcRawHit() -//{} Int_t THcRawHit::Compare(const TObject* obj) const { - // Compare to sort by plane and counter + // Comparision function for Sort(). const THcRawHit* hit = dynamic_cast<const THcRawHit*>(obj); diff --git a/src/THcRawHit.h b/src/THcRawHit.h index 7372463c724a5e66229e48ad9bfb3b3bf270a6af..1ee7d16431cc7d2d6e95b32e2750e5ccdabdf3f4 100644 --- a/src/THcRawHit.h +++ b/src/THcRawHit.h @@ -39,7 +39,7 @@ public: private: - ClassDef(THcRawHit,0) // Track ID abstract base class + ClassDef(THcRawHit,0) // Raw Hit Base Class }; #endif diff --git a/src/THcRawShowerHit.h b/src/THcRawShowerHit.h index 1671ddcbfcc7645315c2e99e7440c1b40927d067..76f0d140a5cae64d1dbff7ce837d276ee6da002f 100644 --- a/src/THcRawShowerHit.h +++ b/src/THcRawShowerHit.h @@ -6,8 +6,9 @@ class THcRawShowerHit : public THcRawHit { public: + friend class THcShowerPlane; - THcRawShowerHit(Int_t plane=0, Int_t counter=0) : THcRawHit(plane, counter), + THcRawShowerHit(Int_t plane=0, Int_t counter=0) : THcRawHit(plane, counter), fADC_pos(-1), fADC_neg(-1){ } THcRawShowerHit& operator=( const THcRawShowerHit& ); @@ -22,14 +23,13 @@ class THcRawShowerHit : public THcRawHit { // virtual Bool_t IsSortable () const {return kTRUE; } // virtual Int_t Compare(const TObject* obj) const; + protected: Int_t fADC_pos; Int_t fADC_neg; - protected: - private: - ClassDef(THcRawShowerHit, 0); // Shower hit class + ClassDef(THcRawShowerHit, 0); // Raw Shower counter hit }; #endif diff --git a/src/THcScintillatorPlane.h b/src/THcScintillatorPlane.h index cb832fa7dd0975bf1eb0d064e6e6cb91a2e60cfb..9b5f33e5cc5a40300b3c93bfc7e7755d2ccb1bc1 100644 --- a/src/THcScintillatorPlane.h +++ b/src/THcScintillatorPlane.h @@ -113,7 +113,7 @@ class THcScintillatorPlane : public THaSubDetector { virtual Int_t DefineVariables( EMode mode = kDefine ); virtual void InitializePedestals( ); - ClassDef(THcScintillatorPlane,0) + ClassDef(THcScintillatorPlane,0); // Scintillator bars in a plane }; #endif diff --git a/src/THcShower.cxx b/src/THcShower.cxx index 67c2ca0ef61d301fdb93e5c0542957b4b7dcdc5a..2047500b70ba5a58635c99363448b27371a4cf89 100644 --- a/src/THcShower.cxx +++ b/src/THcShower.cxx @@ -111,7 +111,7 @@ THaAnalysisObject::EStatus THcShower::Init( const TDatime& date ) // Should probably put this in ReadDatabase as we will know the // maximum number of hits after setting up the detector map - THcHitList::InitHitList(fDetMap, "THcRawShowerHit", 100); + InitHitList(fDetMap, "THcRawShowerHit", 100); EStatus status; if( (status = THaNonTrackingDetector::Init( date )) ) @@ -514,7 +514,7 @@ Int_t THcShower::Decode( const THaEvData& evdata ) Clear(); // Get the Hall C style hitlist (fRawHitList) for this event - Int_t nhits = THcHitList::DecodeToHitList(evdata); + Int_t nhits = DecodeToHitList(evdata); if(gHaCuts->Result("Pedestal_event")) { Int_t nexthit = 0; diff --git a/src/THcShower.h b/src/THcShower.h index 4286a8252b1b169efb2b52fd473c49adf22a7b44..89e6c053558b36af11955fd09c1ed7f41838f587 100644 --- a/src/THcShower.h +++ b/src/THcShower.h @@ -197,7 +197,7 @@ protected: friend class THcShowerPlane; //to access debug flags. - ClassDef(THcShower,0) // Generic class + ClassDef(THcShower,0) // Shower counter detector }; /////////////////////////////////////////////////////////////////////////////// diff --git a/src/THcShowerPlane.h b/src/THcShowerPlane.h index 8cb7e141d6c2cf355d56a25a50f62dc98a3f1356..41fecdfcb29768015bca2e7ec96828da94a01e8b 100644 --- a/src/THcShowerPlane.h +++ b/src/THcShowerPlane.h @@ -147,6 +147,6 @@ protected: virtual Int_t ReadDatabase( const TDatime& date ); virtual Int_t DefineVariables( EMode mode = kDefine ); virtual void InitializePedestals( ); - ClassDef(THcShowerPlane,0) + ClassDef(THcShowerPlane,0); // Calorimeter bars in a plane }; #endif diff --git a/src/THcSignalHit.h b/src/THcSignalHit.h index 6af80a6e68a203261d306336022d015a237a71cf..808c730b287d256ade1d35f8dab854c9c0445d7f 100644 --- a/src/THcSignalHit.h +++ b/src/THcSignalHit.h @@ -29,7 +29,7 @@ class THcSignalHit : public TObject { Int_t fPaddleNumber; Double_t fData; - ClassDef(THcSignalHit,0) + ClassDef(THcSignalHit,0); // Single signal value and wire/counter number }; ///////////////////////////////////////////////////////////////// #endif diff --git a/src/THcSpacePoint.h b/src/THcSpacePoint.h index bf63699e881b5d921b4aefea52ec1d3d7518d4c1..36faa3d347b911c4728e5baab1422ba3459b9b92 100644 --- a/src/THcSpacePoint.h +++ b/src/THcSpacePoint.h @@ -84,7 +84,7 @@ protected: Double_t fStub[4]; // Should we also have a pointer back to the chamber object - ClassDef(THcSpacePoint,0) // Drift Chamber class + ClassDef(THcSpacePoint,0); // Space Point/stub track in a single drift chamber }; ////////////////////////////////////////////////////////////////////////////////