src/photongen.cc
// Writing the photon list to a ROOT file
Writing the photon list to a ROOT file
Writing the photon list to a ROOT file
void savePhoton() {
    P_Identifiers identity;
    Coords pos;
    TString filename = "photonList_Run" + to_string(RUN_NO) + ".root";
    TFile f(ROOT_DIR + filename,"recreate");
    TTree *t = new TTree("t","PhotonList");
    t->Branch("identity", &identity, "run/I:event/I:pid/I");
    t->Branch("pos", &pos, "x/F:y/F:z/F:theta/F:phi/F");
    for (auto p = photonList.begin(); p != photonList.end(); ++p) {
        identity = p->identity;
        pos = p->coords;
        t->Fill();
    }
    t->Write();
    delete t;
}
void savePhoton ( ) { P_Identifiers identity ; Coords pos ; TString filename = " " + to_string ( RUN_NO ) + " " ; TFile f ( ROOT_DIR + filename , " " ) ; TTree * t = new TTree ( " " , " " ) ; t -> Branch ( " " , & identity , " " ) ; t -> Branch ( " " , & pos , " " ) ; for ( auto p = photonList . begin ( ) ; p != photonList . end ( ) ; ++ p ) { identity = p -> identity ; pos = p -> coords ; t -> Fill ( ) ; } t -> Write ( ) ; delete t ; }
Writing the photon list to a ROOT file
Writing the photon list to a ROOT file
// Defining Branch Variables // Creating ROOT file // Setting Tree and Branches // Iterating over Muon List and Filling Tree // Write to ROOT file