33 gSystem->Load(
"libFWCoreFWLite" );
42 parser.
stringValue (
"outputFile" ) =
"analyzeEdmTuple.root";
47 unsigned int outputEvery_ = parser.
integerValue(
"outputEvery");
49 std::vector<std::string> inputFiles_ = parser.
stringVector(
"inputFiles");
54 TH1F* muonPt_ = dir.
make<TH1F>(
"muonPt" ,
"pt" , 100, 0., 300.);
55 TH1F* muonEta_ = dir.make<TH1F>(
"muonEta" ,
"eta" , 100, -3., 3.);
56 TH1F* muonPhi_ = dir.make<TH1F>(
"muonPhi" ,
"phi" , 100, -5., 5.);
60 for(
unsigned int iFile=0; iFile<inputFiles_.size(); ++iFile){
62 TFile* inFile = TFile::Open(inputFiles_[iFile].c_str());
76 if(maxEvents_>0 ? ievt+1>maxEvents_ :
false)
break;
78 if(outputEvery_!=0 ? (ievt>0 && ievt%outputEvery_==0) :
false)
79 std::cout <<
" processing event: " << ievt << std::endl;
83 event.getByLabel(
std::string(
"patMuonAnalyzer:pt"), muonPt);
85 for(std::vector<float>::const_iterator mu1=muonPt->begin(); mu1!=muonPt->end(); ++mu1){
86 muonPt_ ->Fill( *mu1 );
90 event.getByLabel(
std::string(
"patMuonAnalyzer:eta"), muonEta);
91 for(std::vector<float>::const_iterator mu1=muonEta->begin(); mu1!=muonEta->end(); ++mu1){
92 muonEta_ ->Fill( *mu1 );
96 event.getByLabel(
std::string(
"patMuonAnalyzer:phi"), muonPhi);
97 for(std::vector<float>::const_iterator mu1=muonPhi->begin(); mu1!=muonPhi->end(); ++mu1){
98 muonPhi_ ->Fill( *mu1 );
106 if(maxEvents_>0 ? ievt+1>maxEvents_ :
false)
break;
std::string & stringValue(std::string key)
void parseArguments(int argc, char **argv, bool allowArgs=false)
Event const & toBegin()
Go to the very first Event.
int & integerValue(std::string key)
static void enable()
enable automatic library loading
T * make(const Args &...args) const
make new ROOT object
virtual bool atEnd() const
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
SVec & stringVector(std::string key)