//////////////////////////////////////////////////////////////////// /// \file pmtcal.C /// /// \brief Extracts eca and pca calibration info /// /// \author F Descamps, /// /// REVISION HISTORY:\n /// 2015-09-14 : F. Descamps - First version, using data for now // 2018-02-10 : R Lane - change to function arguments necessary for ROOT 6 compatibility /// /// //////////////////////////////////////////////////////////////////// #include #include #include #include void pmtcal(std::string event_file, std::string outfile) { RAT::DU::DSReader* dsReader = new RAT::DU::DSReader(event_file); TFile *outtfile = new TFile(outfile.c_str(),"RECREATE"); TH1D* hECATime = new TH1D("hECATime", "Hit times for the ECA calibrated PMTs", 450, 100.0, 550.0); TH1D* hPCATime = new TH1D("hPCATime", "Hit times for the PCA calibrated PMTs", 450, 200.0, 400.0); TH1D* hECAQHS = new TH1D("hECAQHS", "QHS for the ECA calibrated PMTs", 275, -50, 500); TH1D* hECAQHL = new TH1D("hECAQHL", "QHL for the ECA calibrated PMTs", 275, -50, 500); TH1D* hStatus = new TH1D("hStatus", "Calibration status word", 64, 0, 63); for (size_t iEntry = 0; iEntry < dsReader->GetEntryCount(); iEntry++) { const RAT::DS::Entry& rDS = dsReader->GetEntry(iEntry); for (size_t iEV = 0; iEV < rDS.GetEVCount(); iEV++) { const RAT::DS::EV& rEV = rDS.GetEV(iEV); // The ECA calibrated PMTs are stored as partial calibrations const RAT::DS::CalPMTs& ECAcalibratedPMTs = rEV.GetPartialCalPMTs(1); // The PCA calibrated PMTs const RAT::DS::CalPMTs& PCAcalibratedPMTs = rEV.GetCalPMTs(); for (size_t iPMT = 0; iPMT < PCAcalibratedPMTs.GetAllCount(); iPMT++) { hECATime->Fill(ECAcalibratedPMTs.GetAllPMT(iPMT).GetTime()); hPCATime->Fill(PCAcalibratedPMTs.GetAllPMT(iPMT).GetTime()); hECAQHS->Fill(ECAcalibratedPMTs.GetAllPMT(iPMT).GetQHS()); hECAQHL->Fill(ECAcalibratedPMTs.GetAllPMT(iPMT).GetQHL()); // We also want to check the status flag // Loop over the bits and see if they were set for (int bit = 0; bit < 64; bit++) { unsigned long testword = pow(2, bit); unsigned long status = PCAcalibratedPMTs.GetAllPMT(iPMT) .GetStatus() .GetULong64_t(0); if ((status & testword) != 0) { hStatus->Fill(bit); } } } } } outtfile->cd(); hECATime->Write(); hPCATime->Write(); hECAQHS->Write(); hECAQHL->Write(); hStatus->Write(); outtfile->Close(); delete outtfile; delete dsReader; }