CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/HLTriggerOffline/Top/src/TopValidation.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    TopValidation
00004 // Class:      TopValidation
00005 // 
00013 //
00014 // Original Author:  Patricia LOBELLE PARDO ()
00015 //         Created:  Tue Sep 23 11:06:32 CEST 2008
00016 // $Id: TopValidation.cc,v 1.12 2011/10/13 14:58:07 eulisse Exp $
00017 //
00018 //
00019 
00020 
00021 # include "HLTriggerOffline/Top/interface/TopValidation.h"
00022 #include "FWCore/Common/interface/TriggerNames.h"
00023 
00024 
00025 
00026 TopValidation::TopValidation(const edm::ParameterSet& iConfig)
00027 
00028 {
00029   
00030    
00031      inputTag_           = iConfig.getParameter<edm::InputTag>("TriggerResultsCollection");
00032      hlt_bitnames        = iConfig.getParameter<std::vector<std::string> >("hltPaths");     
00033      hlt_bitnamesMu      = iConfig.getParameter<std::vector<std::string> >("hltMuonPaths");
00034      hlt_bitnamesEg      = iConfig.getParameter<std::vector<std::string> >("hltEgPaths");  
00035      hlt_bitnamesJet      = iConfig.getParameter<std::vector<std::string> >("hltJetPaths");  
00036   //   triggerTag_         = iConfig.getUntrackedParameter<string>("DQMFolder","HLT/Top");
00037      outputFileName      = iConfig.getParameter<std::string>("OutputFileName");
00038      outputMEsInRootFile = iConfig.getParameter<bool>("OutputMEsInRootFile");
00039       FolderName_ = iConfig.getParameter<std::string>("FolderName");
00040    
00041       topFolder << FolderName_ ;  
00042 
00043  
00044       
00045 }
00046 
00047 
00048 TopValidation::~TopValidation()
00049 {
00050   
00051   // do anything here that needs to be done at desctruction time
00052   // (e.g. close files, deallocate resources etc.)
00053   
00054 }
00055 
00056 
00057 //
00058 // member functions
00059 //
00060 
00061 
00062 // ------------ method called to for each event  ------------
00063 void
00064 TopValidation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00065 {
00066   using namespace edm;
00067   
00068  
00069   // muon collection
00070   Handle<reco::MuonCollection> muonsH;
00071   iEvent.getByLabel("muons", muonsH);
00072   
00073   // tracks collection
00074   Handle<reco::TrackCollection> tracks;
00075   iEvent.getByLabel("ctfWithMaterialTracks", tracks);
00076     
00077      
00078   // get calo jet collection
00079   Handle<reco::CaloJetCollection> jetsHandle;
00080   iEvent.getByLabel("iterativeCone5CaloJets", jetsHandle);
00081 
00082   
00083   // electron collection
00084   Handle<reco::GsfElectronCollection> electronsH;
00085   //  iEvent.getByLabel("pixelMatchGsfElectrons",electronsH);
00086   iEvent.getByLabel("gsfElectrons",electronsH);
00087 
00088   // Trigger 
00089   Handle<TriggerResults> trh;
00090   iEvent.getByLabel(inputTag_,trh);
00091   if( ! trh.isValid() ) {
00092     LogDebug("") << "HL TriggerResults with label ["+inputTag_.encode()+"] not found!";
00093     return;
00094   }  
00095 
00096 
00097 
00098   const edm::TriggerNames & triggerNames = iEvent.triggerNames(*trh);
00099  
00101   //   generation  info                                     
00103   
00104   //bool topevent = false;
00105  
00106   int ntop     = 0;
00107   int ngenel   = 0;
00108   int ngenmu   = 0;
00109   int ngentau  = 0;
00110   int ngenlep  = 0;
00111   int nmuaccept= 0;
00112   int nelaccept= 0;
00113  
00114   // Gen Particles Collection
00115   Handle <reco::GenParticleCollection> genParticles;
00116    iEvent.getByLabel("genParticles", genParticles);
00117   
00118    for (size_t i=0; i < genParticles->size(); ++i){
00119      const reco::Candidate & p = (*genParticles)[i];
00120     int id = p.pdgId();
00121     int st = p.status();
00122     
00123     if (abs(id) == 6 && st == 3) ntop++;
00124    
00125     if (st==3 && abs(id)==11) {
00126       ngenel++;
00127        if ( p.pt()>10 && fabs(p.eta())<2.4)   nelaccept++;
00128     }
00129     
00130     if (st==3 && abs(id)==13) {
00131       ngenmu++;      
00132       if ( p.pt()>10 && fabs(p.eta())<2.4)    nmuaccept++;     
00133     }
00134     
00135     if (st==3 && abs(id)==15)  ngentau++;
00136     if (st==3 && ( abs(id)==11 || abs(id)==13 || abs(id)==15)) ngenlep++;
00137     
00138   }
00139   
00140   // if (ntop == 2) topevent = true; 
00141   
00142  
00143 
00144  // if (topevent){
00145  
00149   
00150     //Muon Collection to use
00151     std::map<double,reco::Muon> muonMap; 
00152   
00153     for (size_t i = 0; i< muonsH->size(); ++i){    
00154       if ( (*muonsH)[i].isGlobalMuon() && (*muonsH)[i].pt()>15 && fabs((*muonsH)[i].eta())<2.1){  
00155       muonMap[(*muonsH)[i].pt()] = (*muonsH)[i];
00156        }
00157     }     
00158 
00159     //Muon selection
00160     bool TwoMuonsAccepted = false;
00161   
00162     std::vector<reco::Muon> selected_muons;
00163     reco::Muon muon1,muon2;
00164   
00165     for( std::map<double,reco::Muon>::reverse_iterator rit=muonMap.rbegin(); rit!=muonMap.rend(); ++rit){
00166       selected_muons.push_back( (*rit).second );
00167     }
00168     
00169        if (selected_muons.size()==1) muon1 = selected_muons[0];
00170 
00171        if (selected_muons.size()>1){
00172           muon1 = selected_muons[0];
00173           muon2 = selected_muons[1];   
00174        }
00175  
00176  
00177     if( selected_muons.size()>1 && muon1.pt() >20 && muon1.charge()*muon2.charge()<0 ) TwoMuonsAccepted = true;
00178 
00179    
00183    
00184     //Electron Collection to use
00185     std::map<double,reco::GsfElectron> electronMap;
00186    
00187     for (size_t i = 0; i<electronsH->size();++i){
00188      if( (*electronsH)[i].pt()>15 && fabs( (*electronsH)[i].eta() )<2.4) {
00189       electronMap[(*electronsH)[i].pt()] = (*electronsH)[i];
00190        }
00191     }     
00192         
00193     //Electron selection
00194     bool TwoElectronsAccepted = false;
00195    
00196     std::vector<reco::GsfElectron> selected_electrons;
00197     reco::GsfElectron electron1, electron2;
00198   
00199     for( std::map<double,reco::GsfElectron>::reverse_iterator rit=electronMap.rbegin(); rit!=electronMap.rend(); ++rit){
00200       selected_electrons.push_back( (*rit).second );
00201     }
00202 
00203      if (selected_electrons.size()==1) electron1 = selected_electrons[0];
00204     
00205       if (selected_electrons.size()>1){
00206       
00207         electron1 = selected_electrons[0];
00208         electron2 = selected_electrons[1];
00209       }
00210   
00211   
00212      if( selected_electrons.size()>1 && electron1.pt() >20 && electron1.charge()*electron2.charge()<0 ) TwoElectronsAccepted = true;
00213   
00214   
00215  
00219    
00220     //Jet Collection to use
00221      
00222     // Raw jets
00223     const reco::CaloJetCollection *jets = jetsHandle.product();
00224     reco::CaloJetCollection::const_iterator jet;
00225   
00226     int n_jets_20=0;
00227     
00228       for (jet = jets->begin(); jet != jets->end(); jet++){        
00229        // if (fabs(jet->eta()) <2.4 && jet->et() > 20) n_jets_20++; 
00230      //  if (fabs(jet->eta()) <2.4 && jet->et() > 13) n_jets_20++; 
00231       if (fabs(jet->eta()) <2.4 && jet->et() > 13) n_jets_20++;       
00232       } 
00233     
00234 
00236  /*  std::map<double,reco::CaloJet> jetMap;
00237     
00238  for (size_t i = 0; i<jetsHandle->size();++i){
00239      if ((*jetsHandle)[i].et()>13 && fabs( (*jetsHandle)[i].eta())<2.4){
00240      
00241       
00242       jetMap[(*jetsHandle)[i].et()] = (*jetsHandle)[i];
00243       }
00244     }    
00245     
00246     std::vector<reco::CaloJet> selected_jets;
00247     reco::CaloJet jet1, jet2;
00248   
00249     for( std::map<double,reco::CaloJet>::reverse_iterator rit=jetMap.rbegin(); rit!=jetMap.rend(); ++rit){
00250       selected_jets.push_back( (*rit).second );
00251     }
00252     
00253     if (selected_jets.size()>1){
00254       jet1 = selected_jets[0];
00255       jet2 = selected_jets[1];
00256       }
00257     
00258 */
00259 
00265     
00266  
00267     
00268     bool offline_mu       = false;
00269     bool offline_dimu     = false;
00270     bool offline_el       = false;
00271     bool offline_diel     = false;
00272     bool offline_emu      = false;
00273     
00274     
00275     if ( selected_muons.size()>0 && muon1.pt()>20 && n_jets_20>1)         offline_mu=true;
00276     if ( TwoMuonsAccepted && n_jets_20>1)                                 offline_dimu=true;
00277     if ( selected_electrons.size()>0 && electron1.pt()>20 && n_jets_20>1)  offline_el=true;
00278     if ( TwoElectronsAccepted && n_jets_20>1)                             offline_diel=true;
00279     if ( selected_muons.size()>0 && selected_electrons.size()>0 && (muon1.pt()>20 || electron1.pt()>20) && (muon1.charge()!= electron1.charge()) && n_jets_20>1) offline_emu=true;
00280     
00281     
00282   
00283     
00285  // store fired bits
00287     
00288   int wtrig_[100]  ={0}; 
00289   int wtrig_m[100] ={0};
00290   int wtrig_eg[100]={0};
00291   int wtrig_jet[100]={0};
00292   
00293   bool HLTQuadJet30 = false;
00294   bool HLTMu9       = false;
00295   
00296   
00297   int n_hlt_bits    = hlt_bitnames.size(); 
00298   int n_hlt_bits_mu = hlt_bitnamesMu.size();
00299   int n_hlt_bits_eg = hlt_bitnamesEg.size();
00300   int n_hlt_bits_jet= hlt_bitnamesJet.size();
00301   
00302   const unsigned int n_TriggerResults( trh.product()->size());
00303 
00304   for (unsigned int itrig=0; itrig< n_TriggerResults; ++itrig) {
00305   
00307            if (triggerNames.triggerName(itrig) == "HLT_QuadJet30"){
00308                if ( trh.product()->accept( itrig ) ) HLTQuadJet30=true;
00309              } 
00310            if (triggerNames.triggerName(itrig) == "HLT_Mu9"){
00311                if ( trh.product()->accept( itrig ) ) HLTMu9=true;
00312           } 
00314     if (trh.product()->accept(itrig)) {
00315     
00316          for (int i=0;i<n_hlt_bits;i++) {
00317             if ( triggerNames.triggerName(itrig)== hlt_bitnames[i]) {     
00318                wtrig_[i]=1;
00319             }
00320          }
00321          for (int j=0;j<n_hlt_bits_mu;j++) {
00322             if ( triggerNames.triggerName(itrig)== hlt_bitnamesMu[j]) {     
00323                wtrig_m[j]=1;
00324              }
00325          }
00326          for (int k=0;k<n_hlt_bits_eg;k++) {
00327              if ( triggerNames.triggerName(itrig)== hlt_bitnamesEg[k]) {     
00328                 wtrig_eg[k]=1;
00329              }
00330           }
00331         
00332          for (int l=0;l<n_hlt_bits_jet;l++) {
00333              if ( triggerNames.triggerName(itrig)== hlt_bitnamesJet[l]) {     
00334                 wtrig_jet[l]=1;
00335              }
00336           }
00337     
00338        }
00339      } 
00340     
00341     
00342           
00346     
00347      events_acc_off_muon->Fill(1,1); 
00348      if (ngenlep==1 && ngenmu==1)  events_acc_off_muon->Fill(2,1); 
00349      events_acc_off_electron->Fill(1,1); 
00350       if (ngenlep==1 && ngenel==1)  events_acc_off_electron->Fill(2,1); 
00351                                                                                                                                                                                                                                                                                                                                                                           
00353     
00354   
00355       
00356     if ( ngenlep==1 && ngenmu==1 && nmuaccept==1){  //Select events within acceptance
00357       
00358             events_acc_off_muon->Fill(3,1); 
00359             
00360           for (int j=0;j<n_hlt_bits_mu;j++) {
00361                 h_mu_gen->Fill(j+1);
00362               if (wtrig_m[j]==1) {   
00363                hlt_bitmu_hist_gen->Fill(j+1);
00364               }
00365            }
00366            
00367              for (int it=0; it<n_hlt_bits_jet;it++){
00368            h_jet_gen->Fill(it+1);
00369            if (wtrig_jet[it]==1) {
00370            hlt_bitjet_hist_gen->Fill(it+1);
00371              }   
00372            }
00373      
00374       
00375       // Efficiencies wrt MC + offline
00376       if (offline_mu){
00377       
00378              events_acc_off_muon->Fill(4,1); 
00379       
00380          //  et_off_jet_mu -> Fill(jet1.et());
00381           // eta_off_jet_mu-> Fill(jet1.eta());
00382            
00383            for (int it=0; it<n_hlt_bits_jet;it++){
00384            h_jet_reco->Fill(it+1);
00385            if (wtrig_jet[it]==1) {
00386            hlt_bitjet_hist_reco->Fill(it+1);
00387          //  h_etjet1_trig_mu[it]->Fill(jet1.et());
00388          //  h_etajet1_trig_mu[it]->Fill(jet1.eta());
00389            
00390            
00391            }
00392            
00393            }
00394       
00395           eta_off_mu->Fill(muon1.eta()); 
00396           pt_off_mu-> Fill(muon1.pt());
00397       
00398             for (int j=0;j<n_hlt_bits_mu;j++) {
00399                 h_mu_reco->Fill(j+1);
00400               if (wtrig_m[j]==1) {   
00401                h_ptmu1_trig[j]->Fill(muon1.pt());
00402                h_etamu1_trig[j]->Fill(muon1.eta());
00403                hlt_bitmu_hist_reco->Fill(j+1);
00404               }
00405            }
00406         
00407          }
00408      }
00409 
00410 
00411 
00413 
00414    if (HLTQuadJet30){    // events firing the 4jet30 trigger
00415    
00416     if (offline_mu){    // events with 1 rec muon+ 2jets
00417    
00418       ptmuon_4jet1muSel->Fill(muon1.pt());
00419       etamuon_4jet1muSel->Fill(muon1.eta());
00420       Njets_4jet1muSel->Fill(n_jets_20);
00421       
00422         if (HLTMu9){
00423         
00424          ptmuon_4jet1muSel_hltmu9->Fill(muon1.pt());
00425          etamuon_4jet1muSel_hltmu9->Fill(muon1.eta());
00426          Njets_4jet1muSel_hltmu9->Fill(n_jets_20);      
00427         }
00428       }
00429    }
00430    
00431 
00433      
00434     
00435     // *****  tt->enubjjb *****
00436     if ( ngenlep==1 && ngenel==1 && nelaccept==1){   
00437     
00438          events_acc_off_electron->Fill(3,1); 
00439     
00440            for (int j=0;j<n_hlt_bits_eg;j++) {
00441                 h_el_gen->Fill(j+1);
00442               if (wtrig_eg[j]==1) {   
00443                hlt_bitel_hist_gen->Fill(j+1);
00444               }
00445            }
00446            
00447              for (int it=0; it<n_hlt_bits_jet;it++){
00448            h_jet_gen_el->Fill(it+1);
00449            if (wtrig_jet[it]==1) {
00450            hlt_bitjet_hist_gen_el->Fill(it+1);
00451              }   
00452            }
00453       
00454       // Efficiencies wrt mc + offline
00455           if (offline_el){
00456           
00457            events_acc_off_electron->Fill(4,1); 
00458           
00459             /*/// jets
00460                et_off_jet_el -> Fill(jet1.et());
00461                eta_off_jet_el-> Fill(jet1.eta());*/
00462                
00463                    for (int it=0; it<n_hlt_bits_jet;it++){
00464                      h_jet_reco_el->Fill(it+1);
00465                        if (wtrig_jet[it]==1) {
00466                          hlt_bitjet_hist_reco_el->Fill(it+1);
00467                       //    h_etjet1_trig_el[it]->Fill(jet1.et());
00468                       //    h_etajet1_trig_el[it]->Fill(jet1.eta());   
00469                               }
00470            
00471                                }
00472                
00473                
00475               eta_off_el->Fill(electron1.eta()); 
00476               pt_off_el->Fill(electron1.pt());
00477         
00478                for (int k=0;k<n_hlt_bits_eg;k++) {
00479                       h_el_reco->Fill(k+1);
00480        
00481                if (wtrig_eg[k]==1) {   
00482                 h_ptel1_trig[k]->Fill(electron1.pt());
00483                 h_etael1_trig[k]->Fill(electron1.eta()); 
00484                 hlt_bitel_hist_reco->Fill(k+1);       
00485                }
00486              }
00487                
00488          }    
00489     }
00490     
00491     
00492 
00493     // ****** tt->munubmunub *****
00494     if ( ngenlep==2 && ngenmu==2 && nmuaccept==2){  
00495       
00496       
00497       // Efficiencies wrt mc+offline
00498         if (offline_dimu){
00499         
00500             eta_off_dimu1->Fill(muon1.eta());
00501             eta_off_dimu2->Fill(muon2.eta());
00502             pt_off_dimu1->Fill(muon1.pt());
00503             pt_off_dimu2->Fill(muon2.pt());
00504         
00505            for (int j=0;j<n_hlt_bits_mu;j++) {
00506        
00507                if (wtrig_m[j]==1) {   
00508            
00509                  h_ptmu1_trig_dimu[j]->Fill(muon1.pt());
00510                  h_etamu1_trig_dimu[j]->Fill(muon1.eta());        
00511                 }
00512            }               
00513         } 
00514     }
00515     
00516     
00517     
00518     // *****   tt->enubenub *****
00519     if ( ngenlep==2 && ngenel==2 && nelaccept==2){   
00520       
00521      
00522       // Efficiencies wrt mc+offline
00523          if (offline_diel){
00524          
00525             eta_off_diel1->Fill(electron1.eta()); 
00526             eta_off_diel2->Fill(electron2.eta());
00527             pt_off_diel1->Fill(electron1.pt());
00528             pt_off_diel2->Fill(electron2.pt());
00529                 
00530            for (int k=0;k<n_hlt_bits_eg;k++) {
00531        
00532           if (wtrig_eg[k]==1) {   
00533            
00534               h_ptel1_trig_diel[k]->Fill(electron1.pt());
00535               h_etael1_trig_diel[k]->Fill(electron1.eta());        
00536             }
00537         }
00538               
00539       }    
00540     }
00541     
00542     
00543     // *****  tt->enubmunub
00544     if ( ngenlep==2 && ngenel==1 && ngenmu==1 && nmuaccept==1 && nelaccept==1){   // tt->e mu events passing acceptance
00545       
00546     
00547       // Efficiencies wrt mc+offline      
00548       if (offline_emu){
00549       
00550             eta_off_emu_muon->Fill(muon1.eta()); 
00551             pt_off_emu_muon->Fill(muon1.pt());
00552             eta_off_emu_electron->Fill(electron1.eta()); 
00553             pt_off_emu_electron->Fill(electron1.pt());
00554         
00555          for (int i=0;i<n_hlt_bits;i++) {
00556        
00557           if (wtrig_[i]==1) {   
00558            
00559               h_ptel1_trig_em[i]->Fill(electron1.pt());
00560               h_etael1_trig_em[i]->Fill(electron1.eta()); 
00561               h_ptmu1_trig_em[i]->Fill(muon1.pt());
00562               h_etamu1_trig_em[i]->Fill(muon1.eta());       
00563             }
00564         }
00565                 
00566       }    
00567     }
00568     
00569     
00571   //}
00572   
00573 }
00574 
00575 
00576 
00577 // ------------ method called once each job just before starting event loop  ------------
00578 void 
00579 TopValidation::beginJob()
00580 {
00581   
00582        dbe = edm::Service<DQMStore>().operator->();
00583 
00584         //dbe->setCurrentFolder("HLT/Top");
00585         //dbe->setCurrentFolder(triggerTag_);
00586    
00587   
00588 
00589   
00593   
00594    
00595     dbe->setCurrentFolder(topFolder.str()+"Semileptonic_muon");
00596     
00597     hlt_bitmu_hist_reco = dbe->book1D("muHLT","muHLT",hlt_bitnamesMu.size(),0.5,hlt_bitnamesMu.size()+0.5);
00598     h_mu_reco = dbe->book1D("MuonEvents","MuonEvents",hlt_bitnamesMu.size(),0.5,hlt_bitnamesMu.size()+0.5);
00599     
00600     hlt_bitmu_hist_gen = dbe->book1D("genmuHLT","genmuHLT",hlt_bitnamesMu.size(),0.5,hlt_bitnamesMu.size()+0.5);
00601     h_mu_gen = dbe->book1D("genMuonEvents","genMuonEvents",hlt_bitnamesMu.size(),0.5,hlt_bitnamesMu.size()+0.5);
00602    
00603     events_acc_off_muon = dbe->book1D("NEvents_acc_off","NEvents_acc_off",4,0.5,4.5);
00604     events_acc_off_muon -> setBinLabel(1,"Total Events");
00605     events_acc_off_muon -> setBinLabel(2,"Gen semimuon");
00606     events_acc_off_muon -> setBinLabel(3,"Acceptance");
00607     events_acc_off_muon -> setBinLabel(4,"Acceptance+offline");
00608  
00609      
00610     dbe->setCurrentFolder(topFolder.str()+"Semileptonic_electron"); 
00611     
00612     hlt_bitel_hist_reco = dbe->book1D("elHLT","elHLT",hlt_bitnamesEg.size(),0.5,hlt_bitnamesEg.size()+0.5);
00613     h_el_reco = dbe->book1D("ElectronEvents","ElectronEvents",hlt_bitnamesEg.size(),0.5,hlt_bitnamesEg.size()+0.5);
00614     
00615   
00616     hlt_bitel_hist_gen = dbe->book1D("genelHLT","genelHLT",hlt_bitnamesEg.size(),0.5,hlt_bitnamesEg.size()+0.5);
00617     h_el_gen = dbe->book1D("genElectronEvents","genElectronEvents",hlt_bitnamesEg.size(),0.5,hlt_bitnamesEg.size()+0.5);
00618     
00619     
00620     events_acc_off_electron = dbe->book1D("NEvents_acc_off","NEvents_acc_off",4,0.5,4.5);
00621     events_acc_off_electron -> setBinLabel(1,"Total Events");
00622     events_acc_off_electron -> setBinLabel(2,"Gen semielectron");
00623     events_acc_off_electron -> setBinLabel(3,"Acceptance");
00624     events_acc_off_electron -> setBinLabel(4,"Acceptance+offline");
00625    
00626       
00627     dbe->setCurrentFolder(topFolder.str()+"Jets");
00628        
00629      h_jet_reco =  dbe->book1D("denom","denom",hlt_bitnamesJet.size(),0.5,hlt_bitnamesJet.size()+0.5);
00630      hlt_bitjet_hist_reco =  dbe->book1D("numer","numer",hlt_bitnamesJet.size(),0.5,hlt_bitnamesJet.size()+0.5);
00631    
00632      h_jet_reco_el =  dbe->book1D("denom_el","denom_el",hlt_bitnamesJet.size(),0.5,hlt_bitnamesJet.size()+0.5);
00633      hlt_bitjet_hist_reco_el = dbe->book1D("numer_el","numer_el",hlt_bitnamesJet.size(),0.5,hlt_bitnamesJet.size()+0.5);
00634    
00636      h_jet_gen =  dbe->book1D("denom_gen","denom_gen",hlt_bitnamesJet.size(),0.5,hlt_bitnamesJet.size()+0.5);
00637      hlt_bitjet_hist_gen =  dbe->book1D("numer_gen","numer_gen",hlt_bitnamesJet.size(),0.5,hlt_bitnamesJet.size()+0.5);
00638    
00639      h_jet_gen_el =  dbe->book1D("denom_el_gen","denom_el_gen",hlt_bitnamesJet.size(),0.5,hlt_bitnamesJet.size()+0.5);
00640      hlt_bitjet_hist_gen_el = dbe->book1D("numer_el_gen","numer_el_gen",hlt_bitnamesJet.size(),0.5,hlt_bitnamesJet.size()+0.5);
00641    
00642    
00644     /* et_off_jet_mu                = dbe->book1D ("Jet1Et_M","Jet1Et_M",51,0.0,150.0);
00645      et_off_jet_el                = dbe->book1D ("Jet1Et_E","Jet1Et_E",51,0.0,150.0);
00646      eta_off_jet_mu               = dbe->book1D ("Jet1Eta_M","Jet1Eta_M",51,-2.5,2.5);
00647      eta_off_jet_el               = dbe->book1D ("Jet1Eta_E","Jet1Eta_E",51,-2.5,2.5);
00648      njets_off_mu                 = dbe->book1D ("NJets_M","NJets_M",11,-0.5,10.5);
00649      njets_off_el                 = dbe->book1D ("NJets_E","NJets_E",11,-0.5,10.5);
00650     
00651   
00652   
00653     
00654      for (size_t j=0;j<hlt_bitnamesJet.size();j++) { 
00655     
00656      string histname_etjet       = "Jet1Et_M_"+hlt_bitnamesJet[j];
00657      string histname_etajet       = "Jet1Eta_M_"+hlt_bitnamesJet[j];
00658      string histname_etjet_el       = "Jet1Et_E_"+hlt_bitnamesJet[j];
00659      string histname_etajet_el       = "Jet1Eta_E_"+hlt_bitnamesJet[j];
00660      hlt_bitjet_hist_reco -> setBinLabel(j+1,hlt_bitnamesJet[j].c_str());
00661      h_jet_reco -> setBinLabel(j+1,hlt_bitnamesJet[j].c_str());
00662      h_jet_reco_el -> setBinLabel(j+1,hlt_bitnamesJet[j].c_str());
00663      h_etjet1_trig_mu[j]   =   dbe->book1D((histname_etjet).c_str(),(hlt_bitnamesJet[j]+"jetEt_M").c_str(),51,0.0,150.); 
00664      h_etjet1_trig_el[j]   =   dbe->book1D((histname_etjet_el).c_str(),(hlt_bitnamesJet[j]+"jetEt_E").c_str(),51,0.0,150.); 
00665      h_etajet1_trig_mu[j]  =   dbe->book1D((histname_etajet).c_str(),(hlt_bitnamesJet[j]+"jetEta_M").c_str(),51,-2.5,2.5); 
00666      h_etajet1_trig_el[j]  =   dbe->book1D((histname_etajet_el).c_str(),(hlt_bitnamesJet[j]+"jetEta_E").c_str(),51,-2.5,2.5); 
00667     
00668      
00669   }
00670     */
00671     
00672     
00673         
00674     dbe->setCurrentFolder(topFolder.str()+"Dileptonic_emu");  
00675      
00676  
00677    for (size_t j=0;j<hlt_bitnames.size();j++) { 
00678      std::string histname_ptmu_em  = "Muon1Pt_EM_"+hlt_bitnames[j];
00679      std::string histname_etamu_em = "Muon1Eta_EM_"+hlt_bitnames[j];
00680      std::string histname_ptel_em  = "Electron1Pt_EM_"+hlt_bitnames[j];
00681      std::string histname_etael_em = "Electron1Eta_EM_"+hlt_bitnames[j];
00682      
00683      h_ptmu1_trig_em[j]  = dbe->book1D((histname_ptmu_em).c_str(),(hlt_bitnames[j]+"_muonPt_EM").c_str(),40,0.0,150.); 
00684      h_etamu1_trig_em[j] = dbe->book1D((histname_etamu_em).c_str(),(hlt_bitnames[j]+"_muonEta_EM").c_str(),51,-2.5,2.5);
00685      
00686      h_ptel1_trig_em[j]  = dbe->book1D((histname_ptel_em).c_str(),(hlt_bitnames[j]+"_electronPt_EM").c_str(),40,0.0,150.); 
00687      h_etael1_trig_em[j] = dbe->book1D((histname_etael_em).c_str(),(hlt_bitnames[j]+"_electronEta_EM").c_str(),51,-2.5,2.5); 
00688     
00689   }
00690   
00691  
00692   
00693  
00694    for (size_t jj=0;jj<hlt_bitnamesMu.size();jj++) { 
00695      std::string histname_ptmu       = "Muon1Pt_M_"+hlt_bitnamesMu[jj];
00696      std::string histname_etamu      = "Muon1Eta_M_"+hlt_bitnamesMu[jj];
00697      std::string histname_ptmu_dimu  = "Muon1Pt_MM_"+hlt_bitnamesMu[jj];
00698      std::string histname_etamu_dimu = "Muon1Eta_MM_"+hlt_bitnamesMu[jj];
00699     
00700      dbe->setCurrentFolder(topFolder.str()+"Semileptonic_muon");
00701      h_ptmu1_trig[jj]       = dbe->book1D((histname_ptmu).c_str(),(hlt_bitnamesMu[jj]+"muonPt_M").c_str(),40,0.0,150.); 
00702      h_etamu1_trig[jj]      = dbe->book1D((histname_etamu).c_str(),(hlt_bitnamesMu[jj]+"muonEta_M").c_str(),51,-2.5,2.5);
00703      
00704       hlt_bitmu_hist_reco -> setBinLabel(jj+1,hlt_bitnamesMu[jj].c_str());
00705      h_mu_reco -> setBinLabel(jj+1,hlt_bitnamesMu[jj].c_str());
00706      
00707      hlt_bitmu_hist_gen -> setBinLabel(jj+1,hlt_bitnamesMu[jj].c_str());
00708      h_mu_gen -> setBinLabel(jj+1,hlt_bitnamesMu[jj].c_str());
00709      
00710       dbe->setCurrentFolder(topFolder.str()+"Dileptonic_muon");
00711      h_ptmu1_trig_dimu[jj]  = dbe->book1D((histname_ptmu_dimu).c_str(),(hlt_bitnamesMu[jj]+"muon1Pt_MM").c_str(),40,0.0,150.); 
00712      h_etamu1_trig_dimu[jj] = dbe->book1D((histname_etamu_dimu).c_str(),(hlt_bitnamesMu[jj]+"muon1Pt_MM").c_str(),51,-2.5,2.5); 
00713     
00714      
00715    
00716     
00717   }
00718   
00719   
00720   
00721    
00722   
00723    
00724    for (size_t k=0;k<hlt_bitnamesEg.size();k++) { 
00725    
00726  
00727      std::string histname_ptel       = "Electron1Pt_E_"+hlt_bitnamesEg[k];
00728      std::string histname_etael      = "Electron1Eta_E_"+hlt_bitnamesEg[k];
00729      std::string histname_ptel_diel  = "Electron1Pt_EE_"+hlt_bitnamesEg[k];
00730      std::string histname_etael_diel = "Electron1Eta_EE_"+hlt_bitnamesEg[k];
00731      
00732     
00733      dbe->setCurrentFolder(topFolder.str()+"Semileptonic_electron");
00734     
00735      h_ptel1_trig[k]       = dbe->book1D((histname_ptel).c_str(),(hlt_bitnamesEg[k]+"electronPt_E").c_str(),40,0.0,150.); 
00736      h_etael1_trig[k]      = dbe->book1D((histname_etael).c_str(),(hlt_bitnamesEg[k]+"electronEta_E").c_str(),51,-2.5,2.5);
00737      
00738      hlt_bitel_hist_reco -> setBinLabel(k+1,hlt_bitnamesEg[k].c_str());
00739      h_el_reco -> setBinLabel(k+1,hlt_bitnamesEg[k].c_str());
00740       
00741      hlt_bitel_hist_gen -> setBinLabel(k+1,hlt_bitnamesEg[k].c_str());
00742      h_el_gen -> setBinLabel(k+1,hlt_bitnamesEg[k].c_str());
00743      
00744      
00745       dbe->setCurrentFolder(topFolder.str()+"Dileptonic_electron");
00746      h_ptel1_trig_diel[k]  = dbe->book1D((histname_ptel_diel).c_str(),(hlt_bitnamesEg[k]+"electron1Pt_EE").c_str(),40,0.0,150.); 
00747      h_etael1_trig_diel[k] = dbe->book1D((histname_etael_diel).c_str(),(hlt_bitnamesEg[k]+"electron1Eta_EE").c_str(),51,-2.5,2.5); 
00748     
00749    
00750   
00751     
00752     
00753   }
00754  
00755   
00756   
00760 
00761 
00762    // 4 jets+1mu eff monitoring
00763    
00764     dbe->setCurrentFolder(topFolder.str()+"4JetsPlus1MuonToCompareWithData");
00765     
00766     ptmuon_4jet1muSel     = dbe->book1D ("Muon1Pt_4Jets1MuonMon", "Muon1Pt_4Jets1MuonMon",40, 0.0,150.0);
00767     etamuon_4jet1muSel    = dbe->book1D ("Muon1Eta_4Jets1MuonMon","Muon1Eta_4Jets1MuonMon",51, -2.5,2.5);
00768     Njets_4jet1muSel      = dbe->book1D ("NJets_4Jets1MuonMon",   "NJets_4Jets1MuonMon",11, -0.5,10.5);
00769     
00770     ptmuon_4jet1muSel_hltmu9     = dbe->book1D ("Muon1Pt_4Jets1MuonHLTMu9Mon", "Muon1Pt_4Jets1MuonHLTMu9Mon",40, 0.0,150.0);
00771     etamuon_4jet1muSel_hltmu9    = dbe->book1D ("Muon1Eta_4Jets1MuonHLTMu9Mon","Muon1Eta_4Jets1MuonHLTMu9Mon",51, -2.5,2.5);
00772     Njets_4jet1muSel_hltmu9      = dbe->book1D ("NJets_4Jets1MuonHLTMu9Mon",   "NJets_4Jets1MuonHLTMu9Mon",11, -0.5,10.5);
00773 
00774 
00775   
00776    //semimu events 
00777     dbe->setCurrentFolder(topFolder.str()+"Semileptonic_muon");
00778     
00779   
00780   
00781     eta_off_mu               = dbe->book1D ("Muon1Eta_M","Muon1Eta_M",51,-2.5,2.5);
00782     pt_off_mu                = dbe->book1D ("Muon1Pt_M","Muon1Pt_M",40,0.0,150.0);
00783     
00784   
00785      //semiel events  
00786       dbe->setCurrentFolder(topFolder.str()+"Semileptonic_electron");
00787    
00788     eta_off_el               = dbe->book1D ("Electron1Eta_E","Electron1Eta_E",51,-2.5,2.5);
00789     pt_off_el                = dbe->book1D ("Electron1Pt_E","Electron1Pt_E",40,0.0,150.0);
00790     
00791     
00792         
00793     //dimu events
00794      dbe->setCurrentFolder(topFolder.str()+"Dileptonic_muon");
00795    
00796  
00797     eta_off_dimu1            = dbe->book1D ("Muon1Eta_MM","Muon1Eta_MM",51,-2.5,2.5);
00798     pt_off_dimu1             = dbe->book1D ("Muon1Pt_MM","Muon1Pt_MM",40,0.0,150.0);
00799     eta_off_dimu2            = dbe->book1D ("Muon2Eta_MM","Muon2Eta_MM",51,-2.5,2.5);
00800     pt_off_dimu2             = dbe->book1D ("Muon2Pt_MM","Muon2Pt_MM",40,0.0,150.0);
00801     
00802   
00803     
00804     //diel events
00805      dbe->setCurrentFolder(topFolder.str()+"Dileptonic_electron");
00806      
00807    
00808     eta_off_diel1            = dbe->book1D ("Electron1Eta_EE","Electron1Eta_EE",51,-2.5,2.5);
00809     pt_off_diel1             = dbe->book1D ("Electron1Pt_EE","Electron1Pt_EE",40,0.0,150.0);
00810     eta_off_diel2            = dbe->book1D ("Electron2Eta_EE","Electron2Eta_EE",51,-2.5,2.5);
00811     pt_off_diel2             = dbe->book1D ("Electron2Pt_EE","Electron2Pt_EE",40,0.0,150.0);
00812   
00813     
00814     //emu events
00815      dbe->setCurrentFolder(topFolder.str()+"Dileptonic_emu");
00816      
00817    
00818     
00819     eta_off_emu_muon         = dbe->book1D ("Muon1Eta_EM","Muon1Eta_EM",51,-2.5,2.5);
00820     pt_off_emu_muon          = dbe->book1D ("Muon1Pt_EM","Muon1Pt_EM",40,0.0,150.0);
00821     
00822     eta_off_emu_electron     = dbe->book1D ("Electron1Eta_EM","Electron1Eta_EM",51,-2.5,2.5);
00823     pt_off_emu_electron      = dbe->book1D ("Electron1Pt_EM","Electron1Pt_EM",40,0.0,150.0);
00824   
00825   
00826 
00827 
00828   return ;
00829   
00830   
00831 }
00832 
00833 // ------------ method called once each job just after ending the event loop  ------------
00834 void 
00835 TopValidation::endJob() {  
00836 //Write DQM thing..
00837  // outFile_  =  "prueba";
00838   //if(outFile_.size()>0)
00839   
00840   
00841  // if (&*edm::Service<DQMStore>()) edm::Service<DQMStore>()->save (outFile_);
00842   if(outputMEsInRootFile){
00843     dbe->showDirStructure();
00844     dbe->save(outputFileName);
00845   }
00846 
00847 
00848 
00849    
00850 
00851   return ;
00852 }
00853 
00854 //define this as a plug-in
00855 DEFINE_FWK_MODULE(TopValidation);