diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d2f0c250c4c481bc6e0b111864b1e3d17e2f16c..26e4570d9dbfbc1e6cd4680dcc87539e9b49b418 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5) -project(hcana VERSION 1.2.0 LANGUAGES CXX) +project(hcana VERSION 1.3.0 LANGUAGES CXX) option(HCANA_BUILTIN_PODD "Use built-in Podd submodule (default: YES)" OFF) diff --git a/containers/docker/Dockerfile b/containers/docker/Dockerfile index 4a28aeb5209a8437d4d1d93deb7aeed913bb7a74..50cde706f4b8337506f0e71e5dc10abc6b083083 100644 --- a/containers/docker/Dockerfile +++ b/containers/docker/Dockerfile @@ -24,7 +24,7 @@ RUN ls -lrth /usr/local/lib/lib*.so \ && export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH \ && export PATH=/usr/local/bin:$PATH \ && git clone https://eicweb.phy.anl.gov/jlab/hallc/analyzer_software/analyzer.git \ - && mkdir analyzer/build && cd analyzer/build && git pull \ + && mkdir analyzer/build && cd analyzer/build && git pull && git checkout v1.3-dev\ && cmake ../. && make -j20 VERBOSE=1 && make install \ && cd /tmp && rm -rf analyzer \ && git clone https://eicweb.phy.anl.gov/jlab/hcana.git \ diff --git a/src/THcHelicityScaler.cxx b/src/THcHelicityScaler.cxx index 5a4d5c7d85671529bd87696785dea7c47739f4cb..13423a6cc88269cffa2c8c9ec9220d9939e29d19 100644 --- a/src/THcHelicityScaler.cxx +++ b/src/THcHelicityScaler.cxx @@ -13,31 +13,35 @@ ~~~ \author */ +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <iomanip> +#include <iostream> +#include <iterator> +#include <sstream> +#include <unordered_map> + +#include "TMath.h" +#include "TNamed.h" +#include "TROOT.h" +#include "TString.h" //#include "THaEvtTypeHandler.h" -#include "THcHelicityScaler.h" -#include "Helper.h" #include "THaCodaData.h" #include "THaEvData.h" #include "THaGlobals.h" -#include "THaVarList.h" #include "THcGlobals.h" #include "THcHelicity.h" +#include "THcHelicityScaler.h" #include "THcParmList.h" -#include "TMath.h" -#include "TNamed.h" -#include "TROOT.h" -#include "TString.h" + + +#include "Helper.h" +#include "THaVarList.h" #include "VarDef.h" #include "nlohmann/json.hpp" -#include <cstdio> -#include <cstdlib> -#include <cstring> -#include <iomanip> -#include <iostream> -#include <iterator> -#include <sstream> -#include <unordered_map> + using nlohmann::json; using namespace std; @@ -87,576 +91,482 @@ Int_t THcHelicityScaler::End(THaRunBase* runbase) { fDelayedEvents.size()); for (auto it = fDelayedEvents.begin(); it != fDelayedEvents.end(); ++it) { - cout << "THcHelicityScaler::End Analyzing " << fDelayedEvents.size() - << " delayed helicity scaler events" << endl; - for (std::vector<UInt_t*>::iterator it = fDelayedEvents.begin(); it != fDelayedEvents.end(); - ++it) { - UInt_t* rdata = *it; - AnalyzeBuffer(rdata); - } - - for (auto it = fDelayedEvents.begin(); it != fDelayedEvents.end(); ++it) { - delete[] * it; - } - fDelayedEvents.clear(); + UInt_t* rdata = *it; + AnalyzeBuffer(rdata); + } - // cout << " -- Helicity Scalers -- " << endl; - for (Int_t i = 0; i < fNScalerChannels; i++) { - if (fScalerSums[i] > 0.5) { - fAsymmetry[i] = (fHScalers[0][i] - fHScalers[1][i]) / fScalerSums[i]; - fAsymmetryError[i] = 2 * TMath::Sqrt(fHScalers[0][i] * fHScalers[1][i] * fScalerSums[i]) / - (fScalerSums[i] * fScalerSums[i]); - } else { - fAsymmetry[i] = 0.0; - fAsymmetryError[i] = 0.0; - } - // printf("%2d %12.0f %12.0f %12.0f %12.8f\n",i,fScalerSums[i], - // fHScalers[0][i],fHScalers[1][i], - // fAsymmetry[i]); - } - // cout << " ---------------------- " << endl; - // json dump of helicity charge info - json j_helicity; - int run_number = runbase->GetNumber(); - j_helicity["run_number"] = run_number; - - // Compute Charge Asymmetries - std::map<std::string, Int_t> bcmindex; - bcmindex["BCM1"] = 0; - bcmindex["BCM2"] = 2; - // bcmindex["Unser"] = 6; - bcmindex["BCM4A"] = 10; - bcmindex["BCM4B"] = 4; - bcmindex["BCM4C"] = 12; - // bcmindex["1MHz"] = 8; - Int_t clockindex = 8; - Double_t clockfreq = 1000000.0; - - Double_t pclock = fHScalers[0][clockindex]; - Double_t mclock = fHScalers[1][clockindex]; - param_logger->info("{}: -- Beam Charge Asymmetries -- ", here); - for (Int_t i = 0; i < fNumBCMs; i++) { - if (bcmindex.find(fBCM_Name[i]) != bcmindex.end()) { - Int_t index = bcmindex[fBCM_Name[i]]; - Double_t pcounts = fHScalers[0][index]; - Double_t mcounts = fHScalers[1][index]; - // cout << index << " " << fBCM_Name[i] << " " << pcounts << " " << mcounts - // << " " << fBCM_Gain[i] - // << " " << fBCM_Offset[i] << endl; - Double_t pcharge = (pcounts - (pclock / clockfreq) * fBCM_Offset[i]) / fBCM_Gain[i]; - Double_t mcharge = (mcounts - (mclock / clockfreq) * fBCM_Offset[i]) / fBCM_Gain[i]; - fCharge[i] = pcharge + mcharge; - if (fCharge[i] > 0.0) { - fChargeAsymmetry[i] = (pcharge - mcharge) / fCharge[i]; - } else { - fChargeAsymmetry[i] = 0.0; - } - _param_logger->info("{:10} {:12.2f} uC {:12.2f} ppm", fBCM_Name[i], fCharge[i], - fChargeAsymmetry[i] * 1e6); - j_helicity[fBCM_Name[i]] = {{"charge", fCharge[i]}, - {"charge_asymmetry", fChargeAsymmetry[i]}}; - } - } + for (auto it = fDelayedEvents.begin(); it != fDelayedEvents.end(); ++it) { + delete[] * it; + } + fDelayedEvents.clear(); - fTime = (pclock + mclock) / clockfreq; - if (pclock + mclock > 0) { - fTimeAsymmetry = (pclock - mclock) / (pclock + mclock); - } else { - fTimeAsymmetry = 0.0; - } - j_helicity["clock"] = {{"time", fTime}, {"time_asymmetry", fTimeAsymmetry}}; - _param_logger->info("{:10} {:12.2f} uC {:12.8f} ppm", "TIME(s)", fTime, fTimeAsymmetry); - if (fNTriggersPlus + fNTriggersMinus > 0) { - fTriggerAsymmetry = - ((Double_t)(fNTriggersPlus - fNTriggersMinus)) / (fNTriggersPlus + fNTriggersMinus); + // cout << " -- Helicity Scalers -- " << endl; + for (Int_t i = 0; i < fNScalerChannels; i++) { + if (fScalerSums[i] > 0.5) { + fAsymmetry[i] = (fHScalers[0][i] - fHScalers[1][i]) / fScalerSums[i]; + fAsymmetryError[i] = 2 * TMath::Sqrt(fHScalers[0][i] * fHScalers[1][i] * fScalerSums[i]) / + (fScalerSums[i] * fScalerSums[i]); } else { - fTriggerAsymmetry = 0.0; + fAsymmetry[i] = 0.0; + fAsymmetryError[i] = 0.0; } - j_helicity["triggers"] = {{"N_triggers", fTime}, {"trigger_asymmetry", fTriggerAsymmetry}}; - _param_logger->info("{}: -- Beam Charge Asymmetries End --", here); - - { - std::ofstream json_output_file(fmt::format("hel_scalers_{}.json", run_number)); - json_output_file << std::setw(4) << j_helicity << "\n"; + // printf("%2d %12.0f %12.0f %12.0f %12.8f\n",i,fScalerSums[i], + // fHScalers[0][i],fHScalers[1][i], + // fAsymmetry[i]); + } + // cout << " ---------------------- " << endl; + // json dump of helicity charge info + json j_helicity; + int run_number = runbase->GetNumber(); + j_helicity["run_number"] = run_number; + + // Compute Charge Asymmetries + std::map<std::string, Int_t> bcmindex; + bcmindex["BCM1"] = 0; + bcmindex["BCM2"] = 2; + // bcmindex["Unser"] = 6; + bcmindex["BCM4A"] = 10; + bcmindex["BCM4B"] = 4; + bcmindex["BCM4C"] = 12; + // bcmindex["1MHz"] = 8; + Int_t clockindex = 8; + Double_t clockfreq = 1000000.0; + + Double_t pclock = fHScalers[0][clockindex]; + Double_t mclock = fHScalers[1][clockindex]; + _param_logger->info("{}: -- Beam Charge Asymmetries -- ", here); + for (Int_t i = 0; i < fNumBCMs; i++) { + if (bcmindex.find(fBCM_Name[i]) != bcmindex.end()) { + Int_t index = bcmindex[fBCM_Name[i]]; + Double_t pcounts = fHScalers[0][index]; + Double_t mcounts = fHScalers[1][index]; + // cout << index << " " << fBCM_Name[i] << " " << pcounts << " " << mcounts + // << " " << fBCM_Gain[i] + // << " " << fBCM_Offset[i] << endl; + Double_t pcharge = (pcounts - (pclock / clockfreq) * fBCM_Offset[i]) / fBCM_Gain[i]; + Double_t mcharge = (mcounts - (mclock / clockfreq) * fBCM_Offset[i]) / fBCM_Gain[i]; + fCharge[i] = pcharge + mcharge; + if (fCharge[i] > 0.0) { + fChargeAsymmetry[i] = (pcharge - mcharge) / fCharge[i]; + } else { + fChargeAsymmetry[i] = 0.0; + } + _param_logger->info("{:10} {:12.2f} uC {:12.2f} ppm", fBCM_Name[i], fCharge[i], + fChargeAsymmetry[i] * 1e6); + j_helicity[fBCM_Name[i]] = {{"charge", fCharge[i]}, + {"charge_asymmetry", fChargeAsymmetry[i]}}; } + } - return 0; + fTime = (pclock + mclock) / clockfreq; + if (pclock + mclock > 0) { + fTimeAsymmetry = (pclock - mclock) / (pclock + mclock); + } else { + fTimeAsymmetry = 0.0; + } + j_helicity["clock"] = {{"time", fTime}, {"time_asymmetry", fTimeAsymmetry}}; + _param_logger->info("{:10} {:12.2f} uC {:12.8f} ppm", "TIME(s)", fTime, fTimeAsymmetry); + if (fNTriggersPlus + fNTriggersMinus > 0) { + fTriggerAsymmetry = + ((Double_t)(fNTriggersPlus - fNTriggersMinus)) / (fNTriggersPlus + fNTriggersMinus); + } else { + fTriggerAsymmetry = 0.0; } + j_helicity["triggers"] = {{"N_triggers", fTime}, {"trigger_asymmetry", fTriggerAsymmetry}}; + _param_logger->info("{}: -- Beam Charge Asymmetries End --", here); - Int_t THcHelicityScaler::ReadDatabase(const TDatime& date) { - char prefix[2]; - prefix[0] = 'g'; - prefix[1] = '\0'; - - fNumBCMs = 0; - string bcm_namelist; - DBRequest list[] = { - {"NumBCMs", &fNumBCMs, kInt, 0, 1}, {"BCM_Names", &bcm_namelist, kString}, {0}}; - gHcParms->LoadParmValues((DBRequest*)&list, prefix); - if (fNumBCMs > 0) { - fBCM_Gain.resize(fNumBCMs); - fBCM_Offset.resize(fNumBCMs); - DBRequest list2[] = {{"BCM_Gain", &fBCM_Gain[0], kDouble, (UInt_t)fNumBCMs}, - {"BCM_Offset", &fBCM_Offset[0], kDouble, (UInt_t)fNumBCMs}, - {0}}; - gHcParms->LoadParmValues((DBRequest*)&list2, prefix); - fBCM_Name = vsplit(bcm_namelist); - } - return kOK; + { + std::ofstream json_output_file(fmt::format("hel_scalers_{}.json", run_number)); + json_output_file << std::setw(4) << j_helicity << "\n"; } - void THcHelicityScaler::SetDelayedType(int evtype) { - /** - * \brief Delay analysis of this event type to end. - * - * Final scaler events generated in readout list end routines may not - * come in order in the data stream. If the event type of a end routine - * scaler event is set, then the event contents will be saved and analyzed - * at the end of the analysis so that time ordering of scaler events is preserved. - */ - fDelayedType = evtype; + + return 0; +} + +Int_t THcHelicityScaler::ReadDatabase(const TDatime& date) { + char prefix[2]; + prefix[0] = 'g'; + prefix[1] = '\0'; + + fNumBCMs = 0; + string bcm_namelist; + DBRequest list[] = { + {"NumBCMs", &fNumBCMs, kInt, 0, 1}, {"BCM_Names", &bcm_namelist, kString}, {0}}; + gHcParms->LoadParmValues((DBRequest*)&list, prefix); + if (fNumBCMs > 0) { + fBCM_Gain.resize(fNumBCMs); + fBCM_Offset.resize(fNumBCMs); + DBRequest list2[] = {{"BCM_Gain", &fBCM_Gain[0], kDouble, (UInt_t)fNumBCMs}, + {"BCM_Offset", &fBCM_Offset[0], kDouble, (UInt_t)fNumBCMs}, + {0}}; + gHcParms->LoadParmValues((DBRequest*)&list2, prefix); + fBCM_Name = vsplit(bcm_namelist); } + return kOK; +} +void THcHelicityScaler::SetDelayedType(int evtype) { + /** + * \brief Delay analysis of this event type to end. + * + * Final scaler events generated in readout list end routines may not + * come in order in the data stream. If the event type of a end routine + * scaler event is set, then the event contents will be saved and analyzed + * at the end of the analysis so that time ordering of scaler events is preserved. + */ + fDelayedType = evtype; +} - Int_t THcHelicityScaler::Analyze(THaEvData * evdata) { +Int_t THcHelicityScaler::Analyze(THaEvData* evdata) { - if (!IsMyEvent(evdata->GetEvType())) - return -1; + if (!IsMyEvent(evdata->GetEvType())) + return -1; - if (fDebugFile) { - *fDebugFile << endl << "---------------------------------- " << endl << endl; - *fDebugFile << "\nEnter THcHelicityScaler for fName = " << fName << endl; - EvDump(evdata); - } + if (fDebugFile) { + *fDebugFile << endl << "---------------------------------- " << endl << endl; + *fDebugFile << "\nEnter THcHelicityScaler for fName = " << fName << endl; + EvDump(evdata); + } - UInt_t* rdata = (UInt_t*)evdata->GetRawDataBuffer(); - - if (evdata->GetEvType() == fDelayedType) { // Save this event for processing later - Int_t evlen = evdata->GetEvLength(); - UInt_t* datacopy = new UInt_t[evlen]; - fDelayedEvents.push_back(datacopy); - memcpy(datacopy, rdata, evlen * sizeof(UInt_t)); - return 1; - } else { // A normal event - if (fDebugFile) - *fDebugFile << "\n\nTHcHelicityScaler :: Debugging event type " << dec - << evdata->GetEvType() << " event num = " << evdata->GetEvNum() << endl - << endl; - evNumber = evdata->GetEvNum(); - Int_t ret; - if ((ret = AnalyzeBuffer(rdata))) { - // - } - return ret; + UInt_t* rdata = (UInt_t*)evdata->GetRawDataBuffer(); + + if (evdata->GetEvType() == fDelayedType) { // Save this event for processing later + Int_t evlen = evdata->GetEvLength(); + UInt_t* datacopy = new UInt_t[evlen]; + fDelayedEvents.push_back(datacopy); + memcpy(datacopy, rdata, evlen * sizeof(UInt_t)); + return 1; + } else { // A normal event + if (fDebugFile) + *fDebugFile << "\n\nTHcHelicityScaler :: Debugging event type " << dec << evdata->GetEvType() + << " event num = " << evdata->GetEvNum() << endl + << endl; + evNumber = evdata->GetEvNum(); + Int_t ret; + if ((ret = AnalyzeBuffer(rdata))) { + // } + return ret; } - Int_t THcHelicityScaler::AnalyzeBuffer(UInt_t * rdata) { - fNTrigsInBuf = 0; - const static char* const here = "THcHelicityScaler::AnalyzeBuffer"; +} +Int_t THcHelicityScaler::AnalyzeBuffer(UInt_t* rdata) { + fNTrigsInBuf = 0; + const static char* const here = "THcHelicityScaler::AnalyzeBuffer"; - // Parse the data, load local data arrays. - UInt_t* p = (UInt_t*)rdata; + // Parse the data, load local data arrays. + UInt_t* p = (UInt_t*)rdata; - UInt_t* plast = p + *p; // Index to last word in the bank - Int_t roc = -1; - Int_t evlen = *p + 1; + UInt_t* plast = p + *p; // Index to last word in the bank + Int_t roc = -1; + Int_t evlen = *p + 1; - Int_t ifound = 0; - while (p < plast) { - Int_t banklen = *p; - p++; // point to header + Int_t ifound = 0; + while (p < plast) { + Int_t banklen = *p; + p++; // point to header - if (fDebugFile) { - *fDebugFile << "Bank: " << hex << *p << dec << " len: " << *(p - 1) << endl; + if (fDebugFile) { + *fDebugFile << "Bank: " << hex << *p << dec << " len: " << *(p - 1) << endl; + } + if ((*p & 0xff00) == 0x1000) { // Bank Containing banks + if (evlen - *(p - 1) > 1) { // Don't use overall event header + roc = (*p >> 16) & 0xf; + if (fDebugFile) + *fDebugFile << "ROC: " << roc << " " << evlen << " " << *(p - 1) << hex << " " << *p + << dec << endl; + // cout << "ROC: " << roc << " " << evlen << " " << *(p-1) << hex << " " << + // *p << dec << endl; + if (roc != fROC) { // Not a ROC with helicity scaler + p += *(p - 1) - 1; // Skip to next ROC + } } - if ((*p & 0xff00) == 0x1000) { // Bank Containing banks - if (evlen - *(p - 1) > 1) { // Don't use overall event header - roc = (*p >> 16) & 0xf; - if (fDebugFile) - *fDebugFile << "ROC: " << roc << " " << evlen << " " << *(p - 1) << hex << " " << *p - << dec << endl; - // cout << "ROC: " << roc << " " << evlen << " " << *(p-1) << hex << " " << - // *p << dec << endl; - if (roc != fROC) { // Not a ROC with helicity scaler - p += *(p - 1) - 1; // Skip to next ROC + p++; // Now pointing to a bank in the bank + } else if (((*p & 0xff00) == 0x100) && (*p != 0xC0000100)) { + // Bank containing integers. Look for scalers + // This is either ROC bank containing integers or + // a bank within a ROC containing data from modules of a single type + // Look for banks with the helicity scaler bank ID (9801) + // Assume that very first word is a scaler header + // At any point in the bank where the word is not a matching + // header, we stop. + UInt_t tag = (*p >> 16) & 0xffff; // Bank ID (ROC #) + // UInt_t num = (*p) & 0xff; + UInt_t* pnext = p + banklen; // Next bank + p++; // First data word + // If the bank is not a helicity scaler bank + // or it is not one of the ROC containing helcity scaler data + // skip to the next bank + // cout << "BankID=" << tag << endl; + + if (tag != fBankID) { + p = pnext; // Fall through to end of the above else if + // cout << " Skipping to next bank" << endl; + + } else { + // This is a helicity scaler bank + if (roc == fROC) { + Int_t nevents = (banklen - 2) / fNScalerChannels; + // cout << "# of helicity events in bank:" << " " << nevents << endl; + if (nevents > 100) { + _param_logger->error("{}: Error! Beam off for too long.", here); } - } - p++; // Now pointing to a bank in the bank - } else if (((*p & 0xff00) == 0x100) && (*p != 0xC0000100)) { - // Bank containing integers. Look for scalers - // This is either ROC bank containing integers or - // a bank within a ROC containing data from modules of a single type - // Look for banks with the helicity scaler bank ID (9801) - // Assume that very first word is a scaler header - // At any point in the bank where the word is not a matching - // header, we stop. - UInt_t tag = (*p >> 16) & 0xffff; // Bank ID (ROC #) - // UInt_t num = (*p) & 0xff; - UInt_t* pnext = p + banklen; // Next bank - p++; // First data word - // If the bank is not a helicity scaler bank - // or it is not one of the ROC containing helcity scaler data - // skip to the next bank - // cout << "BankID=" << tag << endl; - - if (tag != fBankID) { - p = pnext; // Fall through to end of the above else if - // cout << " Skipping to next bank" << endl; - - } else { - // This is a helicity scaler bank - if (roc == fROC) { - Int_t nevents = (banklen - 2) / fNScalerChannels; - // cout << "# of helicity events in bank:" << " " << nevents << endl; - if (nevents > 100) { - _param_logger->error("{}: Error! Beam off for too long.", here); - } - - fNTrigsInBuf = 0; - // Save helcitiy and quad info for THcHelicity - for (Int_t iev = 0; iev < nevents; - iev++) { // find number of helicity events in each bank - Int_t index = fNScalerChannels * iev + 1; - AnalyzeHelicityScaler(p + index); - // cout << "H: " << evNumber << endl; - } + + fNTrigsInBuf = 0; + // Save helcitiy and quad info for THcHelicity + for (Int_t iev = 0; iev < nevents; iev++) { // find number of helicity events in each bank + Int_t index = fNScalerChannels * iev + 1; + AnalyzeHelicityScaler(p + index); + // cout << "H: " << evNumber << endl; } } + } - while (p < pnext) { - Int_t nskip = 0; + while (p < pnext) { + Int_t nskip = 0; + if (fDebugFile) { + *fDebugFile << "Scaler Header: " << hex << *p << dec; + } + if (nskip == 0) { if (fDebugFile) { - *fDebugFile << "Scaler Header: " << hex << *p << dec; - } - if (nskip == 0) { - if (fDebugFile) { - *fDebugFile << endl; - } - break; // Didn't find a matching header + *fDebugFile << endl; } - p = p + nskip; + break; // Didn't find a matching header } - p = pnext; - } else { - p = p + *(p - 1); // Skip to next bank + p = p + nskip; } + p = pnext; + } else { + p = p + *(p - 1); // Skip to next bank } + } - if (fDebugFile) { - *fDebugFile << "Finished with decoding. " << endl; - *fDebugFile << " Found flag = " << ifound << endl; - } - - if (!ifound) - return 0; - - return 1; + if (fDebugFile) { + *fDebugFile << "Finished with decoding. " << endl; + *fDebugFile << " Found flag = " << ifound << endl; } - Int_t THcHelicityScaler::AnalyzeHelicityScaler(UInt_t * p) { - const static char* const here = "THcHelicityScaler::AnalyzeHelicityScaler"; - Int_t hbits = (p[0] >> 30) & 0x3; // quartet and helcity bits in scaler word - Bool_t isquartet = (hbits & 2) != 0; - Int_t ispos = hbits & 1; - Int_t actualhelicity = 0; - fHelicityHistory[fNTrigsInBuf] = hbits; - fNTrigsInBuf++; - fNTriggers++; - - Int_t quartetphase = (fNTriggers - fFirstCycle) % 4; - if (fFirstCycle >= -10) { - if (quartetphase == 0) { - Int_t predicted = RanBit30(fRingSeed_reported); - fRingSeed_reported = ((fRingSeed_reported << 1) | ispos) & 0x3FFFFFFF; - // Check if ringseed_predicted agrees with reported if(fNBits>=30) - if (fNBits >= 30 && predicted != fRingSeed_reported) { - _param_logger->warn("{}: Helicity Prediction Failed, Reported {:32b}, Predicted {:32b}", - here, fRingSeed_reported, predicted); - } - fNBits++; - if (fNBits == 30) { - _param_logger->info("{}: A {:32b} found at cycle {}", here, fRingSeed_reported, - fNTriggers); - } - } else if (quartetphase == 3) { - if (!isquartet) { - _param_logger->warn("{}: Quartet bit expected but not set ({})", here, fNTriggers); - fNBits = 0; - fRingSeed_reported = 0; - fRingSeed_actual = 0; - fFirstCycle = -100; - } - } - } else { // First cycle not yet identified - if (isquartet) { // Helicity and quartet signal for next set of scalers - fFirstCycle = fNTriggers - 3; - quartetphase = (fNTriggers - fFirstCycle) % 4; - //// Helicity at start of quartet is same as last of quartet, so we can start filling the - /// seed - fRingSeed_reported = ((fRingSeed_reported << 1) | ispos) & 0x3FFFFFFF; - fNBits++; - if (fNBits == 30) { - _param_logger->info("{}: B {:32b} fount at cycle {}", here, fRingSeed_reported, - fNTriggers); - } - } - } + if (!ifound) + return 0; - if (fNBits >= 30) { - fRingSeed_actual = RanBit30(fRingSeed_reported); - fRingSeed_actual = RanBit30(fRingSeed_actual); + return 1; +} -#define DELAY9 -#ifdef DELAY9 - if (quartetphase == 3) { - fRingSeed_actual = RanBit30(fRingSeed_actual); - actualhelicity = (fRingSeed_actual & 1) ? +1 : -1; - } else { - actualhelicity = (fRingSeed_actual & 1) ? +1 : -1; - if (quartetphase == 0 || quartetphase == 1) { - actualhelicity = -actualhelicity; - } +Int_t THcHelicityScaler::AnalyzeHelicityScaler(UInt_t* p) { + const static char* const here = "THcHelicityScaler::AnalyzeHelicityScaler"; + Int_t hbits = (p[0] >> 30) & 0x3; // quartet and helcity bits in scaler word + Bool_t isquartet = (hbits & 2) != 0; + Int_t ispos = hbits & 1; + Int_t actualhelicity = 0; + fHelicityHistory[fNTrigsInBuf] = hbits; + fNTrigsInBuf++; + fNTriggers++; + + Int_t quartetphase = (fNTriggers - fFirstCycle) % 4; + if (fFirstCycle >= -10) { + if (quartetphase == 0) { + Int_t predicted = RanBit30(fRingSeed_reported); + fRingSeed_reported = ((fRingSeed_reported << 1) | ispos) & 0x3FFFFFFF; + // Check if ringseed_predicted agrees with reported if(fNBits>=30) + if (fNBits >= 30 && predicted != fRingSeed_reported) { + _param_logger->warn("{}: Helicity Prediction Failed, Reported {:32b}, Predicted {:32b}", + here, fRingSeed_reported, predicted); } -#else - actualhelicity = (fRingSeed_actual & 1) ? +1 : -1; - if (quartetphase == 1 || quartetphase == 2) { - actualhelicity = -actualhelicity; + fNBits++; + if (fNBits == 30) { + _param_logger->info("{}: A {:32b} found at cycle {}", here, fRingSeed_reported, fNTriggers); } -#endif - } else { - fRingSeed_actual = 0; - } - - if (actualhelicity != 0) { - Int_t hindex = (actualhelicity > 0) ? 0 : 1; - (actualhelicity > 0) ? (fNTriggersPlus++) : (fNTriggersMinus++); - for (Int_t i = 0; i < fNScalerChannels; i++) { - Int_t count = p[i] & 0xFFFFFF; // Bottom 24 bits - fHScalers[hindex][i] += count; - fScalerSums[i] += count; + } else if (quartetphase == 3) { + if (!isquartet) { + _param_logger->warn("{}: Quartet bit expected but not set ({})", here, fNTriggers); + fNBits = 0; + fRingSeed_reported = 0; + fRingSeed_actual = 0; + fFirstCycle = -100; } } - return (0); - } - //_____________________________________________________________________________ - Int_t THcHelicityScaler::AnalyzeHelicityScaler(UInt_t * p) { - Int_t hbits = (p[0] >> 30) & 0x3; // quartet and helcity bits in scaler word - Bool_t isquartet = (hbits & 2) != 0; - Int_t ispos = hbits & 1; - Int_t actualhelicity = 0; - fHelicityHistory[fNTrigsInBuf] = hbits; - fNTrigsInBuf++; - fNTriggers++; - - Int_t quartetphase = (fNTriggers - fFirstCycle) % 4; - if (fFirstCycle >= -10) { - if (quartetphase == 0) { - Int_t predicted = RanBit30(fRingSeed_reported); - fRingSeed_reported = ((fRingSeed_reported << 1) | ispos) & 0x3FFFFFFF; - // Check if ringseed_predicted agrees with reported if(fNBits>=30) - if (fNBits >= 30 && predicted != fRingSeed_reported) { - cout << "THcHelicityScaler: Helicity Prediction Failed" << endl; - cout << "Reported " << bitset<32>(fRingSeed_reported) << endl; - cout << "Predicted " << bitset<32>(predicted) << endl; - } - fNBits++; - if (fNBits == 30) { - cout << "THcHelicityScaler: A " << bitset<32>(fRingSeed_reported) << " found at cycle " - << fNTriggers << endl; - } - } else if (quartetphase == 3) { - if (!isquartet) { - cout << "THcHelicityScaler: Quartet bit expected but not set (" << fNTriggers << ")" - << endl; - fNBits = 0; - fRingSeed_reported = 0; - fRingSeed_actual = 0; - fFirstCycle = -100; - } - } - } else { // First cycle not yet identified - if (isquartet) { // Helicity and quartet signal for next set of scalers - fFirstCycle = fNTriggers - 3; - quartetphase = (fNTriggers - fFirstCycle) % 4; - //// Helicity at start of quartet is same as last of quartet, so we can start filling the - /// seed - fRingSeed_reported = ((fRingSeed_reported << 1) | ispos) & 0x3FFFFFFF; - fNBits++; - if (fNBits == 30) { - cout << "THcHelicityScaler: B " << bitset<32>(fRingSeed_reported) << " found at cycle " - << fNTriggers << endl; - } + } else { // First cycle not yet identified + if (isquartet) { // Helicity and quartet signal for next set of scalers + fFirstCycle = fNTriggers - 3; + quartetphase = (fNTriggers - fFirstCycle) % 4; + //// Helicity at start of quartet is same as last of quartet, so we can start filling the + /// seed + fRingSeed_reported = ((fRingSeed_reported << 1) | ispos) & 0x3FFFFFFF; + fNBits++; + if (fNBits == 30) { + _param_logger->info("{}: B {:32b} fount at cycle {}", here, fRingSeed_reported, fNTriggers); } } + } - if (fNBits >= 30) { - fRingSeed_actual = RanBit30(fRingSeed_reported); - fRingSeed_actual = RanBit30(fRingSeed_actual); + if (fNBits >= 30) { + fRingSeed_actual = RanBit30(fRingSeed_reported); + fRingSeed_actual = RanBit30(fRingSeed_actual); #define DELAY9 #ifdef DELAY9 - if (quartetphase == 3) { - fRingSeed_actual = RanBit30(fRingSeed_actual); - actualhelicity = (fRingSeed_actual & 1) ? +1 : -1; - } else { - actualhelicity = (fRingSeed_actual & 1) ? +1 : -1; - if (quartetphase == 0 || quartetphase == 1) { - actualhelicity = -actualhelicity; - } - } -#else + if (quartetphase == 3) { + fRingSeed_actual = RanBit30(fRingSeed_actual); + actualhelicity = (fRingSeed_actual & 1) ? +1 : -1; + } else { actualhelicity = (fRingSeed_actual & 1) ? +1 : -1; - if (quartetphase == 1 || quartetphase == 2) { + if (quartetphase == 0 || quartetphase == 1) { actualhelicity = -actualhelicity; } -#endif - } else { - fRingSeed_actual = 0; } +#else + actualhelicity = (fRingSeed_actual & 1) ? +1 : -1; + if (quartetphase == 1 || quartetphase == 2) { + actualhelicity = -actualhelicity; + } +#endif + } else { + fRingSeed_actual = 0; + } - if (actualhelicity != 0) { - Int_t hindex = (actualhelicity > 0) ? 0 : 1; - (actualhelicity > 0) ? (fNTriggersPlus++) : (fNTriggersMinus++); - for (Int_t i = 0; i < fNScalerChannels; i++) { - Int_t count = p[i] & 0xFFFFFF; // Bottom 24 bits - fHScalers[hindex][i] += count; - fScalerSums[i] += count; - } + if (actualhelicity != 0) { + Int_t hindex = (actualhelicity > 0) ? 0 : 1; + (actualhelicity > 0) ? (fNTriggersPlus++) : (fNTriggersMinus++); + for (Int_t i = 0; i < fNScalerChannels; i++) { + Int_t count = p[i] & 0xFFFFFF; // Bottom 24 bits + fHScalers[hindex][i] += count; + fScalerSums[i] += count; } - return (0); } - //_____________________________________________________________________________ - Int_t THcHelicityScaler::RanBit30(Int_t ranseed) { + return (0); +} - UInt_t bit7 = (ranseed & 0x00000040) != 0; - UInt_t bit28 = (ranseed & 0x08000000) != 0; - UInt_t bit29 = (ranseed & 0x10000000) != 0; - UInt_t bit30 = (ranseed & 0x20000000) != 0; +//_____________________________________________________________________________ +Int_t THcHelicityScaler::RanBit30(Int_t ranseed) { - UInt_t newbit = (bit30 ^ bit29 ^ bit28 ^ bit7) & 0x1; + UInt_t bit7 = (ranseed & 0x00000040) != 0; + UInt_t bit28 = (ranseed & 0x08000000) != 0; + UInt_t bit29 = (ranseed & 0x10000000) != 0; + UInt_t bit30 = (ranseed & 0x20000000) != 0; - ranseed = ((ranseed << 1) | newbit) & 0x3FFFFFFF; + UInt_t newbit = (bit30 ^ bit29 ^ bit28 ^ bit7) & 0x1; - return ranseed; - } - //_____________________________________________________________________________ - THaAnalysisObject::EStatus THcHelicityScaler::Init(const TDatime& date) { + ranseed = ((ranseed << 1) | newbit) & 0x3FFFFFFF; - ReadDatabase(date); + return ranseed; +} +//_____________________________________________________________________________ +THaAnalysisObject::EStatus THcHelicityScaler::Init(const TDatime& date) { - fStatus = kOK; + ReadDatabase(date); - for (vector<UInt_t*>::iterator it = fDelayedEvents.begin(); it != fDelayedEvents.end(); ++it) - delete[] * it; - fDelayedEvents.clear(); + fStatus = kOK; - _param_logger->info("Howdy! We are initializing THcHelicityScaler !! name = {}", fName.Data()); + for (vector<UInt_t*>::iterator it = fDelayedEvents.begin(); it != fDelayedEvents.end(); ++it) + delete[] * it; + fDelayedEvents.clear(); - if (eventtypes.size() == 0) { - eventtypes.push_back(0); // Default Event Type - } + _param_logger->info("Howdy! We are initializing THcHelicityScaler !! name = {}", fName.Data()); - if (fROC < 0) { - fROC = 8; // Default to SHMS crate - } + if (eventtypes.size() == 0) { + eventtypes.push_back(0); // Default Event Type + } - fNTriggers = 0; - fNTrigsInBuf = 0; - fFirstCycle = -100; - fRingSeed_reported = 0; - fRingSeed_actual = 0; - fNBits = 0; - fNTriggersPlus = fNTriggersMinus = 0; - fHScalers[0].resize(fNScalerChannels); - fHScalers[1].resize(fNScalerChannels); - fScalerSums.resize(fNScalerChannels); - fAsymmetry.resize(fNScalerChannels); - fAsymmetryError.resize(fNScalerChannels); - for (Int_t i = 0; i < fNScalerChannels; i++) { - fHScalers[0][i] = 0.0; - fHScalers[1][i] = 0.0; - fScalerSums[0] = 0.0; - fAsymmetry[0] = 0.0; - fAsymmetryError[0] = 0.0; - } + if (fROC < 0) { + fROC = 8; // Default to SHMS crate + } - fCharge.resize(fNumBCMs); - fChargeAsymmetry.resize(fNumBCMs); + fNTriggers = 0; + fNTrigsInBuf = 0; + fFirstCycle = -100; + fRingSeed_reported = 0; + fRingSeed_actual = 0; + fNBits = 0; + fNTriggersPlus = fNTriggersMinus = 0; + fHScalers[0].resize(fNScalerChannels); + fHScalers[1].resize(fNScalerChannels); + fScalerSums.resize(fNScalerChannels); + fAsymmetry.resize(fNScalerChannels); + fAsymmetryError.resize(fNScalerChannels); + for (Int_t i = 0; i < fNScalerChannels; i++) { + fHScalers[0][i] = 0.0; + fHScalers[1][i] = 0.0; + fScalerSums[0] = 0.0; + fAsymmetry[0] = 0.0; + fAsymmetryError[0] = 0.0; + } - fTime = fTimeAsymmetry = 0; - fTriggerAsymmetry = 0.0; + fCharge.resize(fNumBCMs); + fChargeAsymmetry.resize(fNumBCMs); - MakeParms(); + fTime = fTimeAsymmetry = 0; + fTriggerAsymmetry = 0.0; - return kOK; - } + MakeParms(); - void THcHelicityScaler::MakeParms() { - /** - Put Various helicity scaler results in gHcParms so they can be included in results. - */ - gHcParms->Define(Form("g%s_hscaler_plus[%d]", fName.Data(), fNScalerChannels), - "Plus Helcity Scalers", fHScalers[0][0]); - gHcParms->Define(Form("g%s_hscaler_minus[%d]", fName.Data(), fNScalerChannels), - "Minus Helcity Scalers", fHScalers[1][0]); - gHcParms->Define(Form("g%s_hscaler_sum[%d]", fName.Data(), fNScalerChannels), - "Helcity Scalers Sum", fScalerSums[0]); - gHcParms->Define(Form("g%s_hscaler_asy[%d]", fName.Data(), fNScalerChannels), - "Helicity Scaler Asymmetry[%d]", fAsymmetry[0]); - gHcParms->Define(Form("g%s_hscaler_asyerr[%d]", fName.Data(), fNScalerChannels), - "Helicity Scaler Asymmetry Error[%d]", fAsymmetryError[0]); - gHcParms->Define(Form("g%s_hscaler_triggers", fName.Data()), "Total Helicity Scaler Triggers", - fNTriggers); - gHcParms->Define(Form("g%s_hscaler_triggers_plus", fName.Data()), - "Positive Helicity Scaler Triggers", fNTriggersPlus); - gHcParms->Define(Form("g%s_hscaler_triggers_minus", fName.Data()), - "Negative Helicity Scaler Triggers", fNTriggersMinus); - gHcParms->Define(Form("g%s_hscaler_charge[%d]", fName.Data(), fNumBCMs), - "Helicity Gated Charge", fCharge[0]); - gHcParms->Define(Form("g%s_hscaler_charge_asy[%d]", fName.Data(), fNumBCMs), - "Helicity Gated Charge Asymmetry", fChargeAsymmetry[0]); - gHcParms->Define(Form("g%s_hscaler_time", fName.Data()), "Helicity Gated Time (sec)", fTime); - gHcParms->Define(Form("g%s_hscaler_time_asy", fName.Data()), "Helicity Gated Time Asymmetry", - fTimeAsymmetry); - gHcParms->Define(Form("g%s_hscaler_trigger_asy", fName.Data()), "Helicity Trigger Asymmetry", - fTriggerAsymmetry); - } + return kOK; +} - Double_t THcHelicityScaler::GetPlusCharge(const std::string& name) { - size_t i = 0; - for (; i < fNumBCMs; ++i) { - if (name == fBCM_Name[i]) { - break; - } - } - auto it = bcmindex.find(name); +void THcHelicityScaler::MakeParms() { + /** + Put Various helicity scaler results in gHcParms so they can be included in results. + */ + gHcParms->Define(Form("g%s_hscaler_plus[%d]", fName.Data(), fNScalerChannels), + "Plus Helcity Scalers", fHScalers[0][0]); + gHcParms->Define(Form("g%s_hscaler_minus[%d]", fName.Data(), fNScalerChannels), + "Minus Helcity Scalers", fHScalers[1][0]); + gHcParms->Define(Form("g%s_hscaler_sum[%d]", fName.Data(), fNScalerChannels), + "Helcity Scalers Sum", fScalerSums[0]); + gHcParms->Define(Form("g%s_hscaler_asy[%d]", fName.Data(), fNScalerChannels), + "Helicity Scaler Asymmetry[%d]", fAsymmetry[0]); + gHcParms->Define(Form("g%s_hscaler_asyerr[%d]", fName.Data(), fNScalerChannels), + "Helicity Scaler Asymmetry Error[%d]", fAsymmetryError[0]); + gHcParms->Define(Form("g%s_hscaler_triggers", fName.Data()), "Total Helicity Scaler Triggers", + fNTriggers); + gHcParms->Define(Form("g%s_hscaler_triggers_plus", fName.Data()), + "Positive Helicity Scaler Triggers", fNTriggersPlus); + gHcParms->Define(Form("g%s_hscaler_triggers_minus", fName.Data()), + "Negative Helicity Scaler Triggers", fNTriggersMinus); + gHcParms->Define(Form("g%s_hscaler_charge[%d]", fName.Data(), fNumBCMs), "Helicity Gated Charge", + fCharge[0]); + gHcParms->Define(Form("g%s_hscaler_charge_asy[%d]", fName.Data(), fNumBCMs), + "Helicity Gated Charge Asymmetry", fChargeAsymmetry[0]); + gHcParms->Define(Form("g%s_hscaler_time", fName.Data()), "Helicity Gated Time (sec)", fTime); + gHcParms->Define(Form("g%s_hscaler_time_asy", fName.Data()), "Helicity Gated Time Asymmetry", + fTimeAsymmetry); + gHcParms->Define(Form("g%s_hscaler_trigger_asy", fName.Data()), "Helicity Trigger Asymmetry", + fTriggerAsymmetry); +} - if (it != bcmindex.end() && i < fNumBCMs) { - auto index = it->second; - Double_t clock = fHScalers[0][clockindex]; - Double_t counts = fHScalers[0][index]; - return (counts - (clock / clockfreq) * fBCM_Offset[i]) / fBCM_Gain[i]; +Double_t THcHelicityScaler::GetPlusCharge(const std::string& name) { + size_t i = 0; + for (; i < fNumBCMs; ++i) { + if (name == fBCM_Name[i]) { + break; } - _param_logger->warn("THcHelicityScaler::GetPlusCharge: Cannot find scaler {}, return 0.", name); - return 0.; } + auto it = bcmindex.find(name); - Double_t THcHelicityScaler::GetMinusCharge(const std::string& name) { - size_t i = 0; - for (; i < fNumBCMs; ++i) { - if (name == fBCM_Name[i]) { - break; - } - } - auto it = bcmindex.find(name); + if (it != bcmindex.end() && i < fNumBCMs) { + auto index = it->second; + Double_t clock = fHScalers[0][clockindex]; + Double_t counts = fHScalers[0][index]; + return (counts - (clock / clockfreq) * fBCM_Offset[i]) / fBCM_Gain[i]; + } + _param_logger->warn("THcHelicityScaler::GetPlusCharge: Cannot find scaler {}, return 0.", name); + return 0.; +} - if (it != bcmindex.end() && i < fNumBCMs) { - auto index = it->second; - Double_t clock = fHScalers[1][clockindex]; - Double_t counts = fHScalers[1][index]; - return (counts - (clock / clockfreq) * fBCM_Offset[i]) / fBCM_Gain[i]; +Double_t THcHelicityScaler::GetMinusCharge(const std::string& name) { + size_t i = 0; + for (; i < fNumBCMs; ++i) { + if (name == fBCM_Name[i]) { + break; } - _param_logger->warn("THcHelicityScaler::GetMinusCharge: Cannot find scaler {}, return 0.", - name); - return 0.; } + auto it = bcmindex.find(name); + + if (it != bcmindex.end() && i < fNumBCMs) { + auto index = it->second; + Double_t clock = fHScalers[1][clockindex]; + Double_t counts = fHScalers[1][index]; + return (counts - (clock / clockfreq) * fBCM_Offset[i]) / fBCM_Gain[i]; + } + _param_logger->warn("THcHelicityScaler::GetMinusCharge: Cannot find scaler {}, return 0.", name); + return 0.; +} - ClassImp(THcHelicityScaler) +ClassImp(THcHelicityScaler) diff --git a/src/THcHelicityScaler.h b/src/THcHelicityScaler.h index 437964f1793201f6fc1e0b3ddcacd620892a87fc..650eb4bb200a9fdb6c8422998264174395043d51 100644 --- a/src/THcHelicityScaler.h +++ b/src/THcHelicityScaler.h @@ -8,94 +8,91 @@ // ///////////////////////////////////////////////////////////////////// -#include "THaRunBase.h" -#include "THaEvtTypeHandler.h" #include "Decoder.h" -#include <string> -#include <vector> -#include <algorithm> -#include <set> -#include "TTree.h" +#include "THaEvtTypeHandler.h" +#include "THaRunBase.h" #include "TString.h" -#include <cstring> +#include "TTree.h" #include "hcana/Logger.h" +#include <algorithm> +#include <cstring> +#include <set> +#include <string> +#include <vector> class THcHelicity; class THcHelicityScaler : public hcana::ConfigLogging<THaEvtTypeHandler> { public: - THcHelicityScaler(const char*, const char*); virtual ~THcHelicityScaler(); - Int_t Analyze(THaEvData *evdata); - Int_t AnalyzeBuffer(UInt_t *rdata); - Int_t AnalyzeHelicityScaler(UInt_t *p); - virtual EStatus Init( const TDatime& run_time); - virtual Int_t ReadDatabase(const TDatime& date ); - virtual Int_t End( THaRunBase* r=0 ); + Int_t Analyze(THaEvData* evdata); + Int_t AnalyzeBuffer(UInt_t* rdata); + Int_t AnalyzeHelicityScaler(UInt_t* p); + virtual EStatus Init(const TDatime& run_time); + virtual Int_t ReadDatabase(const TDatime& date); + virtual Int_t End(THaRunBase* r = 0); - virtual void SetUseFirstEvent(Bool_t b = kFALSE) {fUseFirstEvent = b;} + virtual void SetUseFirstEvent(Bool_t b = kFALSE) { fUseFirstEvent = b; } virtual void SetDelayedType(int evtype); - virtual void SetROC(Int_t roc) {fROC=roc;} - virtual void SetBankID(Int_t bankid) {fBankID=bankid;} - virtual void SetNScalerChannels(Int_t n) {fNScalerChannels = n;} - virtual Int_t GetNevents() { return fNTrigsInBuf;} - virtual Int_t GetNcycles() { return fNTriggers;} - virtual Int_t GetEvNum() { return evNumber;} - virtual Int_t* GetHelicityHistoryP() {return fHelicityHistory;} - virtual Int_t GetReportedSeed() {return fRingSeed_reported;} - virtual Int_t GetReportedActual() {return fRingSeed_actual;} - virtual Bool_t IsSeedGood() {return fNBits>=30;} - - Double_t GetPlusCharge(const std::string &name); - Double_t GetMinusCharge(const std::string &name); + virtual void SetROC(Int_t roc) { fROC = roc; } + virtual void SetBankID(Int_t bankid) { fBankID = bankid; } + virtual void SetNScalerChannels(Int_t n) { fNScalerChannels = n; } + virtual Int_t GetNevents() { return fNTrigsInBuf; } + virtual Int_t GetNcycles() { return fNTriggers; } + virtual Int_t GetEvNum() { return evNumber; } + virtual Int_t* GetHelicityHistoryP() { return fHelicityHistory; } + virtual Int_t GetReportedSeed() { return fRingSeed_reported; } + virtual Int_t GetReportedActual() { return fRingSeed_actual; } + virtual Bool_t IsSeedGood() { return fNBits >= 30; } + + Double_t GetPlusCharge(const std::string& name); + Double_t GetMinusCharge(const std::string& name); private: - Int_t RanBit30(Int_t ranseed); void MakeParms(); UInt_t fBankID; // Helicity Scaler variables - Int_t fNTrigsInBuf; /* # of helicity scaler reads in last event */ + Int_t fNTrigsInBuf; /* # of helicity scaler reads in last event */ Int_t fNTriggers; Int_t fFirstCycle; Int_t fHelicityHistory[200]; // Bool_t fUseFirstEvent; - Int_t fDelayedType; + Int_t fDelayedType; Int_t fRingSeed_reported; Int_t fRingSeed_actual; Int_t fNBits; - Int_t fNTriggersPlus; - Int_t fNTriggersMinus; + Int_t fNTriggersPlus; + Int_t fNTriggersMinus; std::vector<Double_t> fHScalers[2]; - Int_t fGateCount[2]; + Int_t fGateCount[2]; std::vector<Double_t> fScalerSums, fAsymmetry, fAsymmetryError; std::vector<Double_t> fCharge, fChargeAsymmetry; - Double_t fTime; - Double_t fTimeAsymmetry; - Double_t fTriggerAsymmetry; + Double_t fTime; + Double_t fTimeAsymmetry; + Double_t fTriggerAsymmetry; std::vector<UInt_t*> fDelayedEvents; - Int_t fROC; - Int_t fNScalerChannels; // Number of scaler channels/event + Int_t fROC; + Int_t fNScalerChannels; // Number of scaler channels/event - Int_t fNumBCMs; - std::vector<Double_t> fBCM_Gain, fBCM_Offset; - std::vector <std::string> fBCM_Name; + Int_t fNumBCMs; + std::vector<Double_t> fBCM_Gain, fBCM_Offset; + std::vector<std::string> fBCM_Name; THcHelicityScaler(const THcHelicityScaler& fh); THcHelicityScaler& operator=(const THcHelicityScaler& fh); UInt_t evNumber; - ClassDef(THcHelicityScaler,0) // Scaler Event handler - + ClassDef(THcHelicityScaler, 0) // Scaler Event handler }; #endif diff --git a/src/THcScalerEvtHandler.cxx b/src/THcScalerEvtHandler.cxx index 7a117a98ae6d7608d420b193d029c353607a7077..1f06497096487779ffd852c868f87086d6b2b366 100644 --- a/src/THcScalerEvtHandler.cxx +++ b/src/THcScalerEvtHandler.cxx @@ -32,6 +32,13 @@ To enable debugging you may try this in the setup script ~~~ \author E. Brash based on THaScalerEvtHandler by R. Michaels */ +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <iostream> +#include <iterator> +#include <map> +#include <sstream> #include "THcScalerEvtHandler.h" #include "GenScaler.h" @@ -54,13 +61,6 @@ To enable debugging you may try this in the setup script #include "TROOT.h" #include "TString.h" #include "VarDef.h" -#include <cstdio> -#include <cstdlib> -#include <cstring> -#include <iostream> -#include <iterator> -#include <map> -#include <sstream> using namespace std; using namespace Decoder;