CMS 3D CMS Logo

HLTMCtruth Class Reference

$Date: November 2006 $Revision: More...

#include <HLTrigger/HLTanalyzers/interface/HLTMCtruth.h>

List of all members.

Public Member Functions

void analyze (const edm::Handle< CandidateView > &mctruth, const edm::Handle< double > &pthat, TTree *tree)
 Analyze the Data.
 HLTMCtruth ()
void setup (const edm::ParameterSet &pSet, TTree *tree)

Private Attributes

bool _Debug
bool _Monte
float * mceta
float * mcphi
intmcpid
float * mcpt
intmcstatus
float * mcvx
float * mcvy
float * mcvz
int nab
int nbb
int nel3
int nmcpart
int nmu3
int nwenu
int nwmunu
int nzee
int nzmumu
float ptEleMax
float pthatf
float ptMuMax


Detailed Description

$Date: November 2006 $Revision:

Author:
P. Bargassa - Rice U.

Definition at line 27 of file HLTMCtruth.h.


Constructor & Destructor Documentation

HLTMCtruth::HLTMCtruth (  ) 

Definition at line 15 of file HLTMCtruth.cc.

References _Debug, and _Monte.

00015                        {
00016 
00017   //set parameter defaults 
00018   _Monte=false;
00019   _Debug=false;
00020 }


Member Function Documentation

void HLTMCtruth::analyze ( const edm::Handle< CandidateView > &  mctruth,
const edm::Handle< double > &  pthat,
TTree *  tree 
)

Analyze the Data.

Definition at line 67 of file HLTMCtruth.cc.

References _Monte, GenMuonPlsPt100GeV_cfg::cout, d, reco::Candidate::daughter(), lat::endl(), reco::Particle::eta(), i, edm::Handle< T >::isValid(), j, mceta, mcphi, mcpid, mcpt, mcvx, mcvy, mcvz, nab, nbb, nel3, nmcpart, nmu3, reco::Candidate::numberOfDaughters(), nwenu, nwmunu, nzee, nzmumu, p, reco::Particle::pdgId(), reco::Particle::phi(), reco::Particle::pt(), ptEleMax, pthatf, ptMuMax, reco::Particle::vx(), reco::Particle::vy(), and reco::Particle::vz().

Referenced by HLTAnalyzer::analyze().

