38 gSystem->Load(
"libFWCoreFWLite" );
47 parser.
stringValue (
"outputFile" ) =
"analyzeFWLiteHistograms.root";
52 unsigned int outputEvery_ = parser.
integerValue(
"outputEvery");
53 std::string outputFile_ = parser.
stringValue(
"outputFile");
54 std::vector<std::string> inputFiles_ = parser.
stringVector(
"inputFiles");
59 TH1F* muonPt_ = dir.
make<TH1F>(
"muonPt" ,
"pt" , 100, 0., 300.);
60 TH1F* muonEta_ = dir.make<TH1F>(
"muonEta" ,
"eta" , 100, -3., 3.);
61 TH1F* muonPhi_ = dir.make<TH1F>(
"muonPhi" ,
"phi" , 100, -5., 5.);
62 TH1F* mumuMass_= dir.make<TH1F>(
"mumuMass",
"mass", 90, 30., 120.);
66 for(
unsigned int iFile=0; iFile<inputFiles_.size(); ++iFile){
68 TFile* inFile = TFile::Open(inputFiles_[iFile].c_str());
82 if(maxEvents_>0 ? ievt+1>maxEvents_ :
false)
break;
84 if(outputEvery_!=0 ? (ievt>0 && ievt%outputEvery_==0) :
false)
85 std::cout <<
" processing event: " << ievt << std::endl;
89 event.getByLabel(std::string(
"muons"), muons);
92 for(std::vector<Muon>::const_iterator mu1=muons->begin(); mu1!=muons->end(); ++mu1){
93 muonPt_ ->Fill( mu1->pt () );
94 muonEta_->Fill( mu1->eta() );
95 muonPhi_->Fill( mu1->phi() );
96 if( mu1->pt()>20 && fabs(mu1->eta())<2.1 ){
97 for(std::vector<Muon>::const_iterator mu2=muons->begin(); mu2!=muons->end(); ++mu2){
99 if( mu1->charge()*mu2->charge()<0 ){
100 if( mu2->pt()>20 && fabs(mu2->eta())<2.1 ){
101 mumuMass_->Fill( (mu1->p4()+mu2->p4()).
mass() );
114 if(maxEvents_>0 ? ievt+1>maxEvents_ :
false)
break;
std::string & stringValue(std::string key)
void parseArguments(int argc, char **argv, bool allowArgs=false)
int main(int argc, char **argv)
Event const & toBegin()
Go to the very first Event.
int & integerValue(std::string key)
virtual bool atEnd() const
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
SVec & stringVector(std::string key)
T * make() const
make new ROOT object
static void enable()
enable automatic library loading