CMS 3D CMS Logo

SimplePi0DiscAnalyzer Class Reference

Inheritance diagram for SimplePi0DiscAnalyzer:

edm::EDAnalyzer

List of all members.

Public Member Functions

 SimplePi0DiscAnalyzer (const edm::ParameterSet &)
 ~SimplePi0DiscAnalyzer ()

Private Member Functions

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

Private Attributes

string correctedPhotonCollection_
TH1F * hAll_nnout_Assoc_
TH1F * hAll_nnout_NoConv_Assoc_
TH1F * hBarrel_nnout_Assoc_
TH1F * hBarrel_nnout_NoConv_Assoc_
TH1F * hConv_ntracks_
TH1F * hEndcNoPresh_nnout_Assoc_
TH1F * hEndcNoPresh_nnout_NoConv_Assoc_
TH1F * hEndcWithPresh_nnout_Assoc_
TH1F * hEndcWithPresh_nnout_NoConv_Assoc_
string outputFile_
string photonCollectionProducer_
string photonCorrCollectionProducer_
TFile * rootFile_
string uncorrectedPhotonCollection_


Detailed Description

Definition at line 49 of file SimplePi0DiscAnalyzer.cc.


Constructor & Destructor Documentation

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

Definition at line 84 of file SimplePi0DiscAnalyzer.cc.

References correctedPhotonCollection_, edm::ParameterSet::getParameter(), outputFile_, photonCollectionProducer_, photonCorrCollectionProducer_, rootFile_, and uncorrectedPhotonCollection_.

00086 {
00087 
00088   photonCollectionProducer_ = iConfig.getParameter<string>("phoProducer");
00089   photonCorrCollectionProducer_ = iConfig.getParameter<string>("corrPhoProducer");
00090   uncorrectedPhotonCollection_ = iConfig.getParameter<string>("uncorrectedPhotonCollection");
00091   correctedPhotonCollection_ = iConfig.getParameter<string>("correctedPhotonCollection");
00092 
00093     outputFile_   = iConfig.getParameter<string>("outputFile");
00094 
00095     rootFile_ = TFile::Open(outputFile_.c_str(),"RECREATE"); // open output file to store histograms
00096 
00097 }

SimplePi0DiscAnalyzer::~SimplePi0DiscAnalyzer (  ) 

Definition at line 99 of file SimplePi0DiscAnalyzer.cc.

References rootFile_.

00100 {
00101    delete rootFile_;
00102 
00103 }


Member Function Documentation

void SimplePi0DiscAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 111 of file SimplePi0DiscAnalyzer.cc.

References correctedPhotonCollection_, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::Event::getByLabel(), edm::Event::id(), photonCorrCollectionProducer_, photons_cfi::photons, and edm::Handle< T >::product().

