File indexing completed on 2024-04-06 12:23:59
0001 #include <memory>
0002 #include <string>
0003 #include <vector>
0004 #include <sstream>
0005 #include <fstream>
0006 #include <iostream>
0007
0008 #include <TH1F.h>
0009 #include <TROOT.h>
0010 #include <TFile.h>
0011 #include <TSystem.h>
0012
0013 #include "DataFormats/FWLite/interface/Handle.h"
0014 #include "DataFormats/PatCandidates/interface/Muon.h"
0015 #include "DataFormats/PatCandidates/interface/CompositeCandidate.h"
0016 #include "FWCore/FWLite/interface/FWLiteEnabler.h"
0017
0018 using namespace std;
0019
0020 int main(int argc, char* argv[])
0021 {
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 gSystem->Load( "libFWCoreFWLite" );
0032 FWLiteEnabler::enable();
0033
0034
0035 TFile* inFile = TFile::Open( "file:jpsi.root" );
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047 unsigned int iEvent=0;
0048 fwlite::Event event(inFile);
0049 for(event.toBegin(); !event.atEnd(); ++event, ++iEvent){
0050
0051
0052 if( iEvent==1000 ) break;
0053
0054
0055 if(iEvent>0 && iEvent%1==0){
0056 std::cout << " processing event: " << iEvent << std::endl;
0057 }
0058
0059
0060 fwlite::Handle<std::vector<pat::CompositeCandidate> > jpsis;
0061 jpsis.getByLabel(event, "patJPsiCandidates");
0062
0063
0064 for(unsigned i=0; i<jpsis->size(); ++i){
0065 cout << "jpsi " << i << ", mass = " << jpsis->at(i).mass() << ", dR = " << jpsis->at(i).userFloat("dR") << endl;
0066 }
0067 }
0068
0069 inFile->Close();
0070
0071
0072 return 0;
0073 }