00069                                          {
00070 
00071   //std::cout << " Beginning HLTMCtruth " << std::endl;
00072 
00073   if (_Monte) {
00074     int nmc = 0;
00075     int mu3 = 0;
00076     int el3 = 0;
00077     int mab = 0;
00078     int mbb = 0;
00079     int wel = 0;
00080     int wmu = 0;
00081     int zee = 0;
00082     int zmumu = 0;
00083 
00084     ptEleMax = -999.0;
00085     ptMuMax  = -999.0;    
00086     pthatf   = pthat.isValid() ? * pthat : 0.0;
00087 
00088     if (mctruth.isValid()){
00089 
00090       for (size_t i = 0; i < mctruth->size(); ++ i) {
00091         const Candidate & p = (*mctruth)[i];
00092 
00093         mcpid[nmc] = p.pdgId();
00094         mcpt[nmc] = p.pt();
00095         mceta[nmc] = p.eta();
00096         mcphi[nmc] = p.phi();
00097         mcvx[nmc] = p.vx();
00098         mcvy[nmc] = p.vy();
00099         mcvz[nmc] = p.vz();
00100 
00101         if ((mcpid[nmc]==24)||(mcpid[nmc]==-24)) { // Checking W -> e/mu nu
00102           size_t idg = p.numberOfDaughters();
00103           for (size_t j=0; j != idg; ++j){
00104             const Candidate & d = *p.daughter(j);
00105             if ((d.pdgId()==11)||(d.pdgId()==-11)){wel += 1;}
00106             if ((d.pdgId()==13)||(d.pdgId()==-13)){wmu += 1;}
00107 //          if ( (abs(d.pdgId())!=24) && ((mcpid[nmc])*(d.pdgId())>0) ) 
00108 //            {cout << "Wrong sign between mother-W and daughter !" << endl;}
00109           }
00110         }
00111         if (mcpid[nmc]==23) { // Checking Z -> 2 e/mu
00112           size_t idg = p.numberOfDaughters();
00113           for (size_t j=0; j != idg; ++j){
00114             const Candidate & d = *p.daughter(j);
00115             if (d.pdgId()==11){zee += 1;}
00116             if (d.pdgId()==-11){zee += 2;}
00117             if (d.pdgId()==13){zmumu += 1;}
00118             if (d.pdgId()==-13){zmumu += 2;}
00119           }
00120         }
00121 
00122         if (((mcpid[nmc]==13)||(mcpid[nmc]==-13))&&(mcpt[nmc]>2.5)) {mu3 += 1;} // Flag for muons with pT > 2.5 GeV/c
00123         if (((mcpid[nmc]==11)||(mcpid[nmc]==-11))&&(mcpt[nmc]>2.5)) {el3 += 1;} // Flag for electrons with pT > 2.5 GeV/c
00124 
00125         if (mcpid[nmc]==-5) {mab += 1;} // Flag for bbar
00126         if (mcpid[nmc]==5) {mbb += 1;} // Flag for b
00127 
00128         if ((mcpid[nmc]==13)||(mcpid[nmc]==-13))
00129           {if (p.pt()>ptMuMax) {ptMuMax=p.pt();} } // Save max pt of generated Muons
00130         if ((mcpid[nmc]==11)||(mcpid[nmc]==-11))
00131           {if (p.pt() > ptEleMax) ptEleMax=p.pt();} // Save max pt of generated Electrons
00132 
00133         nmc++;
00134       }
00135 
00136     }
00137     else {std::cout << "%HLTMCtruth -- No MC truth information" << std::endl;}
00138 
00139     nmcpart = nmc;
00140     nmu3 = mu3;
00141     nel3 = el3;
00142     nbb = mbb;
00143     nab = mab;
00144     nwenu = wel;
00145     nwmunu = wmu;
00146     if((zee%3)==0){nzee = zee/3;}
00147 //     else {cout << "Z does not decay in e+ e- !" << endl;}
00148     if ((zmumu%3)==0){nzmumu = zmumu/3;}
00149 //     else {cout << "Z does not decay in mu+ mu- !" << endl;}
00150 
00151   }
00152 
00153 }

void HLTMCtruth::setup ( const edm::ParameterSet pSet,
TTree *  tree 
)

Definition at line 23 of file HLTMCtruth.cc.

References _Debug, _Monte, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), mceta, mcphi, mcpid, mcpt, mcvx, mcvy, mcvz, nab, nbb, nel3, nmcpart, nmu3, nwenu, nwmunu, nzee, nzmumu, ptEleMax, pthatf, and ptMuMax.

Referenced by HLTAnalyzer::HLTAnalyzer().

