58 histfile_ =
new TFile(
"histos.root",
"RECREATE");
61 tree_ =
new TTree(
"TPGtree",
"TPGtree");
90 fedtree_ =
new TTree(
"fedtree",
"fedtree");
95 treetopbot_ =
new TTree(
"topbottree",
"topbottree") ;
131 if (id < 600 || id > 654)
continue;
139 map<EcalTrigTowerDetId, towerEner> mapTower ;
140 map<EcalTrigTowerDetId, towerEner>::iterator itTT ;
145 for (
unsigned int i=0;
i<digi.product()->size();
i++) {
152 for (
int samp = 0 ; samp<10 ; samp++) {
153 adc = df[samp].adc() ;
154 if (samp<2) mean +=
adc ;
161 if (mean>0 &&
max > mean + 10) {
162 gain = df[theSamp].gainId() ;
163 adc = df[theSamp].adc() ;
164 if (gain == 1) E_xtal = (adc-
mean) ;
165 if (gain == 2) E_xtal = 2.*(adc-
mean) ;
166 if (gain == 3) E_xtal = 12.*(adc-
mean) ;
167 if (gain == 0) E_xtal = 12.*(adc-
mean) ;
171 itTT = mapTower.find(towid) ;
172 if (itTT != mapTower.end()) {
173 (itTT->second).
eRec_ += E_xtal ;
174 (itTT->second).
sample_ += E_xtal*theSamp ;
175 for (
int samp = 0 ; samp<10 ; samp++) (itTT->second).data_[samp] += df[samp].adc()-
mean ;
177 (itTT->second).
nXtal_ ++ ;
178 (itTT->second).
mean_ += mean ;
185 for (
int samp = 0 ; samp<10 ; samp++) tE.
data_[samp] = df[samp].adc()-
mean ;
190 mapTower[towid] = tE ;
199 for (
unsigned int i=0;
i<tpEmul.product()->size();
i++) {
202 itTT = mapTower.find(TPtowid) ;
204 if (itTT != mapTower.end()) {
205 (itTT->second).
tpgEmul0_ = (d[0].raw() & 0x1ff) ;
206 (itTT->second).
tpgEmul1_ = (d[1].raw() & 0x1ff) ;
207 (itTT->second).
tpgEmul2_ = (d[2].raw() & 0x1ff) ;
208 (itTT->second).
tpgEmul3_ = (d[3].raw() & 0x1ff) ;
209 (itTT->second).
tpgEmul4_ = (d[4].raw() & 0x1ff) ;
218 mapTower[TPtowid] = tE ;
229 for (
unsigned int i=0;
i<tp.product()->size();
i++) {
232 float Et = ecalScale.getTPGInGeV(d) ;
235 itTT = mapTower.find(TPtowid) ;
236 if (itTT != mapTower.end()) {
252 mapTower[TPtowid] = tE ;
260 if (mapTower.size()>0)
nevt_++ ;
261 for (itTT = mapTower.begin() ; itTT != mapTower.end() ; ++itTT ) {
272 fg_ = (itTT->second).
fg_ ;
275 data0_ = (itTT->second).data_[0] ;
276 data1_ = (itTT->second).data_[1] ;
277 data2_ = (itTT->second).data_[2] ;
278 data3_ = (itTT->second).data_[3] ;
279 data4_ = (itTT->second).data_[4] ;
280 data5_ = (itTT->second).data_[5] ;
281 data6_ = (itTT->second).data_[6] ;
282 data7_ = (itTT->second).data_[7] ;
283 data8_ = (itTT->second).data_[8] ;
284 data9_ = (itTT->second).data_[9] ;
340 float E_max_top = 0., E_max_bot = 0.;
342 for (
unsigned int i=0;
i<digi.product()->size();
i++) {
349 if (towid.
ieta() == 15 && towid.
iphi() == 19) good =
false ;
350 if (towid.
ieta() == 9 && towid.
iphi() == 11) good =
false ;
351 if (towid.
ieta() == 9 && towid.
iphi() == 12) good =
false ;
352 if (towid.
ieta() == 12 && towid.
iphi()>54 && towid.
iphi()<59) good =
false ;
353 if (towid.
ieta() == 5 && towid.
iphi()>50 && towid.
iphi()<55) good =
false ;
354 if (towid.
ieta() == 6 && towid.
iphi()>54 && towid.
iphi()<59) good =
false ;
355 if (towid.
ieta() == 6 && towid.
iphi()>14 && towid.
iphi()<19) good =
false ;
360 if (
id.
ism() >= 4 &&
id.ism() <= 7) {
364 float mean = 0.5*(df[0].adc()+df[1].adc()) ;
366 for (
int samp = 0 ; samp<10 ; samp++) {
367 adc = df[samp].adc() ;
368 if (adc>max) max =
adc ;
370 if (mean>0 && max > mean + 10) E_xtal = (adc-
mean) ;
371 if (E_xtal > E_max_top) {
378 if (
id.
ism() >= 14 &&
id.ism() <= 16) {
381 float mean = 0.5*(df[0].adc()+df[1].adc()) ;
383 for (
int samp = 0 ; samp<10 ; samp++) {
384 adc = df[samp].adc() ;
385 if (adc>max) max =
adc ;
387 if (mean>0 && max > mean + 10) E_xtal = (adc-
mean) ;
388 if (E_xtal > E_max_bot) {
396 if (E_max_top >0 && E_max_bot>0) {
398 std::cout<<idRef_top.iphi()<<
" "<<idRef_top.ieta()<<
" "<<idRef_top.ic()<<
" "<<idRef_top.ism()<<
" "<<E_max_top<<std::endl ;
399 std::cout<<idRef_bot.iphi()<<
" "<<idRef_bot.ieta()<<
" "<<idRef_bot.ic()<<
" "<<idRef_bot.ism()<<
" "<<E_max_bot<<std::endl ;
402 int rangePhitop[3] = {idRef_top.iphi()-1, idRef_top.iphi(), idRef_top.iphi()+1} ;
403 int rangeEtatop[3] = {idRef_top.ieta()-1, idRef_top.ieta(), idRef_top.ieta()+1} ;
404 int rangePhibot[3] = {idRef_bot.iphi()-1, idRef_bot.iphi(), idRef_bot.iphi()+1} ;
405 int rangeEtabot[3] = {idRef_bot.ieta()-1, idRef_bot.ieta(), idRef_bot.ieta()+1} ;
406 for (
int i=0 ;
i<3 ;
i++) {
407 if (rangePhitop[
i] <= 0) rangePhitop[
i] += 360 ;
408 if (rangePhitop[
i] > 360) rangePhitop[
i] -= 360 ;
409 if (rangeEtatop[
i] <= 0 || rangeEtatop[
i]>85) rangeEtatop[
i] = 999999 ;
410 if (rangePhibot[
i] <= 0) rangePhibot[
i] += 360 ;
411 if (rangePhibot[
i] > 360) rangePhibot[
i] -= 360 ;
412 if (rangeEtabot[
i] <= 0 || rangeEtabot[
i]>85) rangeEtabot[
i] = 999999 ;
419 for (
unsigned int i=0;
i<digi.product()->size();
i++) {
424 float mean = 0.5*(df[0].adc()+df[1].adc()) ;
426 for (
int samp = 0 ; samp<10 ; samp++) {
427 adc = df[samp].adc() ;
428 if (adc>max) max =
adc ;
430 E_xtal = (adc-
mean) ;
432 for (
int phiIndex=0 ; phiIndex<3 ; phiIndex++)
433 for (
int etaIndex = 0 ; etaIndex<3 ; etaIndex++) {
434 if (
id.iphi() == rangePhitop[phiIndex] &&
id.ieta() == rangeEtatop[etaIndex]) {
438 if (
id.iphi() == rangePhibot[phiIndex] &&
id.ieta() == rangeEtabot[etaIndex]) {
int adc(sample_type sample)
get the ADC sample (12 bits)
T getParameter(std::string const &) const
~EcalTrigPrimAnalyzerMIPs()
void setEventSetup(const edm::EventSetup &evtSetup)
bool getByType(Handle< PROD > &result) const
EcalTrigPrimAnalyzerMIPs(const edm::ParameterSet &)
size_t size() const
Lenght of the data buffer in bytes.
int ieta() const
get the tower ieta
int compressedEt() const
get the encoded/compressed Et of interesting sample
std::string digi_producer_
std::string emul_producer_
const T & max(const T &a, const T &b)
int ietaAbs() const
get the absolute value of the tower ieta
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
int iphi() const
get the tower iphi
const EcalTrigTowerDetId & id() const
char data[epos_bytes_allocation]
bool fineGrain() const
get the fine-grain bit of interesting sample
int ism(int ieta, int iphi)
int ttFlag() const
get the Trigger tower Flag of interesting sample
virtual void analyze(const edm::Event &, const edm::EventSetup &)