ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/src/AnaMenu.cc
(Generate patch)

Comparing UserCode/L1RpcTriggerAnalysis/src/AnaMenu.cc (file contents):
Revision 1.1 by konec, Mon Oct 29 12:46:00 2012 UTC vs.
Revision 1.6 by konec, Tue Apr 23 09:27:55 2013 UTC

# Line 5 | Line 5
5   #include "TGraphErrors.h"
6   #include "UserCode/L1RpcTriggerAnalysis/interface/MuonObj.h"
7   #include "UserCode/L1RpcTriggerAnalysis/interface/EventObj.h"
8 + #include "UserCode/L1RpcTriggerAnalysis/interface/Utilities.h"
9 + #include "UserCode/L1RpcTriggerAnalysis/interface/TriggerMenuResultObj.h"
10   #include <sstream>
11   #include <iostream>
12 + #include <cmath>
13  
14   namespace {
15 + TH1D *hMuonPt_MEN, *hMuonEta_MEN, *hMuonPhi_MEN;
16   }
17  
18  
19 + void  AnaMenu::updateMenu(const std::vector<std::string> & menuL1, const std::vector<std::string> & menuHLT)
20 + {
21 +  if (menuL1.size() != 0) theMenuL1 = menuL1;
22 +  if (menuHLT.size() != 0) theMenuHLT = menuHLT;
23 + }
24 +
25   bool AnaMenu::filter( const EventObj* ev, const MuonObj* muon,
26 <                  const  std::vector<std::string> & namesL1,
27 <                  const std::vector<unsigned int> & algosL1,
28 <                  const std::vector<std::string> &  namesHLT,
19 <                  const std::vector<unsigned int> & algosHLT)
26 >                      const TriggerMenuResultObj *bitsL1,
27 >                      const TriggerMenuResultObj *bitsHLT)
28 >
29   {
30 +  const std::vector<unsigned int> & algosL1 = bitsL1->firedAlgos;
31 +  const std::vector<unsigned int> & algosHLT = bitsHLT->firedAlgos;
32 +
33    typedef std::vector<unsigned int>::const_iterator CIT;
34  
35 < //  static int count = 0;
36 < //  std::cout <<"----------"<<std::endl;
37 <  bool hasNoL1Mu= false;
35 >
36 >  bool okL1 = false;
37 >  
38 >  if (debug) std::cout <<"--------------------------------------------------------------"<<std::endl;
39 >  if (debug) std::cout << "================== L1 names: "<< std::endl;
40 >  std::vector<std::string> acceptL1_Names = theConfig.exists("acceptL1_Names") ?  theConfig.getParameter<std::vector<std::string> >("acceptL1_Names") : std::vector<std::string>();
41    for (CIT it=algosL1.begin(); it != algosL1.end(); ++it) {
42 <    std::string nameAlgo = namesL1[*it];
43 < //    std::cout <<nameAlgo << std::endl;
42 >    bool aokL1 = false;
43 >    std::string nameAlgo = theMenuL1[*it];
44      if (theAlgosL1.find(nameAlgo) == theAlgosL1.end()) theAlgosL1[nameAlgo]=0;    
45      bool isMu = ( nameAlgo.find("Mu") != std::string::npos);
46 <    if (!isMu) hasNoL1Mu = true;
46 >    if (theConfig.getParameter<bool>("acceptL1_OtherThanMu") && !isMu ) aokL1 = true;
47 >    if (theConfig.getParameter<bool>("acceptL1_Mu") &&  isMu) aokL1 = true;
48 >    for ( std::vector<std::string>::const_iterator is=acceptL1_Names.begin(); is != acceptL1_Names.end(); ++is) if (nameAlgo==(*is)) aokL1 = true;
49 >    if (debug) {std::cout <<nameAlgo; if (aokL1) std::cout <<" <--"; std::cout << std::endl; }
50 >    if (aokL1) okL1=true;
51    }
33 // if (hasNoL1Mu) std::cout <<" HAS NO L1 MUON!: " <<++count<< std::endl;
52  
53 <  bool hasNoHLTMu= false;
53 >  bool okHLT = false;
54 >  if (debug) std::cout << "================== L1 names: "<< std::endl;
55    for (CIT it=algosHLT.begin(); it != algosHLT.end(); ++it) {
56 <    std::string nameAlgo = namesHLT[*it];
57 < //    std::cout <<nameAlgo << std::endl;
56 >    bool aokHLT = false;
57 >    std::string nameAlgo = theMenuHLT[*it];
58      if (theAlgosHLT.find(nameAlgo) == theAlgosHLT.end()) theAlgosHLT[nameAlgo]=0;    
59 <    if (nameAlgo.find("Physic") != std::string::npos) continue;
60 <    bool isMu = ( (nameAlgo.find("Mu") != std::string::npos) && (nameAlgo.find("Multi") == std::string::npos) );
61 <    if (!isMu) hasNoHLTMu = true;
59 >    bool isMu = (    (    (nameAlgo.find("Mu") != std::string::npos   )
60 >                       && (nameAlgo.find("Multi") == std::string::npos) )
61 >                  || (     nameAlgo.find("muon") != std::string::npos   )  );
62 >    if ( theConfig.getParameter<bool>("acceptHLT_OtherThanMuPhysicsAlCa")
63 >         && !isMu
64 >         && (nameAlgo.find("Physics") == std::string::npos)
65 >         && (nameAlgo.find("AlCa") == std::string::npos) ) aokHLT = true;
66 >    if (theConfig.getParameter<bool>("acceptHLT_Mu") && isMu) aokHLT = true;
67 >    if (theConfig.getParameter<bool>("acceptHLT_L1")       && (nameAlgo.find("HLT_L1")   != std::string::npos) ) aokHLT = true;
68 >    if (theConfig.getParameter<bool>("acceptHLT_Physics")  && (nameAlgo.find("Physics")  != std::string::npos) ) aokHLT = true;
69 >    if (theConfig.getParameter<bool>("acceptHLT_ZeroBias") && (nameAlgo.find("ZeroBias") != std::string::npos) ) aokHLT = true;
70 >    if (debug) {std::cout <<nameAlgo; if (aokHLT) std::cout <<" <--"; std::cout << std::endl; }
71 >    if (aokHLT) okHLT=true;
72    }
44 //  if (hasNoHLTMu) std::cout <<" HAS NO HLT MUON!" << std::endl;
73  
74 <  if (hasNoL1Mu && hasNoHLTMu) {
75 < //  if (hasNoL1Mu ) {
76 <    for (CIT it=algosL1.begin();  it != algosL1.end();  ++it)  theAlgosL1[ namesL1[*it] ]++;
77 <    for (CIT it=algosHLT.begin(); it != algosHLT.end(); ++it) theAlgosHLT[ namesHLT[*it] ]++;
78 <    return true;
79 <  }
74 >  if (okL1  && okHLT) {
75 >    for (CIT it=algosL1.begin();  it != algosL1.end();  ++it)  theAlgosL1[ theMenuL1[*it] ]++;
76 >    for (CIT it=algosHLT.begin(); it != algosHLT.end(); ++it) theAlgosHLT[ theMenuHLT[*it] ]++;
77 >    if (hMuonPt_MEN)  hMuonPt_MEN->Fill(muon->pt());
78 >    if (hMuonEta_MEN) hMuonEta_MEN->Fill(muon->eta());
79 >    if (hMuonPhi_MEN) hMuonPhi_MEN->Fill(muon->phi());
80 >    return true;
81 >  } else return  false;
82  
53  return  false;
83   }
84  
85   void AnaMenu::resume(TObjArray& histos)
# Line 65 | Line 94 | void AnaMenu::resume(TObjArray& histos)
94      ibin++;
95      hMenuAlgosL1->GetXaxis()->SetBinLabel(ibin, (*it).first.c_str());
96      hMenuAlgosL1->SetBinContent(ibin, (*it).second);
97 <    std::cout <<" BIN "<<ibin<<" LABEL: "<<(*it).first.c_str()<<" ENTRIES:"<<(*it).second<<std::endl;
97 > //    std::cout <<" BIN "<<ibin<<" LABEL: "<<(*it).first.c_str()<<" ENTRIES:"<<(*it).second<<std::endl;
98    }
99    ibin = 0;
100    for (CIM it=theAlgosHLT.begin(); it != theAlgosHLT.end(); ++it) {
101      ibin++;
102      hMenuAlgosHLT->GetXaxis()->SetBinLabel(ibin, (*it).first.c_str());
103      hMenuAlgosHLT->SetBinContent(ibin, (*it).second);
104 <    std::cout <<" BIN "<<ibin<<" LABEL: "<<(*it).first.c_str()<<" ENTRIES:"<<(*it).second<<std::endl;
104 > //    std::cout <<" BIN "<<ibin<<" LABEL: "<<(*it).first.c_str()<<" ENTRIES:"<<(*it).second<<std::endl;
105    }
106   }
107  
108  
109   void AnaMenu::init(TObjArray& histos)
110   {
111 < /*
112 < hClu_SizeDigi = new TH1D( "hClu_SizeDigi", "hClu_SizeDigi", 97, -0.5, 96.5);  histos.Add( hClu_SizeDigi);
113 < hClu_SizeRHit = new TH1D( "hClu_SizeRHit", "hClu_SizeRHit", 97, -0.5, 96.5);  histos.Add( hClu_SizeRHit);
85 < hClu_DigiRHit = new TH2D( "hClu_DigiRHit","hClu_DigiRHit", 97, -0.5, 96.5, 97, -0.5, 96.5);  histos.Add(hClu_DigiRHit);
86 < */
111 >  hMuonPt_MEN  = new TH1D("hMuonPt_MEN","All global muons Pt;Glb.muon p_{T} [GeV];Muons / bin",L1PtScale::nPtBins,L1PtScale::ptBins); histos.Add(hMuonPt_MEN);
112 >  hMuonEta_MEN = new TH1D("hMuonEta_MEN","All global muons Eta;Glb.muon #eta;Muons / bin",96, -2.4, 2.4);  histos.Add(hMuonEta_MEN);
113 >  hMuonPhi_MEN = new TH1D("hMuonPhi_MEN","All global muons Phi;Glb.muon #phi [rad];Muons / bin",90,-M_PI,M_PI);  histos.Add(hMuonPhi_MEN);
114   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines