CMS 3D CMS Logo

Public Member Functions | Private Attributes

SimplePi0DiscAnalyzer Class Reference

#include <SimplePi0DiscAnalyzer.h>

Inheritance diagram for SimplePi0DiscAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &e, const edm::EventSetup &c)
virtual void beginJob ()
virtual void endJob ()
 SimplePi0DiscAnalyzer (const edm::ParameterSet &conf)
virtual ~SimplePi0DiscAnalyzer ()

Private Attributes

TH1F * hAll_nnout_Assoc_
TH1F * hAll_nnout_NoConv_Assoc_
TH1F * hAll_nnout_NoConv_Assoc_R9_
TH1F * hBarrel_nnout_Assoc_
TH1F * hBarrel_nnout_NoConv_Assoc_
TH1F * hBarrel_nnout_NoConv_Assoc_R9_
TH1F * hConv_ntracks_
TH1F * hEndcNoPresh_nnout_Assoc_
TH1F * hEndcNoPresh_nnout_NoConv_Assoc_
TH1F * hEndcNoPresh_nnout_NoConv_Assoc_R9_
TH1F * hEndcWithPresh_nnout_Assoc_
TH1F * hEndcWithPresh_nnout_NoConv_Assoc_
TH1F * hEndcWithPresh_nnout_NoConv_Assoc_R9_
std::string outputFile_
std::string photonCollection_
std::string photonCollectionProducer_
TFile * rootFile_

Detailed Description

Description: Pi0DiscAnalyzer analyzer using reco data

Implementation: <Notes on="" implementation>="">

Definition at line 44 of file SimplePi0DiscAnalyzer.h.


Constructor & Destructor Documentation

SimplePi0DiscAnalyzer::SimplePi0DiscAnalyzer ( const edm::ParameterSet conf) [explicit]

Definition at line 50 of file SimplePi0DiscAnalyzer.cc.

References edm::ParameterSet::getParameter().

{

  outputFile_ = conf.getParameter<std::string>("outputFile");
  rootFile_ = new TFile(outputFile_.c_str(),"RECREATE");


  photonCollectionProducer_ = conf.getParameter<std::string>("phoProducer");
  photonCollection_ = conf.getParameter<std::string>("photonCollection");


 
}
SimplePi0DiscAnalyzer::~SimplePi0DiscAnalyzer ( ) [virtual]

Definition at line 64 of file SimplePi0DiscAnalyzer.cc.

{

  // do anything here that needs to be done at desctruction time
  // (e.g. close files, deallocate resources etc.)
   rootFile_->Write();
   rootFile_->Close();
}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 117 of file SimplePi0DiscAnalyzer.cc.

References gather_cfg::cout, reco::LeafCandidate::et(), reco::LeafCandidate::eta(), edm::Event::getByLabel(), reco::Photon::hasConversionTracks(), edm::EventBase::id(), Association::map, reco::LeafCandidate::phi(), ExpressReco_HICollisions_FallBack::photons, edm::Handle< T >::product(), reco::Photon::r9(), and reco::Photon::superCluster().

{
  std::cout << std::endl;
  std::cout << " -------------- NEW EVENT : Run, Event =  " << iEvent.id() << std::endl;

 edm::Handle<reco::PhotonCollection> PhotonHandle;
  iEvent.getByLabel(photonCollectionProducer_, photonCollection_ , PhotonHandle);
  const reco::PhotonCollection photons = *(PhotonHandle.product());

  std::cout <<"----> Photons size: "<< photons.size()<<std::endl;

  edm::Handle<reco::PhotonPi0DiscriminatorAssociationMap>  map;
  iEvent.getByLabel("piZeroDiscriminators","PhotonPi0DiscriminatorAssociationMap",  map);
  reco::PhotonPi0DiscriminatorAssociationMap::const_iterator mapIter;

  int PhoInd = 0;

  for( reco::PhotonCollection::const_iterator  iPho = photons.begin(); iPho != photons.end(); iPho++) { // Loop over Photons

    reco::Photon localPho(*iPho);

    float Photon_et = localPho.et(); float Photon_eta = localPho.eta(); 
    float Photon_phi = localPho.phi(); float Photon_r9 = localPho.r9();
    bool isPhotConv  = localPho.hasConversionTracks();
    std::cout << "Photon Id = " << PhoInd 
              << " with Et = " << Photon_et 
              << " Eta = " << Photon_eta 
              << " Phi = " << Photon_phi 
              << " R9 = " << Photon_r9 
              << " and conv_id = " << isPhotConv << std::endl;


    SuperClusterRef it_super = localPho.superCluster(); // get the SC related to the Photon candidate

//    hConv_ntracks_->Fill(Ntrk_conv);

    float nn = -10;
    mapIter = map->find(edm::Ref<reco::PhotonCollection>(PhotonHandle,PhoInd));
    if(mapIter!=map->end()) {
      nn = mapIter->val;
    }
    if(fabs(it_super->eta()) <= 1.442) {
       hBarrel_nnout_Assoc_->Fill(nn);
       hAll_nnout_Assoc_->Fill(nn);
       std::cout << "AssociationMap Barrel NN = " << nn << std::endl;
       if(!isPhotConv) {
          hBarrel_nnout_NoConv_Assoc_->Fill(nn);
          hAll_nnout_NoConv_Assoc_->Fill(nn);
       }
       if(Photon_r9>0.93) {
          hBarrel_nnout_NoConv_Assoc_R9_->Fill(nn);
          hAll_nnout_NoConv_Assoc_R9_->Fill(nn);
       }
    } else if( (fabs(it_super->eta()) >= 1.556 && fabs(it_super->eta()) < 1.65) || fabs(it_super->eta()) > 2.5) {
       hEndcNoPresh_nnout_Assoc_->Fill(nn);
       hAll_nnout_Assoc_->Fill(nn);
       std::cout << "AssociationMap EndcNoPresh NN = " << nn << std::endl;
       if(!isPhotConv) {
          hEndcNoPresh_nnout_NoConv_Assoc_->Fill(nn);
          hAll_nnout_NoConv_Assoc_->Fill(nn);
       }
       if(Photon_r9>0.93) {
          hEndcNoPresh_nnout_NoConv_Assoc_R9_->Fill(nn);
          hAll_nnout_NoConv_Assoc_R9_->Fill(nn);
       }       
    } else if(fabs(it_super->eta()) >= 1.65 && fabs(it_super->eta()) <= 2.5 ) {
       hEndcWithPresh_nnout_Assoc_->Fill(nn);
       hAll_nnout_Assoc_->Fill(nn);
       std::cout << "AssociationMap EndcWithPresh NN = " << nn << std::endl;
       if(!isPhotConv) {
          hEndcWithPresh_nnout_NoConv_Assoc_->Fill(nn);
          hAll_nnout_NoConv_Assoc_->Fill(nn);
       }
       if(Photon_r9>0.93) {
          hEndcWithPresh_nnout_NoConv_Assoc_R9_->Fill(nn);
          hAll_nnout_NoConv_Assoc_R9_->Fill(nn);
       }       
    }


    PhoInd++;
  } // End Loop over Photons

}
void SimplePi0DiscAnalyzer::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 73 of file SimplePi0DiscAnalyzer.cc.

