ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/src/AnaMenu.cc
Revision: 1.1
Committed: Mon Oct 29 12:46:00 2012 UTC (12 years, 6 months ago) by konec
Content type: text/plain
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 konec 1.1 #include "UserCode/L1RpcTriggerAnalysis/interface/AnaMenu.h"
2     #include "TObjArray.h"
3     #include "TH1D.h"
4     #include "TH2D.h"
5     #include "TGraphErrors.h"
6     #include "UserCode/L1RpcTriggerAnalysis/interface/MuonObj.h"
7     #include "UserCode/L1RpcTriggerAnalysis/interface/EventObj.h"
8     #include <sstream>
9     #include <iostream>
10    
11     namespace {
12     }
13    
14    
15     bool AnaMenu::filter( const EventObj* ev, const MuonObj* muon,
16     const std::vector<std::string> & namesL1,
17     const std::vector<unsigned int> & algosL1,
18     const std::vector<std::string> & namesHLT,
19     const std::vector<unsigned int> & algosHLT)
20     {
21     typedef std::vector<unsigned int>::const_iterator CIT;
22    
23     // static int count = 0;
24     // std::cout <<"----------"<<std::endl;
25     bool hasNoL1Mu= false;
26     for (CIT it=algosL1.begin(); it != algosL1.end(); ++it) {
27     std::string nameAlgo = namesL1[*it];
28     // std::cout <<nameAlgo << std::endl;
29     if (theAlgosL1.find(nameAlgo) == theAlgosL1.end()) theAlgosL1[nameAlgo]=0;
30     bool isMu = ( nameAlgo.find("Mu") != std::string::npos);
31     if (!isMu) hasNoL1Mu = true;
32     }
33     // if (hasNoL1Mu) std::cout <<" HAS NO L1 MUON!: " <<++count<< std::endl;
34    
35     bool hasNoHLTMu= false;
36     for (CIT it=algosHLT.begin(); it != algosHLT.end(); ++it) {
37     std::string nameAlgo = namesHLT[*it];
38     // std::cout <<nameAlgo << std::endl;
39     if (theAlgosHLT.find(nameAlgo) == theAlgosHLT.end()) theAlgosHLT[nameAlgo]=0;
40     if (nameAlgo.find("Physic") != std::string::npos) continue;
41     bool isMu = ( (nameAlgo.find("Mu") != std::string::npos) && (nameAlgo.find("Multi") == std::string::npos) );
42     if (!isMu) hasNoHLTMu = true;
43     }
44     // if (hasNoHLTMu) std::cout <<" HAS NO HLT MUON!" << std::endl;
45    
46     if (hasNoL1Mu && hasNoHLTMu) {
47     // if (hasNoL1Mu ) {
48     for (CIT it=algosL1.begin(); it != algosL1.end(); ++it) theAlgosL1[ namesL1[*it] ]++;
49     for (CIT it=algosHLT.begin(); it != algosHLT.end(); ++it) theAlgosHLT[ namesHLT[*it] ]++;
50     return true;
51     }
52    
53     return false;
54     }
55    
56     void AnaMenu::resume(TObjArray& histos)
57     {
58     unsigned int sizeL1 = theAlgosL1.size();
59     unsigned int sizeHLT = theAlgosHLT.size();
60     TH1D *hMenuAlgosL1 = new TH1D( "hMenuAlgosL1", "hMenuAlgosL1", sizeL1, 1., 1.+sizeL1); histos.Add(hMenuAlgosL1);
61     TH1D *hMenuAlgosHLT = new TH1D("hMenuAlgosHLT","hMenuAlgosHLT",sizeHLT, 1., 1.+sizeHLT); histos.Add(hMenuAlgosHLT);
62     unsigned int ibin = 0;
63     typedef std::map< std::string, unsigned int>::const_iterator CIM;
64     for (CIM it=theAlgosL1.begin(); it != theAlgosL1.end(); ++it) {
65     ibin++;
66     hMenuAlgosL1->GetXaxis()->SetBinLabel(ibin, (*it).first.c_str());
67     hMenuAlgosL1->SetBinContent(ibin, (*it).second);
68     std::cout <<" BIN "<<ibin<<" LABEL: "<<(*it).first.c_str()<<" ENTRIES:"<<(*it).second<<std::endl;
69     }
70     ibin = 0;
71     for (CIM it=theAlgosHLT.begin(); it != theAlgosHLT.end(); ++it) {
72     ibin++;
73     hMenuAlgosHLT->GetXaxis()->SetBinLabel(ibin, (*it).first.c_str());
74     hMenuAlgosHLT->SetBinContent(ibin, (*it).second);
75     std::cout <<" BIN "<<ibin<<" LABEL: "<<(*it).first.c_str()<<" ENTRIES:"<<(*it).second<<std::endl;
76     }
77     }
78    
79    
80     void AnaMenu::init(TObjArray& histos)
81     {
82     /*
83     hClu_SizeDigi = new TH1D( "hClu_SizeDigi", "hClu_SizeDigi", 97, -0.5, 96.5); histos.Add( hClu_SizeDigi);
84     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     */
87     }