56 |
|
|
57 |
|
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" |
58 |
|
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" |
59 |
+ |
#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" |
60 |
|
#include "DataFormats/HcalDetId/interface/HcalDetId.h" |
61 |
|
#include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h" |
62 |
|
#include "DataFormats/EgammaReco/interface/BasicClusterFwd.h" |
72 |
|
|
73 |
|
#define MAXHITS 100000 |
74 |
|
|
75 |
+ |
|
76 |
|
struct MyRecHit{ |
77 |
|
int depth[MAXHITS]; |
78 |
|
int n; |
102 |
|
|
103 |
|
}; |
104 |
|
|
105 |
+ |
struct MyZDCRecHit{ |
106 |
+ |
int n; |
107 |
+ |
float e[18]; |
108 |
+ |
int zside[18]; |
109 |
+ |
int section [18]; |
110 |
+ |
int channel[18]; |
111 |
+ |
int saturation[18]; |
112 |
+ |
}; |
113 |
+ |
|
114 |
+ |
struct MyZDCDigi{ |
115 |
+ |
int n; |
116 |
+ |
int nts; |
117 |
+ |
float chargefC[18][10]; |
118 |
+ |
int adc[18][10]; |
119 |
+ |
int zside[18][10]; |
120 |
+ |
int section [18][10]; |
121 |
+ |
int channel[18][10]; |
122 |
+ |
int ts[18][10]; |
123 |
+ |
}; |
124 |
|
|
125 |
|
struct MyBkg{ |
126 |
|
int n; |
181 |
|
MyRecHit hfRecHit; |
182 |
|
MyRecHit ebRecHit; |
183 |
|
MyRecHit eeRecHit; |
184 |
< |
MyRecHit myBC; |
185 |
< |
MyRecHit myTowers; |
184 |
> |
MyRecHit myBC; |
185 |
> |
MyRecHit myTowers; |
186 |
|
MyRecHit castorRecHit; |
187 |
|
|
188 |
< |
MyBkg bkg; |
188 |
> |
MyZDCRecHit zdcRecHit; |
189 |
> |
MyZDCDigi zdcDigi; |
190 |
> |
|
191 |
> |
MyBkg bkg; |
192 |
|
|
193 |
|
TNtuple* nt; |
194 |
|
TTree* hbheTree; |
199 |
|
TTree* towerTree; |
200 |
|
TTree* bkgTree; |
201 |
|
TTree* castorTree; |
202 |
+ |
TTree* zdcRecHitTree; |
203 |
+ |
TTree* zdcDigiTree; |
204 |
|
|
205 |
|
double cone; |
206 |
|
double hfTowerThreshold_; |
239 |
|
bool doHcal_; |
240 |
|
bool doHF_; |
241 |
|
bool doCastor_; |
242 |
+ |
bool doZDCRecHit_; |
243 |
+ |
bool doZDCDigi_; |
244 |
|
|
245 |
|
bool hasVtx_; |
246 |
|
bool saveBothVtx_; |
283 |
|
doHcal_ = iConfig.getUntrackedParameter<bool>("doHcal",true); |
284 |
|
doHF_ = iConfig.getUntrackedParameter<bool>("doHF",true); |
285 |
|
doCastor_ = iConfig.getUntrackedParameter<bool>("doCASTOR",true); |
286 |
+ |
doZDCRecHit_ = iConfig.getUntrackedParameter<bool>("doZDCRecHit",true); |
287 |
+ |
doZDCDigi_ = iConfig.getUntrackedParameter<bool>("doZDCDigi",true); |
288 |
|
|
289 |
|
hasVtx_ = iConfig.getUntrackedParameter<bool>("hasVtx",true); |
290 |
|
saveBothVtx_ = iConfig.getUntrackedParameter<bool>("saveBothVtx",false); |
638 |
|
castorTree->Fill(); |
639 |
|
} |
640 |
|
|
641 |
+ |
if(doZDCRecHit_){ |
642 |
+ |
|
643 |
+ |
edm::Handle<ZDCRecHitCollection> zdcrechits; |
644 |
+ |
|
645 |
+ |
try{ ev.getByLabel("zdcreco",zdcrechits); } |
646 |
+ |
catch(...) { edm::LogWarning(" ZDC ") << " Cannot get ZDC RecHits " << std::endl; } |
647 |
+ |
|
648 |
+ |
int nhits = 0; |
649 |
+ |
|
650 |
+ |
if (zdcrechits.failedToGet()!=0 || !zdcrechits.isValid()) { |
651 |
+ |
edm::LogWarning(" ZDC ") << " Cannot read ZDCRecHitCollection" << std::endl; |
652 |
+ |
} else { |
653 |
+ |
for(size_t i1 = 0; i1 < zdcrechits->size(); ++i1) { |
654 |
+ |
const ZDCRecHit & rh = (*zdcrechits)[i1]; |
655 |
+ |
HcalZDCDetId zdcid = rh.id(); |
656 |
+ |
if (nhits < 18) { |
657 |
+ |
zdcRecHit.e[nhits] = rh.energy(); |
658 |
+ |
zdcRecHit.zside[nhits] = zdcid.zside(); |
659 |
+ |
zdcRecHit.section[nhits] = zdcid.section(); |
660 |
+ |
zdcRecHit.channel[nhits] = zdcid.channel(); |
661 |
+ |
} |
662 |
+ |
|
663 |
+ |
nhits++; |
664 |
+ |
|
665 |
+ |
} // end loop zdc rechits |
666 |
+ |
} |
667 |
+ |
|
668 |
+ |
zdcRecHit.n = nhits; |
669 |
+ |
zdcRecHitTree->Fill(); |
670 |
+ |
|
671 |
+ |
} |
672 |
+ |
|
673 |
+ |
if(doZDCDigi_){ |
674 |
+ |
|
675 |
+ |
edm::Handle<ZDCDigiCollection> zdcdigis; |
676 |
+ |
|
677 |
+ |
try{ ev.getByLabel("hcalDigis",zdcdigis); } |
678 |
+ |
catch(...) { edm::LogWarning(" ZDC ") << " Cannot get ZDC Digis " << std::endl; } |
679 |
+ |
|
680 |
+ |
int nhits = 0; |
681 |
+ |
|
682 |
+ |
if (zdcdigis.failedToGet()!=0 || !zdcdigis.isValid()) { |
683 |
+ |
edm::LogWarning(" ZDC ") << " Cannot read ZDCDigiCollection" << std::endl; |
684 |
+ |
} else { |
685 |
+ |
for(size_t i1 = 0; i1 < zdcdigis->size(); ++i1) { |
686 |
+ |
|
687 |
+ |
const ZDCDataFrame & rh = (*zdcdigis)[i1]; |
688 |
+ |
HcalZDCDetId zdcid = rh.id(); |
689 |
+ |
|
690 |
+ |
if (nhits < 18) { |
691 |
+ |
|
692 |
+ |
int ts = 0; |
693 |
+ |
|
694 |
+ |
for(int j1 = 0; j1 < rh.size(); j1++){ |
695 |
+ |
|
696 |
+ |
zdcDigi.chargefC[nhits][ts]= rh[ts].nominal_fC(); |
697 |
+ |
zdcDigi.adc[nhits][ts]= rh[ts].adc(); |
698 |
+ |
zdcDigi.zside[nhits][ts] = zdcid.zside(); |
699 |
+ |
zdcDigi.section[nhits][ts] = zdcid.section(); |
700 |
+ |
zdcDigi.channel[nhits][ts] = zdcid.channel(); |
701 |
+ |
zdcDigi.ts[nhits][ts] = ts; |
702 |
+ |
|
703 |
+ |
ts++; |
704 |
+ |
} |
705 |
+ |
|
706 |
+ |
zdcDigi.nts=ts; |
707 |
+ |
|
708 |
+ |
} |
709 |
+ |
|
710 |
+ |
nhits++; |
711 |
+ |
|
712 |
+ |
} // end loop zdc rechits |
713 |
+ |
} |
714 |
+ |
|
715 |
+ |
zdcDigi.n = nhits; |
716 |
+ |
zdcDigiTree->Fill(); |
717 |
+ |
|
718 |
+ |
} |
719 |
|
|
720 |
|
if(!doEbyEonly_){ |
721 |
|
towerTree->Fill(); |
802 |
|
castorTree->Branch("depth",castorRecHit.depth,"depth[n]/I"); |
803 |
|
} |
804 |
|
|
805 |
+ |
if(doZDCRecHit_){ |
806 |
+ |
zdcRecHitTree = fs->make<TTree>("zdc",versionTag); |
807 |
+ |
zdcRecHitTree->Branch("n",&zdcRecHit.n,"n/I"); |
808 |
+ |
zdcRecHitTree->Branch("e",zdcRecHit.e,"e[n]/F"); |
809 |
+ |
zdcRecHitTree->Branch("zside",zdcRecHit.zside,"zside[n]/I"); |
810 |
+ |
zdcRecHitTree->Branch("section",zdcRecHit.section,"section[n]/I"); |
811 |
+ |
zdcRecHitTree->Branch("channel",zdcRecHit.channel,"channel[n]/I"); |
812 |
+ |
} |
813 |
+ |
|
814 |
+ |
if(doZDCDigi_){ |
815 |
+ |
zdcDigiTree = fs->make<TTree>("zdcDigi",versionTag); |
816 |
+ |
zdcDigiTree->Branch("n",&zdcDigi.n,"n/I"); |
817 |
+ |
zdcDigiTree->Branch("nts",&zdcDigi.nts,"nts/I"); |
818 |
+ |
zdcDigiTree->Branch("zside",zdcDigi.zside,"zside[n][nts]/I"); |
819 |
+ |
zdcDigiTree->Branch("section",zdcDigi.section,"section[n][nts]/I"); |
820 |
+ |
zdcDigiTree->Branch("channel",zdcDigi.channel,"channel[n][nts]/I"); |
821 |
+ |
zdcDigiTree->Branch("adc",zdcDigi.adc,"adc[n][nts]/I"); |
822 |
+ |
zdcDigiTree->Branch("chargefC",zdcDigi.chargefC,"chargefC[n][nts]/F"); |
823 |
+ |
} |
824 |
+ |
|
825 |
|
if (saveBothVtx_) { |
826 |
|
towerTree->Branch("etVtx",myTowers.etVtx,"etvtx[n]/F"); |
827 |
|
towerTree->Branch("etaVtx",myTowers.etaVtx,"etavtx[n]/F"); |
829 |
|
towerTree->Branch("hadEtVtx",myTowers.hadEtVtx,"hadEtVtx[n]/F"); |
830 |
|
} |
831 |
|
|
704 |
– |
|
832 |
|
if(doBasicClusters_){ |
833 |
|
bcTree = fs->make<TTree>("bc",versionTag); |
834 |
|
bcTree->Branch("n",&myBC.n,"n/I"); |