//////////////////////////////////////////////////////////////////// /// \file n16.cc /// /// \brief Extracts calibrated and mc hit information /// /// \author M Mottram /// /// REVISION HISTORY:\n /// 2014-05-29 : P G Jones - Added header information.\n // 2018-02-10 : R Lane - change to function arguments necessary for ROOT 6 compatibility /// /// \details This information is used to check the N16 is simulated /// correctly. /// //////////////////////////////////////////////////////////////////// #include #include #include #include #include #include void n16(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* hMC = new TH1D( "hMC", "Number of mc hits per mc event", 3, 0.0, 3000.0 ); hMC->SetXTitle( "Number of mc hits per mc-event." ); hMC->SetYTitle( "Count per 1000 hit bin." ); TH1D* hCalibHits = new TH1D( "hCalibHits", "Number of mc-photoeletrons on calib channel.", 20, -0.5, 20.5 ); hCalibHits->SetXTitle( "Number of total hits" ); hCalibHits->SetYTitle( "Count per 1 hit bin." ); RAT::DB *db = RAT::DB::Get(); RAT::DBLinkPtr dblink = db->GetLink("GEO", "N16Source"); unsigned int fLCN = dblink->GetI("lcn"); for( size_t iEntry = 0; iEntry < dsReader->GetEntryCount(); iEntry++ ) { const RAT::DS::Entry& rDS = dsReader->GetEntry( iEntry ); const RAT::DS::MC& rMC = rDS.GetMC(); hMC->Fill( rMC.GetMCPMTCount() ); for( size_t iMCPMT = 0; iMCPMT < rMC.GetMCPMTCount(); iMCPMT++ ) if( rMC.GetMCPMT( iMCPMT ).GetID() == fLCN ) hCalibHits->Fill( rMC.GetMCPMT( iMCPMT ).GetMCPECount() ); } outtfile->cd(); hMC->Write(); hCalibHits->Write(); outtfile->Close(); delete outtfile; delete dsReader; }