00112 {
00113   cout << endl;
00114   cout << " -------------- NEW EVENT : Run, Event =  " << iEvent.id() << endl;
00115    
00116   // Get the ConvertedPhotonCollection
00117   Handle<ConversionCollection> convertedPhotonHandle; // get the Converted Photon info
00118   iEvent.getByLabel("conversions", "", convertedPhotonHandle);
00119   const reco::ConversionCollection phoCollection = *(convertedPhotonHandle.product());
00120 
00121   cout << " ---> ConvertedPhotonCollection.size() = " << phoCollection.size() << endl;
00122 
00123   // Get the  corrected  photon collection
00124   Handle<reco::PhotonCollection> correctedPhotonHandle; 
00125   iEvent.getByLabel(photonCorrCollectionProducer_, correctedPhotonCollection_ , correctedPhotonHandle);
00126   const reco::PhotonCollection photons = *(correctedPhotonHandle.product());
00127 
00128   cout <<"----> Photons size: "<< photons.size()<<endl;
00129 
00130   edm::Handle<reco::PhotonPi0DiscriminatorAssociationMap>  map;
00131   iEvent.getByLabel("piZeroDiscriminators","PhotonPi0DiscriminatorAssociationMap",  map);
00132   reco::PhotonPi0DiscriminatorAssociationMap::const_iterator mapIter;
00133 
00134   int PhoInd = 0;
00135 
00136   /*
00137       
00138   for( reco::PhotonCollection::const_iterator  iPho = photons.begin(); iPho != photons.end(); iPho++) { // Loop over Photons
00139           
00140     reco::Photon localPho(*iPho);
00141 
00142     float Photon_eta = localPho.eta(); float Photon_phi = localPho.phi();
00143     cout << "Photon Id = " << PhoInd << " with Energy = " << localPho.energy() 
00144          << " Et = " <<  localPho.energy()*sin(2*atan(exp(-Photon_eta)))
00145          << " Eta = " << Photon_eta << " and Phi = " << Photon_phi << endl;       
00146 
00147     SuperClusterRef it_super = localPho.superCluster(); // get the SC related to the Photon candidate
00148 
00149     bool isPhotConv = false;
00150     int Ntrk_conv = 0;
00151     int Conv_SCE_id = 0;
00152     for( reco::ConversionCollection::const_iterator iCPho = phoCollection.begin(); 
00153          iCPho != phoCollection.end(); iCPho++) { 
00154        SuperClusterRef it_superConv = (*iCPho).superCluster();// get the SC related to the  Converted Photon candidate
00155        if(it_super == it_superConv) { 
00156          isPhotConv = (*iCPho).isConverted(); 
00157          Ntrk_conv = (*iCPho).tracks().size();
00158          break;
00159        }    
00160        Conv_SCE_id++;
00161     } // End of Photon Conversion Loop     
00162     hConv_ntracks_->Fill(Ntrk_conv);
00163     
00164     mapIter = map->find(edm::Ref<reco::PhotonCollection>(correctedPhotonHandle,PhoInd));
00165     float nn = mapIter->val;
00166     if(fabs(Photon_eta) <= 1.442) {
00167        hBarrel_nnout_Assoc_->Fill(nn);
00168        hAll_nnout_Assoc_->Fill(nn);
00169        cout << "AssociationMap Barrel NN = " << nn << endl;
00170        if(isPhotConv) {
00171           hBarrel_nnout_NoConv_Assoc_->Fill(nn);
00172           hAll_nnout_NoConv_Assoc_->Fill(nn);          
00173        } 
00174     } else if( (fabs(Photon_eta) >= 1.556 && fabs(Photon_eta) < 1.65) || fabs(Photon_eta) > 2.5) {     
00175        hEndcNoPresh_nnout_Assoc_->Fill(nn);
00176        hAll_nnout_Assoc_->Fill(nn);
00177        cout << "AssociationMap EndcNoPresh NN = " << nn << endl;
00178        if(isPhotConv) {
00179           hEndcNoPresh_nnout_NoConv_Assoc_->Fill(nn);
00180           hAll_nnout_NoConv_Assoc_->Fill(nn);
00181        }
00182     } else if(fabs(Photon_eta) >= 1.65 && fabs(Photon_eta) <= 2.5 ) {
00183        hEndcWithPresh_nnout_Assoc_->Fill(nn);
00184        hAll_nnout_Assoc_->Fill(nn);
00185        cout << "AssociationMap EndcWithPresh NN = " << nn << endl;
00186        if(isPhotConv) {
00187           hEndcWithPresh_nnout_NoConv_Assoc_->Fill(nn);
00188           hAll_nnout_NoConv_Assoc_->Fill(nn);
00189        }
00190     } 
00191 
00192     PhoInd++;
00193   } // End Loop over Photons
00194 
00195 
00196 
00197   */
00198 
00199 }

void SimplePi0DiscAnalyzer::beginJob ( const edm::EventSetup  )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 202 of file SimplePi0DiscAnalyzer.cc.

References hAll_nnout_Assoc_, hAll_nnout_NoConv_Assoc_, hBarrel_nnout_Assoc_, hBarrel_nnout_NoConv_Assoc_, hConv_ntracks_, hEndcNoPresh_nnout_Assoc_, hEndcNoPresh_nnout_NoConv_Assoc_, hEndcWithPresh_nnout_Assoc_, hEndcWithPresh_nnout_NoConv_Assoc_, and rootFile_.

00203 {
00204   rootFile_->cd();
00205 
00206   hConv_ntracks_ = new TH1F("nConvTracks","Number of tracks of converted Photons ",10,0.,10);    
00207   hAll_nnout_Assoc_ = new TH1F("All_nnout_Assoc","NNout for All Photons(AssociationMap)",100,0.,1.);
00208   hAll_nnout_NoConv_Assoc_ = new TH1F("All_nnout_NoConv_Assoc","NNout for Unconverted Photons(AssociationMap)",100,0.,1.);
00209   hBarrel_nnout_Assoc_ = new TH1F("barrel_nnout_Assoc","NNout for Barrel Photons(AssociationMap)",100,0.,1.);
00210   hBarrel_nnout_NoConv_Assoc_ = new TH1F("barrel_nnout_NoConv_Assoc","NNout for Barrel Unconverted Photons(AssociationMap)",100,0.,1.);
00211   hEndcNoPresh_nnout_Assoc_ = new TH1F("endcNoPresh_nnout_Assoc","NNout for Endcap NoPresh Photons(AssociationMap)",100,0.,1.);
00212   hEndcNoPresh_nnout_NoConv_Assoc_ = new TH1F("endcNoPresh_nnout_NoConv_Assoc","NNout for Endcap Unconverted NoPresh Photons(AssociationMap)",100,0.,1.);
00213   hEndcWithPresh_nnout_Assoc_ = new TH1F("endcWithPresh_nnout_Assoc","NNout for Endcap WithPresh Photons(AssociationMap)",100,0.,1.);
00214   hEndcWithPresh_nnout_NoConv_Assoc_ = new TH1F("endcWithPresh_nnout_NoConv_Assoc","NNout for Endcap Unconverted WithPresh Photons(AssociationMap)",100,0.,1.);
00215 
00216 }

