CMS 3D CMS Logo

Public Member Functions | Private Attributes

cms::ProducerAnalyzer Class Reference

#include <ProducerAnalyzer.h>

Inheritance diagram for cms::ProducerAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void endJob ()
 ProducerAnalyzer (const edm::ParameterSet &)
 ~ProducerAnalyzer ()

Private Attributes

std::string ecalInput_
std::string gammaClus_
std::string hbheInput_
std::string hfInput_
std::string hoInput_
std::string jetCalo_
std::string nameProd_
std::string Tracks_

Detailed Description

Definition at line 31 of file ProducerAnalyzer.h.


Constructor & Destructor Documentation

cms::ProducerAnalyzer::ProducerAnalyzer ( const edm::ParameterSet iConfig) [explicit]

Definition at line 37 of file ProducerAnalyzer.cc.

References edm::ParameterSet::getUntrackedParameter().

{
  // get name of output file with histogramms  
   
   nameProd_ = iConfig.getUntrackedParameter<std::string>("nameProd");
   jetCalo_ = iConfig.getUntrackedParameter<std::string>("jetCalo","GammaJetJetBackToBackCollection");
   gammaClus_ = iConfig.getUntrackedParameter<std::string>("gammaClus","GammaJetGammaBackToBackCollection");
   ecalInput_=iConfig.getUntrackedParameter<std::string>("ecalInput","GammaJetEcalRecHitCollection");
   hbheInput_ = iConfig.getUntrackedParameter<std::string>("hbheInput");
   hoInput_ = iConfig.getUntrackedParameter<std::string>("hoInput");
   hfInput_ = iConfig.getUntrackedParameter<std::string>("hfInput");
   Tracks_ = iConfig.getUntrackedParameter<std::string>("Tracks","GammaJetTracksCollection");    

}
cms::ProducerAnalyzer::~ProducerAnalyzer ( )

Definition at line 52 of file ProducerAnalyzer.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void cms::ProducerAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 75 of file ProducerAnalyzer.cc.

References begin, gather_cfg::cout, patCandidatesForDimuonsSequences_cff::ecal, end, spr::energyECAL(), spr::energyHCAL(), PV3DBase< T, PVType, FrameType >::eta(), edm::EventSetup::get(), edm::Event::getAllProvenance(), edm::Event::getByLabel(), metsig::jet, fwrapper::jets, RPCpg::mu, PV3DBase< T, PVType, FrameType >::phi(), edm::Handle< T >::product(), findQualityFiles::size, and testEve_cfg::tracks.

