#ifndef TRooTrackerVtxModuleBase_hxx_seen #define TRooTrackerVtxModuleBase_hxx_seen #include #include #include #include #include "TNamed.h" #include "TTree.h" #include "TLorentzVector.h" #include "TClonesArray.h" #include "TFile.h" #include "ICOMETEvent.hxx" #include "IAnalysisTruthModuleBase.hxx" #include "IJNuBeamFlux.hxx" #include "EoaAnalysis.hxx" #include "IG4PrimaryParticle.hxx" #include "IG4PrimaryVertex.hxx" namespace COMET { class IRooTrackerVtxModuleBase; OA_EXCEPTION(ERooTrackerVerticesModule,EoaAnalysis); OA_EXCEPTION(EPassThroughMismatch,ERooTrackerVerticesModule); OA_EXCEPTION(EIncorrectInputGenerator,ERooTrackerVerticesModule); OA_EXCEPTION(ENoKinematicsPassThroughTrees,ERooTrackerVerticesModule); }; /// /// Abstract base class for converting the neutrino MC pass-through information /// into oaAnalysis defined objects which hold the truth information about /// the interaction vertices in the event. This is so that inherited classes do /// not have to replicate the funtionality of picking up the pass-through /// information. /// class COMET::IRooTrackerVtxModuleBase : public IAnalysisTruthModuleBase { public: IRooTrackerVtxModuleBase(); virtual ~IRooTrackerVtxModuleBase(); virtual Bool_t IsEnabledByDefault() const { return kTRUE;} // Derived classes share this functionality void InitializeBranches(); bool FillTree(COMET::ICOMETEvent&); Bool_t ProcessFirstEvent(COMET::ICOMETEvent& event); void SetFluxTreeAddresses(COMET::IJNuBeamFlux * flux); // Derived classes have to implement this functionality virtual void SetGeneratorTreeAddresses() = 0; virtual Bool_t IsKnownGenerator(const char *) = 0; virtual Bool_t CheckMismatch(COMET::IG4PrimaryVertex vtx) = 0; virtual void FillVtx(int entry) = 0; void SetBeginFile(TFile *input){fLastBeginFile=input;} public: Int_t fNVtx; ///< The number of vertices TClonesArray *fVtx; ///< TClonesArray of vertex objects protected: // File from last time BeginFile was called TFile * fLastBeginFile; //! /// Current loaded pass-through file. TFile * fCurrInputFile; //! /// Current loaded rootracker file. TTree * fRooTrackerTree; //! /// Pass-through book keeping trees. TTree * fInputFileTree; //! TTree * fInputKinemTree; //! /// Entry in original rootracker tree. int fOrigTreeEntryNumber; //! /// The entry number in the current rootracker file. int fInputTreeEntryNumber; //! /// The number of entries in the original input tree. Important for working out POTs. int fOrigInputTreeEntries; //! double fOrigInputTreePOT; //! /// The original rootracker tree POT. std::string fOrigInputFileName; //! /// The generator name. Cuttently genie or neut. std::string fGeneratorName; //! /// The input rootracker tree name. Currently gRooTracker or nRooTracker. std::string fInputTreeName; //! /// The time within the spill for vertex. double fTimeInSpill; //! /// The ID of the truth vertex created from this generator vertex. int fTruthVertexID; //! private: bool LoadPassThroughInput(const COMET::IG4PrimaryVertex & vtx); bool UpdateBookKeepingInfo(const COMET::IG4PrimaryVertex & vtx); bool AreTreesLoaded(const COMET::IG4PrimaryVertex & vtx); bool GetTreesFromFile(const COMET::IG4PrimaryVertex & vtx); bool GetTreesFromDirectory(const COMET::IG4PrimaryVertex & vtx); void ClearInputTrees(); std::string GetFileName(const COMET::IG4PrimaryVertex & vtx); std::string GetTreeName(const COMET::IG4PrimaryVertex & vtx); int GetEntryNum(const COMET::IG4PrimaryVertex & vtx); std::string GetFileFromPath(const char * path); bool ComparePaths(const char* path1, const char* path2); void ResetFileInfo(); void ResetVtxInfo(); bool fPassThroughPresent; ClassDef(IRooTrackerVtxModuleBase,1); }; #endif