#include <RecoHI/CentralityProducer/src/CentralityProducer.cc>
Public Member Functions | |
CentralityProducer (const edm::ParameterSet &) | |
~CentralityProducer () | |
Private Member Functions | |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
bool | genLevel_ |
bool | recoLevel_ |
Implementation: <Notes on="" implementation>="">
Definition at line 52 of file CentralityProducer.cc.
CentralityProducer::CentralityProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 81 of file CentralityProducer.cc.
References genLevel_, edm::ParameterSet::getUntrackedParameter(), and recoLevel_.
00082 { 00083 //register your products 00084 00085 recoLevel_ = iConfig.getUntrackedParameter<bool>("recoLevel",true); 00086 genLevel_ = iConfig.getUntrackedParameter<bool>("genLevel",true); 00087 00088 if(recoLevel_){ 00089 produces<reco::Centrality>("recoBased"); 00090 } 00091 if(genLevel_){ 00092 produces<reco::Centrality>("genBased"); 00093 } 00094 00095 }
CentralityProducer::~CentralityProducer | ( | ) |
Definition at line 98 of file CentralityProducer.cc.
00099 { 00100 00101 // do anything here that needs to be done at desctruction time 00102 // (e.g. close files, deallocate resources etc.) 00103 00104 }
void CentralityProducer::beginJob | ( | const edm::EventSetup & | ) | [private, virtual] |
void CentralityProducer::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 113 of file CentralityProducer.cc.
References begin, e, end, CaloRecHit::energy(), eta, genLevel_, edm::Event::getByLabel(), it, p, phi, edm::Event::put(), HcalSimpleRecAlgoImpl::reco(), recoLevel_, and StDecayID::status.
00114 { 00115 using namespace edm; 00116 using namespace reco; 00117 using namespace HepMC; 00118 00119 const GenEvent* evt; 00120 00121 double eHF = 0; // Variable for computing total HF energy 00122 double eCASTOR = 0; 00123 double eZDC = 0; 00124 int cnt = 0; 00125 00126 if(recoLevel_){ 00127 Handle<HFRecHitCollection> hits; 00128 iEvent.getByLabel("hfreco",hits); 00129 for( size_t ihit = 0; ihit<hits->size(); ++ ihit){ 00130 const HFRecHit & rechit = (*hits)[ ihit ]; 00131 eHF = eHF + rechit.energy(); 00132 } 00133 std::auto_ptr<Centrality> centOutput(new Centrality(eHF,eCASTOR,eZDC,cnt)); 00134 iEvent.put(centOutput, "recoBased"); 00135 00136 /* 00137 To Do : 00138 - Add other detectors into reconstruction. 00139 */ 00140 00141 } 00142 00143 if(genLevel_){ 00144 Handle<HepMCProduct> mc; 00145 iEvent.getByLabel("source",mc); 00146 evt=mc->GetEvent(); 00147 00148 HepMC::GenEvent::particle_const_iterator begin = evt->particles_begin(); 00149 HepMC::GenEvent::particle_const_iterator end = evt->particles_end(); 00150 for(HepMC::GenEvent::particle_const_iterator it = begin;it!=end;++it) 00151 { 00152 HepMC::GenParticle* p = *it; 00153 float status = p->status(); 00154 float pdg_id = p->pdg_id(); 00155 float eta = p->momentum().eta(); 00156 float phi = p->momentum().phi(); 00157 float pt = p->momentum().perp(); 00158 float e = p->momentum().e(); 00159 00160 00161 if(fabs(eta)>=3&&fabs(eta)<=5){ 00162 00163 eHF+=e; 00164 } 00165 if(fabs(eta)>=5.3&&fabs(eta)<=6.7){ 00166 00167 eCASTOR+=e; 00168 } 00169 if(fabs(eta)>=5.9){ 00170 if(pdg_id==2112){ 00171 00172 eZDC+=e; 00173 cnt+=1; 00174 } 00175 } 00176 } 00177 00178 std::auto_ptr<Centrality> centOutput(new Centrality(eHF,eCASTOR,eZDC,cnt)); 00179 iEvent.put(centOutput, "genBased"); 00180 00181 } 00182 }
bool CentralityProducer::genLevel_ [private] |
Definition at line 65 of file CentralityProducer.cc.
Referenced by CentralityProducer(), and produce().
bool CentralityProducer::recoLevel_ [private] |
Definition at line 64 of file CentralityProducer.cc.
Referenced by CentralityProducer(), and produce().