CMS 3D CMS Logo

Public Member Functions | Private Attributes | Static Private Attributes

AnalysisRootpleProducerOnlyMC Class Reference

#include <AnalysisRootpleProducerOnlyMC.h>

Inheritance diagram for AnalysisRootpleProducerOnlyMC:
edm::EDAnalyzer

List of all members.

Public Member Functions

 AnalysisRootpleProducerOnlyMC (const edm::ParameterSet &)
virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void endJob ()
void fillChargedJet (float, float, float, float)
void fillEventInfo (int)
void fillInclusiveJet (float, float, float, float)
void fillMCParticles (float, float, float, float)
void store ()
virtual ~AnalysisRootpleProducerOnlyMC ()

Private Attributes

TTree * AnalysisTree
edm::Handle< std::vector
< reco::GenParticle > > 
CandHandleMC
TClonesArray * ChargedJet
edm::Handle
< reco::GenJetCollection
ChgGenJetsHandle
edm::InputTag chgGenPartCollName
edm::InputTag chgJetCollName
float EtaCJ [NCJMAX]
float EtaEHJ [NEHJMAX]
float EtaIJ [NIJMAX]
float EtaMC [NMCPMAX]
float EtaTJ [NTJMAX]
float EtaTK [NTKMAX]
int EventKind
edm::Handle< edm::HepMCProductEvtHandle
edm::Service< TFileServicefs
edm::InputTag genJetCollName
edm::Handle
< reco::GenJetCollection
GenJetsHandle
TClonesArray * InclusiveJet
edm::InputTag mcEvent
float MomentumCJ [NCJMAX]
float MomentumEHJ [NEHJMAX]
float MomentumIJ [NIJMAX]
float MomentumMC [NMCPMAX]
float MomentumTJ [NTJMAX]
float MomentumTK [NTKMAX]
TClonesArray * MonteCarlo
int NumberCaloJet
int NumberChargedJet
int NumberInclusiveJet
int NumberMCParticles
int NumberTracks
int NumberTracksJet
float PhiCJ [NCJMAX]
float PhiEHJ [NEHJMAX]
float PhiIJ [NIJMAX]
float PhiMC [NMCPMAX]
float PhiTJ [NTJMAX]
float PhiTK [NTKMAX]
float piG
float TransverseMomentumCJ [NCJMAX]
float TransverseMomentumEHJ [NEHJMAX]
float TransverseMomentumIJ [NIJMAX]
float TransverseMomentumMC [NMCPMAX]
float TransverseMomentumTJ [NTJMAX]
float TransverseMomentumTK [NTKMAX]

Static Private Attributes

static const int NCJMAX = 10000
static const int NEHJMAX = 10000
static const int NIJMAX = 10000
static const int NMCPMAX = 10000
static const int NTJMAX = 10000
static const int NTKMAX = 10000

Detailed Description

Definition at line 31 of file AnalysisRootpleProducerOnlyMC.h.


Constructor & Destructor Documentation

AnalysisRootpleProducerOnlyMC::AnalysisRootpleProducerOnlyMC ( const edm::ParameterSet pset) [explicit]
virtual AnalysisRootpleProducerOnlyMC::~AnalysisRootpleProducerOnlyMC ( ) [inline, virtual]

Definition at line 37 of file AnalysisRootpleProducerOnlyMC.h.

{} 

Member Function Documentation

