CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/Calibration/IsolatedParticles/plugins/IsolatedTracksHcalScale.cc

Go to the documentation of this file.
00001 
00002 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00003 #include "DataFormats/TrackReco/interface/TrackBase.h"
00004 #include "Calibration/IsolatedParticles/plugins/IsolatedTracksHcalScale.h"
00005 
00006 #include "Calibration/IsolatedParticles/interface/CaloPropagateTrack.h"
00007 #include "Calibration/IsolatedParticles/interface/ChargeIsolation.h"
00008 #include "Calibration/IsolatedParticles/interface/eCone.h"
00009 #include "Calibration/IsolatedParticles/interface/eHCALMatrixExtra.h"
00010 #include "MagneticField/Engine/interface/MagneticField.h"
00011 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00012 #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
00013 #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h"
00014 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
00015 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h"
00016 
00017 IsolatedTracksHcalScale::IsolatedTracksHcalScale(const edm::ParameterSet& iConfig) {
00018 
00019   //now do what ever initialization is needed
00020   doMC                                = iConfig.getUntrackedParameter<bool>("DoMC", false); 
00021   myverbose                           = iConfig.getUntrackedParameter<int>("Verbosity", 5          );
00022   theTrackQuality                     = iConfig.getUntrackedParameter<std::string>("TrackQuality","highPurity");
00023   reco::TrackBase::TrackQuality trackQuality_=reco::TrackBase::qualityByName(theTrackQuality);
00024   selectionParameters.minPt           = iConfig.getUntrackedParameter<double>("MinTrackPt", 10.0);
00025   selectionParameters.minQuality      = trackQuality_;
00026   selectionParameters.maxDxyPV        = iConfig.getUntrackedParameter<double>("MaxDxyPV", 0.2);
00027   selectionParameters.maxDzPV         = iConfig.getUntrackedParameter<double>("MaxDzPV",  5.0);
00028   selectionParameters.maxChi2         = iConfig.getUntrackedParameter<double>("MaxChi2",  5.0);
00029   selectionParameters.maxDpOverP      = iConfig.getUntrackedParameter<double>("MaxDpOverP",  0.1);
00030   selectionParameters.minOuterHit     = iConfig.getUntrackedParameter<int>("MinOuterHit", 4);
00031   selectionParameters.minLayerCrossed = iConfig.getUntrackedParameter<int>("MinLayerCrossed", 8);
00032   selectionParameters.maxInMiss       = iConfig.getUntrackedParameter<int>("MaxInMiss", 0);
00033   selectionParameters.maxOutMiss      = iConfig.getUntrackedParameter<int>("MaxOutMiss", 0);
00034   a_coneR                             = iConfig.getUntrackedParameter<double>("ConeRadius",34.98);
00035   a_charIsoR                          = a_coneR + 28.9;
00036   a_neutIsoR                          = a_charIsoR*0.726;
00037   a_mipR                              = iConfig.getUntrackedParameter<double>("ConeRadiusMIP",14.0);
00038   tMinE_                              = iConfig.getUntrackedParameter<double>("TimeMinCutECAL", -500.);
00039   tMaxE_                              = iConfig.getUntrackedParameter<double>("TimeMaxCutECAL",  500.);
00040   
00041   if (myverbose>=0) {
00042     std::cout <<"Parameters read from config file \n" 
00043               <<" doMC "              << doMC
00044               <<"\t myverbose "       << myverbose        
00045               <<"\t minPt "           << selectionParameters.minPt   
00046               <<"\t theTrackQuality " << theTrackQuality
00047               <<"\t minQuality "      << selectionParameters.minQuality
00048               <<"\t maxDxyPV "        << selectionParameters.maxDxyPV          
00049               <<"\t maxDzPV "         << selectionParameters.maxDzPV          
00050               <<"\t maxChi2 "         << selectionParameters.maxChi2          
00051               <<"\t maxDpOverP "      << selectionParameters.maxDpOverP
00052               <<"\t minOuterHit "     << selectionParameters.minOuterHit
00053               <<"\t minLayerCrossed " << selectionParameters.minLayerCrossed
00054               <<"\t maxInMiss "       << selectionParameters.maxInMiss
00055               <<"\t maxOutMiss "      << selectionParameters.maxOutMiss
00056               <<"\t a_coneR "         << a_coneR          
00057               <<"\t a_charIsoR "      << a_charIsoR          
00058               <<"\t a_neutIsoR "      << a_neutIsoR          
00059               <<"\t a_mipR "          << a_mipR 
00060               <<"\t time Range ("     << tMinE_ << ":" << tMaxE_ << ")"
00061               << std::endl;
00062   }
00063   initL1 = false;
00064   
00065 }
00066 
00067 IsolatedTracksHcalScale::~IsolatedTracksHcalScale() {}
00068 
00069 void IsolatedTracksHcalScale::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
00070 
00071   edm::ESHandle<MagneticField> bFieldH;
00072   iSetup.get<IdealMagneticFieldRecord>().get(bFieldH);
00073   bField = bFieldH.product();
00074 
00075   // get handles to calogeometry and calotopology
00076   edm::ESHandle<CaloGeometry> pG;
00077   iSetup.get<CaloGeometryRecord>().get(pG);
00078   const CaloGeometry* geo = pG.product();
00079 
00080   edm::ESHandle<CaloTopology> theCaloTopology;
00081   iSetup.get<CaloTopologyRecord>().get(theCaloTopology); 
00082   const CaloTopology *caloTopology = theCaloTopology.product();
00083   
00084   /*  
00085   edm::ESHandle<HcalTopology> htopo;
00086   iSetup.get<IdealGeometryRecord>().get(htopo);
00087   const HcalTopology* theHBHETopology = htopo.product();
00088   */
00089 
00090   // Retrieve the good/bad ECAL channels from the DB
00091   edm::ESHandle<EcalChannelStatus> ecalChStatus;
00092   iSetup.get<EcalChannelStatusRcd>().get(ecalChStatus);
00093   const EcalChannelStatus* theEcalChStatus = ecalChStatus.product();
00094 
00095   /*  
00096   // Retrieve trigger tower map
00097   edm::ESHandle<EcalTrigTowerConstituentsMap> hTtmap;
00098   iSetup.get<IdealGeometryRecord>().get(hTtmap);
00099   const EcalTrigTowerConstituentsMap& ttMap = *hTtmap;
00100   */
00101 
00102   clearTreeVectors();
00103 
00104   nEventProc++;
00105 
00106   t_RunNo = iEvent.id().run();
00107   t_EvtNo = iEvent.id().event();
00108   t_Lumi  = iEvent.luminosityBlock();
00109   t_Bunch = iEvent.bunchCrossing();
00110   if (myverbose>0) std::cout << nEventProc << " Run " << t_RunNo << " Event " << t_EvtNo << " Lumi " << t_Lumi << " Bunch " << t_Bunch << std::endl;
00111 
00112   edm::Handle<reco::TrackCollection> trkCollection;
00113   iEvent.getByLabel("generalTracks", trkCollection);
00114 
00115   edm::Handle<reco::VertexCollection> recVtxs;
00116   iEvent.getByLabel("offlinePrimaryVertices",recVtxs);  
00117 
00118   // Get the beamspot
00119   edm::Handle<reco::BeamSpot> beamSpotH;
00120   iEvent.getByLabel("offlineBeamSpot", beamSpotH);
00121 
00122   math::XYZPoint leadPV(0,0,0);
00123   if (recVtxs->size()>0 && !((*recVtxs)[0].isFake())) {
00124     leadPV = math::XYZPoint( (*recVtxs)[0].x(),(*recVtxs)[0].y(), (*recVtxs)[0].z() );
00125   } else if (beamSpotH.isValid()) {
00126     leadPV = beamSpotH->position();
00127   }
00128 
00129   if (myverbose>0) {
00130     std::cout << "Primary Vertex " << leadPV;
00131     if (beamSpotH.isValid()) std::cout << " Beam Spot " << beamSpotH->position();
00132     std::cout << std::endl;
00133   }
00134 
00135   std::vector<spr::propagatedTrackDirection> trkCaloDirections;
00136   spr::propagateCALO(trkCollection, geo, bField, theTrackQuality, trkCaloDirections, (myverbose>2));
00137   std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
00138   
00139   edm::Handle<EcalRecHitCollection> barrelRecHitsHandle;
00140   edm::Handle<EcalRecHitCollection> endcapRecHitsHandle;
00141   iEvent.getByLabel("ecalRecHit","EcalRecHitsEB",barrelRecHitsHandle);
00142   iEvent.getByLabel("ecalRecHit","EcalRecHitsEE",endcapRecHitsHandle);
00143 
00144   edm::Handle<HBHERecHitCollection> hbhe;
00145   iEvent.getByLabel("hbhereco",hbhe);
00146   const HBHERecHitCollection Hithbhe = *(hbhe.product());
00147 
00148   //get Handles to SimTracks and SimHits
00149   edm::Handle<edm::SimTrackContainer> SimTk;
00150   edm::SimTrackContainer::const_iterator simTrkItr;
00151   edm::Handle<edm::SimVertexContainer> SimVtx;
00152   edm::SimVertexContainer::const_iterator vtxItr = SimVtx->begin();
00153 
00154   //get Handles to PCaloHitContainers of eb/ee/hbhe
00155   edm::Handle<edm::PCaloHitContainer> pcaloeb;
00156   edm::Handle<edm::PCaloHitContainer> pcaloee;
00157   edm::Handle<edm::PCaloHitContainer> pcalohh;
00158 
00159   //associates tracker rechits/simhits to a track
00160   TrackerHitAssociator* associate=0;
00161  
00162   if (doMC) {
00163     iEvent.getByLabel("g4SimHits",SimTk);
00164     iEvent.getByLabel("g4SimHits",SimVtx);
00165     iEvent.getByLabel("g4SimHits", "EcalHitsEB", pcaloeb);
00166     iEvent.getByLabel("g4SimHits", "EcalHitsEE", pcaloee);
00167     iEvent.getByLabel("g4SimHits", "HcalHits", pcalohh);
00168     associate = new TrackerHitAssociator(iEvent);
00169   }
00170  
00171   unsigned int nTracks=0;
00172   for (trkDetItr = trkCaloDirections.begin(),nTracks=0; trkDetItr != trkCaloDirections.end(); trkDetItr++,nTracks++){
00173     const reco::Track* pTrack = &(*(trkDetItr->trkItr));
00174     if (spr::goodTrack(pTrack,leadPV,selectionParameters,(myverbose>2)) && trkDetItr->okECAL && trkDetItr->okHCAL) {
00175       int                nRH_eMipDR=0, nRH_eDR=0, nNearTRKs=0, nRecHitsCone=-99;
00176       double             distFromHotCell=-99.0, distFromHotCell2=-99.0;
00177       int                ietaHotCell=-99, iphiHotCell=-99;
00178       int                ietaHotCell2=-99, iphiHotCell2=-99;
00179       GlobalPoint        gposHotCell(0.,0.,0.), gposHotCell2(0.,0.,0.);
00180       std::vector<DetId> coneRecHitDetIds, coneRecHitDetIds2;
00181       std::pair<double, bool> e11x11_20SigP, e15x15_20SigP;
00182       double hCone = spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL, 
00183                                      trkDetItr->pointECAL,
00184                                      a_coneR, trkDetItr->directionHCAL, 
00185                                      nRecHitsCone, coneRecHitDetIds,
00186                                      distFromHotCell, ietaHotCell, iphiHotCell,
00187                                      gposHotCell, -1);
00188       double hConeHB = spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL, 
00189                                        trkDetItr->pointECAL,
00190                                        a_coneR, trkDetItr->directionHCAL, 
00191                                        nRecHitsCone, coneRecHitDetIds,
00192                                        distFromHotCell, ietaHotCell,
00193                                        iphiHotCell, gposHotCell,
00194                                        (int)(HcalBarrel));
00195       double eHCALDR = spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL, 
00196                                        trkDetItr->pointECAL, a_charIsoR, 
00197                                        trkDetItr->directionHCAL, nRecHitsCone,
00198                                        coneRecHitDetIds2, distFromHotCell2,
00199                                        ietaHotCell2, iphiHotCell2, gposHotCell2,
00200                                        -1);
00201       double eHCALDRHB = spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL, 
00202                                          trkDetItr->pointECAL, a_charIsoR, 
00203                                          trkDetItr->directionHCAL, nRecHitsCone,
00204                                          coneRecHitDetIds2, distFromHotCell2,
00205                                          ietaHotCell2, iphiHotCell2,
00206                                          gposHotCell2, (int)(HcalBarrel));
00207 
00208       double conehmaxNearP = spr::chargeIsolationCone(nTracks, trkCaloDirections, a_charIsoR, nNearTRKs, (myverbose>3));
00209 
00210       double eMipDR  = spr::eCone_ecal(geo, barrelRecHitsHandle, 
00211                                        endcapRecHitsHandle,trkDetItr->pointHCAL,
00212                                        trkDetItr->pointECAL, a_mipR, 
00213                                        trkDetItr->directionECAL, nRH_eMipDR);
00214       double eECALDR = spr::eCone_ecal(geo, barrelRecHitsHandle,  
00215                                        endcapRecHitsHandle,trkDetItr->pointHCAL,
00216                                        trkDetItr->pointECAL, a_neutIsoR, 
00217                                        trkDetItr->directionECAL, nRH_eDR);
00218       double eMipDR_1= spr::eCone_ecal(geo, barrelRecHitsHandle, 
00219                                        endcapRecHitsHandle,trkDetItr->pointHCAL,
00220                                        trkDetItr->pointECAL, a_mipR, 
00221                                        trkDetItr->directionECAL, nRH_eMipDR,
00222                                        0.030, 0.150);
00223       double eECALDR_1=spr::eCone_ecal(geo, barrelRecHitsHandle,
00224                                        endcapRecHitsHandle,trkDetItr->pointHCAL,
00225                                        trkDetItr->pointECAL, a_neutIsoR,
00226                                        trkDetItr->directionECAL, nRH_eDR,
00227                                        0.030, 0.150);
00228       double eMipDR_2= spr::eCone_ecal(geo, barrelRecHitsHandle,
00229                                        endcapRecHitsHandle,trkDetItr->pointHCAL,
00230                                        trkDetItr->pointECAL, a_mipR,
00231                                        trkDetItr->directionECAL, nRH_eMipDR,
00232                                        0.060, 0.300);
00233       double eECALDR_2=spr::eCone_ecal(geo, barrelRecHitsHandle,
00234                                        endcapRecHitsHandle,trkDetItr->pointHCAL,
00235                                        trkDetItr->pointECAL, a_neutIsoR,
00236                                        trkDetItr->directionECAL, nRH_eDR,
00237                                        0.060, 0.300);
00238 
00239       HcalDetId closestCell = (HcalDetId)(trkDetItr->detIdHCAL);
00240 
00241       edm::ESHandle<EcalSeverityLevelAlgo> sevlv;
00242       iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
00243 
00244       e11x11_20SigP = spr::eECALmatrix(trkDetItr->detIdECAL,barrelRecHitsHandle,endcapRecHitsHandle, *theEcalChStatus, geo, caloTopology,sevlv.product(),5,5,   0.060,  0.300, tMinE_,tMaxE_);
00245       e15x15_20SigP = spr::eECALmatrix(trkDetItr->detIdECAL,barrelRecHitsHandle,endcapRecHitsHandle, *theEcalChStatus, geo, caloTopology,sevlv.product(),7,7,   0.060,  0.300, tMinE_,tMaxE_);
00246       
00247       // Fill the tree Branches here 
00248       t_trackP                ->push_back( pTrack->p() );
00249       t_trackPt               ->push_back( pTrack->pt() );
00250       t_trackEta              ->push_back( pTrack->momentum().eta() );
00251       t_trackPhi              ->push_back( pTrack->momentum().phi() );
00252       t_trackHcalEta          ->push_back( closestCell.ieta() );
00253       t_trackHcalPhi          ->push_back( closestCell.iphi() );
00254       t_hCone                 ->push_back( hCone);
00255       t_conehmaxNearP         ->push_back( conehmaxNearP);
00256       t_eMipDR                ->push_back( eMipDR);
00257       t_eECALDR               ->push_back( eECALDR);
00258       t_eHCALDR               ->push_back( eHCALDR);
00259       t_e11x11_20Sig          ->push_back( e11x11_20SigP.first );
00260       t_e15x15_20Sig          ->push_back( e15x15_20SigP.first );
00261       t_eMipDR_1              ->push_back( eMipDR_1);
00262       t_eECALDR_1             ->push_back( eECALDR_1);
00263       t_eMipDR_2              ->push_back( eMipDR_2);
00264       t_eECALDR_2             ->push_back( eECALDR_2);
00265       t_hConeHB               ->push_back( hConeHB);
00266       t_eHCALDRHB             ->push_back( eHCALDRHB);
00267 
00268       if (myverbose > 0) {
00269         std::cout << "Track p " << pTrack->p() << " pt " << pTrack->pt()
00270                   << " eta " << pTrack->momentum().eta() << " phi "
00271                   << pTrack->momentum().phi() << " ieta/iphi ("
00272                   << closestCell.ieta() << ", " << closestCell.iphi() 
00273                   << ") Energy in cone " << hCone << " Charge Isolation "
00274                   << conehmaxNearP << " eMIP (" << eMipDR << ", "
00275                   << eMipDR_1 << ", " << eMipDR_2 << ")"
00276                   << " Neutral isolation (ECAL) (" << eECALDR-eMipDR << ", "
00277                   << eECALDR_1-eMipDR_1 << ", " << eECALDR_2-eMipDR_2 << ")"
00278                   << " (ECAL NxN) " << e15x15_20SigP.first-e11x11_20SigP.first
00279                   << " (HCAL) " << eHCALDR-hCone << std::endl;
00280       }
00281 
00282       if (doMC) {
00283         int nSimHits = -999;
00284         double hsim;
00285         std::map<std::string, double> hsimInfo;
00286         std::vector<int> multiplicity;
00287         hsim = spr::eCone_hcal(geo, pcalohh, trkDetItr->pointHCAL, 
00288                                trkDetItr->pointECAL, a_coneR, 
00289                                trkDetItr->directionHCAL, nSimHits);
00290         hsimInfo = spr::eHCALSimInfoCone(iEvent, pcalohh, SimTk, SimVtx, 
00291                                          pTrack, *associate, geo, 
00292                                          trkDetItr->pointHCAL, 
00293                                          trkDetItr->pointECAL, a_coneR,
00294                                          trkDetItr->directionHCAL,
00295                                          multiplicity);
00296 
00297         t_hsimInfoMatched   ->push_back(hsimInfo["eMatched"   ]);
00298         t_hsimInfoRest      ->push_back(hsimInfo["eRest"      ]);
00299         t_hsimInfoPhoton    ->push_back(hsimInfo["eGamma"     ]);
00300         t_hsimInfoNeutHad   ->push_back(hsimInfo["eNeutralHad"]);
00301         t_hsimInfoCharHad   ->push_back(hsimInfo["eChargedHad"]);
00302         t_hsimInfoPdgMatched->push_back(hsimInfo["pdgMatched" ]);
00303         t_hsimInfoTotal     ->push_back(hsimInfo["eTotal"     ]);
00304 
00305         t_hsimInfoNMatched  ->push_back(multiplicity.at(0));
00306         t_hsimInfoNTotal    ->push_back(multiplicity.at(1));
00307         t_hsimInfoNNeutHad  ->push_back(multiplicity.at(2));
00308         t_hsimInfoNCharHad  ->push_back(multiplicity.at(3));
00309         t_hsimInfoNPhoton   ->push_back(multiplicity.at(4));
00310         t_hsimInfoNRest     ->push_back(multiplicity.at(5));
00311 
00312         t_hsim              ->push_back(hsim                   );
00313         t_nSimHits          ->push_back(nSimHits               );
00314 
00315         if (myverbose > 0) {
00316           std::cout << "Matched (E) " << hsimInfo["eMatched"] << " (N) "
00317                     << multiplicity.at(0) << " Rest (E) " << hsimInfo["eRest"] 
00318                     << " (N) " << multiplicity.at(1) << " Gamma (E) "
00319                     << hsimInfo["eGamma"] << " (N) "  << multiplicity.at(2) 
00320                     << " Neutral Had (E) " << hsimInfo["eNeutralHad"]  
00321                     << " (N) "  << multiplicity.at(3) << " Charged Had (E) "
00322                     << hsimInfo["eChargedHad"] << " (N) " << multiplicity.at(4)
00323                     << " Total (E) " << hsimInfo["eTotal"] << " (N) "
00324                     << multiplicity.at(5) << " PDG " << hsimInfo["pdgMatched"] 
00325                     << " Total E " << hsim << " NHit " << nSimHits <<std::endl;
00326         }
00327       }
00328     }
00329   }
00330 
00331   //  delete associate;
00332   if (associate) delete associate;
00333   tree->Fill();
00334 }
00335 
00336 void IsolatedTracksHcalScale::beginJob() {
00337 
00338   nEventProc=0;
00339 
00340 
00342   tree = fs->make<TTree>("tree", "tree");
00343   tree->SetAutoSave(10000);
00344 
00345   tree->Branch("t_RunNo"              ,&t_RunNo               ,"t_RunNo/I");
00346   tree->Branch("t_Lumi"               ,&t_Lumi                ,"t_Lumi/I");
00347   tree->Branch("t_Bunch"              ,&t_Bunch               ,"t_Bunch/I");
00348 
00349   t_trackP              = new std::vector<double>();
00350   t_trackPt             = new std::vector<double>();
00351   t_trackEta            = new std::vector<double>();
00352   t_trackPhi            = new std::vector<double>();
00353   t_trackHcalEta        = new std::vector<double>();
00354   t_trackHcalPhi        = new std::vector<double>();
00355   t_hCone               = new std::vector<double>();
00356   t_conehmaxNearP       = new std::vector<double>();
00357   t_eMipDR              = new std::vector<double>();
00358   t_eECALDR             = new std::vector<double>();
00359   t_eHCALDR             = new std::vector<double>();
00360   t_e11x11_20Sig        = new std::vector<double>();
00361   t_e15x15_20Sig        = new std::vector<double>();
00362   t_eMipDR_1            = new std::vector<double>();
00363   t_eECALDR_1           = new std::vector<double>();
00364   t_eMipDR_2            = new std::vector<double>();
00365   t_eECALDR_2           = new std::vector<double>();
00366   t_hConeHB             = new std::vector<double>();
00367   t_eHCALDRHB           = new std::vector<double>();
00368 
00369   tree->Branch("t_trackP",            "vector<double>", &t_trackP           );
00370   tree->Branch("t_trackPt",           "vector<double>", &t_trackPt          );
00371   tree->Branch("t_trackEta",          "vector<double>", &t_trackEta         );
00372   tree->Branch("t_trackPhi",          "vector<double>", &t_trackPhi         );
00373   tree->Branch("t_trackHcalEta",      "vector<double>", &t_trackHcalEta     );
00374   tree->Branch("t_trackHcalPhi",      "vector<double>", &t_trackHcalPhi     );
00375   tree->Branch("t_hCone",             "vector<double>", &t_hCone            );
00376   tree->Branch("t_conehmaxNearP",     "vector<double>", &t_conehmaxNearP    );
00377   tree->Branch("t_eMipDR",            "vector<double>", &t_eMipDR           );
00378   tree->Branch("t_eECALDR",           "vector<double>", &t_eECALDR          );
00379   tree->Branch("t_eHCALDR",           "vector<double>", &t_eHCALDR          );
00380   tree->Branch("t_e11x11_20Sig",      "vector<double>", &t_e11x11_20Sig     );
00381   tree->Branch("t_e15x15_20Sig",      "vector<double>", &t_e15x15_20Sig     );
00382   tree->Branch("t_eMipDR_1",          "vector<double>", &t_eMipDR_1         );
00383   tree->Branch("t_eECALDR_1",         "vector<double>", &t_eECALDR_1        );
00384   tree->Branch("t_eMipDR_2",          "vector<double>", &t_eMipDR_2         );
00385   tree->Branch("t_eECALDR_2",         "vector<double>", &t_eECALDR_2        );
00386   tree->Branch("t_hConeHB",           "vector<double>", &t_hConeHB          );
00387   tree->Branch("t_eHCALDRHB",         "vector<double>", &t_eHCALDRHB        );
00388 
00389   if (doMC) {
00390     t_hsimInfoMatched    = new std::vector<double>();
00391     t_hsimInfoRest       = new std::vector<double>();
00392     t_hsimInfoPhoton     = new std::vector<double>();
00393     t_hsimInfoNeutHad    = new std::vector<double>();
00394     t_hsimInfoCharHad    = new std::vector<double>();
00395     t_hsimInfoPdgMatched = new std::vector<double>();
00396     t_hsimInfoTotal      = new std::vector<double>();
00397     t_hsimInfoNMatched   = new std::vector<int>();
00398     t_hsimInfoNTotal     = new std::vector<int>();
00399     t_hsimInfoNNeutHad   = new std::vector<int>();
00400     t_hsimInfoNCharHad   = new std::vector<int>();
00401     t_hsimInfoNPhoton    = new std::vector<int>();
00402     t_hsimInfoNRest      = new std::vector<int>();
00403     t_hsim               = new std::vector<double>();
00404     t_nSimHits           = new std::vector<int>();
00405 
00406     tree->Branch("t_hsimInfoMatched",    "vector<double>", &t_hsimInfoMatched    );
00407     tree->Branch("t_hsimInfoRest",       "vector<double>", &t_hsimInfoRest    );
00408     tree->Branch("t_hsimInfoPhoton",     "vector<double>", &t_hsimInfoPhoton    );
00409     tree->Branch("t_hsimInfoNeutHad",    "vector<double>", &t_hsimInfoNeutHad    );
00410     tree->Branch("t_hsimInfoCharHad",    "vector<double>", &t_hsimInfoCharHad    );
00411     tree->Branch("t_hsimInfoPdgMatched", "vector<double>", &t_hsimInfoPdgMatched );
00412     tree->Branch("t_hsimInfoTotal",      "vector<double>", &t_hsimInfoTotal    );
00413     tree->Branch("t_hsimInfoNMatched",   "vector<int>",    &t_hsimInfoNMatched    );
00414     tree->Branch("t_hsimInfoNTotal",     "vector<int>",    &t_hsimInfoNTotal    );
00415     tree->Branch("t_hsimInfoNNeutHad",   "vector<int>",    &t_hsimInfoNNeutHad    );
00416     tree->Branch("t_hsimInfoNCharHad",   "vector<int>",    &t_hsimInfoNCharHad    );
00417     tree->Branch("t_hsimInfoNPhoton",    "vector<int>",    &t_hsimInfoNPhoton    );
00418     tree->Branch("t_hsimInfoNRest",      "vector<int>",    &t_hsimInfoNRest    );
00419     tree->Branch("t_hsim",               "vector<double>", &t_hsim    );
00420     tree->Branch("t_nSimHits",           "vector<int>",    &t_nSimHits    );
00421   }
00422 }
00423 
00424 void IsolatedTracksHcalScale::endJob() {
00425 
00426   std::cout << "Number of Events Processed " << nEventProc << std::endl;
00427 }
00428 
00429 void IsolatedTracksHcalScale::clearTreeVectors() {
00430 
00431   t_trackP            ->clear();
00432   t_trackPt           ->clear();
00433   t_trackEta          ->clear();
00434   t_trackPhi          ->clear();
00435   t_trackHcalEta      ->clear();
00436   t_trackHcalPhi      ->clear();
00437   t_hCone             ->clear();
00438   t_conehmaxNearP     ->clear();
00439   t_eMipDR            ->clear();
00440   t_eECALDR           ->clear();
00441   t_eHCALDR           ->clear();
00442   t_e11x11_20Sig      ->clear();
00443   t_e15x15_20Sig      ->clear();
00444   t_eMipDR_1          ->clear();
00445   t_eECALDR_1         ->clear();
00446   t_eMipDR_2          ->clear();
00447   t_eECALDR_2         ->clear();
00448   t_hConeHB           ->clear();
00449   t_eHCALDRHB         ->clear();
00450 
00451   if (doMC) {
00452     t_hsimInfoMatched    ->clear();
00453     t_hsimInfoRest       ->clear();
00454     t_hsimInfoPhoton     ->clear();
00455     t_hsimInfoNeutHad    ->clear();
00456     t_hsimInfoCharHad    ->clear();
00457     t_hsimInfoPdgMatched ->clear();
00458     t_hsimInfoTotal      ->clear();
00459     t_hsimInfoNMatched   ->clear();
00460     t_hsimInfoNTotal     ->clear();
00461     t_hsimInfoNNeutHad   ->clear();
00462     t_hsimInfoNCharHad   ->clear();
00463     t_hsimInfoNPhoton    ->clear();
00464     t_hsimInfoNRest      ->clear();
00465     t_hsim               ->clear();
00466     t_nSimHits           ->clear();
00467   }
00468 }
00469 
00470 
00471 //define this as a plug-in
00472 DEFINE_FWK_MODULE(IsolatedTracksHcalScale);