ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/CmsHi/JetAnalysis/src/RecHitTreeProducer.cc
(Generate patch)

Comparing UserCode/CmsHi/JetAnalysis/src/RecHitTreeProducer.cc (file contents):
Revision 1.7 by yilmaz, Tue Nov 2 12:58:33 2010 UTC vs.
Revision 1.12 by yilmaz, Thu Nov 11 18:37:16 2010 UTC

# Line 68 | Line 68 | using namespace std;
68   #define MAXHITS 1000000
69  
70   struct MyRecHit{
71 <
71 >  int depth[MAXHITS];
72    int n;
73  
74    float e[MAXHITS];
# Line 124 | Line 124 | class RecHitTreeProducer : public edm::E
124     edm::Handle<reco::BasicClusterCollection> bClusters;
125     edm::Handle<CaloTowerCollection> towers;
126  
127
127    typedef vector<EcalRecHit>::const_iterator EcalIterator;
128    
129    edm::Handle<reco::CaloJetCollection> jets;
# Line 140 | Line 139 | class RecHitTreeProducer : public edm::E
139     MyRecHit myTowers;
140     MyBkg bkg;
141  
142 <
142 >  TNtuple* nt;
143    TTree* hbheTree;
144    TTree* hfTree;
145    TTree* ebTree;
# Line 150 | Line 149 | class RecHitTreeProducer : public edm::E
149     TTree* bkgTree;
150  
151    double cone;
152 +  double hfTowerThreshold_;
153 +  double hfLongThreshold_;
154 +  double hfShortThreshold_;
155 +  double hbheThreshold_;
156 +  double ebThreshold_;
157 +  double eeThreshold_;
158  
159     edm::Service<TFileService> fs;
160     const CentralityBins * cbins_;
# Line 173 | Line 178 | class RecHitTreeProducer : public edm::E
178     bool doHcal_;
179  
180     bool doFastJet_;
181 +
182 +  bool doEbyEonly_;
183   };
184  
185   //
# Line 198 | Line 205 | RecHitTreeProducer::RecHitTreeProducer(c
205    HcalRecHitHBHESrc_ = iConfig.getUntrackedParameter<edm::InputTag>("hcalHBHERecHitSrc",edm::InputTag("hbhereco"));
206    BCSrc_ = iConfig.getUntrackedParameter<edm::InputTag>("BasicClusterSrc1",edm::InputTag("ecalRecHit","EcalRecHitsEB","RECO"));
207    TowerSrc_ = iConfig.getUntrackedParameter<edm::InputTag>("towersSrc",edm::InputTag("towerMaker"));
208 <  JetSrc_ = iConfig.getUntrackedParameter<edm::InputTag>("JetSrc",edm::InputTag("iterativeCone5CaloJets"));
208 >  JetSrc_ = iConfig.getUntrackedParameter<edm::InputTag>("JetSrc",edm::InputTag("iterativeConePu5CaloJets"));
209    useJets_ = iConfig.getUntrackedParameter<bool>("useJets",true);
210    doBasicClusters_ = iConfig.getUntrackedParameter<bool>("doBasicClusters",false);
211    doTowers_ = iConfig.getUntrackedParameter<bool>("doTowers",true);
# Line 206 | Line 213 | RecHitTreeProducer::RecHitTreeProducer(c
213    doHcal_ = iConfig.getUntrackedParameter<bool>("doHcal",true);
214    doFastJet_ = iConfig.getUntrackedParameter<bool>("doFastJet",true);
215    FastJetTag_ = iConfig.getUntrackedParameter<edm::InputTag>("FastJetTag",edm::InputTag("kt4CaloJets"));
216 <
216 >  doEbyEonly_ = iConfig.getUntrackedParameter<bool>("doEbyEonly",false);
217 >  hfTowerThreshold_ = iConfig.getUntrackedParameter<double>("HFtowerMin",3.);
218 >  hfLongThreshold_ = iConfig.getUntrackedParameter<double>("HFlongMin",0.5);
219 >  hfShortThreshold_ = iConfig.getUntrackedParameter<double>("HFshortMin",0.85);
220   }
221  
222  
# Line 273 | Line 283 | RecHitTreeProducer::analyze(const edm::E
283        iSetup.get<CaloGeometryRecord>().get(pGeo);
284        geo = pGeo.product();
285     }
286 +
287 +   int nHFlongPlus = 0;
288 +   int nHFshortPlus = 0;
289 +   int nHFtowerPlus = 0;
290 +   int nHFlongMinus = 0;
291 +   int nHFshortMinus = 0;
292 +   int nHFtowerMinus = 0;
293 +
294 +
295    
296     if(doHcal_){
297     for(unsigned int i = 0; i < hfHits->size(); ++i){
# Line 282 | Line 301 | RecHitTreeProducer::analyze(const edm::E
301       hfRecHit.eta[hfRecHit.n] = getEta(hit.id());
302       hfRecHit.phi[hfRecHit.n] = getPhi(hit.id());
303       hfRecHit.isjet[hfRecHit.n] = false;
304 +     hfRecHit.depth[hfRecHit.n] = hit.id().depth();
305 +
306 +     if(hit.id().ieta() > 0){
307 +     if(hit.energy() > hfShortThreshold_ && hit.id().depth() != 1) nHFshortPlus++;
308 +     if(hit.energy() > hfLongThreshold_ && hit.id().depth() == 1) nHFlongPlus++;
309 +     }else{
310 +       if(hit.energy() > hfShortThreshold_ && hit.id().depth() != 1) nHFshortMinus++;
311 +       if(hit.energy() > hfLongThreshold_ && hit.id().depth() == 1) nHFlongMinus++;
312 +     }
313 +
314       if(useJets_){
315         for(unsigned int j = 0 ; j < jets->size(); ++j){
316           const reco::Jet& jet = (*jets)[j];
# Line 291 | Line 320 | RecHitTreeProducer::analyze(const edm::E
320       }
321       hfRecHit.n++;
322     }
323 <  
323 >   if(!doEbyEonly_){
324     for(unsigned int i = 0; i < hbheHits->size(); ++i){
325       const HBHERecHit & hit= (*hbheHits)[i];
326       hbheRecHit.e[hbheRecHit.n] = hit.energy();
# Line 309 | Line 338 | RecHitTreeProducer::analyze(const edm::E
338       hbheRecHit.n++;
339     }
340     }
341 <   if(doEcal_){
341 >   }
342 >   if(doEcal_ && !doEbyEonly_){
343     for(unsigned int i = 0; i < ebHits->size(); ++i){
344       const EcalRecHit & hit= (*ebHits)[i];
345       ebRecHit.e[ebRecHit.n] = hit.energy();
# Line 354 | Line 384 | RecHitTreeProducer::analyze(const edm::E
384        myTowers.eta[myTowers.n] = getEta(hit.id());
385        myTowers.phi[myTowers.n] = getPhi(hit.id());
386        myTowers.isjet[myTowers.n] = false;
387 +
388 +      if(hit.ieta() > 29 && hit.energy() > hfTowerThreshold_) nHFtowerPlus++;
389 +      if(hit.ieta() < -29 && hit.energy() > hfTowerThreshold_) nHFtowerMinus++;
390 +
391        if(useJets_){
392           for(unsigned int j = 0 ; j < jets->size(); ++j){
393              const reco::Jet& jet = (*jets)[j];
# Line 366 | Line 400 | RecHitTreeProducer::analyze(const edm::E
400  
401     }
402  
403 <   if(doBasicClusters_){
403 >   if(doBasicClusters_ && !doEbyEonly_){
404        for(unsigned int j = 0 ; j < jets->size(); ++j){
405           const reco::Jet& jet = (*jets)[j];
406           myBC.n = 0;
# Line 389 | Line 423 | RecHitTreeProducer::analyze(const edm::E
423        }
424     }
425  
426 <   towerTree->Fill();
427 <  
428 <   eeTree->Fill();
429 <   ebTree->Fill();
426 >   if(!doEbyEonly_){
427 >     towerTree->Fill();
428 >    
429 >     eeTree->Fill();
430 >     ebTree->Fill();
431 >    
432 >     hbheTree->Fill();
433 >     hfTree->Fill();
434 >      
435 >     if (doFastJet_) {
436 >       bkgTree->Fill();
437 >     }
438 >   }
439 >
440 >   nt->Fill(nHFtowerPlus,nHFtowerMinus,nHFlongPlus,nHFlongMinus,nHFshortPlus,nHFshortMinus);
441    
397   hbheTree->Fill();
398   hfTree->Fill();
399   bkgTree->Fill();  
442   }
443  
444  
# Line 419 | Line 461 | RecHitTreeProducer::beginJob()
461    hfTree->Branch("et",hfRecHit.et,"et[n]/F");
462    hfTree->Branch("eta",hfRecHit.eta,"eta[n]/F");
463    hfTree->Branch("phi",hfRecHit.phi,"phi[n]/F");
464 +  hfTree->Branch("depth",hfRecHit.depth,"depth[n]/I");
465    hfTree->Branch("isjet",hfRecHit.isjet,"isjet[n]/O");
466  
467    eeTree = fs->make<TTree>("ee","");
# Line 465 | Line 508 | RecHitTreeProducer::beginJob()
508       bkgTree->Branch("rho",bkg.rho,"rho[n]/F");
509       bkgTree->Branch("sigma",bkg.sigma,"sigma[n]/F");
510    }
511 +  
512 +  nt = fs->make<TNtuple>("ntEvent","","nHFplus:nHFminus:nHFlongPlus:nHFlongMinus:nHFshortPlus:nHFshortMinus");
513  
514   }
515  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines