GeneratorInterface/AMPTInterface/test/AMPTAnalyzer.cc
// ------------ method called once each job just before starting event loop  ------------
method called once each job just before starting event loop
method called once each job just before starting event loop
void AMPTAnalyzer::beginJob() {
  if (printLists_) {
    out_b.open(fBFileName.c_str());
    if (out_b.good() == false)
      throw cms::Exception("BadFile") << "Can\'t open file " << fBFileName;
    out_n.open(fNFileName.c_str());
    if (out_n.good() == false)
      throw cms::Exception("BadFile") << "Can\'t open file " << fNFileName;
    out_m.open(fMFileName.c_str());
    if (out_m.good() == false)
      throw cms::Exception("BadFile") << "Can\'t open file " << fMFileName;
  }
  if (doAnalysis_) {
    edm::Service<TFileService> f;
    nt = f->make<TNtuple>("nt", "Mixing Analysis", "mix:np:src:sig");
    hydjetTree_ = f->make<TTree>("hi", "Tree of AMPT Events");
    hydjetTree_->Branch("event", &hev_.event, "event/I");
    hydjetTree_->Branch("b", &hev_.b, "b/F");
    hydjetTree_->Branch("npart", &hev_.npart, "npart/F");
    hydjetTree_->Branch("ncoll", &hev_.ncoll, "ncoll/F");
    hydjetTree_->Branch("nhard", &hev_.nhard, "nhard/F");
    hydjetTree_->Branch("phi0", &hev_.phi0, "phi0/F");
    hydjetTree_->Branch("n", hev_.n, "n[3]/I");
    hydjetTree_->Branch("ptav", hev_.ptav, "ptav[3]/F");
    hydjetTree_->Branch("mult", &hev_.mult, "mult/I");
    hydjetTree_->Branch("pt", hev_.pt, "pt[mult]/F");
    hydjetTree_->Branch("eta", hev_.eta, "eta[mult]/F");
    hydjetTree_->Branch("phi", hev_.phi, "phi[mult]/F");
    hydjetTree_->Branch("pdg", hev_.pdg, "pdg[mult]/I");
    hydjetTree_->Branch("chg", hev_.chg, "chg[mult]/I");
    hydjetTree_->Branch("vx", &hev_.vx, "vx/F");
    hydjetTree_->Branch("vy", &hev_.vy, "vy/F");
    hydjetTree_->Branch("vz", &hev_.vz, "vz/F");
    hydjetTree_->Branch("vr", &hev_.vr, "vr/F");
  }
}
void AMPTAnalyzer :: beginJob ( ) { if ( printLists_ ) { out_b . open ( fBFileName . c_str ( ) ) ; if ( out_b . good ( ) == false ) throw cms :: Exception ( " " ) << " \' " << fBFileName ; out_n . open ( fNFileName . c_str ( ) ) ; if ( out_n . good ( ) == false ) throw cms :: Exception ( " " ) << " \' " << fNFileName ; out_m . open ( fMFileName . c_str ( ) ) ; if ( out_m . good ( ) == false ) throw cms :: Exception ( " " ) << " \' " << fMFileName ; } if ( doAnalysis_ ) { edm :: Service < TFileService > f ; nt = f -> make < TNtuple > ( " " , " " , " " ) ; hydjetTree_ = f -> make < TTree > ( " " , " " ) ; hydjetTree_ -> Branch ( " " , & hev_ . event , " " ) ; hydjetTree_ -> Branch ( " " , & hev_ . b , " " ) ; hydjetTree_ -> Branch ( " " , & hev_ . npart , " " ) ; hydjetTree_ -> Branch ( " " , & hev_ . ncoll , " " ) ; hydjetTree_ -> Branch ( " " , & hev_ . nhard , " " ) ; hydjetTree_ -> Branch ( " " , & hev_ . phi0 , " " ) ; hydjetTree_ -> Branch ( " " , hev_ . n , " " ) ; hydjetTree_ -> Branch ( " " , hev_ . ptav , " " ) ; hydjetTree_ -> Branch ( " " , & hev_ . mult , " " ) ; hydjetTree_ -> Branch ( " " , hev_ . pt , " " ) ; hydjetTree_ -> Branch ( " " , hev_ . eta , " " ) ; hydjetTree_ -> Branch ( " " , hev_ . phi , " " ) ; hydjetTree_ -> Branch ( " " , hev_ . pdg , " " ) ; hydjetTree_ -> Branch ( " " , hev_ . chg , " " ) ; hydjetTree_ -> Branch ( " " , & hev_ . vx , " " ) ; hydjetTree_ -> Branch ( " " , & hev_ . vy , " " ) ; hydjetTree_ -> Branch ( " " , & hev_ . vz , " " ) ; hydjetTree_ -> Branch ( " " , & hev_ . vr , " " ) ; } }
method called once each job just before starting event loop
method called once each job just before starting event loop