{

  using namespace edm;

   const CaloGeometry* geo;
   edm::ESHandle<CaloGeometry> pG;
   iSetup.get<CaloGeometryRecord>().get(pG);
   geo = pG.product();
   

  std::vector<Provenance const*> theProvenance;
  iEvent.getAllProvenance(theProvenance);
  for( std::vector<Provenance const*>::const_iterator ip = theProvenance.begin();
                                                      ip != theProvenance.end(); ip++)
  {
     cout<<" Print all module/label names "<<(**ip).moduleName()<<" "<<(**ip).moduleLabel()<<
     " "<<(**ip).productInstanceName()<<endl;
  }
  
  
  if(nameProd_ == "hoCalibProducer")
  {
     edm::Handle<HOCalibVariableCollection> ho;
     iEvent.getByLabel(nameProd_,hoInput_, ho);
     const HOCalibVariableCollection Hitho = *(ho.product());
     std::cout<<" Size of HO "<<(Hitho).size()<<std::endl;
  }
  
   if(nameProd_ == "ALCARECOMuAlZMuMu" )
   {
   
   edm::Handle<HORecHitCollection> ho;
   iEvent.getByLabel("horeco", ho);
   const HORecHitCollection Hitho = *(ho.product());
   std::cout<<" Size of HO "<<(Hitho).size()<<std::endl;
   edm::Handle<MuonCollection> mucand;
   iEvent.getByLabel(nameProd_,"SelectedMuons", mucand);
   std::cout<<" Size of muon collection "<<mucand->size()<<std::endl;
   for(MuonCollection::const_iterator it =  mucand->begin(); it != mucand->end(); it++)
   {
      TrackRef mu = (*it).combinedMuon();
      std::cout<<" Pt muon "<<mu->innerMomentum()<<std::endl;
   }
   
   }  
  
   if(nameProd_ != "IsoProd" && nameProd_ != "ALCARECOMuAlZMuMu" && nameProd_ != "hoCalibProducer")
   {
   edm::Handle<HBHERecHitCollection> hbhe;
   iEvent.getByLabel(hbheInput_, hbhe);
   const HBHERecHitCollection Hithbhe = *(hbhe.product());
   std::cout<<" Size of HBHE "<<(Hithbhe).size()<<std::endl;


   edm::Handle<HORecHitCollection> ho;
   iEvent.getByLabel(hoInput_, ho);
   const HORecHitCollection Hitho = *(ho.product());
   std::cout<<" Size of HO "<<(Hitho).size()<<std::endl;


   edm::Handle<HFRecHitCollection> hf;
   iEvent.getByLabel(hfInput_, hf);
   const HFRecHitCollection Hithf = *(hf.product());
   std::cout<<" Size of HF "<<(Hithf).size()<<std::endl;
   }
   if(nameProd_ == "IsoProd")
   {
   cout<<" We are here "<<endl;
   edm::Handle<reco::TrackCollection> tracks;
   iEvent.getByLabel(nameProd_,Tracks_,tracks);
 
   
   std::cout<<" Tracks size "<<(*tracks).size()<<std::endl;
   reco::TrackCollection::const_iterator track = tracks->begin ();

          for (; track != tracks->end (); track++)
         {
           cout<<" P track "<<(*track).p()<<" eta "<<(*track).eta()<<" phi "<<(*track).phi()<<" Outer "<<(*track).outerMomentum()<<" "<<
           (*track).outerPosition()<<endl;
           TrackExtraRef myextra = (*track).extra();
           cout<<" Track extra "<<myextra->outerMomentum()<<" "<<myextra->outerPosition()<<endl;
         }  

   edm::Handle<EcalRecHitCollection> ecal;
   iEvent.getByLabel(nameProd_,ecalInput_,ecal);
   const EcalRecHitCollection Hitecal = *(ecal.product());
   std::cout<<" Size of Ecal "<<(Hitecal).size()<<std::endl;
   EcalRecHitCollection::const_iterator hite = (ecal.product())->begin ();

         double energyECAL = 0.;
         double energyHCAL = 0.;

          for (; hite != (ecal.product())->end (); hite++)
         {

//           cout<<" Energy ECAL "<<(*hite).energy()<<endl;


//         " eta "<<(*hite).detid()<<" phi "<<(*hite).detid().getPosition().phi()<<endl;

         GlobalPoint posE = geo->getPosition((*hite).detid());

           cout<<" Energy ECAL "<<(*hite).energy()<<
           " eta "<<posE.eta()<<" phi "<<posE.phi()<<endl;

         energyECAL = energyECAL + (*hite).energy();
         
         }

   edm::Handle<HBHERecHitCollection> hbhe;
   iEvent.getByLabel(nameProd_,hbheInput_,hbhe);
   const HBHERecHitCollection Hithbhe = *(hbhe.product());
   std::cout<<" Size of HBHE "<<(Hithbhe).size()<<std::endl;
   HBHERecHitCollection::const_iterator hith = (hbhe.product())->begin ();

          for (; hith != (hbhe.product())->end (); hith++)
         {

         GlobalPoint posH = geo->getPosition((*hith).detid());

           cout<<" Energy HCAL "<<(*hith).energy()<<
           " eta "<<posH.eta()<<" phi "<<posH.phi()<<endl;

         energyHCAL = energyHCAL + (*hith).energy();
         
         }
   
   cout<<" Energy ECAL "<< energyECAL<<" Energy HCAL "<< energyHCAL<<endl;
   
   edm::Handle<HORecHitCollection> ho;
   iEvent.getByLabel(nameProd_,hoInput_,ho);
   const HORecHitCollection Hitho = *(ho.product());
   std::cout<<" Size of HO "<<(Hitho).size()<<std::endl;
   HORecHitCollection::const_iterator hito = (ho.product())->begin ();

          for (; hito != (ho.product())->end (); hito++)
         {
//           cout<<" Energy HO    "<<(*hito).energy()<<endl;
//         " eta "<<(*hite).eta()<<" phi "<<(*hite).phi()<<endl;
         }

   }
   
   
   if(nameProd_ == "GammaJetProd" || nameProd_ == "DiJProd")
   {
    cout<<" we are in GammaJetProd area "<<endl;
   edm::Handle<EcalRecHitCollection> ecal;
   iEvent.getByLabel(nameProd_,ecalInput_, ecal);
   std::cout<<" Size of ECAL "<<(*ecal).size()<<std::endl;

   edm::Handle<reco::CaloJetCollection> jets;
   iEvent.getByLabel(nameProd_,jetCalo_, jets);
   std::cout<<" Jet size "<<(*jets).size()<<std::endl; 
   reco::CaloJetCollection::const_iterator jet = jets->begin ();
          for (; jet != jets->end (); jet++)
         {
           cout<<" Et jet "<<(*jet).et()<<" eta "<<(*jet).eta()<<" phi "<<(*jet).phi()<<endl;
         }  

   edm::Handle<reco::TrackCollection> tracks;
   iEvent.getByLabel(nameProd_,Tracks_, tracks);
   std::cout<<" Tracks size "<<(*tracks).size()<<std::endl; 
   }
   if( nameProd_ == "GammaJetProd")
   {
   edm::Handle<reco::SuperClusterCollection> eclus;
   iEvent.getByLabel(nameProd_,gammaClus_, eclus);
   std::cout<<" GammaClus size "<<(*eclus).size()<<std::endl;
      reco::SuperClusterCollection::const_iterator iclus = eclus->begin ();
          for (; iclus != eclus->end (); iclus++)
         {
           cout<<" Et gamma "<<(*iclus).energy()/cosh((*iclus).eta())<<" eta "<<(*iclus).eta()<<" phi "<<(*iclus).phi()<<endl;
         }
   }

}
void cms::ProducerAnalyzer::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 60 of file ProducerAnalyzer.cc.

{
}
void cms::ProducerAnalyzer::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 64 of file ProducerAnalyzer.cc.

{
}

Member Data Documentation

std::string cms::ProducerAnalyzer::ecalInput_ [private]

Definition at line 45 of file ProducerAnalyzer.h.

std::string cms::ProducerAnalyzer::gammaClus_ [private]

Definition at line 44 of file ProducerAnalyzer.h.

std::string cms::ProducerAnalyzer::hbheInput_ [private]

Definition at line 46 of file ProducerAnalyzer.h.

std::string cms::ProducerAnalyzer::hfInput_ [private]

Definition at line 48 of file ProducerAnalyzer.h.

std::string cms::ProducerAnalyzer::hoInput_ [private]

Definition at line 47 of file ProducerAnalyzer.h.

std::string cms::ProducerAnalyzer::jetCalo_ [private]

Definition at line 43 of file ProducerAnalyzer.h.

std::string cms::ProducerAnalyzer::nameProd_ [private]

Definition at line 42 of file ProducerAnalyzer.h.

std::string cms::ProducerAnalyzer::Tracks_ [private]

Definition at line 49 of file ProducerAnalyzer.h.