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.18 by yilmaz, Sun Nov 20 15:45:10 2011 UTC vs.
Revision 1.22 by yilmaz, Wed Jan 16 17:22:56 2013 UTC

# Line 69 | Line 69
69  
70   using namespace std;
71  
72 < #define MAXHITS 1000000
72 > #define MAXHITS 100000
73  
74   struct MyRecHit{
75    int depth[MAXHITS];
76    int n;
77  
78 +  int ieta[MAXHITS];
79 +  int iphi[MAXHITS];
80 +
81    float e[MAXHITS];
82    float et[MAXHITS];
83    float eta[MAXHITS];
# Line 159 | Line 162 | class RecHitTreeProducer : public edm::E
162    MyRecHit eeRecHit;
163     MyRecHit myBC;
164     MyRecHit myTowers;
165 +  MyRecHit castorRecHit;
166 +
167     MyBkg bkg;
168  
169    TNtuple* nt;
# Line 169 | Line 174 | class RecHitTreeProducer : public edm::E
174     TTree* bcTree;
175     TTree* towerTree;
176     TTree* bkgTree;
177 +  TTree* castorTree;
178  
179    double cone;
180    double hfTowerThreshold_;
# Line 206 | Line 212 | class RecHitTreeProducer : public edm::E
212     bool doEcal_;
213     bool doHcal_;
214     bool doHF_;
215 +  bool doCastor_;
216 +
217     bool hasVtx_;
218    bool saveBothVtx_;
219  
# Line 246 | Line 254 | RecHitTreeProducer::RecHitTreeProducer(c
254    doEcal_ = iConfig.getUntrackedParameter<bool>("doEcal",true);
255    doHcal_ = iConfig.getUntrackedParameter<bool>("doHcal",true);
256    doHF_ = iConfig.getUntrackedParameter<bool>("doHF",true);
257 +  doCastor_ = iConfig.getUntrackedParameter<bool>("doCASTOR",true);
258 +
259    hasVtx_ = iConfig.getUntrackedParameter<bool>("hasVtx",true);
260    saveBothVtx_ = iConfig.getUntrackedParameter<bool>("saveBothVtx",false);
261  
# Line 510 | Line 520 | RecHitTreeProducer::analyze(const edm::E
520  
521        myTowers.et[myTowers.n] = hit.p4(vtx).Et();
522        myTowers.eta[myTowers.n] = hit.p4(vtx).Eta();
523 +      myTowers.phi[myTowers.n] = hit.p4(vtx).Phi();
524        myTowers.emEt[myTowers.n] = hit.emEt(vtx);
525        myTowers.hadEt[myTowers.n] = hit.hadEt(vtx);
526  
# Line 565 | Line 576 | RecHitTreeProducer::analyze(const edm::E
576        }
577     }
578  
579 +   if(doCastor_){
580 +
581 +     edm::Handle<CastorRecHitCollection> casrechits;    
582 +     try{ ev.getByLabel("castorreco",casrechits); }
583 +     catch(...) { edm::LogWarning(" CASTOR ") << " Cannot get Castor RecHits " << std::endl; }
584 +
585 +     int nhits = 0;
586 +     double energyCastor = 0;
587 +
588 +     if(casrechits.failedToGet()!=0 || !casrechits.isValid()) {      
589 +       edm::LogWarning(" CASTOR ") << " Cannot read CastorRecHitCollection" << std::endl;
590 +     } else {      
591 +       for(size_t i1 = 0; i1 < casrechits->size(); ++i1) {      
592 +         const CastorRecHit & rh = (*casrechits)[i1];    
593 +         HcalCastorDetId castorid = rh.id();    
594 +         energyCastor += rh.energy();
595 +         if (nhits  < 224) {      
596 +           castorRecHit.e[nhits] = rh.energy();    
597 +           castorRecHit.iphi[nhits] = castorid.sector();          
598 +           castorRecHit.depth[nhits] = castorid.module();          
599 +           castorRecHit.phi[nhits] = getPhi(castorid);
600 +       }
601 +
602 +       nhits++;
603 +
604 +       } // end loop castor rechits
605 +     }
606 +    
607 +     castorRecHit.n = nhits;        
608 +     castorTree->Fill();
609 +   }
610 +
611 +
612     if(!doEbyEonly_){
613       towerTree->Fill();
614      
# Line 640 | Line 684 | RecHitTreeProducer::beginJob()
684    towerTree->Branch("emEt",myTowers.emEt,"emEt[n]/F");
685    towerTree->Branch("hadEt",myTowers.hadEt,"hadEt[n]/F");
686  
687 +
688 +  if(doCastor_){
689 +    castorTree = fs->make<TTree>("castor",versionTag);
690 +    castorTree->Branch("n",&castorRecHit.n,"n/I");
691 +    castorTree->Branch("e",castorRecHit.e,"e[n]/F");
692 +    castorTree->Branch("iphi",castorRecHit.iphi,"iphi[n]/I");
693 +    castorTree->Branch("phi",castorRecHit.phi,"phi[n]/F");
694 +    castorTree->Branch("depth",castorRecHit.depth,"depth[n]/I");
695 +  }
696 +
697    if (saveBothVtx_) {
698      towerTree->Branch("etVtx",myTowers.etVtx,"etvtx[n]/F");
699      towerTree->Branch("etaVtx",myTowers.etaVtx,"etavtx[n]/F");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines