CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/Calibration/IsolatedParticles/plugins/IsolatedGenParticles.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    IsolatedGenParticles
00004 // Class:      IsolatedGenParticles
00005 // 
00013 //
00014 // Original Author:  Seema Sharma
00015 //         Created:  Tue Oct 27 09:46:41 CDT 2009
00016 //
00017 //
00018 
00019 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00020 #include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h"
00021 
00022 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00023 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
00024 #include "Geometry/CaloTopology/interface/HcalTopology.h"
00025 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00026 #include "RecoCaloTools/Navigation/interface/CaloNavigator.h"
00027 
00028 #include "MagneticField/Engine/interface/MagneticField.h"
00029 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00030 
00031 #include "FWCore/Framework/interface/EventSetup.h"
00032 #include "FWCore/Framework/interface/ESHandle.h"
00033 #include <iostream>
00034 #include <iomanip>
00035 #include<list>
00036 #include<vector>
00037 #include<cmath>
00038 
00039 #include "Calibration/IsolatedParticles/interface/CaloPropagateTrack.h"
00040 #include "Calibration/IsolatedParticles/interface/ChargeIsolation.h"
00041 
00042 #include "Calibration/IsolatedParticles/plugins/IsolatedGenParticles.h"
00043 
00044 IsolatedGenParticles::IsolatedGenParticles(const edm::ParameterSet& iConfig) {
00045 
00046   genSrc_    = iConfig.getUntrackedParameter("GenSrc",std::string("generator"));
00047   useHepMC   = iConfig.getUntrackedParameter<bool>("UseHepMC", false );
00048   pSeed      = iConfig.getUntrackedParameter<double>("ChargedHadronSeedP", 1.0);
00049   ptMin      = iConfig.getUntrackedParameter<double>("PTMin", 1.0);
00050   etaMax     = iConfig.getUntrackedParameter<double>("MaxChargedHadronEta", 2.5);
00051   a_coneR    = iConfig.getUntrackedParameter<double>("ConeRadius",34.98);
00052   a_charIsoR = a_coneR + 28.9;
00053   a_neutIsoR = a_charIsoR*0.726;
00054   a_mipR     = iConfig.getUntrackedParameter<double>("ConeRadiusMIP",14.0);
00055   a_Isolation= iConfig.getUntrackedParameter<bool>("UseConeIsolation",false);
00056   pCutIsolate= iConfig.getUntrackedParameter<double>("PMaxIsolation",20.0);
00057   verbosity  = iConfig.getUntrackedParameter<int>("Verbosity", 0);
00058 
00059   debugL1Info_           = iConfig.getUntrackedParameter<bool>( "DebugL1Info", false );
00060   L1extraTauJetSource_   = iConfig.getParameter<edm::InputTag>("L1extraTauJetSource");
00061   L1extraCenJetSource_   = iConfig.getParameter<edm::InputTag>("L1extraCenJetSource");
00062   L1extraFwdJetSource_   = iConfig.getParameter<edm::InputTag>("L1extraFwdJetSource");
00063   L1extraMuonSource_     = iConfig.getParameter<edm::InputTag>("L1extraMuonSource");
00064   L1extraIsoEmSource_    = iConfig.getParameter<edm::InputTag>("L1extraIsoEmSource");
00065   L1extraNonIsoEmSource_ = iConfig.getParameter<edm::InputTag>("L1extraNonIsoEmSource");
00066   L1GTReadoutRcdSource_  = iConfig.getParameter<edm::InputTag>("L1GTReadoutRcdSource");
00067   L1GTObjectMapRcdSource_= iConfig.getParameter<edm::InputTag>("L1GTObjectMapRcdSource");
00068 
00069   if (!strcmp("Dummy", genSrc_.c_str())) {
00070     if (useHepMC) genSrc_ = "generator";
00071     else          genSrc_ = "genParticles";
00072   }
00073   std::cout << "Generator Source " << genSrc_ << " Use HepMC " << useHepMC
00074             << " pSeed " << pSeed << " ptMin " << ptMin << " etaMax " << etaMax
00075             << "\n a_coneR " << a_coneR << " a_charIsoR " << a_charIsoR
00076             << " a_neutIsoR " << a_neutIsoR << " a_mipR " << a_mipR 
00077             << " debug " << verbosity << " debugL1Info " <<   debugL1Info_ << "\n"
00078             << " Isolation Flag " << a_Isolation << " with cut "
00079             << pCutIsolate << " GeV\n"
00080             << " L1extraTauJetSource_   " << L1extraTauJetSource_ 
00081             << " L1extraCenJetSource_   " << L1extraCenJetSource_ 
00082             << " L1extraFwdJetSource_   " << L1extraFwdJetSource_   
00083             << " L1extraMuonSource_     " << L1extraMuonSource_   
00084             << " L1extraIsoEmSource_    " << L1extraIsoEmSource_    
00085             << " L1extraNonIsoEmSource_ " << L1extraNonIsoEmSource_
00086             << " L1GTReadoutRcdSource_  " << L1GTReadoutRcdSource_  
00087             << " L1GTObjectMapRcdSource_" << L1GTObjectMapRcdSource_ 
00088             << std::endl;
00089 }
00090 
00091 IsolatedGenParticles::~IsolatedGenParticles() {
00092 
00093 }
00094 
00095 void IsolatedGenParticles::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup){
00096 
00097   clearTreeVectors();
00098 
00099   nEventProc++;
00100 
00101   edm::ESHandle<MagneticField> bFieldH;
00102   iSetup.get<IdealMagneticFieldRecord>().get(bFieldH);
00103   bField = bFieldH.product();
00104 
00105   // get particle data table
00106   edm::ESHandle<ParticleDataTable> pdt;
00107   iSetup.getData(pdt);
00108 
00109   // get handle to HEPMCProduct
00110   edm::Handle<edm::HepMCProduct> hepmc;
00111   edm::Handle<reco::GenParticleCollection> genParticles;
00112   if (useHepMC) iEvent.getByLabel(genSrc_, hepmc);
00113   else          iEvent.getByLabel(genSrc_, genParticles);
00114 
00115   edm::ESHandle<CaloGeometry> pG;
00116   iSetup.get<CaloGeometryRecord>().get(pG);
00117   const CaloGeometry* geo = pG.product();
00118 
00119   edm::ESHandle<CaloTopology> theCaloTopology;
00120   iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
00121   const CaloTopology *caloTopology = theCaloTopology.product();
00122   
00123   edm::ESHandle<HcalTopology> htopo;
00124   iSetup.get<IdealGeometryRecord>().get(htopo);
00125   const HcalTopology* theHBHETopology = htopo.product();
00126 
00127   //===================== save L1 Trigger information =======================
00128   // get L1TriggerReadout records
00129   edm::Handle<L1GlobalTriggerReadoutRecord>   gtRecord;
00130   iEvent.getByLabel(L1GTReadoutRcdSource_,   gtRecord);
00131   
00132   edm::Handle<L1GlobalTriggerObjectMapRecord> gtOMRec;
00133   iEvent.getByLabel(L1GTObjectMapRcdSource_, gtOMRec);
00134   
00135   // sanity check on L1 Trigger Records
00136   if (!gtRecord.isValid()) {
00137     std::cout << "\nL1GlobalTriggerReadoutRecord with \n \nnot found"
00138       "\n  --> returning false by default!\n" << std::endl;
00139   }
00140   if (!gtOMRec.isValid()) {
00141     std::cout << "\nL1GlobalTriggerObjectMapRecord with \n \nnot found"
00142       "\n  --> returning false by default!\n" << std::endl;
00143   }
00144 
00145   // L1 decision word
00146   const DecisionWord dWord = gtRecord->decisionWord();  
00147   unsigned int numberTriggerBits= dWord.size();
00148 
00149   // just print the L1Bit number and AlgoName in first event
00150   if ( !initL1){
00151     initL1=true;
00152     std::cout << "\n  Number of Trigger bits " << numberTriggerBits << "\n\n";
00153     std::cout << "\tBit \t L1 Algorithm " << std::endl;
00154 
00155     // get ObjectMaps from ObjectMapRecord
00156     const std::vector<L1GlobalTriggerObjectMap>& objMapVec =  gtOMRec->gtObjectMap();
00157     for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin();
00158          itMap != objMapVec.end(); ++itMap) {
00159 
00160       // Get trigger bits
00161       int itrig = (*itMap).algoBitNumber();
00162 
00163       // Get trigger names
00164       algoBitToName[itrig] = (*itMap).algoName();
00165 
00166       std::cout  << "\t" << itrig << "\t" << algoBitToName[itrig] << std::endl;      
00167 
00168       // store the algoNames as bin labels of a histogram
00169       h_L1AlgoNames->GetXaxis()->SetBinLabel(itrig+1, algoBitToName[itrig].c_str());
00170 
00171     } // end of for loop    
00172   } // end of initL1
00173 
00174   // save L1 decision for each event 
00175   for (unsigned int iBit = 0; iBit < numberTriggerBits; ++iBit) {  
00176     bool accept = dWord[iBit];
00177     t_L1Decision->push_back(accept);
00178     // fill the trigger map
00179     if(debugL1Info_) std::cout << "Bit " << iBit << " " << algoBitToName[iBit] << " " << accept << std::endl;
00180 
00181     if(accept) h_L1AlgoNames->Fill(iBit);
00182   }
00183 
00184   //===================
00185   // L1Taus 
00186   edm::Handle<l1extra::L1JetParticleCollection> l1TauHandle;
00187   iEvent.getByLabel(L1extraTauJetSource_,l1TauHandle);
00188   l1extra::L1JetParticleCollection::const_iterator itr;
00189   for(itr = l1TauHandle->begin(); itr != l1TauHandle->end(); ++itr ) {
00190     t_L1TauJetPt      ->push_back( itr->pt() );
00191     t_L1TauJetEta     ->push_back( itr->eta() );
00192     t_L1TauJetPhi     ->push_back( itr->phi() );
00193     if(debugL1Info_) {
00194       std::cout << "tauJ p/pt  " << itr->momentum() << " " << itr->pt() 
00195                 << "  eta/phi " << itr->eta() << " " << itr->phi()
00196                 << std::endl;
00197     }
00198   }
00199 
00200   // L1 Central Jets
00201   edm::Handle<l1extra::L1JetParticleCollection> l1CenJetHandle;
00202   iEvent.getByLabel(L1extraCenJetSource_,l1CenJetHandle);
00203   for( itr = l1CenJetHandle->begin();  itr != l1CenJetHandle->end(); ++itr ) {
00204     t_L1CenJetPt    ->push_back( itr->pt() );
00205     t_L1CenJetEta   ->push_back( itr->eta() );
00206     t_L1CenJetPhi   ->push_back( itr->phi() );
00207     if(debugL1Info_) {
00208       std::cout << "cenJ p/pt     " << itr->momentum() << " " << itr->pt() 
00209                 << "  eta/phi " << itr->eta() << " " << itr->phi()
00210                 << std::endl;
00211     }
00212   }
00213   // L1 Forward Jets
00214   edm::Handle<l1extra::L1JetParticleCollection> l1FwdJetHandle;
00215   iEvent.getByLabel(L1extraFwdJetSource_,l1FwdJetHandle);
00216   for( itr = l1FwdJetHandle->begin();  itr != l1FwdJetHandle->end(); ++itr ) {
00217     t_L1FwdJetPt    ->push_back( itr->pt() );
00218     t_L1FwdJetEta   ->push_back( itr->eta() );
00219     t_L1FwdJetPhi   ->push_back( itr->phi() );
00220     if(debugL1Info_) {
00221       std::cout << "fwdJ p/pt     " << itr->momentum() << " " << itr->pt() 
00222                 << "  eta/phi " << itr->eta() << " " << itr->phi()
00223                 << std::endl;
00224     }
00225   }
00226   // L1 Isolated EM onjects
00227   l1extra::L1EmParticleCollection::const_iterator itrEm;
00228   edm::Handle<l1extra::L1EmParticleCollection> l1IsoEmHandle ;
00229   iEvent.getByLabel(L1extraIsoEmSource_, l1IsoEmHandle);
00230   for( itrEm = l1IsoEmHandle->begin();  itrEm != l1IsoEmHandle->end(); ++itrEm ) {
00231     t_L1IsoEMPt     ->push_back(  itrEm->pt() );
00232     t_L1IsoEMEta    ->push_back(  itrEm->eta() );
00233     t_L1IsoEMPhi    ->push_back(  itrEm->phi() );
00234     if(debugL1Info_) {
00235       std::cout << "isoEm p/pt    " << itrEm->momentum() << " " << itrEm->pt() 
00236                 << "  eta/phi " << itrEm->eta() << " " << itrEm->phi()
00237                 << std::endl;
00238     }
00239   }
00240   // L1 Non-Isolated EM onjects
00241   edm::Handle<l1extra::L1EmParticleCollection> l1NonIsoEmHandle ;
00242   iEvent.getByLabel(L1extraNonIsoEmSource_, l1NonIsoEmHandle);
00243   for( itrEm = l1NonIsoEmHandle->begin();  itrEm != l1NonIsoEmHandle->end(); ++itrEm ) {
00244     t_L1NonIsoEMPt  ->push_back( itrEm->pt() );
00245     t_L1NonIsoEMEta ->push_back( itrEm->eta() );
00246     t_L1NonIsoEMPhi ->push_back( itrEm->phi() );
00247     if(debugL1Info_) {
00248       std::cout << "nonIsoEm p/pt " << itrEm->momentum() << " " << itrEm->pt() 
00249                 << "  eta/phi " << itrEm->eta() << " " << itrEm->phi()
00250                 << std::endl;
00251     }
00252   }
00253   
00254   // L1 Muons
00255   l1extra::L1MuonParticleCollection::const_iterator itrMu;
00256   edm::Handle<l1extra::L1MuonParticleCollection> l1MuHandle ;
00257   iEvent.getByLabel(L1extraMuonSource_, l1MuHandle);
00258   for( itrMu = l1MuHandle->begin();  itrMu != l1MuHandle->end(); ++itrMu ) {
00259     t_L1MuonPt      ->push_back( itrMu->pt() );
00260     t_L1MuonEta     ->push_back( itrMu->eta() );
00261     t_L1MuonPhi     ->push_back( itrMu->phi() );
00262     if(debugL1Info_) {
00263       std::cout << "l1muon p/pt   " << itrMu->momentum() << " " << itrMu->pt() 
00264                 << "  eta/phi " << itrMu->eta() << " " << itrMu->phi()
00265                 << std::endl;
00266     }
00267   }
00268   //=====================================================================
00269   
00270   GlobalPoint  posVec, posECAL;
00271   math::XYZTLorentzVector momVec;
00272   if (verbosity>0) std::cout << "event number " << iEvent.id().event() <<std::endl;
00273   if (useHepMC) {
00274     const HepMC::GenEvent *myGenEvent = hepmc->GetEvent();
00275     std::vector<spr::propagatedGenTrackID> trackIDs = spr::propagateCALO(myGenEvent, pdt, geo, bField, etaMax, false);
00276     
00277     for (unsigned int indx=0; indx<trackIDs.size(); ++indx) {
00278       int charge = trackIDs[indx].charge;
00279       HepMC::GenEvent::particle_const_iterator p = trackIDs[indx].trkItr;
00280       momVec = math::XYZTLorentzVector((*p)->momentum().px(), (*p)->momentum().py(), (*p)->momentum().pz(), (*p)->momentum().e());
00281       if (verbosity>1) std::cout << "trkIndx " << indx << " pdgid " << trackIDs[indx].pdgId << " charge " << charge <<  " momVec " << momVec << std::endl; 
00282       // only stable particles avoiding electrons and muons
00283       if (trackIDs[indx].ok && (std::abs(trackIDs[indx].pdgId)<11 ||
00284                                 std::abs(trackIDs[indx].pdgId)>=21)) {
00285         // consider particles within a phased space       
00286         if (momVec.Pt() > ptMin && std::abs(momVec.eta()) < etaMax) { 
00287           posVec  = GlobalPoint(0.1*(*p)->production_vertex()->position().x(), 
00288                                 0.1*(*p)->production_vertex()->position().y(), 
00289                                 0.1*(*p)->production_vertex()->position().z());
00290           posECAL = trackIDs[indx].pointECAL;
00291           fillTrack (posVec, momVec, posECAL, trackIDs[indx].pdgId, trackIDs[indx].okECAL, true);
00292           if (verbosity>1) std::cout << "posECAL " << posECAL << " okECAL " << trackIDs[indx].okECAL << "okHCAL " << trackIDs[indx].okHCAL << std::endl;
00293           if (trackIDs[indx].okECAL) {
00294             if ( std::abs(charge)>0 ) {
00295               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, 0, 0, isoinfo1x1,   false);
00296               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, 1, 1, isoinfo3x3,   false);
00297               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, 3, 3, isoinfo7x7,   false);
00298               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, 4, 4, isoinfo9x9,   false);
00299               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, 5, 5, isoinfo11x11, false);
00300               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, 7, 7, isoinfo15x15, false);
00301               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology,10,10, isoinfo21x21, false);
00302               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology,12,12, isoinfo25x25, false);
00303               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology,15,15, isoinfo31x31, false);
00304               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, a_mipR, trackIDs[indx].directionECAL, isoinfoR, false);
00305               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, a_neutIsoR, trackIDs[indx].directionECAL, isoinfoIsoR, false);
00306               if (trackIDs[indx].okHCAL) {
00307                 spr::hGenSimInfo(trackIDs[indx].detIdHCAL, p, trackIDs, theHBHETopology, 0, 0, isoinfoHC1x1, false);
00308                 spr::hGenSimInfo(trackIDs[indx].detIdHCAL, p, trackIDs, theHBHETopology, 1, 1, isoinfoHC3x3, false);
00309                 spr::hGenSimInfo(trackIDs[indx].detIdHCAL, p, trackIDs, theHBHETopology, 2, 2, isoinfoHC5x5, false);
00310                 spr::hGenSimInfo(trackIDs[indx].detIdHCAL, p, trackIDs, theHBHETopology, 3, 3, isoinfoHC7x7, false);
00311                 spr::hGenSimInfo(trackIDs[indx].detIdHCAL, p, trackIDs, geo, theHBHETopology, a_coneR, trackIDs[indx].directionHCAL, isoinfoHCR, false);
00312                 spr::hGenSimInfo(trackIDs[indx].detIdHCAL, p, trackIDs, geo, theHBHETopology, a_charIsoR, trackIDs[indx].directionHCAL, isoinfoIsoHCR, false);
00313               }
00314 
00315               bool saveTrack = true;
00316               if (a_Isolation) saveTrack = (isoinfoR.maxNearP < pCutIsolate);
00317               else             saveTrack = (isoinfo7x7.maxNearP < pCutIsolate);
00318               if (saveTrack) fillIsolatedTrack(momVec, posECAL, trackIDs[indx].pdgId);
00319             }
00320           }
00321         } else { // stabale particles within |eta|=2.5
00322           fillTrack (posVec, momVec, posECAL, 0, false, false);
00323         } 
00324       }
00325     }
00326 
00327     unsigned int indx;
00328     HepMC::GenEvent::particle_const_iterator p;
00329     for (p=myGenEvent->particles_begin(),indx=0; p!=myGenEvent->particles_end();
00330          ++p,++indx) {
00331       int pdgId  = ((*p)->pdg_id());
00332       int ix     = particleCode(pdgId);
00333       if (ix >= 0) {
00334         double  pp = (*p)->momentum().rho();
00335         double eta = (*p)->momentum().eta();
00336         h_pEta[ix]->Fill(pp,eta);
00337       }
00338     }
00339   } else {  // loop over gen particles
00340     std::vector<spr::propagatedGenParticleID> trackIDs = spr::propagateCALO(genParticles, pdt, geo, bField, etaMax, (verbosity>0));
00341 
00342     for (unsigned int indx=0; indx<trackIDs.size(); ++indx) {
00343       int charge = trackIDs[indx].charge;
00344       reco::GenParticleCollection::const_iterator p = trackIDs[indx].trkItr;
00345       
00346       momVec = math::XYZTLorentzVector(p->momentum().x(), p->momentum().y(), p->momentum().z(), p->energy());
00347       if (verbosity>1) std::cout << "trkIndx " << indx << " pdgid " << trackIDs[indx].pdgId << " charge " << charge <<  " momVec " << momVec << std::endl; 
00348       // only stable particles avoiding electrons and muons
00349       if (trackIDs[indx].ok && std::abs(trackIDs[indx].pdgId)>21) {     
00350         // consider particles within a phased space
00351         if (verbosity>1) std::cout << " pt " << momVec.Pt() << " eta " << momVec.eta() << std::endl;
00352         if (momVec.Pt() > ptMin && std::abs(momVec.eta()) < etaMax) { 
00353           posVec  = GlobalPoint(p->vertex().x(), p->vertex().y(), p->vertex().z());
00354           posECAL = trackIDs[indx].pointECAL;
00355           if (verbosity>0) std::cout << "posECAL " << posECAL << " okECAL " << trackIDs[indx].okECAL << "okHCAL " << trackIDs[indx].okHCAL << std::endl;
00356           fillTrack (posVec, momVec, posECAL, trackIDs[indx].pdgId, trackIDs[indx].okECAL, true);
00357           if (trackIDs[indx].okECAL) {
00358             if ( std::abs(charge)>0 ) {
00359               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, 0, 0, isoinfo1x1,   verbosity>1);
00360               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, 1, 1, isoinfo3x3,   verbosity>0);
00361               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, 3, 3, isoinfo7x7,   verbosity>1);
00362               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, 4, 4, isoinfo9x9,   verbosity>1);
00363               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, 5, 5, isoinfo11x11, verbosity>1);
00364               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, 7, 7, isoinfo15x15, verbosity>1);
00365               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology,10,10, isoinfo21x21, verbosity>1);
00366               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology,12,12, isoinfo25x25, verbosity>1);
00367               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology,15,15, isoinfo31x31, verbosity>1);
00368               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, a_mipR, trackIDs[indx].directionECAL, isoinfoR, verbosity>1);
00369               spr::eGenSimInfo(trackIDs[indx].detIdECAL, p, trackIDs, geo, caloTopology, a_neutIsoR, trackIDs[indx].directionECAL, isoinfoIsoR, verbosity>1);
00370               if (trackIDs[indx].okHCAL) {
00371                 spr::hGenSimInfo(trackIDs[indx].detIdHCAL, p, trackIDs, theHBHETopology, 0, 0, isoinfoHC1x1, verbosity>1);
00372                 spr::hGenSimInfo(trackIDs[indx].detIdHCAL, p, trackIDs, theHBHETopology, 1, 1, isoinfoHC3x3, verbosity>1);
00373                 spr::hGenSimInfo(trackIDs[indx].detIdHCAL, p, trackIDs, theHBHETopology, 2, 2, isoinfoHC5x5, verbosity>1);
00374                 spr::hGenSimInfo(trackIDs[indx].detIdHCAL, p, trackIDs, theHBHETopology, 3, 3, isoinfoHC7x7, verbosity>1);
00375                 spr::hGenSimInfo(trackIDs[indx].detIdHCAL, p, trackIDs, geo, theHBHETopology, a_coneR, trackIDs[indx].directionHCAL, isoinfoHCR, verbosity>1);
00376                 spr::hGenSimInfo(trackIDs[indx].detIdHCAL, p, trackIDs, geo, theHBHETopology, a_charIsoR, trackIDs[indx].directionHCAL, isoinfoIsoHCR, verbosity>1);
00377               }
00378 
00379               bool saveTrack = true;
00380               if (a_Isolation) saveTrack = (isoinfoIsoR.maxNearP < pCutIsolate);
00381               else             saveTrack = (isoinfo7x7.maxNearP < pCutIsolate);
00382               if (saveTrack) fillIsolatedTrack(momVec, posECAL, trackIDs[indx].pdgId);
00383             }
00384           }
00385         } else { // stabale particles within |eta|=2.5
00386           fillTrack (posVec, momVec, posECAL, 0, false, false);
00387         } 
00388       }
00389     } // loop over gen particles
00390 
00391     unsigned int indx;
00392     reco::GenParticleCollection::const_iterator p;
00393     for (p=genParticles->begin(),indx=0; p!=genParticles->end(); ++p,++indx) {
00394       int pdgId  = (p->pdgId());
00395       int ix     = particleCode(pdgId);
00396       if (ix >= 0) {
00397         double  pp = (p->momentum()).R();
00398         double eta = (p->momentum()).Eta();
00399         h_pEta[ix]->Fill(pp,eta);
00400       }
00401     }
00402 
00403   } 
00404 
00405   //t_nEvtProc->push_back(nEventProc);
00406   h_NEventProc->SetBinContent(1,nEventProc);
00407   tree->Fill();
00408   
00409 } 
00410 
00411 void IsolatedGenParticles::beginJob() {
00412   
00413   nEventProc=0;
00414   
00415   initL1 = false;
00416 
00417   double tempgen_TH[NPBins+1] = { 0.0,  5.0,  12.0, 300.0}; 
00418   for(int i=0; i<=NPBins; i++)  genPartPBins[i]  = tempgen_TH[i];
00419   
00420   double tempgen_Eta[NEtaBins+1] = {0.0, 0.5, 1.1, 1.7, 2.3};
00421   for(int i=0; i<=NEtaBins; i++) genPartEtaBins[i] = tempgen_Eta[i];
00422   
00423   BookHistograms();
00424 
00425 }
00426 
00427 void IsolatedGenParticles::endJob() {
00428 }
00429 
00430 double IsolatedGenParticles::DeltaPhi(double v1, double v2) {
00431   // Computes the correctly normalized phi difference
00432   // v1, v2 = phi of object 1 and 2
00433   
00434   double pi    = 3.141592654;
00435   double twopi = 6.283185307;
00436   
00437   double diff = std::abs(v2 - v1);
00438   double corr = twopi - diff;
00439   if (diff < pi){ return diff;} else { return corr;} 
00440 }
00441 
00442 double IsolatedGenParticles::DeltaR(double eta1, double phi1, double eta2, double phi2) {
00443   double deta = eta1 - eta2;
00444   double dphi = DeltaPhi(phi1, phi2);
00445   return std::sqrt(deta*deta + dphi*dphi);
00446 }
00447 
00448 double IsolatedGenParticles::DeltaR2(double eta1, double phi1, double eta2, double phi2) {
00449   double deta = eta1 - eta2;
00450   double dphi = DeltaPhi(phi1, phi2);
00451   return deta*deta + dphi*dphi;
00452 }
00453 
00454 void IsolatedGenParticles::fillTrack (GlobalPoint & posVec, math::XYZTLorentzVector & momVec, GlobalPoint & posECAL, int pdgId, bool okECAL, bool accept) {
00455 
00456   if (accept) {
00457     t_isoTrkPAll        ->push_back( momVec.P() );
00458     t_isoTrkPtAll       ->push_back( momVec.Pt() );
00459     t_isoTrkPhiAll      ->push_back( momVec.phi() );
00460     t_isoTrkEtaAll      ->push_back( momVec.eta() );
00461     t_isoTrkPdgIdAll    ->push_back( pdgId ) ;
00462     if (okECAL) {
00463       double phi1 = momVec.phi();
00464       double phi2 = (posECAL - posVec).phi();
00465       double dphi = DeltaPhi( phi1, phi2 );
00466       double deta = momVec.eta() - (posECAL - posVec).eta();
00467       t_isoTrkDPhiAll ->push_back( dphi );
00468       t_isoTrkDEtaAll ->push_back( deta );      
00469     } else {
00470       t_isoTrkDPhiAll ->push_back( 999.0 );
00471       t_isoTrkDEtaAll ->push_back( 999.0 );     
00472     }
00473   } else {
00474     t_isoTrkDPhiAll ->push_back( -999.0 );
00475     t_isoTrkDEtaAll ->push_back( -999.0 );      
00476   }
00477 }
00478 
00479 void IsolatedGenParticles::fillIsolatedTrack(math::XYZTLorentzVector & momVec, GlobalPoint & posECAL, int pdgId) {
00480 
00481   t_isoTrkP           ->push_back(momVec.P());
00482   t_isoTrkPt          ->push_back(momVec.Pt());
00483   t_isoTrkEne         ->push_back(momVec.E());
00484   t_isoTrkEta         ->push_back(momVec.eta());
00485   t_isoTrkPhi         ->push_back(momVec.phi());
00486   t_isoTrkEtaEC       ->push_back(posECAL.eta());
00487   t_isoTrkPhiEC       ->push_back(posECAL.phi());
00488   t_isoTrkPdgId       ->push_back(pdgId);
00489   
00490   t_maxNearP31x31     ->push_back(isoinfo31x31.maxNearP);
00491   t_cHadronEne31x31   ->push_back(isoinfo31x31.cHadronEne);
00492   t_cHadronEne31x31_1 ->push_back(isoinfo31x31.cHadronEne_[0]);
00493   t_cHadronEne31x31_2 ->push_back(isoinfo31x31.cHadronEne_[1]);
00494   t_cHadronEne31x31_3 ->push_back(isoinfo31x31.cHadronEne_[2]);
00495   t_nHadronEne31x31   ->push_back(isoinfo31x31.nHadronEne);
00496   t_photonEne31x31    ->push_back(isoinfo31x31.photonEne);
00497   t_eleEne31x31       ->push_back(isoinfo31x31.eleEne);
00498   t_muEne31x31        ->push_back(isoinfo31x31.muEne);
00499           
00500   t_maxNearP25x25     ->push_back(isoinfo25x25.maxNearP);
00501   t_cHadronEne25x25   ->push_back(isoinfo25x25.cHadronEne);
00502   t_cHadronEne25x25_1 ->push_back(isoinfo25x25.cHadronEne_[0]);
00503   t_cHadronEne25x25_2 ->push_back(isoinfo25x25.cHadronEne_[1]);
00504   t_cHadronEne25x25_3 ->push_back(isoinfo25x25.cHadronEne_[2]);
00505   t_nHadronEne25x25   ->push_back(isoinfo25x25.nHadronEne);
00506   t_photonEne25x25    ->push_back(isoinfo25x25.photonEne);
00507   t_eleEne25x25       ->push_back(isoinfo25x25.eleEne);
00508   t_muEne25x25        ->push_back(isoinfo25x25.muEne);
00509           
00510   t_maxNearP21x21     ->push_back(isoinfo21x21.maxNearP);
00511   t_cHadronEne21x21   ->push_back(isoinfo21x21.cHadronEne);
00512   t_cHadronEne21x21_1 ->push_back(isoinfo21x21.cHadronEne_[0]);
00513   t_cHadronEne21x21_2 ->push_back(isoinfo21x21.cHadronEne_[1]);
00514   t_cHadronEne21x21_3 ->push_back(isoinfo21x21.cHadronEne_[2]);
00515   t_nHadronEne21x21   ->push_back(isoinfo21x21.nHadronEne);
00516   t_photonEne21x21    ->push_back(isoinfo21x21.photonEne);
00517   t_eleEne21x21       ->push_back(isoinfo21x21.eleEne);
00518   t_muEne21x21        ->push_back(isoinfo21x21.muEne);
00519           
00520   t_maxNearP15x15     ->push_back(isoinfo15x15.maxNearP);
00521   t_cHadronEne15x15   ->push_back(isoinfo15x15.cHadronEne);
00522   t_cHadronEne15x15_1 ->push_back(isoinfo15x15.cHadronEne_[0]);
00523   t_cHadronEne15x15_2 ->push_back(isoinfo15x15.cHadronEne_[1]);
00524   t_cHadronEne15x15_3 ->push_back(isoinfo15x15.cHadronEne_[2]);
00525   t_nHadronEne15x15   ->push_back(isoinfo15x15.nHadronEne);
00526   t_photonEne15x15    ->push_back(isoinfo15x15.photonEne);
00527   t_eleEne15x15       ->push_back(isoinfo15x15.eleEne);
00528   t_muEne15x15        ->push_back(isoinfo15x15.muEne);
00529           
00530   t_maxNearP11x11     ->push_back(isoinfo11x11.maxNearP);
00531   t_cHadronEne11x11   ->push_back(isoinfo11x11.cHadronEne);
00532   t_cHadronEne11x11_1 ->push_back(isoinfo11x11.cHadronEne_[0]);
00533   t_cHadronEne11x11_2 ->push_back(isoinfo11x11.cHadronEne_[1]);
00534   t_cHadronEne11x11_3 ->push_back(isoinfo11x11.cHadronEne_[2]);
00535   t_nHadronEne11x11   ->push_back(isoinfo11x11.nHadronEne);
00536   t_photonEne11x11    ->push_back(isoinfo11x11.photonEne);
00537   t_eleEne11x11       ->push_back(isoinfo11x11.eleEne);
00538   t_muEne11x11        ->push_back(isoinfo11x11.muEne);
00539           
00540   t_maxNearP9x9       ->push_back(isoinfo9x9.maxNearP);
00541   t_cHadronEne9x9     ->push_back(isoinfo9x9.cHadronEne);
00542   t_cHadronEne9x9_1   ->push_back(isoinfo9x9.cHadronEne_[0]);
00543   t_cHadronEne9x9_2   ->push_back(isoinfo9x9.cHadronEne_[1]);
00544   t_cHadronEne9x9_3   ->push_back(isoinfo9x9.cHadronEne_[2]);
00545   t_nHadronEne9x9     ->push_back(isoinfo9x9.nHadronEne);
00546   t_photonEne9x9      ->push_back(isoinfo9x9.photonEne);
00547   t_eleEne9x9         ->push_back(isoinfo9x9.eleEne);
00548   t_muEne9x9          ->push_back(isoinfo9x9.muEne);
00549             
00550   t_maxNearP7x7       ->push_back(isoinfo7x7.maxNearP);
00551   t_cHadronEne7x7     ->push_back(isoinfo7x7.cHadronEne);
00552   t_cHadronEne7x7_1   ->push_back(isoinfo7x7.cHadronEne_[0]);
00553   t_cHadronEne7x7_2   ->push_back(isoinfo7x7.cHadronEne_[1]);
00554   t_cHadronEne7x7_3   ->push_back(isoinfo7x7.cHadronEne_[2]);
00555   t_nHadronEne7x7     ->push_back(isoinfo7x7.nHadronEne);
00556   t_photonEne7x7      ->push_back(isoinfo7x7.photonEne);
00557   t_eleEne7x7         ->push_back(isoinfo7x7.eleEne);
00558   t_muEne7x7          ->push_back(isoinfo7x7.muEne);
00559   
00560   t_maxNearP3x3       ->push_back(isoinfo3x3.maxNearP);
00561   t_cHadronEne3x3     ->push_back(isoinfo3x3.cHadronEne);
00562   t_cHadronEne3x3_1   ->push_back(isoinfo3x3.cHadronEne_[0]);
00563   t_cHadronEne3x3_2   ->push_back(isoinfo3x3.cHadronEne_[1]);
00564   t_cHadronEne3x3_3   ->push_back(isoinfo3x3.cHadronEne_[2]);
00565   t_nHadronEne3x3     ->push_back(isoinfo3x3.nHadronEne);
00566   t_photonEne3x3      ->push_back(isoinfo3x3.photonEne);
00567   t_eleEne3x3         ->push_back(isoinfo3x3.eleEne);
00568   t_muEne3x3          ->push_back(isoinfo3x3.muEne);
00569 
00570   t_maxNearP1x1       ->push_back(isoinfo1x1.maxNearP);
00571   t_cHadronEne1x1     ->push_back(isoinfo1x1.cHadronEne);
00572   t_cHadronEne1x1_1   ->push_back(isoinfo1x1.cHadronEne_[0]);
00573   t_cHadronEne1x1_2   ->push_back(isoinfo1x1.cHadronEne_[1]);
00574   t_cHadronEne1x1_3   ->push_back(isoinfo1x1.cHadronEne_[2]);
00575   t_nHadronEne1x1     ->push_back(isoinfo1x1.nHadronEne);
00576   t_photonEne1x1      ->push_back(isoinfo1x1.photonEne);
00577   t_eleEne1x1         ->push_back(isoinfo1x1.eleEne);
00578   t_muEne1x1          ->push_back(isoinfo1x1.muEne);
00579 
00580   t_maxNearPHC1x1       ->push_back(isoinfoHC1x1.maxNearP);
00581   t_cHadronEneHC1x1     ->push_back(isoinfoHC1x1.cHadronEne);
00582   t_cHadronEneHC1x1_1   ->push_back(isoinfoHC1x1.cHadronEne_[0]);
00583   t_cHadronEneHC1x1_2   ->push_back(isoinfoHC1x1.cHadronEne_[1]);
00584   t_cHadronEneHC1x1_3   ->push_back(isoinfoHC1x1.cHadronEne_[2]);
00585   t_nHadronEneHC1x1     ->push_back(isoinfoHC1x1.nHadronEne);
00586   t_photonEneHC1x1      ->push_back(isoinfoHC1x1.photonEne);
00587   t_eleEneHC1x1         ->push_back(isoinfoHC1x1.eleEne);
00588   t_muEneHC1x1          ->push_back(isoinfoHC1x1.muEne);
00589   
00590   t_maxNearPHC3x3       ->push_back(isoinfoHC3x3.maxNearP);
00591   t_cHadronEneHC3x3     ->push_back(isoinfoHC3x3.cHadronEne);
00592   t_cHadronEneHC3x3_1   ->push_back(isoinfoHC3x3.cHadronEne_[0]);
00593   t_cHadronEneHC3x3_2   ->push_back(isoinfoHC3x3.cHadronEne_[1]);
00594   t_cHadronEneHC3x3_3   ->push_back(isoinfoHC3x3.cHadronEne_[2]);
00595   t_nHadronEneHC3x3     ->push_back(isoinfoHC3x3.nHadronEne);
00596   t_photonEneHC3x3      ->push_back(isoinfoHC3x3.photonEne);
00597   t_eleEneHC3x3         ->push_back(isoinfoHC3x3.eleEne);
00598   t_muEneHC3x3          ->push_back(isoinfoHC3x3.muEne);
00599 
00600   t_maxNearPHC5x5       ->push_back(isoinfoHC5x5.maxNearP);
00601   t_cHadronEneHC5x5     ->push_back(isoinfoHC5x5.cHadronEne);
00602   t_cHadronEneHC5x5_1   ->push_back(isoinfoHC5x5.cHadronEne_[0]);
00603   t_cHadronEneHC5x5_2   ->push_back(isoinfoHC5x5.cHadronEne_[1]);
00604   t_cHadronEneHC5x5_3   ->push_back(isoinfoHC5x5.cHadronEne_[2]);
00605   t_nHadronEneHC5x5     ->push_back(isoinfoHC5x5.nHadronEne);
00606   t_photonEneHC5x5      ->push_back(isoinfoHC5x5.photonEne);
00607   t_eleEneHC5x5         ->push_back(isoinfoHC5x5.eleEne);
00608   t_muEneHC5x5          ->push_back(isoinfoHC5x5.muEne);
00609 
00610   t_maxNearPHC7x7       ->push_back(isoinfoHC7x7.maxNearP);
00611   t_cHadronEneHC7x7     ->push_back(isoinfoHC7x7.cHadronEne);
00612   t_cHadronEneHC7x7_1   ->push_back(isoinfoHC7x7.cHadronEne_[0]);
00613   t_cHadronEneHC7x7_2   ->push_back(isoinfoHC7x7.cHadronEne_[1]);
00614   t_cHadronEneHC7x7_3   ->push_back(isoinfoHC7x7.cHadronEne_[2]);
00615   t_nHadronEneHC7x7     ->push_back(isoinfoHC7x7.nHadronEne);
00616   t_photonEneHC7x7      ->push_back(isoinfoHC7x7.photonEne);
00617   t_eleEneHC7x7         ->push_back(isoinfoHC7x7.eleEne);
00618   t_muEneHC7x7          ->push_back(isoinfoHC7x7.muEne);
00619 
00620   t_maxNearPR           ->push_back(isoinfoR.maxNearP);
00621   t_cHadronEneR         ->push_back(isoinfoR.cHadronEne);
00622   t_cHadronEneR_1       ->push_back(isoinfoR.cHadronEne_[0]);
00623   t_cHadronEneR_2       ->push_back(isoinfoR.cHadronEne_[1]);
00624   t_cHadronEneR_3       ->push_back(isoinfoR.cHadronEne_[2]);
00625   t_nHadronEneR         ->push_back(isoinfoR.nHadronEne);
00626   t_photonEneR          ->push_back(isoinfoR.photonEne);
00627   t_eleEneR             ->push_back(isoinfoR.eleEne);
00628   t_muEneR              ->push_back(isoinfoR.muEne);
00629 
00630   t_maxNearPIsoR        ->push_back(isoinfoIsoR.maxNearP);
00631   t_cHadronEneIsoR      ->push_back(isoinfoIsoR.cHadronEne);
00632   t_cHadronEneIsoR_1    ->push_back(isoinfoIsoR.cHadronEne_[0]);
00633   t_cHadronEneIsoR_2    ->push_back(isoinfoIsoR.cHadronEne_[1]);
00634   t_cHadronEneIsoR_3    ->push_back(isoinfoIsoR.cHadronEne_[2]);
00635   t_nHadronEneIsoR      ->push_back(isoinfoIsoR.nHadronEne);
00636   t_photonEneIsoR       ->push_back(isoinfoIsoR.photonEne);
00637   t_eleEneIsoR          ->push_back(isoinfoIsoR.eleEne);
00638   t_muEneIsoR           ->push_back(isoinfoIsoR.muEne);
00639 
00640   t_maxNearPHCR         ->push_back(isoinfoHCR.maxNearP);
00641   t_cHadronEneHCR       ->push_back(isoinfoHCR.cHadronEne);
00642   t_cHadronEneHCR_1     ->push_back(isoinfoHCR.cHadronEne_[0]);
00643   t_cHadronEneHCR_2     ->push_back(isoinfoHCR.cHadronEne_[1]);
00644   t_cHadronEneHCR_3     ->push_back(isoinfoHCR.cHadronEne_[2]);
00645   t_nHadronEneHCR       ->push_back(isoinfoHCR.nHadronEne);
00646   t_photonEneHCR        ->push_back(isoinfoHCR.photonEne);
00647   t_eleEneHCR           ->push_back(isoinfoHCR.eleEne);
00648   t_muEneHCR            ->push_back(isoinfoHCR.muEne);
00649 
00650   t_maxNearPIsoHCR      ->push_back(isoinfoIsoHCR.maxNearP);
00651   t_cHadronEneIsoHCR    ->push_back(isoinfoIsoHCR.cHadronEne);
00652   t_cHadronEneIsoHCR_1  ->push_back(isoinfoIsoHCR.cHadronEne_[0]);
00653   t_cHadronEneIsoHCR_2  ->push_back(isoinfoIsoHCR.cHadronEne_[1]);
00654   t_cHadronEneIsoHCR_3  ->push_back(isoinfoIsoHCR.cHadronEne_[2]);
00655   t_nHadronEneIsoHCR    ->push_back(isoinfoIsoHCR.nHadronEne);
00656   t_photonEneIsoHCR     ->push_back(isoinfoIsoHCR.photonEne);
00657   t_eleEneIsoHCR        ->push_back(isoinfoIsoHCR.eleEne);
00658   t_muEneIsoHCR         ->push_back(isoinfoIsoHCR.muEne);
00659 }
00660 
00661 void IsolatedGenParticles::BookHistograms(){
00662 
00663   //char hname[100], htit[100];
00664 
00665   h_NEventProc  = fs->make<TH1I>("h_NEventProc",  "h_NEventProc", 2, -0.5, 0.5);
00666   h_L1AlgoNames = fs->make<TH1I>("h_L1AlgoNames", "h_L1AlgoNames:Bin Labels", 128, -0.5, 127.5);  
00667 
00668   double pBin[] = {0.0, 2.0, 4.0, 6.0, 8.0, 10.0, 20.0, 30.0, 40.0, 50.0,
00669                    60.0, 70.0, 80.0, 90.0, 100.0, 150.0, 200.0, 250.0,
00670                    300.0, 350.0, 400.0, 450.0, 500.0, 550.0, 600.0,
00671                    650.0, 700.0, 750.0, 800.0, 850.0, 900.0, 950.0,
00672                    1000.0};
00673   constexpr double etaBin[] = {-3.0, -2.9, -2.8, -2.7, -2.6, -2.5, -2.4, -2.3,
00674                               -2.2, -2.1, -2.0, -1.9, -1.8, -1.7, -1.6, -1.5,
00675                               -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7,
00676                               -0.6, -0.5, -0.4, -0.3, -0.2, -0.1,  0.0,  0.1,
00677                                0.2,  0.3,  0.4,  0.5,  0.6,  0.7,  0.8,  0.9,
00678                                1.0,  1.1,  1.2,  1.3,  1.4,  1.5,  1.6,  1.7,
00679                                1.8,  1.9,  2.0,  2.1,  2.2,  2.3,  2.4,  2.5,
00680                                2.6,  2.7,  2.8,  2.9,  3.0};
00681   constexpr char const* particle[] = {"electron", "positron", "#gamma", "#pi^+",
00682                                       "#pi^-", "K^+", "K^-", "p", "n", "pbar",
00683                                       "nbar", "K^0_L"};
00684   TFileDirectory dir1     = fs->mkdir( "pEta" );
00685   char name[20], title[50];
00686   for (int i=0; i<Particles; ++i) {
00687     sprintf (name, "pEta%d", i);
00688     sprintf (title, "#eta vs momentum for %s", particle[i]);
00689     h_pEta[i] = dir1.make<TH2D>(name, title, (sizeof(pBin)/sizeof(double))-1, pBin, (sizeof(etaBin)/sizeof(double))-1, etaBin);
00690   }
00691 
00692   // build the tree
00693   tree = fs->make<TTree>("tree", "tree");
00694 
00695   t_isoTrkPAll        = new std::vector<double>();
00696   t_isoTrkPtAll       = new std::vector<double>();
00697   t_isoTrkPhiAll      = new std::vector<double>();
00698   t_isoTrkEtaAll      = new std::vector<double>();
00699   t_isoTrkDPhiAll     = new std::vector<double>();
00700   t_isoTrkDEtaAll     = new std::vector<double>();
00701   t_isoTrkPdgIdAll    = new std::vector<double>();
00702 
00703   t_isoTrkP           = new std::vector<double>();
00704   t_isoTrkPt          = new std::vector<double>();
00705   t_isoTrkEne         = new std::vector<double>();
00706   t_isoTrkEta         = new std::vector<double>();
00707   t_isoTrkPhi         = new std::vector<double>();
00708   t_isoTrkEtaEC       = new std::vector<double>();
00709   t_isoTrkPhiEC       = new std::vector<double>();
00710   t_isoTrkPdgId       = new std::vector<double>();
00711   
00712   t_maxNearP31x31     = new std::vector<double>();
00713   t_cHadronEne31x31   = new std::vector<double>();
00714   t_cHadronEne31x31_1 = new std::vector<double>();
00715   t_cHadronEne31x31_2 = new std::vector<double>();
00716   t_cHadronEne31x31_3 = new std::vector<double>();
00717   t_nHadronEne31x31   = new std::vector<double>();
00718   t_photonEne31x31    = new std::vector<double>();
00719   t_eleEne31x31       = new std::vector<double>();
00720   t_muEne31x31        = new std::vector<double>();
00721 
00722   t_maxNearP25x25     = new std::vector<double>();
00723   t_cHadronEne25x25   = new std::vector<double>();
00724   t_cHadronEne25x25_1 = new std::vector<double>();
00725   t_cHadronEne25x25_2 = new std::vector<double>();
00726   t_cHadronEne25x25_3 = new std::vector<double>();
00727   t_nHadronEne25x25   = new std::vector<double>();
00728   t_photonEne25x25    = new std::vector<double>();
00729   t_eleEne25x25       = new std::vector<double>();
00730   t_muEne25x25        = new std::vector<double>();
00731 
00732   t_maxNearP21x21     = new std::vector<double>();
00733   t_cHadronEne21x21   = new std::vector<double>();
00734   t_cHadronEne21x21_1 = new std::vector<double>();
00735   t_cHadronEne21x21_2 = new std::vector<double>();
00736   t_cHadronEne21x21_3 = new std::vector<double>();
00737   t_nHadronEne21x21   = new std::vector<double>();
00738   t_photonEne21x21    = new std::vector<double>();
00739   t_eleEne21x21       = new std::vector<double>();
00740   t_muEne21x21        = new std::vector<double>();
00741 
00742   t_maxNearP15x15     = new std::vector<double>();
00743   t_cHadronEne15x15   = new std::vector<double>();
00744   t_cHadronEne15x15_1 = new std::vector<double>();
00745   t_cHadronEne15x15_2 = new std::vector<double>();
00746   t_cHadronEne15x15_3 = new std::vector<double>();
00747   t_nHadronEne15x15   = new std::vector<double>();
00748   t_photonEne15x15    = new std::vector<double>();
00749   t_eleEne15x15       = new std::vector<double>();
00750   t_muEne15x15        = new std::vector<double>();
00751 
00752   t_maxNearP11x11     = new std::vector<double>();
00753   t_cHadronEne11x11   = new std::vector<double>();
00754   t_cHadronEne11x11_1 = new std::vector<double>();
00755   t_cHadronEne11x11_2 = new std::vector<double>();
00756   t_cHadronEne11x11_3 = new std::vector<double>();
00757   t_nHadronEne11x11   = new std::vector<double>();
00758   t_photonEne11x11    = new std::vector<double>();
00759   t_eleEne11x11       = new std::vector<double>();
00760   t_muEne11x11        = new std::vector<double>();
00761 
00762   t_maxNearP9x9       = new std::vector<double>();
00763   t_cHadronEne9x9     = new std::vector<double>();
00764   t_cHadronEne9x9_1   = new std::vector<double>();
00765   t_cHadronEne9x9_2   = new std::vector<double>();
00766   t_cHadronEne9x9_3   = new std::vector<double>();
00767   t_nHadronEne9x9     = new std::vector<double>();
00768   t_photonEne9x9      = new std::vector<double>();
00769   t_eleEne9x9         = new std::vector<double>();
00770   t_muEne9x9          = new std::vector<double>();
00771 
00772   t_maxNearP7x7       = new std::vector<double>();
00773   t_cHadronEne7x7     = new std::vector<double>();
00774   t_cHadronEne7x7_1   = new std::vector<double>();
00775   t_cHadronEne7x7_2   = new std::vector<double>();
00776   t_cHadronEne7x7_3   = new std::vector<double>();
00777   t_nHadronEne7x7     = new std::vector<double>();
00778   t_photonEne7x7      = new std::vector<double>();
00779   t_eleEne7x7         = new std::vector<double>();
00780   t_muEne7x7          = new std::vector<double>();
00781 
00782   t_maxNearP3x3       = new std::vector<double>();
00783   t_cHadronEne3x3     = new std::vector<double>();
00784   t_cHadronEne3x3_1   = new std::vector<double>();
00785   t_cHadronEne3x3_2   = new std::vector<double>();
00786   t_cHadronEne3x3_3   = new std::vector<double>();
00787   t_nHadronEne3x3     = new std::vector<double>();
00788   t_photonEne3x3      = new std::vector<double>();
00789   t_eleEne3x3         = new std::vector<double>();
00790   t_muEne3x3          = new std::vector<double>();
00791 
00792   t_maxNearP1x1       = new std::vector<double>();
00793   t_cHadronEne1x1     = new std::vector<double>();
00794   t_cHadronEne1x1_1   = new std::vector<double>();
00795   t_cHadronEne1x1_2   = new std::vector<double>();
00796   t_cHadronEne1x1_3   = new std::vector<double>();
00797   t_nHadronEne1x1     = new std::vector<double>();
00798   t_photonEne1x1      = new std::vector<double>();
00799   t_eleEne1x1         = new std::vector<double>();
00800   t_muEne1x1          = new std::vector<double>();
00801 
00802   t_maxNearPHC1x1       = new std::vector<double>();
00803   t_cHadronEneHC1x1     = new std::vector<double>();
00804   t_cHadronEneHC1x1_1   = new std::vector<double>();
00805   t_cHadronEneHC1x1_2   = new std::vector<double>();
00806   t_cHadronEneHC1x1_3   = new std::vector<double>();
00807   t_nHadronEneHC1x1     = new std::vector<double>();
00808   t_photonEneHC1x1      = new std::vector<double>();
00809   t_eleEneHC1x1         = new std::vector<double>();
00810   t_muEneHC1x1          = new std::vector<double>();
00811 
00812   t_maxNearPHC3x3       = new std::vector<double>();
00813   t_cHadronEneHC3x3     = new std::vector<double>();
00814   t_cHadronEneHC3x3_1   = new std::vector<double>();
00815   t_cHadronEneHC3x3_2   = new std::vector<double>();
00816   t_cHadronEneHC3x3_3   = new std::vector<double>();
00817   t_nHadronEneHC3x3     = new std::vector<double>();
00818   t_photonEneHC3x3      = new std::vector<double>();
00819   t_eleEneHC3x3         = new std::vector<double>();
00820   t_muEneHC3x3          = new std::vector<double>();
00821 
00822   t_maxNearPHC5x5       = new std::vector<double>();
00823   t_cHadronEneHC5x5     = new std::vector<double>();
00824   t_cHadronEneHC5x5_1   = new std::vector<double>();
00825   t_cHadronEneHC5x5_2   = new std::vector<double>();
00826   t_cHadronEneHC5x5_3   = new std::vector<double>();
00827   t_nHadronEneHC5x5     = new std::vector<double>();
00828   t_photonEneHC5x5      = new std::vector<double>();
00829   t_eleEneHC5x5         = new std::vector<double>();
00830   t_muEneHC5x5          = new std::vector<double>();
00831 
00832   t_maxNearPHC7x7       = new std::vector<double>();
00833   t_cHadronEneHC7x7     = new std::vector<double>();
00834   t_cHadronEneHC7x7_1   = new std::vector<double>();
00835   t_cHadronEneHC7x7_2   = new std::vector<double>();
00836   t_cHadronEneHC7x7_3   = new std::vector<double>();
00837   t_nHadronEneHC7x7     = new std::vector<double>();
00838   t_photonEneHC7x7      = new std::vector<double>();
00839   t_eleEneHC7x7         = new std::vector<double>();
00840   t_muEneHC7x7          = new std::vector<double>();
00841 
00842   t_maxNearPR           = new std::vector<double>();
00843   t_cHadronEneR         = new std::vector<double>();
00844   t_cHadronEneR_1       = new std::vector<double>();
00845   t_cHadronEneR_2       = new std::vector<double>();
00846   t_cHadronEneR_3       = new std::vector<double>();
00847   t_nHadronEneR         = new std::vector<double>();
00848   t_photonEneR          = new std::vector<double>();
00849   t_eleEneR             = new std::vector<double>();
00850   t_muEneR              = new std::vector<double>();
00851 
00852   t_maxNearPIsoR        = new std::vector<double>();
00853   t_cHadronEneIsoR      = new std::vector<double>();
00854   t_cHadronEneIsoR_1    = new std::vector<double>();
00855   t_cHadronEneIsoR_2    = new std::vector<double>();
00856   t_cHadronEneIsoR_3    = new std::vector<double>();
00857   t_nHadronEneIsoR      = new std::vector<double>();
00858   t_photonEneIsoR       = new std::vector<double>();
00859   t_eleEneIsoR          = new std::vector<double>();
00860   t_muEneIsoR           = new std::vector<double>();
00861 
00862   t_maxNearPHCR         = new std::vector<double>();
00863   t_cHadronEneHCR       = new std::vector<double>();
00864   t_cHadronEneHCR_1     = new std::vector<double>();
00865   t_cHadronEneHCR_2     = new std::vector<double>();
00866   t_cHadronEneHCR_3     = new std::vector<double>();
00867   t_nHadronEneHCR       = new std::vector<double>();
00868   t_photonEneHCR        = new std::vector<double>();
00869   t_eleEneHCR           = new std::vector<double>();
00870   t_muEneHCR            = new std::vector<double>();
00871 
00872   t_maxNearPIsoHCR      = new std::vector<double>();
00873   t_cHadronEneIsoHCR    = new std::vector<double>();
00874   t_cHadronEneIsoHCR_1  = new std::vector<double>();
00875   t_cHadronEneIsoHCR_2  = new std::vector<double>();
00876   t_cHadronEneIsoHCR_3  = new std::vector<double>();
00877   t_nHadronEneIsoHCR    = new std::vector<double>();
00878   t_photonEneIsoHCR     = new std::vector<double>();
00879   t_eleEneIsoHCR        = new std::vector<double>();
00880   t_muEneIsoHCR         = new std::vector<double>();
00881 
00882   //----- L1Trigger 
00883   t_L1Decision        = new std::vector<int>();
00884   t_L1CenJetPt        = new std::vector<double>();
00885   t_L1CenJetEta       = new std::vector<double>();    
00886   t_L1CenJetPhi       = new std::vector<double>();
00887   t_L1FwdJetPt        = new std::vector<double>();
00888   t_L1FwdJetEta       = new std::vector<double>();
00889   t_L1FwdJetPhi       = new std::vector<double>();
00890   t_L1TauJetPt        = new std::vector<double>();
00891   t_L1TauJetEta       = new std::vector<double>();     
00892   t_L1TauJetPhi       = new std::vector<double>();
00893   t_L1MuonPt          = new std::vector<double>();
00894   t_L1MuonEta         = new std::vector<double>();     
00895   t_L1MuonPhi         = new std::vector<double>();
00896   t_L1IsoEMPt         = new std::vector<double>();
00897   t_L1IsoEMEta        = new std::vector<double>();
00898   t_L1IsoEMPhi        = new std::vector<double>();
00899   t_L1NonIsoEMPt      = new std::vector<double>();
00900   t_L1NonIsoEMEta     = new std::vector<double>();
00901   t_L1NonIsoEMPhi     = new std::vector<double>();
00902   t_L1METPt           = new std::vector<double>();
00903   t_L1METEta          = new std::vector<double>();
00904   t_L1METPhi          = new std::vector<double>();
00905   
00906   //tree->Branch("t_nEvtProc",          "vector<int>",    &t_nEvtProc);
00907 
00908   tree->Branch("t_isoTrkPAll",        "vector<double>", &t_isoTrkPAll);
00909   tree->Branch("t_isoTrkPtAll",       "vector<double>", &t_isoTrkPtAll);
00910   tree->Branch("t_isoTrkPhiAll",      "vector<double>", &t_isoTrkPhiAll);
00911   tree->Branch("t_isoTrkEtaAll",      "vector<double>", &t_isoTrkEtaAll);
00912   tree->Branch("t_isoTrkDPhiAll",     "vector<double>", &t_isoTrkDPhiAll);
00913   tree->Branch("t_isoTrkDEtaAll",     "vector<double>", &t_isoTrkDEtaAll);
00914   tree->Branch("t_isoTrkPdgIdAll",    "vector<double>", &t_isoTrkPdgIdAll);
00915 
00916   tree->Branch("t_isoTrkP",           "vector<double>", &t_isoTrkP);
00917   tree->Branch("t_isoTrkPt",          "vector<double>", &t_isoTrkPt);
00918   tree->Branch("t_isoTrkEne",         "vector<double>", &t_isoTrkEne);
00919   tree->Branch("t_isoTrkEta",         "vector<double>", &t_isoTrkEta);
00920   tree->Branch("t_isoTrkPhi",         "vector<double>", &t_isoTrkPhi);
00921   tree->Branch("t_isoTrkEtaEC",       "vector<double>", &t_isoTrkEtaEC);
00922   tree->Branch("t_isoTrkPhiEC",       "vector<double>", &t_isoTrkPhiEC);
00923   tree->Branch("t_isoTrkPdgId",       "vector<double>", &t_isoTrkPdgId);
00924 
00925   tree->Branch("t_maxNearP31x31",     "vector<double>", &t_maxNearP31x31);
00926   tree->Branch("t_cHadronEne31x31",   "vector<double>", &t_cHadronEne31x31);
00927   tree->Branch("t_cHadronEne31x31_1", "vector<double>", &t_cHadronEne31x31_1);
00928   tree->Branch("t_cHadronEne31x31_2", "vector<double>", &t_cHadronEne31x31_2);
00929   tree->Branch("t_cHadronEne31x31_3", "vector<double>", &t_cHadronEne31x31_3);
00930   tree->Branch("t_nHadronEne31x31",   "vector<double>", &t_nHadronEne31x31);
00931   tree->Branch("t_photonEne31x31",    "vector<double>", &t_photonEne31x31);
00932   tree->Branch("t_eleEne31x31",       "vector<double>", &t_eleEne31x31);
00933   tree->Branch("t_muEne31x31",        "vector<double>", &t_muEne31x31);
00934 
00935   tree->Branch("t_maxNearP25x25",     "vector<double>", &t_maxNearP25x25);
00936   tree->Branch("t_cHadronEne25x25",   "vector<double>", &t_cHadronEne25x25);
00937   tree->Branch("t_cHadronEne25x25_1", "vector<double>", &t_cHadronEne25x25_1);
00938   tree->Branch("t_cHadronEne25x25_2", "vector<double>", &t_cHadronEne25x25_2);
00939   tree->Branch("t_cHadronEne25x25_3", "vector<double>", &t_cHadronEne25x25_3);
00940   tree->Branch("t_nHadronEne25x25",   "vector<double>", &t_nHadronEne25x25);
00941   tree->Branch("t_photonEne25x25",    "vector<double>", &t_photonEne25x25);
00942   tree->Branch("t_eleEne25x25",       "vector<double>", &t_eleEne25x25);
00943   tree->Branch("t_muEne25x25",        "vector<double>", &t_muEne25x25);
00944   
00945   tree->Branch("t_maxNearP21x21",     "vector<double>", &t_maxNearP21x21);
00946   tree->Branch("t_cHadronEne21x21",   "vector<double>", &t_cHadronEne21x21);
00947   tree->Branch("t_cHadronEne21x21_1", "vector<double>", &t_cHadronEne21x21_1);
00948   tree->Branch("t_cHadronEne21x21_2", "vector<double>", &t_cHadronEne21x21_2);
00949   tree->Branch("t_cHadronEne21x21_3", "vector<double>", &t_cHadronEne21x21_3);
00950   tree->Branch("t_nHadronEne21x21",   "vector<double>", &t_nHadronEne21x21);
00951   tree->Branch("t_photonEne21x21",    "vector<double>", &t_photonEne21x21);
00952   tree->Branch("t_eleEne21x21",       "vector<double>", &t_eleEne21x21);
00953   tree->Branch("t_muEne21x21",        "vector<double>", &t_muEne21x21);
00954 
00955   tree->Branch("t_maxNearP15x15",     "vector<double>", &t_maxNearP15x15);
00956   tree->Branch("t_cHadronEne15x15",   "vector<double>", &t_cHadronEne15x15);
00957   tree->Branch("t_cHadronEne15x15_1", "vector<double>", &t_cHadronEne15x15_1);
00958   tree->Branch("t_cHadronEne15x15_2", "vector<double>", &t_cHadronEne15x15_2);
00959   tree->Branch("t_cHadronEne15x15_3", "vector<double>", &t_cHadronEne15x15_3);
00960   tree->Branch("t_nHadronEne15x15",   "vector<double>", &t_nHadronEne15x15);
00961   tree->Branch("t_photonEne15x15",    "vector<double>", &t_photonEne15x15);
00962   tree->Branch("t_eleEne15x15",       "vector<double>", &t_eleEne15x15);
00963   tree->Branch("t_muEne15x15",        "vector<double>", &t_muEne15x15);
00964 
00965   tree->Branch("t_maxNearP11x11",     "vector<double>", &t_maxNearP11x11);
00966   tree->Branch("t_cHadronEne11x11",   "vector<double>", &t_cHadronEne11x11);
00967   tree->Branch("t_cHadronEne11x11_1", "vector<double>", &t_cHadronEne11x11_1);
00968   tree->Branch("t_cHadronEne11x11_2", "vector<double>", &t_cHadronEne11x11_2);
00969   tree->Branch("t_cHadronEne11x11_3", "vector<double>", &t_cHadronEne11x11_3);
00970   tree->Branch("t_nHadronEne11x11",   "vector<double>", &t_nHadronEne11x11);
00971   tree->Branch("t_photonEne11x11",    "vector<double>", &t_photonEne11x11);
00972   tree->Branch("t_eleEne11x11",       "vector<double>", &t_eleEne11x11);
00973   tree->Branch("t_muEne11x11",        "vector<double>", &t_muEne11x11);
00974 
00975   tree->Branch("t_maxNearP9x9",       "vector<double>", &t_maxNearP9x9);
00976   tree->Branch("t_cHadronEne9x9",     "vector<double>", &t_cHadronEne9x9);
00977   tree->Branch("t_cHadronEne9x9_1",   "vector<double>", &t_cHadronEne9x9_1);
00978   tree->Branch("t_cHadronEne9x9_2",   "vector<double>", &t_cHadronEne9x9_2);
00979   tree->Branch("t_cHadronEne9x9_3",   "vector<double>", &t_cHadronEne9x9_3);
00980   tree->Branch("t_nHadronEne9x9",     "vector<double>", &t_nHadronEne9x9);
00981   tree->Branch("t_photonEne9x9",      "vector<double>", &t_photonEne9x9);
00982   tree->Branch("t_eleEne9x9",         "vector<double>", &t_eleEne9x9);
00983   tree->Branch("t_muEne9x9",          "vector<double>", &t_muEne9x9);
00984 
00985   tree->Branch("t_maxNearP7x7",       "vector<double>", &t_maxNearP7x7);
00986   tree->Branch("t_cHadronEne7x7",     "vector<double>", &t_cHadronEne7x7);
00987   tree->Branch("t_cHadronEne7x7_1",   "vector<double>", &t_cHadronEne7x7_1);
00988   tree->Branch("t_cHadronEne7x7_2",   "vector<double>", &t_cHadronEne7x7_2);
00989   tree->Branch("t_cHadronEne7x7_3",   "vector<double>", &t_cHadronEne7x7_3);
00990   tree->Branch("t_nHadronEne7x7",     "vector<double>", &t_nHadronEne7x7);
00991   tree->Branch("t_photonEne7x7",      "vector<double>", &t_photonEne7x7);
00992   tree->Branch("t_eleEne7x7",         "vector<double>", &t_eleEne7x7);
00993   tree->Branch("t_muEne7x7",          "vector<double>", &t_muEne7x7);
00994 
00995   tree->Branch("t_maxNearP3x3",       "vector<double>", &t_maxNearP3x3);
00996   tree->Branch("t_cHadronEne3x3",     "vector<double>", &t_cHadronEne3x3);
00997   tree->Branch("t_cHadronEne3x3_1",   "vector<double>", &t_cHadronEne3x3_1);
00998   tree->Branch("t_cHadronEne3x3_2",   "vector<double>", &t_cHadronEne3x3_2);
00999   tree->Branch("t_cHadronEne3x3_3",   "vector<double>", &t_cHadronEne3x3_3);
01000   tree->Branch("t_nHadronEne3x3",     "vector<double>", &t_nHadronEne3x3);
01001   tree->Branch("t_photonEne3x3",      "vector<double>", &t_photonEne3x3);
01002   tree->Branch("t_eleEne3x3",         "vector<double>", &t_eleEne3x3);
01003   tree->Branch("t_muEne3x3",          "vector<double>", &t_muEne3x3);
01004 
01005   tree->Branch("t_maxNearP1x1",       "vector<double>", &t_maxNearP1x1);
01006   tree->Branch("t_cHadronEne1x1",     "vector<double>", &t_cHadronEne1x1);
01007   tree->Branch("t_cHadronEne1x1_1",   "vector<double>", &t_cHadronEne1x1_1);
01008   tree->Branch("t_cHadronEne1x1_2",   "vector<double>", &t_cHadronEne1x1_2);
01009   tree->Branch("t_cHadronEne1x1_3",   "vector<double>", &t_cHadronEne1x1_3);
01010   tree->Branch("t_nHadronEne1x1",     "vector<double>", &t_nHadronEne1x1);
01011   tree->Branch("t_photonEne1x1",      "vector<double>", &t_photonEne1x1);
01012   tree->Branch("t_eleEne1x1",         "vector<double>", &t_eleEne1x1);
01013   tree->Branch("t_muEne1x1",          "vector<double>", &t_muEne1x1);
01014 
01015   tree->Branch("t_maxNearPHC1x1",       "vector<double>", &t_maxNearPHC1x1);
01016   tree->Branch("t_cHadronEneHC1x1",     "vector<double>", &t_cHadronEneHC1x1);
01017   tree->Branch("t_cHadronEneHC1x1_1",   "vector<double>", &t_cHadronEneHC1x1_1);
01018   tree->Branch("t_cHadronEneHC1x1_2",   "vector<double>", &t_cHadronEneHC1x1_2);
01019   tree->Branch("t_cHadronEneHC1x1_3",   "vector<double>", &t_cHadronEneHC1x1_3);
01020   tree->Branch("t_nHadronEneHC1x1",     "vector<double>", &t_nHadronEneHC1x1);
01021   tree->Branch("t_photonEneHC1x1",      "vector<double>", &t_photonEneHC1x1);
01022   tree->Branch("t_eleEneHC1x1",         "vector<double>", &t_eleEneHC1x1);
01023   tree->Branch("t_muEneHC1x1",          "vector<double>", &t_muEneHC1x1);
01024 
01025   tree->Branch("t_maxNearPHC3x3",       "vector<double>", &t_maxNearPHC3x3);
01026   tree->Branch("t_cHadronEneHC3x3",     "vector<double>", &t_cHadronEneHC3x3);
01027   tree->Branch("t_cHadronEneHC3x3_1",   "vector<double>", &t_cHadronEneHC3x3_1);
01028   tree->Branch("t_cHadronEneHC3x3_2",   "vector<double>", &t_cHadronEneHC3x3_2);
01029   tree->Branch("t_cHadronEneHC3x3_3",   "vector<double>", &t_cHadronEneHC3x3_3);
01030   tree->Branch("t_nHadronEneHC3x3",     "vector<double>", &t_nHadronEneHC3x3);
01031   tree->Branch("t_photonEneHC3x3",      "vector<double>", &t_photonEneHC3x3);
01032   tree->Branch("t_eleEneHC3x3",         "vector<double>", &t_eleEneHC3x3);
01033   tree->Branch("t_muEneHC3x3",          "vector<double>", &t_muEneHC3x3);
01034 
01035   tree->Branch("t_maxNearPHC5x5",       "vector<double>", &t_maxNearPHC5x5);
01036   tree->Branch("t_cHadronEneHC5x5",     "vector<double>", &t_cHadronEneHC5x5);
01037   tree->Branch("t_cHadronEneHC5x5_1",   "vector<double>", &t_cHadronEneHC5x5_1);
01038   tree->Branch("t_cHadronEneHC5x5_2",   "vector<double>", &t_cHadronEneHC5x5_2);
01039   tree->Branch("t_cHadronEneHC5x5_3",   "vector<double>", &t_cHadronEneHC5x5_3);
01040   tree->Branch("t_nHadronEneHC5x5",     "vector<double>", &t_nHadronEneHC5x5);
01041   tree->Branch("t_photonEneHC5x5",      "vector<double>", &t_photonEneHC5x5);
01042   tree->Branch("t_eleEneHC5x5",         "vector<double>", &t_eleEneHC5x5);
01043   tree->Branch("t_muEneHC5x5",          "vector<double>", &t_muEneHC5x5);
01044 
01045   tree->Branch("t_maxNearPHC7x7",       "vector<double>", &t_maxNearPHC7x7);
01046   tree->Branch("t_cHadronEneHC7x7",     "vector<double>", &t_cHadronEneHC7x7);
01047   tree->Branch("t_cHadronEneHC7x7_1",   "vector<double>", &t_cHadronEneHC7x7_1);
01048   tree->Branch("t_cHadronEneHC7x7_2",   "vector<double>", &t_cHadronEneHC7x7_2);
01049   tree->Branch("t_cHadronEneHC7x7_3",   "vector<double>", &t_cHadronEneHC7x7_3);
01050   tree->Branch("t_nHadronEneHC7x7",     "vector<double>", &t_nHadronEneHC7x7);
01051   tree->Branch("t_photonEneHC7x7",      "vector<double>", &t_photonEneHC7x7);
01052   tree->Branch("t_eleEneHC7x7",         "vector<double>", &t_eleEneHC7x7);
01053   tree->Branch("t_muEneHC7x7",          "vector<double>", &t_muEneHC7x7);
01054 
01055   tree->Branch("t_maxNearPR",       "vector<double>", &t_maxNearPR);
01056   tree->Branch("t_cHadronEneR",     "vector<double>", &t_cHadronEneR);
01057   tree->Branch("t_cHadronEneR_1",   "vector<double>", &t_cHadronEneR_1);
01058   tree->Branch("t_cHadronEneR_2",   "vector<double>", &t_cHadronEneR_2);
01059   tree->Branch("t_cHadronEneR_3",   "vector<double>", &t_cHadronEneR_3);
01060   tree->Branch("t_nHadronEneR",     "vector<double>", &t_nHadronEneR);
01061   tree->Branch("t_photonEneR",      "vector<double>", &t_photonEneR);
01062   tree->Branch("t_eleEneR",         "vector<double>", &t_eleEneR);
01063   tree->Branch("t_muEneR",          "vector<double>", &t_muEneR);
01064 
01065   tree->Branch("t_maxNearPIsoR",       "vector<double>", &t_maxNearPIsoR);
01066   tree->Branch("t_cHadronEneIsoR",     "vector<double>", &t_cHadronEneIsoR);
01067   tree->Branch("t_cHadronEneIsoR_1",   "vector<double>", &t_cHadronEneIsoR_1);
01068   tree->Branch("t_cHadronEneIsoR_2",   "vector<double>", &t_cHadronEneIsoR_2);
01069   tree->Branch("t_cHadronEneIsoR_3",   "vector<double>", &t_cHadronEneIsoR_3);
01070   tree->Branch("t_nHadronEneIsoR",     "vector<double>", &t_nHadronEneIsoR);
01071   tree->Branch("t_photonEneIsoR",      "vector<double>", &t_photonEneIsoR);
01072   tree->Branch("t_eleEneIsoR",         "vector<double>", &t_eleEneIsoR);
01073   tree->Branch("t_muEneIsoR",          "vector<double>", &t_muEneIsoR);
01074 
01075   tree->Branch("t_maxNearPHCR",       "vector<double>", &t_maxNearPHCR);
01076   tree->Branch("t_cHadronEneHCR",     "vector<double>", &t_cHadronEneHCR);
01077   tree->Branch("t_cHadronEneHCR_1",   "vector<double>", &t_cHadronEneHCR_1);
01078   tree->Branch("t_cHadronEneHCR_2",   "vector<double>", &t_cHadronEneHCR_2);
01079   tree->Branch("t_cHadronEneHCR_3",   "vector<double>", &t_cHadronEneHCR_3);
01080   tree->Branch("t_nHadronEneHCR",     "vector<double>", &t_nHadronEneHCR);
01081   tree->Branch("t_photonEneHCR",      "vector<double>", &t_photonEneHCR);
01082   tree->Branch("t_eleEneHCR",         "vector<double>", &t_eleEneHCR);
01083   tree->Branch("t_muEneHCR",          "vector<double>", &t_muEneHCR);
01084 
01085   tree->Branch("t_maxNearPIsoHCR",       "vector<double>", &t_maxNearPIsoHCR);
01086   tree->Branch("t_cHadronEneIsoHCR",     "vector<double>", &t_cHadronEneIsoHCR);
01087   tree->Branch("t_cHadronEneIsoHCR_1",   "vector<double>", &t_cHadronEneIsoHCR_1);
01088   tree->Branch("t_cHadronEneIsoHCR_2",   "vector<double>", &t_cHadronEneIsoHCR_2);
01089   tree->Branch("t_cHadronEneIsoHCR_3",   "vector<double>", &t_cHadronEneIsoHCR_3);
01090   tree->Branch("t_nHadronEneIsoHCR",     "vector<double>", &t_nHadronEneIsoHCR);
01091   tree->Branch("t_photonEneIsoHCR",      "vector<double>", &t_photonEneIsoHCR);
01092   tree->Branch("t_eleEneIsoHCR",         "vector<double>", &t_eleEneIsoHCR);
01093   tree->Branch("t_muEneIsoHCR",          "vector<double>", &t_muEneIsoHCR);
01094 
01095   tree->Branch("t_L1Decision",        "vector<int>",    &t_L1Decision);
01096   tree->Branch("t_L1CenJetPt",        "vector<double>", &t_L1CenJetPt);
01097   tree->Branch("t_L1CenJetEta",       "vector<double>", &t_L1CenJetEta);
01098   tree->Branch("t_L1CenJetPhi",       "vector<double>", &t_L1CenJetPhi);
01099   tree->Branch("t_L1FwdJetPt",        "vector<double>", &t_L1FwdJetPt);
01100   tree->Branch("t_L1FwdJetEta",       "vector<double>", &t_L1FwdJetEta);
01101   tree->Branch("t_L1FwdJetPhi",       "vector<double>", &t_L1FwdJetPhi);
01102   tree->Branch("t_L1TauJetPt",        "vector<double>", &t_L1TauJetPt);
01103   tree->Branch("t_L1TauJetEta",       "vector<double>", &t_L1TauJetEta);     
01104   tree->Branch("t_L1TauJetPhi",       "vector<double>", &t_L1TauJetPhi);
01105   tree->Branch("t_L1MuonPt",          "vector<double>", &t_L1MuonPt);
01106   tree->Branch("t_L1MuonEta",         "vector<double>", &t_L1MuonEta);
01107   tree->Branch("t_L1MuonPhi",         "vector<double>", &t_L1MuonPhi);
01108   tree->Branch("t_L1IsoEMPt",         "vector<double>", &t_L1IsoEMPt);
01109   tree->Branch("t_L1IsoEMEta",        "vector<double>", &t_L1IsoEMEta);
01110   tree->Branch("t_L1IsoEMPhi",        "vector<double>", &t_L1IsoEMPhi);
01111   tree->Branch("t_L1NonIsoEMPt",      "vector<double>", &t_L1NonIsoEMPt);
01112   tree->Branch("t_L1NonIsoEMEta",     "vector<double>", &t_L1NonIsoEMEta);
01113   tree->Branch("t_L1NonIsoEMPhi",     "vector<double>", &t_L1NonIsoEMPhi);
01114   tree->Branch("t_L1METPt",           "vector<double>", &t_L1METPt);
01115   tree->Branch("t_L1METEta",          "vector<double>", &t_L1METEta);
01116   tree->Branch("t_L1METPhi",          "vector<double>", &t_L1METPhi);
01117 }
01118 
01119 
01120 void IsolatedGenParticles::clearTreeVectors() {
01121   //  t_maxNearP31x31->clear();
01122   
01123   //t_nEvtProc          ->clear();
01124 
01125   t_isoTrkPAll        ->clear();
01126   t_isoTrkPtAll       ->clear();
01127   t_isoTrkPhiAll      ->clear();
01128   t_isoTrkEtaAll      ->clear();
01129   t_isoTrkDPhiAll     ->clear();
01130   t_isoTrkDEtaAll     ->clear();
01131   t_isoTrkPdgIdAll    ->clear();
01132 
01133   t_isoTrkP           ->clear();
01134   t_isoTrkPt          ->clear();
01135   t_isoTrkEne         ->clear();
01136   t_isoTrkEta         ->clear();
01137   t_isoTrkPhi         ->clear();
01138   t_isoTrkEtaEC       ->clear();
01139   t_isoTrkPhiEC       ->clear();
01140   t_isoTrkPdgId       ->clear();
01141 
01142   t_maxNearP31x31     ->clear();
01143   t_cHadronEne31x31   ->clear();
01144   t_cHadronEne31x31_1 ->clear();
01145   t_cHadronEne31x31_2 ->clear();
01146   t_cHadronEne31x31_3 ->clear();
01147   t_nHadronEne31x31   ->clear();
01148   t_photonEne31x31    ->clear();
01149   t_eleEne31x31       ->clear();
01150   t_muEne31x31        ->clear();
01151 
01152   t_maxNearP25x25     ->clear();
01153   t_cHadronEne25x25   ->clear();
01154   t_cHadronEne25x25_1 ->clear();
01155   t_cHadronEne25x25_2 ->clear();
01156   t_cHadronEne25x25_3 ->clear();
01157   t_nHadronEne25x25   ->clear();
01158   t_photonEne25x25    ->clear();
01159   t_eleEne25x25       ->clear();
01160   t_muEne25x25        ->clear();
01161 
01162   t_maxNearP21x21     ->clear();
01163   t_cHadronEne21x21   ->clear();
01164   t_cHadronEne21x21_1 ->clear();
01165   t_cHadronEne21x21_2 ->clear();
01166   t_cHadronEne21x21_3 ->clear();
01167   t_nHadronEne21x21   ->clear();
01168   t_photonEne21x21    ->clear();
01169   t_eleEne21x21       ->clear();
01170   t_muEne21x21        ->clear();
01171 
01172   t_maxNearP15x15     ->clear();
01173   t_cHadronEne15x15   ->clear();
01174   t_cHadronEne15x15_1 ->clear();
01175   t_cHadronEne15x15_2 ->clear();
01176   t_cHadronEne15x15_3 ->clear();
01177   t_nHadronEne15x15   ->clear();
01178   t_photonEne15x15    ->clear();
01179   t_eleEne15x15       ->clear();
01180   t_muEne15x15        ->clear();
01181 
01182   t_maxNearP11x11     ->clear();
01183   t_cHadronEne11x11   ->clear();
01184   t_cHadronEne11x11_1 ->clear();
01185   t_cHadronEne11x11_2 ->clear();
01186   t_cHadronEne11x11_3 ->clear();
01187   t_nHadronEne11x11   ->clear();
01188   t_photonEne11x11    ->clear();
01189   t_eleEne11x11       ->clear();
01190   t_muEne11x11        ->clear();
01191 
01192   t_maxNearP9x9       ->clear();
01193   t_cHadronEne9x9     ->clear();
01194   t_cHadronEne9x9_1   ->clear();
01195   t_cHadronEne9x9_2   ->clear();
01196   t_cHadronEne9x9_3   ->clear();
01197   t_nHadronEne9x9     ->clear();
01198   t_photonEne9x9      ->clear();
01199   t_eleEne9x9         ->clear();
01200   t_muEne9x9          ->clear();
01201 
01202   t_maxNearP7x7       ->clear();
01203   t_cHadronEne7x7     ->clear();
01204   t_cHadronEne7x7_1   ->clear();
01205   t_cHadronEne7x7_2   ->clear();
01206   t_cHadronEne7x7_3   ->clear();
01207   t_nHadronEne7x7     ->clear();
01208   t_photonEne7x7      ->clear();
01209   t_eleEne7x7         ->clear();
01210   t_muEne7x7          ->clear();
01211 
01212   t_maxNearP3x3       ->clear();
01213   t_cHadronEne3x3     ->clear();
01214   t_cHadronEne3x3_1   ->clear();
01215   t_cHadronEne3x3_2   ->clear();
01216   t_cHadronEne3x3_3   ->clear();
01217   t_nHadronEne3x3     ->clear();
01218   t_photonEne3x3      ->clear();
01219   t_eleEne3x3         ->clear();
01220   t_muEne3x3          ->clear();
01221 
01222   t_maxNearP1x1       ->clear();
01223   t_cHadronEne1x1     ->clear();
01224   t_cHadronEne1x1_1   ->clear();
01225   t_cHadronEne1x1_2   ->clear();
01226   t_cHadronEne1x1_3   ->clear();
01227   t_nHadronEne1x1     ->clear();
01228   t_photonEne1x1      ->clear();
01229   t_eleEne1x1         ->clear();
01230   t_muEne1x1          ->clear();
01231 
01232   t_maxNearPHC1x1       ->clear();
01233   t_cHadronEneHC1x1     ->clear();
01234   t_cHadronEneHC1x1_1   ->clear();
01235   t_cHadronEneHC1x1_2   ->clear();
01236   t_cHadronEneHC1x1_3   ->clear();
01237   t_nHadronEneHC1x1     ->clear();
01238   t_photonEneHC1x1      ->clear();
01239   t_eleEneHC1x1         ->clear();
01240   t_muEneHC1x1          ->clear();
01241 
01242   t_maxNearPHC3x3       ->clear();
01243   t_cHadronEneHC3x3     ->clear();
01244   t_cHadronEneHC3x3_1   ->clear();
01245   t_cHadronEneHC3x3_2   ->clear();
01246   t_cHadronEneHC3x3_3   ->clear();
01247   t_nHadronEneHC3x3     ->clear();
01248   t_photonEneHC3x3      ->clear();
01249   t_eleEneHC3x3         ->clear();
01250   t_muEneHC3x3          ->clear();
01251 
01252   t_maxNearPHC5x5       ->clear();
01253   t_cHadronEneHC5x5     ->clear();
01254   t_cHadronEneHC5x5_1   ->clear();
01255   t_cHadronEneHC5x5_2   ->clear();
01256   t_cHadronEneHC5x5_3   ->clear();
01257   t_nHadronEneHC5x5     ->clear();
01258   t_photonEneHC5x5      ->clear();
01259   t_eleEneHC5x5         ->clear();
01260   t_muEneHC5x5          ->clear();
01261 
01262   t_maxNearPHC7x7       ->clear();
01263   t_cHadronEneHC7x7     ->clear();
01264   t_cHadronEneHC7x7_1   ->clear();
01265   t_cHadronEneHC7x7_2   ->clear();
01266   t_cHadronEneHC7x7_3   ->clear();
01267   t_nHadronEneHC7x7     ->clear();
01268   t_photonEneHC7x7      ->clear();
01269   t_eleEneHC7x7         ->clear();
01270   t_muEneHC7x7          ->clear();
01271 
01272   t_maxNearPR           ->clear();
01273   t_cHadronEneR         ->clear();
01274   t_cHadronEneR_1       ->clear();
01275   t_cHadronEneR_2       ->clear();
01276   t_cHadronEneR_3       ->clear();
01277   t_nHadronEneR         ->clear();
01278   t_photonEneR          ->clear();
01279   t_eleEneR             ->clear();
01280   t_muEneR              ->clear();
01281 
01282   t_maxNearPIsoR        ->clear();
01283   t_cHadronEneIsoR      ->clear();
01284   t_cHadronEneIsoR_1    ->clear();
01285   t_cHadronEneIsoR_2    ->clear();
01286   t_cHadronEneIsoR_3    ->clear();
01287   t_nHadronEneIsoR      ->clear();
01288   t_photonEneIsoR       ->clear();
01289   t_eleEneIsoR          ->clear();
01290   t_muEneIsoR           ->clear();
01291 
01292   t_maxNearPHCR         ->clear();
01293   t_cHadronEneHCR       ->clear();
01294   t_cHadronEneHCR_1     ->clear();
01295   t_cHadronEneHCR_2     ->clear();
01296   t_cHadronEneHCR_3     ->clear();
01297   t_nHadronEneHCR       ->clear();
01298   t_photonEneHCR        ->clear();
01299   t_eleEneHCR           ->clear();
01300   t_muEneHCR            ->clear();
01301 
01302   t_maxNearPIsoHCR      ->clear();
01303   t_cHadronEneIsoHCR    ->clear();
01304   t_cHadronEneIsoHCR_1  ->clear();
01305   t_cHadronEneIsoHCR_2  ->clear();
01306   t_cHadronEneIsoHCR_3  ->clear();
01307   t_nHadronEneIsoHCR    ->clear();
01308   t_photonEneIsoHCR     ->clear();
01309   t_eleEneIsoHCR        ->clear();
01310   t_muEneIsoHCR         ->clear();
01311 
01312   t_L1Decision        ->clear();
01313   t_L1CenJetPt        ->clear();
01314   t_L1CenJetEta       ->clear();    
01315   t_L1CenJetPhi       ->clear();
01316   t_L1FwdJetPt        ->clear();
01317   t_L1FwdJetEta       ->clear();
01318   t_L1FwdJetPhi       ->clear();
01319   t_L1TauJetPt        ->clear();
01320   t_L1TauJetEta       ->clear();     
01321   t_L1TauJetPhi       ->clear();
01322   t_L1MuonPt          ->clear();
01323   t_L1MuonEta         ->clear();     
01324   t_L1MuonPhi         ->clear();
01325   t_L1IsoEMPt         ->clear();
01326   t_L1IsoEMEta        ->clear();
01327   t_L1IsoEMPhi        ->clear();
01328   t_L1NonIsoEMPt      ->clear();
01329   t_L1NonIsoEMEta     ->clear();
01330   t_L1NonIsoEMPhi     ->clear();
01331   t_L1METPt           ->clear();
01332   t_L1METEta          ->clear();
01333   t_L1METPhi          ->clear();
01334 }
01335 
01336 int IsolatedGenParticles::particleCode(int pdgId) {
01337  
01338  int partID[Particles]={11,-11,21,211,-211,321,-321,2212,2112,-2212,-2112,130};
01339   int ix = -1;
01340   for (int ik=0; ik<Particles; ++ik) {
01341     if (pdgId == partID[ik]) {
01342       ix = ik; break;
01343     }
01344   }
01345   return ix;
01346 }
01347 
01348 //define this as a plug-in
01349 DEFINE_FWK_MODULE(IsolatedGenParticles);