@@ -178,7 +178,7 @@ double puFactor(int type, int ieta, double pmom, double eHcal, double ediff, boo
178178 if (debug )
179179 std ::cout << " d2p " << d2p << ":" << DELTA_CUT << " coeff " << icor << ":" << CONST_COR_COEF [icor ] << ":"
180180 << LINEAR_COR_COEF [icor ] << ":" << SQUARE_COR_COEF [icor ] << " Fac " << fac ;
181- } else { // 21pu
181+ } else if ( type == 6 ) { // 21pu (old)
182182 const double CONST_COR_COEF [6 ] = {0.98913 , 0.982008 , 0.974011 , 0.496234 , 0.368110 , 0.294053 };
183183 const double LINEAR_COR_COEF [6 ] = {-0.0491388 , -0.124058 , -0.249718 , -0.0667390 , -0.0770766 , -0.0580492 };
184184 const double SQUARE_COR_COEF [6 ] = {0 , 0 , 0.0368657 , 0.00656337 , 0.00724508 , 0.00568967 };
@@ -195,6 +195,40 @@ double puFactor(int type, int ieta, double pmom, double eHcal, double ediff, boo
195195 if (debug )
196196 std ::cout << " d2p " << d2p << ":" << DELTA_CUT << " coeff " << icor << ":" << CONST_COR_COEF [icor ] << ":"
197197 << LINEAR_COR_COEF [icor ] << ":" << SQUARE_COR_COEF [icor ] << " Fac " << fac ;
198+ } else if (type == 99 ) { // dlphin
199+ const double CONST_COR_COEF [6 ] = {0.98312 , 0.978532 , 0.972211 , 0.756004 , 0.638075 , 0.547192 };
200+ const double LINEAR_COR_COEF [6 ] = {-0.0472436 , -0.186206 , -0.247339 , -0.166062 , -0.159781 , -0.118747 };
201+ const double SQUARE_COR_COEF [6 ] = {0 , 0 , 0.0356827 , 0.0202461 , 0.01785078 , 0.0123003 };
202+ const int PU_IETA_1 = 7 ;
203+ const int PU_IETA_2 = 16 ;
204+ const int PU_IETA_3 = 25 ;
205+ const int PU_IETA_4 = 26 ;
206+ const int PU_IETA_5 = 27 ;
207+ unsigned icor = (unsigned (jeta >= PU_IETA_1 ) + unsigned (jeta >= PU_IETA_2 ) + unsigned (jeta >= PU_IETA_3 ) +
208+ unsigned (jeta >= PU_IETA_4 ) + unsigned (jeta >= PU_IETA_5 ));
209+ double deltaCut = (icor > 2 ) ? 1.0 : DELTA_CUT ;
210+ if (d2p > deltaCut )
211+ fac = (CONST_COR_COEF [icor ] + LINEAR_COR_COEF [icor ] * d2p + SQUARE_COR_COEF [icor ] * d2p * d2p );
212+ if (debug )
213+ std ::cout << " d2p " << d2p << ":" << DELTA_CUT << " coeff " << icor << ":" << CONST_COR_COEF [icor ] << ":"
214+ << LINEAR_COR_COEF [icor ] << ":" << SQUARE_COR_COEF [icor ] << " Fac " << fac ;
215+ } else { // 21pu (June, 2021)
216+ const double CONST_COR_COEF [6 ] = {0.989727 , 0.981923 , 0.97571 , 0.562475 , 0.467947 , 0.411831 };
217+ const double LINEAR_COR_COEF [6 ] = {-0.0469558 , -0.125805 , -0.251383 , -0.0668994 , -0.0964236 , -0.0947158 };
218+ const double SQUARE_COR_COEF [6 ] = {0 , 0 , 0.0399785 , 0.00610104 , 0.00952528 , 0.0100645 };
219+ const int PU_IETA_1 = 7 ;
220+ const int PU_IETA_2 = 16 ;
221+ const int PU_IETA_3 = 25 ;
222+ const int PU_IETA_4 = 26 ;
223+ const int PU_IETA_5 = 27 ;
224+ unsigned icor = (unsigned (jeta >= PU_IETA_1 ) + unsigned (jeta >= PU_IETA_2 ) + unsigned (jeta >= PU_IETA_3 ) +
225+ unsigned (jeta >= PU_IETA_4 ) + unsigned (jeta >= PU_IETA_5 ));
226+ double deltaCut = (icor > 2 ) ? 1.0 : DELTA_CUT ;
227+ if (d2p > deltaCut )
228+ fac = (CONST_COR_COEF [icor ] + LINEAR_COR_COEF [icor ] * d2p + SQUARE_COR_COEF [icor ] * d2p * d2p );
229+ if (debug )
230+ std ::cout << " d2p " << d2p << ":" << DELTA_CUT << " coeff " << icor << ":" << CONST_COR_COEF [icor ] << ":"
231+ << LINEAR_COR_COEF [icor ] << ":" << SQUARE_COR_COEF [icor ] << " Fac " << fac ;
198232 }
199233 }
200234 if (fac < 0 || fac > 1 )
@@ -307,9 +341,10 @@ private:
307341 const int useScale_ ;
308342 const double scale_ ;
309343 const bool etaMax_ , debug_ ;
344+ static const int depMax_ = 10 ;
310345 bool corrE_ ;
311346 int etamp_ , etamn_ ;
312- double cfacmp_ , cfacmn_ ;
347+ double cfacmp_ [ depMax_ ] , cfacmn_ [ depMax_ ] ;
313348 std ::map < std ::pair < int , int > , double > cfactors_ ;
314349};
315350
@@ -357,7 +392,11 @@ private:
357392};
358393
359394CalibCorrFactor ::CalibCorrFactor (const char * infile , int useScale , double scale , bool etamax , bool debug )
360- : useScale_ (useScale ), scale_ (scale ), etaMax_ (etamax ), debug_ (debug ), etamp_ (0 ), etamn_ (0 ), cfacmp_ (1 ), cfacmn_ (1 ) {
395+ : useScale_ (useScale ), scale_ (scale ), etaMax_ (etamax ), debug_ (debug ), etamp_ (0 ), etamn_ (0 ) {
396+ for (int i = 0 ; i < depMax_ ; ++ i ) {
397+ cfacmp_ [i ] = 1.0 ;
398+ cfacmn_ [i ] = 1.0 ;
399+ }
361400 if (std ::string (infile ) != "" ) {
362401 corrE_ = readCorrFactor (infile );
363402 std ::cout << "Reads " << cfactors_ .size () << " correction factors from " << infile << " with flag " << corrE_
@@ -382,9 +421,9 @@ double CalibCorrFactor::getCorr(unsigned int id) {
382421 cfac = itr -> second ;
383422 } else if (etaMax_ ) {
384423 if (zside > 0 && ieta > etamp_ )
385- cfac = cfacmp_ ;
424+ cfac = ( depth < depMax_ ) ? cfacmp_ [ depth ] : cfacmp_ [ depMax_ - 1 ] ;
386425 if (zside < 0 && ieta > - etamn_ )
387- cfac = cfacmn_ ;
426+ cfac = ( depth < depMax_ ) ? cfacmn_ [ depth ] : cfacmn_ [ depMax_ - 1 ] ;
388427 }
389428 } else if (useScale_ != 0 ) {
390429 int subdet , zside , ieta , iphi , depth ;
@@ -417,20 +456,21 @@ bool CalibCorrFactor::readCorrFactor(const char* fname) {
417456 float corrf = std ::atof (items [3 ].c_str ());
418457 double scale = getFactor (std ::abs (ieta ));
419458 cfactors_ [std ::pair < int , int > (ieta , depth )] = scale * corrf ;
420- if (ieta > etamp_ && depth == 1 ) {
459+ if (ieta > etamp_ && depth == 1 )
421460 etamp_ = ieta ;
422- cfacmp_ = scale * corrf ;
423- }
424- if (ieta < etamn_ && depth == 1 ) {
461+ if ( ieta == etamp_ && depth < depMax_ )
462+ cfacmp_ [ depth ] = scale * corrf ;
463+ if (ieta < etamn_ && depth == 1 )
425464 etamn_ = ieta ;
426- cfacmn_ = scale * corrf ;
427- }
465+ if ( ieta == etamn_ && depth < depMax_ )
466+ cfacmn_ [ depth ] = scale * corrf ;
428467 }
429468 }
430469 fInput .close ();
431470 std ::cout << "Reads total of " << all << " and " << good << " good records"
432- << " Max eta (z>0) " << etamp_ << ":" << cfacmp_ << " eta (z<0) " << etamn_ << ":" << cfacmn_
433- << std ::endl ;
471+ << " Max eta (z>0) " << etamp_ << " eta (z<0) " << etamn_ << std ::endl ;
472+ for (int i = 0 ; i < depMax_ ; ++ i )
473+ std ::cout << "[" << i << "] C+ " << cfacmp_ [i ] << " C- " << cfacmn_ [i ] << std ::endl ;
434474 if (good > 0 )
435475 ok = true;
436476 }
0 commit comments