Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 22 of file PatMuonEDMAnalyzer.cc.
References fwlite::Event::atEnd(), gather_cfg::cout, dir, AutoLibraryLoader::enable(), optutl::VariableMapCont::integerValue(), TFileDirectory::make(), TFileDirectory::mkdir(), optutl::CommandLineParser::parseArguments(), geometryXMLtoCSV::parser, optutl::VariableMapCont::stringValue(), optutl::VariableMapCont::stringVector(), TrackerOfflineValidation_Standalone_cff::TFileService, and fwlite::Event::toBegin().
33 gSystem->Load(
"libFWCoreFWLite" );
40 parser.integerValue (
"maxEvents" ) = 1000;
41 parser.integerValue (
"outputEvery") = 10;
42 parser.stringValue (
"outputFile" ) =
"analyzeEdmTuple.root";
46 int maxEvents_ =
parser.integerValue(
"maxEvents");
47 unsigned int outputEvery_ =
parser.integerValue(
"outputEvery");
48 std::string outputFile_ =
parser.stringValue(
"outputFile");
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());
73 for(ev.toBegin(); !ev.atEnd(); ++ev, ++ievt){
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;
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
T * make() const
make new ROOT object
static void enable()
enable automatic library loading