/// @file AllPixRun.hh /// @brief The header file for the Allpix run class. #ifndef AllPixRun_h #define AllPixRun_h 1 // GEANT4 include statements. #include "G4Run.hh" #include "G4RunMessenger.hh" #include "G4Event.hh" #include "G4HCofThisEvent.hh" #include "G4SDManager.hh" #include "G4DigiManager.hh" #include "G4Trajectory.hh" // ROOT include statements. #include #include #include #include #include #include // Allpix include statements. // Hits //#include "AllPix_Hits_WriteToEntuple.h" #include "WriteToNtuple.h" // // Geometry #include "ReadGeoDescription.hh" // #include "AllPixDetectorConstruction.hh" #include "AllPixTrackerHit.hh" #include "AllPixRunAction.hh" #include "AllPixMimosa26Digit.hh" #include "AllPixDigitInterface.hh" // #include "Utils.h" // Standard include statements. #include #include #include #include #include #include #include using namespace std; using namespace Utils; class FramesHandler; class WriteToNtuple; //class SimpleHits; class AllPixDetectorConstruction; #ifdef _EUTELESCOPE #define __magic_trigger_cntr_ack 4 // 4 scintillators with 4 primary particle hits #endif /// @brief The Allpix run class. class AllPixRun : public G4Run { public: /// @brief The constructor. /// /// @param [in] p_det Pointer to the detector construction object. /// @param [in] ofp The output file prefix (???). /// @param [in] datasetid The dataset ID (???). /// @param [in] outputdir The output directory. /// /// This constructor is called once per run. AllPixRun( AllPixDetectorConstruction * p_det, TString ofp, TString datasetid, TString outputdir ); /// @brief The destructor. virtual ~AllPixRun(); virtual void RecordEvent(const G4Event*); void RecordHits(const G4Event*); void RecordDigits(const G4Event*); // TW commented out for now 2014-02-17 // inline void SetLCIOBridgeFileDsc(ofstream * f, ofstream * fdut) // { // //m_lciobridge_f = f; m_lciobridge_dut_f = fdut; // }; // filling frames void FillFramesNtuple(const G4Run *); /// @brief Set the number of (source particle) events to store per frame. /// /// @param [in] evpf The events too store per frame. inline void SetEventsPerFrame(G4int evpf) { m_eventsPerFrame = evpf; } void FillDetectorMetaData(G4int id, G4int index, AllPixGeoDsc * det); void FillFrames(); inline map::const_iterator GetNtuplesBegin() { return m_ntuples.begin(); } inline map::const_iterator GetNtuplesEnd() { return m_ntuples.end(); } void CloseNtupleFiles(); inline G4int GetNumOfDetectors() { return m_nOfDetectors; } /// @brief Add a source particle to the current frame. /// void AddSourceParticle(G4ThreeVector x_, G4ThreeVector p_, G4double m, G4double kinE, G4double pdgid); void ClearSourceParticles(); private: AllPixDetectorConstruction * m_detectorPtr; AllPixTrackerHitsCollection * m_hitsCollection; // TW commented out 2014-06-17 // // Hits // SimpleHits ** m_storableHits; // map index in frames handler to det Id map m_detIdToIndex; /// @brief Container for the frame information. /// /// The Digis are not stored - rather, the frames are built /// from the Digis which are then stored in the Mafalda format. FramesHandler ** m_frames; TString m_datasetDigits; TString m_datasetHits; TString m_tempdir; // Same as number of digitizers G4int m_nOfDetectors; // Number of sensitive detectors. Can be more than the number of // digitizers if the user decides to have other volumes as SDs G4int m_nOfSD; // TW commented out for now 2014-02-17 // // coming from AllPixRunAction // ofstream * m_lciobridge_f; // ofstream * m_lciobridge_dut_f; // /TW G4String m_outputFilePrefix; /// @brief The number of (source particle) events to store per frame. G4int m_eventsPerFrame; /// @brief Map of the ntuple files??? map m_ntuples; /// @brief Timer. time_t m_timer; /// @brief The time handler. TimeHandler * m_timeHandler; /// @brief The run start time [s]. Double_t m_startTime; /// @brief The current time (in the run) [s]. Double_t m_currentTime; /// @brief The current frame number (used for frame ID). Long_t m_currentFrame; /// @brief Filter map std::map m_filterMap; // Source particle information vector m_pri_x; vector m_pri_y; vector m_pri_z; // vector m_pri_px; vector m_pri_py; vector m_pri_pz; // vector m_pri_kinE; vector m_pri_m; /// @brief Vector of the source particle PDG IDs. vector m_pri_id; }; #endif