void AnalysisRootpleProducerOnlyMC::analyze ( const edm::Event e,
const edm::EventSetup  
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 129 of file AnalysisRootpleProducerOnlyMC.cc.

References edm::Event::getByLabel().

{

  e.getByLabel( mcEvent           , EvtHandle        ) ;
  e.getByLabel( chgGenPartCollName, CandHandleMC     );
  e.getByLabel( chgJetCollName    , ChgGenJetsHandle );
  e.getByLabel( genJetCollName    , GenJetsHandle    );
  
  const HepMC::GenEvent* Evt = EvtHandle->GetEvent() ;
  
  EventKind = Evt->signal_process_id();
  
  std::vector<math::XYZTLorentzVector> GenPart;
  std::vector<GenJet> ChgGenJetContainer;
  std::vector<GenJet> GenJetContainer;
  
  GenPart.clear();
  ChgGenJetContainer.clear();
  GenJetContainer.clear();
  
  ChargedJet->Clear();
  InclusiveJet->Clear();
  MonteCarlo->Clear();

  if (ChgGenJetsHandle->size()){

    for ( GenJetCollection::const_iterator it(ChgGenJetsHandle->begin()), itEnd(ChgGenJetsHandle->end());
          it!=itEnd; ++it)
      {
        ChgGenJetContainer.push_back(*it);
      }
    
    std::stable_sort(ChgGenJetContainer.begin(),ChgGenJetContainer.end(),GenJetSort());
    
    std::vector<GenJet>::const_iterator it(ChgGenJetContainer.begin()), itEnd(ChgGenJetContainer.end());
    for ( int iChargedJet(0); it != itEnd; ++it, ++iChargedJet)
      {
        fillChargedJet(it->p(),it->pt(),it->eta(),it->phi());
        new((*ChargedJet)[iChargedJet]) TLorentzVector(it->px(), it->py(), it->pz(), it->energy());
      }
  }
  
  if (GenJetsHandle->size()){
    
    for ( GenJetCollection::const_iterator it(GenJetsHandle->begin()), itEnd(GenJetsHandle->end());
          it!=itEnd; ++it )
      {
        GenJetContainer.push_back(*it);
      }

    std::stable_sort(GenJetContainer.begin(),GenJetContainer.end(),GenJetSort());

    std::vector<GenJet>::const_iterator it(GenJetContainer.begin()), itEnd(GenJetContainer.end()); 
    for ( int iInclusiveJet(0); it != itEnd; ++it, ++iInclusiveJet)
      {
        fillInclusiveJet(it->p(),it->pt(),it->eta(),it->phi());
        new((*InclusiveJet)[iInclusiveJet]) TLorentzVector(it->px(), it->py(), it->pz(), it->energy());
      }
  }
  
  if (CandHandleMC->size()){

    for (vector<GenParticle>::const_iterator it(CandHandleMC->begin()), itEnd(CandHandleMC->end());
         it != itEnd;it++)
      {
        GenPart.push_back(it->p4());
      }

    std::stable_sort(GenPart.begin(),GenPart.end(),GreaterPt());

    std::vector<math::XYZTLorentzVector>::const_iterator it(GenPart.begin()), itEnd(GenPart.end());
    for( int iMonteCarlo(0); it != itEnd; ++it, ++iMonteCarlo )
      {
        fillMCParticles(it->P(),it->Pt(),it->Eta(),it->Phi());
        new((*MonteCarlo)[iMonteCarlo]) TLorentzVector(it->Px(), it->Py(), it->Pz(), it->E()); 
      }
  }

  store();
}
void AnalysisRootpleProducerOnlyMC::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 82 of file AnalysisRootpleProducerOnlyMC.cc.

{
  // use TFileService for output to root file 
  AnalysisTree = fs->make<TTree>("AnalysisTree","MBUE Analysis Tree ");
 
  // process type
  AnalysisTree->Branch("EventKind",&EventKind,"EventKind/I");
  
  // store p, pt, eta, phi for particles and jets

  // GenParticles at hadron level
  AnalysisTree->Branch("NumberMCParticles",&NumberMCParticles,"NumberMCParticles/I");
  AnalysisTree->Branch("MomentumMC",MomentumMC,"MomentumMC[NumberMCParticles]/F");
  AnalysisTree->Branch("TransverseMomentumMC",TransverseMomentumMC,"TransverseMomentumMC[NumberMCParticles]/F");
  AnalysisTree->Branch("EtaMC",EtaMC,"EtaMC[NumberMCParticles]/F");
  AnalysisTree->Branch("PhiMC",PhiMC,"PhiMC[NumberMCParticles]/F");

  // GenJets
  AnalysisTree->Branch("NumberInclusiveJet",&NumberInclusiveJet,"NumberInclusiveJet/I");
  AnalysisTree->Branch("MomentumIJ",MomentumIJ,"MomentumIJ[NumberInclusiveJet]/F");
  AnalysisTree->Branch("TrasverseMomentumIJ",TransverseMomentumIJ,"TransverseMomentumIJ[NumberInclusiveJet]/F");
  AnalysisTree->Branch("EtaIJ",EtaIJ,"EtaIJ[NumberInclusiveJet]/F");
  AnalysisTree->Branch("PhiIJ",PhiIJ,"PhiIJ[NumberInclusiveJet]/F");
  
  // jets from charged GenParticles
  AnalysisTree->Branch("NumberChargedJet",&NumberChargedJet,"NumberChargedJet/I");
  AnalysisTree->Branch("MomentumCJ",MomentumCJ,"MomentumCJ[NumberChargedJet]/F");
  AnalysisTree->Branch("TrasverseMomentumCJ",TransverseMomentumCJ,"TransverseMomentumCJ[NumberChargedJet]/F");
  AnalysisTree->Branch("EtaCJ",EtaCJ,"EtaCJ[NumberChargedJet]/F");
  AnalysisTree->Branch("PhiCJ",PhiCJ,"PhiCJ[NumberChargedJet]/F");
  

  // alternative storage method:
  // save TClonesArrays of TLorentzVectors
  // i.e. store 4-vectors of particles and jets

  MonteCarlo = new TClonesArray("TLorentzVector", 10000);
  AnalysisTree->Branch("MonteCarlo", "TClonesArray", &MonteCarlo, 128000, 0);
  
  InclusiveJet = new TClonesArray("TLorentzVector", 10000);
  AnalysisTree->Branch("InclusiveJet", "TClonesArray", &InclusiveJet, 128000, 0);

  ChargedJet = new TClonesArray("TLorentzVector", 10000);
  AnalysisTree->Branch("ChargedJet", "TClonesArray", &ChargedJet, 128000, 0);
}
void AnalysisRootpleProducerOnlyMC::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 210 of file AnalysisRootpleProducerOnlyMC.cc.

{
}
void AnalysisRootpleProducerOnlyMC::fillChargedJet ( float  p,
float  pt,
float  eta,
float  phi 
)
void AnalysisRootpleProducerOnlyMC::fillEventInfo ( int  e)

Definition at line 36 of file AnalysisRootpleProducerOnlyMC.cc.

References alignCSCRings::e.

{
  EventKind = e;
}
void AnalysisRootpleProducerOnlyMC::fillInclusiveJet ( float  p,
float  pt,
float  eta,
float  phi 
)
void AnalysisRootpleProducerOnlyMC::fillMCParticles ( float  p,
float  pt,
float  eta,
float  phi 
)
void AnalysisRootpleProducerOnlyMC::store ( )

Member Data Documentation

Definition at line 66 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 57 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 86 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 59 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 54 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 53 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 80 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 82 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 79 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 77 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 81 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 78 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 75 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 56 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 64 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 52 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 58 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 85 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 51 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 80 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 82 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 79 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 77 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 81 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 78 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 84 of file AnalysisRootpleProducerOnlyMC.h.

const int AnalysisRootpleProducerOnlyMC::NCJMAX = 10000 [static, private]

Definition at line 71 of file AnalysisRootpleProducerOnlyMC.h.

const int AnalysisRootpleProducerOnlyMC::NEHJMAX = 10000 [static, private]

Definition at line 73 of file AnalysisRootpleProducerOnlyMC.h.

const int AnalysisRootpleProducerOnlyMC::NIJMAX = 10000 [static, private]

Definition at line 70 of file AnalysisRootpleProducerOnlyMC.h.

const int AnalysisRootpleProducerOnlyMC::NMCPMAX = 10000 [static, private]

Definition at line 68 of file AnalysisRootpleProducerOnlyMC.h.

const int AnalysisRootpleProducerOnlyMC::NTJMAX = 10000 [static, private]

Definition at line 72 of file AnalysisRootpleProducerOnlyMC.h.

const int AnalysisRootpleProducerOnlyMC::NTKMAX = 10000 [static, private]

Definition at line 69 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 75 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 75 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 75 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 75 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 75 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 75 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 80 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 82 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 79 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 77 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 81 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 78 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 62 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 80 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 82 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 79 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 77 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 81 of file AnalysisRootpleProducerOnlyMC.h.

Definition at line 78 of file AnalysisRootpleProducerOnlyMC.h.