References gather_cfg::cout.

                                    {

  rootFile_->cd();
  std::cout << "beginJob() ->  Book the Histograms" << std::endl;
  
  hConv_ntracks_ = new TH1F("nConvTracks","Number of tracks of converted Photons ",10,0.,10);
  hAll_nnout_Assoc_ = new TH1F("All_nnout_Assoc","NNout for All Photons(AssociationMap)",100,0.,1.);
  hAll_nnout_NoConv_Assoc_ = new TH1F("All_nnout_NoConv_Assoc","NNout for Unconverted Photons(AssociationMap)",100,0.,1.);
  hAll_nnout_NoConv_Assoc_R9_ = new TH1F("All_nnout_NoConv_Assoc_R9","NNout for Unconverted Photons with R9>0.93 (AssociationMap)",100,0.,1.);
  hBarrel_nnout_Assoc_ = new TH1F("barrel_nnout_Assoc","NNout for Barrel Photons(AssociationMap)",100,0.,1.);
  hBarrel_nnout_NoConv_Assoc_ = new TH1F("barrel_nnout_NoConv_Assoc","NNout for Barrel Unconverted Photons(AssociationMap)",100,0.,1.);
  hBarrel_nnout_NoConv_Assoc_R9_ = new TH1F("barrel_nnout_NoConv_Assoc_R9","NNout for Barrel Unconverted Photons with R9>0.93 (AssociationMap)",100,0.,1.);
  hEndcNoPresh_nnout_Assoc_ = new TH1F("endcNoPresh_nnout_Assoc","NNout for Endcap NoPresh Photons(AssociationMap)",100,0.,1.);
  hEndcNoPresh_nnout_NoConv_Assoc_ = new TH1F("endcNoPresh_nnout_NoConv_Assoc","NNout for Endcap Unconverted NoPresh Photons(AssociationMap)",100,0.,1.);
  hEndcNoPresh_nnout_NoConv_Assoc_R9_ = new TH1F("endcNoPresh_nnout_NoConv_Assoc_R9","NNout for Endcap Unconverted NoPresh Photons with R9>0.93 (AssociationMap)",100,0.,1.);
  hEndcWithPresh_nnout_Assoc_ = new TH1F("endcWithPresh_nnout_Assoc","NNout for Endcap WithPresh Photons(AssociationMap)",100,0.,1.);
  hEndcWithPresh_nnout_NoConv_Assoc_ = new TH1F("endcWithPresh_nnout_NoConv_Assoc","NNout for Endcap Unconverted WithPresh Photons(AssociationMap)",100,0.,1.);
  hEndcWithPresh_nnout_NoConv_Assoc_R9_ = new TH1F("endcWithPresh_nnout_NoConv_Assoc_R9","NNout for Endcap Unconverted WithPresh Photons with R9>0.93 (AssociationMap)",100,0.,1.);

}
void SimplePi0DiscAnalyzer::endJob ( void  ) [virtual]

Member Data Documentation

Definition at line 68 of file SimplePi0DiscAnalyzer.h.

Definition at line 69 of file SimplePi0DiscAnalyzer.h.

Definition at line 76 of file SimplePi0DiscAnalyzer.h.

Definition at line 70 of file SimplePi0DiscAnalyzer.h.

Definition at line 71 of file SimplePi0DiscAnalyzer.h.

Definition at line 77 of file SimplePi0DiscAnalyzer.h.

Definition at line 66 of file SimplePi0DiscAnalyzer.h.

Definition at line 72 of file SimplePi0DiscAnalyzer.h.

Definition at line 73 of file SimplePi0DiscAnalyzer.h.

Definition at line 78 of file SimplePi0DiscAnalyzer.h.

Definition at line 74 of file SimplePi0DiscAnalyzer.h.

Definition at line 75 of file SimplePi0DiscAnalyzer.h.

Definition at line 79 of file SimplePi0DiscAnalyzer.h.

std::string SimplePi0DiscAnalyzer::outputFile_ [private]

Definition at line 63 of file SimplePi0DiscAnalyzer.h.

Definition at line 61 of file SimplePi0DiscAnalyzer.h.

Definition at line 60 of file SimplePi0DiscAnalyzer.h.

Definition at line 64 of file SimplePi0DiscAnalyzer.h.