26 double muMass = 0.105658;
27 double px = ptEtaPhiE[0]*
cos(ptEtaPhiE[2]);
28 double py = ptEtaPhiE[0]*
sin(ptEtaPhiE[2]);
29 double tmp = 2*atan(
exp(-ptEtaPhiE[1]));
30 double pz = ptEtaPhiE[0]*
cos(tmp)/
sin(tmp);
31 double E =
sqrt(px*px+py*py+pz*pz+muMass*muMass);
44 std::cout <<
"Please provide the name of the file with file: or rfio: as needed" << std::endl;
48 if( fileName.find(
"file:") != 0 && fileName.find(
"rfio:") != 0 ) {
49 std::cout <<
"Please provide the name of the file with file: or rfio: as needed" << std::endl;
62 gSystem->Load(
"libFWCoreFWLite" );
68 TH1F* muonPt_ = theDir.
make<TH1F>(
"muonPt",
"pt", 100, 0.,300.);
69 TH1F* muonEta_ = theDir.
make<TH1F>(
"muonEta",
"eta", 100, -3., 3.);
70 TH1F* muonPhi_ = theDir.
make<TH1F>(
"muonPhi",
"phi", 100, -5., 5.);
73 TFile* inFile = TFile::Open(fileName.c_str());
94 std::vector<MuonPair> pairVector;
102 if(iEvent>0 && iEvent%100==0){
103 std::cout <<
" processing event: " << iEvent << std::endl;
113 muon1pt.
getByLabel(ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau1Pt");
114 muon1eta.
getByLabel(ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau1Eta");
115 muon1phi.
getByLabel(ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau1Phi");
116 muon2pt.
getByLabel(ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau2Pt");
117 muon2eta.
getByLabel(ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau2Eta");
118 muon2phi.
getByLabel(ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau2Phi");
120 if( !muon1pt.
isValid() )
continue;
121 if( !muon1eta.
isValid() )
continue;
122 if( !muon1phi.
isValid() )
continue;
123 if( !muon2pt.
isValid() )
continue;
124 if( !muon2eta.
isValid() )
continue;
125 if( !muon2phi.
isValid() )
continue;
129 if( muon1pt->size() != muon2pt->size() ) {
130 std::cout <<
"Error: size of muon1 and muon2 is different. Skipping event" << std::endl;
133 for(
unsigned i=0;
i<muon1pt->size(); ++
i){
134 muonPt_->Fill( (*muon1pt)[
i] );
135 muonEta_->Fill( (*muon1eta)[i] );
136 muonPhi_->Fill( (*muon1phi)[i] );
137 muonPt_->Fill( (*muon2pt)[i] );
138 muonEta_->Fill( (*muon2eta)[i] );
139 muonPhi_->Fill( (*muon2phi)[i] );
141 double muon1[3] = {(*muon1pt)[
i], (*muon1eta)[
i], (*muon1phi)[
i]};
142 double muon2[3] = {(*muon2pt)[
i], (*muon2eta)[
i], (*muon2phi)[
i]};
148 size_t namePos = fileName.find_last_of(
"/");
149 treeHandler.writeTree((
"tree_"+fileName.substr(namePos+1, fileName.size())).c_str(), &pairVector);
Event const & toBegin() override
Go to the very first Event.
int main(int argc, char *argv[])
Sin< T >::type sin(const T &t)
reco::Particle::LorentzVector lorentzVector
void getByLabel(const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
virtual bool atEnd() const override
lorentzVector fromPtEtaPhiToPxPyPz(const double *ptEtaPhiE)
Cos< T >::type cos(const T &t)
static void enable()
enable automatic library loading
T * make(const Args &...args) const
make new ROOT object
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
std::vector< std::vector< double > > tmp