00023                                                                   {
00024 
00025   edm::ParameterSet myMCParams = pSet.getParameter<edm::ParameterSet>("RunParameters") ;
00026   vector<std::string> parameterNames = myMCParams.getParameterNames() ;
00027   
00028   for ( vector<std::string>::iterator iParam = parameterNames.begin();
00029         iParam != parameterNames.end(); iParam++ ){
00030     if  ( (*iParam) == "Monte" ) _Monte =  myMCParams.getParameter<bool>( *iParam );
00031     else if ( (*iParam) == "Debug" ) _Debug =  myMCParams.getParameter<bool>( *iParam );
00032   }
00033 
00034   const int kMaxMcTruth = 10000;
00035   mcpid = new int[kMaxMcTruth];
00036   mcvx = new float[kMaxMcTruth];
00037   mcvy = new float[kMaxMcTruth];
00038   mcvz = new float[kMaxMcTruth];
00039   mcpt = new float[kMaxMcTruth];
00040   mceta = new float[kMaxMcTruth];
00041   mcphi = new float[kMaxMcTruth];
00042 
00043   // MCtruth-specific branches of the tree 
00044   HltTree->Branch("NMCpart",&nmcpart,"NMCpart/I");
00045   HltTree->Branch("MCpid",mcpid,"MCpid[NMCpart]/I");
00046   HltTree->Branch("MCvtxX",mcvx,"MCvtxX[NMCpart]/F");
00047   HltTree->Branch("MCvtxY",mcvy,"MCvtxY[NMCpart]/F");
00048   HltTree->Branch("MCvtxZ",mcvz,"MCvtxZ[NMCpart]/F");
00049   HltTree->Branch("MCpt",mcpt,"MCpt[NMCpart]/F");
00050   HltTree->Branch("MCeta",mceta,"MCeta[NMCpart]/F");
00051   HltTree->Branch("MCphi",mcphi,"MCphi[NMCpart]/F");
00052   HltTree->Branch("MCPtHat",&pthatf,"MCPtHat/F");
00053   HltTree->Branch("MCmu3",&nmu3,"MCmu3/I");
00054   HltTree->Branch("MCel3",&nel3,"MCel3/I");
00055   HltTree->Branch("MCbb",&nbb,"MCbb/I");
00056   HltTree->Branch("MCab",&nab,"MCab/I");
00057   HltTree->Branch("MCWenu",&nwenu,"MCWenu/I");
00058   HltTree->Branch("MCWmunu",&nwmunu,"MCmunu/I");
00059   HltTree->Branch("MCZee",&nzee,"MCZee/I");
00060   HltTree->Branch("MCZmumu",&nzmumu,"MCZmumu/I");
00061   HltTree->Branch("MCptEleMax",&ptEleMax,"MCptEleMax/F");
00062   HltTree->Branch("MCptMuMax",&ptMuMax,"MCptMuMax/F");
00063 
00064 }


Member Data Documentation

bool HLTMCtruth::_Debug [private]

Definition at line 47 of file HLTMCtruth.h.

Referenced by HLTMCtruth(), and setup().

bool HLTMCtruth::_Monte [private]

Definition at line 47 of file HLTMCtruth.h.

Referenced by analyze(), HLTMCtruth(), and setup().

float * HLTMCtruth::mceta [private]

Definition at line 41 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

float * HLTMCtruth::mcphi [private]

Definition at line 41 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

int* HLTMCtruth::mcpid [private]

Definition at line 42 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

float * HLTMCtruth::mcpt [private]

Definition at line 41 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

int * HLTMCtruth::mcstatus [private]

Definition at line 42 of file HLTMCtruth.h.

float* HLTMCtruth::mcvx [private]

Definition at line 41 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

float * HLTMCtruth::mcvy [private]

Definition at line 41 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

float * HLTMCtruth::mcvz [private]

Definition at line 41 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

int HLTMCtruth::nab [private]

Definition at line 43 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

int HLTMCtruth::nbb [private]

Definition at line 43 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

int HLTMCtruth::nel3 [private]

Definition at line 43 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

int HLTMCtruth::nmcpart [private]

Definition at line 43 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

int HLTMCtruth::nmu3 [private]

Definition at line 43 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

int HLTMCtruth::nwenu [private]

Definition at line 43 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

int HLTMCtruth::nwmunu [private]

Definition at line 43 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

int HLTMCtruth::nzee [private]

Definition at line 43 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

int HLTMCtruth::nzmumu [private]

Definition at line 43 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

float HLTMCtruth::ptEleMax [private]

Definition at line 45 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

float HLTMCtruth::pthatf [private]

Definition at line 44 of file HLTMCtruth.h.

Referenced by analyze(), and setup().

float HLTMCtruth::ptMuMax [private]

Definition at line 45 of file HLTMCtruth.h.

Referenced by analyze(), and setup().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:24:32 2009 for CMSSW by  doxygen 1.5.4