void SimplePi0DiscAnalyzer::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 220 of file SimplePi0DiscAnalyzer.cc.

References hAll_nnout_Assoc_, hAll_nnout_NoConv_Assoc_, hBarrel_nnout_Assoc_, hBarrel_nnout_NoConv_Assoc_, hConv_ntracks_, hEndcNoPresh_nnout_Assoc_, hEndcNoPresh_nnout_NoConv_Assoc_, hEndcWithPresh_nnout_Assoc_, hEndcWithPresh_nnout_NoConv_Assoc_, and rootFile_.

00220                               {
00221   rootFile_->cd();
00222 
00223   hConv_ntracks_->Write();
00224 
00225   hAll_nnout_Assoc_->Write();
00226   hAll_nnout_NoConv_Assoc_->Write();
00227   hBarrel_nnout_Assoc_->Write();
00228   hBarrel_nnout_NoConv_Assoc_->Write();
00229   hEndcNoPresh_nnout_Assoc_->Write();
00230   hEndcNoPresh_nnout_NoConv_Assoc_->Write();
00231   hEndcWithPresh_nnout_Assoc_->Write();
00232   hEndcWithPresh_nnout_NoConv_Assoc_->Write();
00233 
00234   rootFile_->Close();
00235 
00236 }


Member Data Documentation

string SimplePi0DiscAnalyzer::correctedPhotonCollection_ [private]

Definition at line 66 of file SimplePi0DiscAnalyzer.cc.

Referenced by analyze(), and SimplePi0DiscAnalyzer().

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_Assoc_ [private]

Definition at line 73 of file SimplePi0DiscAnalyzer.cc.

Referenced by beginJob(), and endJob().

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_ [private]

Definition at line 74 of file SimplePi0DiscAnalyzer.cc.

Referenced by beginJob(), and endJob().

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_Assoc_ [private]

Definition at line 75 of file SimplePi0DiscAnalyzer.cc.

Referenced by beginJob(), and endJob().

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_ [private]

Definition at line 76 of file SimplePi0DiscAnalyzer.cc.

Referenced by beginJob(), and endJob().

TH1F* SimplePi0DiscAnalyzer::hConv_ntracks_ [private]

Definition at line 71 of file SimplePi0DiscAnalyzer.cc.

Referenced by beginJob(), and endJob().

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_Assoc_ [private]

Definition at line 77 of file SimplePi0DiscAnalyzer.cc.

Referenced by beginJob(), and endJob().

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_NoConv_Assoc_ [private]

Definition at line 78 of file SimplePi0DiscAnalyzer.cc.

Referenced by beginJob(), and endJob().

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_Assoc_ [private]

Definition at line 79 of file SimplePi0DiscAnalyzer.cc.

Referenced by beginJob(), and endJob().

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_ [private]

Definition at line 80 of file SimplePi0DiscAnalyzer.cc.

Referenced by beginJob(), and endJob().

string SimplePi0DiscAnalyzer::outputFile_ [private]

Definition at line 68 of file SimplePi0DiscAnalyzer.cc.

Referenced by SimplePi0DiscAnalyzer().

string SimplePi0DiscAnalyzer::photonCollectionProducer_ [private]

Definition at line 63 of file SimplePi0DiscAnalyzer.cc.

Referenced by SimplePi0DiscAnalyzer().

string SimplePi0DiscAnalyzer::photonCorrCollectionProducer_ [private]

Definition at line 64 of file SimplePi0DiscAnalyzer.cc.

Referenced by analyze(), and SimplePi0DiscAnalyzer().

TFile* SimplePi0DiscAnalyzer::rootFile_ [private]

Definition at line 69 of file SimplePi0DiscAnalyzer.cc.

Referenced by beginJob(), endJob(), SimplePi0DiscAnalyzer(), and ~SimplePi0DiscAnalyzer().

string SimplePi0DiscAnalyzer::uncorrectedPhotonCollection_ [private]

Definition at line 65 of file SimplePi0DiscAnalyzer.cc.

Referenced by SimplePi0DiscAnalyzer().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:31:43 2009 for CMSSW by  doxygen 1.5.4