18 "R",
"SM",
"LMR",
"LMM",
"SC",
"C"
22 "FLAG",
"MEAN",
"RMS",
"M3",
23 "APD_OVER_PNA_MEAN",
"APD_OVER_PNA_RMS",
"APD_OVER_PNA_M3",
24 "APD_OVER_PNB_MEAN",
"APD_OVER_PNB_RMS",
"APD_OVER_PNB_M3",
25 "APD_OVER_PN_MEAN",
"APD_OVER_PN_RMS",
"APD_OVER_PN_M3",
26 "SHAPE_COR",
"ALPHA",
"BETA",
27 "TIME_MEAN",
"TIME_RMS",
"TIME_M3",
"TIME_NEVT"
31 "FLAG",
"MEAN",
"RMS",
"M3",
32 "PNA_OVER_PNB_MEAN",
"PNA_OVER_PNB_RMS",
"PNA_OVER_PNB_M3",
37 "MTQ_AMPL",
"MTQ_TIME",
"MTQ_RISE",
38 "MTQ_FWHM",
"MTQ_FW20",
"MTQ_FW80",
"MTQ_SLIDING"
42 "FLAG",
"MEAN",
"RMS",
"M3",
"NEVT"
46 "GAIN",
"MEAN",
"RMS",
"M3"
54 "Blue",
"Green",
"Red",
"IRed",
"LED1",
"LED2"
64 TString out_(getenv(
"MELMDAT"));
74 TString out_(getenv(
"MESTORE"));
84 return TString(getenv(
"MUSECAL"))+
"/";
92 TString outfile_ = primPath( lmr_ );
95 outfile_ +=
"_"; outfile_ += header.
side;
100 case iBlue: outfile_ +=
"_BlueLaser";
break;
101 case iGreen: outfile_ +=
"_GreenLaser";
break;
102 case iRed: outfile_ +=
"_RedLaser";
break;
103 case iIRed: outfile_ +=
"_IRedLaser";
break;
109 outfile_ +=
"_testPulse";
111 outfile_ +=
"_"; outfile_ += header.
rundir.c_str();
112 outfile_ +=
"_TS"; outfile_ += header.
ts_beg;
120 TString outfile_ = primPath( lmr );
123 outfile_ +=
"runlist_";
126 case ME::iBlue: outfile_+=
"Blue_";
break;
128 case ME::iRed: outfile_+=
"Red_";
break;
129 case ME::iIRed: outfile_+=
"IRed_";
break;
134 else if( type==iTestPulse )
136 outfile_ +=
"runlist_Test_Pulse";
141 std::vector< ME::Time >
157 Time dt_min = dt_s/60;
158 Time n_s = dt_s-dt_min*60;
159 Time dt_h = dt_min/60;
160 Time n_min = dt_min-dt_h*60;
161 Time dt_day = dt_h/24;
162 Time n_h = dt_h-dt_day*24;
166 std::vector< Time > vec_;
167 vec_.push_back( n_day );
168 vec_.push_back( n_h );
169 vec_.push_back( n_min );
170 vec_.push_back( n_s );
189 float dt_f = ((float) dt)*sign;
211 if( dt<0 ) sign = -1;
226 std::cout <<
"dt/it/t0/ " << dt <<
"/" << it_ <<
"/" << t0 << std::endl;
227 if( sign==1 )
return t0+it_;
240 return static_cast<Time>(t>>32);
245 "EE-",
"EB-",
"EB+",
"EE+"
251 assert( ilmr>0 && ilmr<=92 );
252 if( ilmr<=36 )
return iEBM;
254 if( ilmr<=36 )
return iEBP;
256 if( ilmr<=10 )
return iEEP;
265 assert( side==0 || side==1 );
267 if( idcc>600 ) idcc-=600;
268 assert( idcc>=1 && idcc<=54 );
270 if( idcc<=9 ) ireg = iEEM;
274 if( idcc<=18 ) ireg = iEBM;
278 if( idcc<=18 ) ireg = iEBP;
282 if( idcc<=9 ) ireg = iEEP;
288 if( ireg==iEEM || ireg==iEEP )
290 if( side==1 && idcc!=8 )
295 if( idcc==9 ) ilmr++;
296 if( idcc==8 && side==1 ) ilmr++;
298 else if( ireg==iEBM || ireg==iEBP )
300 ilmr = 2*(idcc-1) + side + 1;
305 if( ireg==iEBP ) ilmr+=36;
306 else if( ireg==iEEP ) ilmr+=72;
307 else if( ireg==iEEM ) ilmr+=82;
312 std::pair< int, int >
318 int ireg = ecalRegion( ilmr );
319 if( ireg==iEEM ) ilmr-=82;
320 else if( ireg==iEBP ) ilmr-=36;
321 else if( ireg==iEEP ) ilmr-=72;
323 if( ireg==iEEM || ireg==iEEP )
325 assert( ilmr>=1 && ilmr<=10 );
328 if( ilmr>=9 ) idcc--;
329 if( ilmr==9 ) side=1;
333 assert( ilmr>=1 && ilmr<=36 );
338 if( ireg>iEEM ) idcc+=9;
339 if( ireg>iEBM ) idcc+=18;
340 if( ireg>iEBP ) idcc+=18;
344 return std::pair< int,int >( idcc, side );
350 ireg = ecalRegion( ilmr );
352 std::pair< int, int > ipair_ = dccAndSide( ilmr );
354 side = ipair_.second;
357 if( ireg==iEEM || ireg==iEEP )
359 if( idcc>600 ) idcc-=600;
360 if( idcc>=1 && idcc<=9 )
366 else if( idcc>=46 && idcc<=54 )
374 else if( ireg==iEBM || ireg==iEBP )
376 if( idcc>600 ) idcc-=600;
377 assert( idcc>=10 && idcc<=45 );
379 if( ism>18 ) ism-=18;
392 assert( ism>=1 && ism<=18 );
395 if( ism>9 ) ism -= 9;
400 assert( ism>=1 && ism<=36 );
423 out =
smName( reg_, sm_ );
430 int ilmr = lmr( idcc,0 );
437 return regTree( ecalRegion( ilmr ) )->
getDescendant( iLMRegion, ilmr );
443 assert( ireg>=iEEM && ireg<=iEEP );
444 if( _trees[ireg]!=0 )
return _trees[ireg];
446 int iEcalRegion_ = ireg;
450 int iSuperCrystal_ = 0;
455 if( iEcalRegion_==iEBM || iEcalRegion_==iEBP )
457 for(
int isect=1; isect<=18; isect++ )
460 if( iEcalRegion_==iEBM ) iSector_+=18;
461 if( _trees[iEcalRegion_]==0 )
465 _trees[iEcalRegion_] =
new MEChannel( 0, 0, iEcalRegion_, 0 );
467 tree_=_trees[iEcalRegion_];
468 for(
int iX=0; iX<17; iX++ )
470 for(
int iY=0; iY<4; iY++ )
474 for(
int jx=0; jx<5; jx++ )
476 for(
int jy=0; jy<5; jy++ )
480 if( useElectronicNumbering )
490 int ieta = globalCoord.first;
491 int iphi = globalCoord.second;
494 leaf_ = leaf_->
getDaughter( ieta, iphi, iSector_ );
495 leaf_ = leaf_->
getDaughter( ieta, iphi, iLMRegion_ );
496 leaf_ = leaf_->
getDaughter( ieta, iphi, iLMModule_ );
497 leaf_ = leaf_->
getDaughter( ieta, iphi, iSuperCrystal_ );
498 leaf_ = leaf_->
getDaughter( ieta, iphi, iCrystal_ );
505 else if( iEcalRegion_==iEEM || iEcalRegion_==iEEP )
508 if( iEcalRegion_==iEEM ) iz=-1;
509 if( _trees[iEcalRegion_]==0 )
513 _trees[iEcalRegion_] =
new MEChannel( 0, 0, iEcalRegion_, 0 );
515 tree_=_trees[iEcalRegion_];
517 for(
int ilmr=72; ilmr<=92; ilmr++ )
519 if( ecalRegion( ilmr )!=iEcalRegion_ )
continue;
520 for(
int ilmm=1; ilmm<=19; ilmm++ )
522 for(
int iXX=1; iXX<=10; iXX++ )
524 for(
int iside=1; iside<=2; iside++ )
527 if( iside==2 ) iX = 20-iXX+1;
528 for(
int iY=1; iY<=20; iY++ )
532 if( iSector_<0 )
continue;
534 if( iLMRegion_!=ilmr )
continue;
536 if( iLMModule_!=ilmm )
continue;
539 for(
int jxx=1; jxx<=5; jxx++ )
542 if( iside==2 ) jx = 5-jxx+1;
544 for(
int jy=1; jy<=5; jy++ )
546 int ix = 5*(iX-1)+jx;
547 int iy = 5*(iY-1)+jy;
549 if( iCrystal_<0 )
continue;
554 leaf_ = leaf_->
getDaughter( ix, iy, iSuperCrystal_ );
565 return _trees[iEcalRegion_];
571 int reg_ = ecalRegion( ilmr );
572 if ( reg_==iEEM || reg_==iEEP )
return false;
573 else if( reg_==iEBM || reg_==iEBP )
return true;
581 if( isBarrel( ilmr ) )
585 return std::pair<int,int>();
590 if( isBarrel( ilmr ) )
594 return std::vector< int>();
604 return std::vector<int>();
610 std::vector<int> vec;
611 for(
int iside=0; iside<=1; iside++ )
613 int ilmr = lmr( idcc, iside );
614 if( ilmr<0 )
continue;
615 std::pair< int, int > mem_ = memFromLmr( ilmr );
616 vec.push_back( mem_.first );
617 vec.push_back( mem_.second );
625 std::vector<int> vec;
626 for(
int iside=0; iside<=1; iside++ )
628 int ilmr = lmr( idcc, iside );
629 if( ilmr<0 )
continue;
630 bool isBarrel_ = isBarrel( ilmr );
631 std::vector< int > vec_ = lmmodFromLmr( ilmr );
632 for(
unsigned ii=0;
ii<vec_.size();
ii++ )
634 int ilmmod_ = vec_[
ii];
638 if( ilmmod_==18 && iside==1 ) ilmmod_=20;
639 if( ilmmod_==19 && iside==1 ) ilmmod_=21;
641 vec.push_back( ilmmod_ );
650 std::pair<int,int> pnpair_(0,0);
651 std::pair<int,int> mempair_ = memFromLmr(ilmr);
652 if( isBarrel( ilmr ) )
670 mem_=mempair_.second;
673 return std::pair<int,int>(mem_,pn_);
static std::pair< int, int > memFromLmr(int ilmr)
static void regionAndSector(int ilmr, int &ireg, int &isect, int &idcc, int &iside)
static int lmmod(SuperCrysCoord iX, SuperCrysCoord iY)
static TString PNPrimVar[iSizePN]
static std::vector< ME::DCCid > memFromDcc(ME::DCCid idcc)
static std::vector< int > apdRefChannels(int ilmmod)
static int crystal(CrysCoord ix, CrysCoord iy)
static TString APDPrimVar[iSizeAPD]
static bool useElectronicNumbering
static std::pair< ME::DCCid, ME::DCCid > memFromLmr(ME::LMRid ilmr)
static TString TPAPDPrimVar[iSizeTPAPD]
static TString type[iSizeT]
static int crystal_channel(EBLocalCoord ix, EBLocalCoord iy)
std::pair< EBGlobalCoord, EBGlobalCoord > EtaPhiCoord
const Time_t kLowMask(0xFFFFFFFF)
static TString granularity[iSizeG]
static TString lmdataPath(int lmr)
static std::pair< ME::DCCid, ME::PNid > pn(ME::LMRid ilmr, ME::LMMid ilmmod, ME::PN ipn)
static int lmr(EBGlobalCoord ieta, EBGlobalCoord iphi)
static bool isBarrel(int ilmr)
static TString runListName(int lmr, int type, int color)
MEChannel * getDaughter(int ix, int iy, int ig)
static const TimeStamp kLowMask
static Time time_low(TimeStamp t)
static std::pair< int, int > pn(int ilmmod)
static TString MTQPrimVar[iSizeMTQ]
static TString rootFileName(ME::Header header, ME::Settings settings)
static int lm_channel(EBTTLocalCoord iX, EBTTLocalCoord iY)
static std::pair< int, int > pn(int dee, int ilmod)
MEChannel * getDescendant(int ig, int ii)
static int electronic_channel(EBLocalCoord ix, EBLocalCoord iy)
static EtaPhiCoord globalCoord(int ism, EBLocalCoord ix, EBLocalCoord iy)
static TString TPPNPrimVar[iSizeTPPN]
auto const T2 &decltype(t1.eta()) t2
static std::pair< int, int > dccAndSide(int ilmr)
static int sm(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
static TString smNameFromDcc(int idcc)
static std::vector< int > lmmodFromLmr(int ilmr)
static Time time(float dt, Time t0, int tunit=iHour)
unsigned long long TimeStamp
static std::pair< int, int > memFromLmr(int ilmr)
static int ecalRegion(int ilmr)
static int tt_channel(EBTTLocalCoord iX, EBTTLocalCoord iY)
std::string smName(unsigned)
static MEChannel * regTree(int ireg)
static std::vector< ME::LMMid > lmmodFromLmr(ME::LMRid ilmr)
static int lmr(int idcc, int iside)
static std::vector< int > apdRefChannels(int ilmmod)
static TString primPath(int lmr)
static TString color[iSizeC]
static Time time_high(TimeStamp t)
static std::vector< Time > timeDiff(Time t1, Time t2, short int &sign)
static int dee(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
static std::vector< MEChannel * > _trees
static TString smName(int ilmr)
int ism(int ieta, int iphi)
static MEChannel * lmrTree(int ilmr)
static int sc(SuperCrysCoord iX, SuperCrysCoord iY)
static std::vector< int > apdRefChannels(ME::LMMid ilmmod, ME::LMRid ilmr)
static std::vector< ME::LMMid > lmmodFromDcc(ME::DCCid idcc)
static int lmr(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
static std::vector< int > lmmodFromLmr(int ilmr)