45 verbosity_(pSet.getUntrackedParameter(
"verbosity", 1U)),
46 nChannels_(0), iEvent_(0)
59 std::cout <<
"*EcnaAnalyzer-constructor> Check path for resultsq Root files." << std::endl;
61 if( myPathEB->GetPathForResultsRootFiles() == kFALSE )
63 std::cout <<
"*EcnaAnalyzer-constructor> *** ERROR *** Path for result files not found." << std::endl;
64 kill(getpid(),SIGUSR2);
68 std::cout <<
"*EcnaAnalyzer-constructor> Path for result files found = " << myPathEB->ResultsRootFilePath() << std::endl;
71 if( myPathEE->GetPathForResultsRootFiles() == kFALSE )
73 std::cout <<
"*EcnaAnalyzer-constructor> *** ERROR *** Path for result files not found." << std::endl;
74 kill(getpid(),SIGUSR2);
78 std::cout <<
"*EcnaAnalyzer-constructor> Path for result files found = " << myPathEE->ResultsRootFilePath() << std::endl;
82 std::cout <<
"*EcnaAnalyzer-constructor> Parameter initialization." << std::endl;
221 for(Int_t nFedTcc= 1; nFedTcc<=MaxSMAndDS; nFedTcc++){
fESFromFedTcc[nFedTcc-1] = -1;}
223 for(Int_t nFedTcc= 1;nFedTcc<= 3;nFedTcc++){
fESFromFedTcc[nFedTcc-1]=nFedTcc+ 6;}
224 for(Int_t nFedTcc= 4;nFedTcc<= 9;nFedTcc++){
fESFromFedTcc[nFedTcc-1]=nFedTcc- 3;}
226 for(Int_t nFedTcc=10;nFedTcc<=27;nFedTcc++){
fSMFromFedTcc[nFedTcc-1]=nFedTcc+ 9;}
227 for(Int_t nFedTcc=28;nFedTcc<=45;nFedTcc++){
fSMFromFedTcc[nFedTcc-1]=nFedTcc-27;}
229 for(Int_t nFedTcc=46;nFedTcc<=48;nFedTcc++){
fESFromFedTcc[nFedTcc-1]=nFedTcc-30;}
230 for(Int_t nFedTcc=49;nFedTcc<=54;nFedTcc++){
fESFromFedTcc[nFedTcc-1]=nFedTcc-39;}
404 std::cout <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> fNbOfSamples = " <<
fNbOfSamples << std::endl;
407 std::cout <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> fReqNbOfEvts = " <<
fReqNbOfEvts << std::endl;
408 std::cout <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> fStexName = " <<
fStexName << std::endl;
409 std::cout <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> fStexNumber = " <<
fStexNumber << std::endl;
413 std::cout <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> Init done. " << std::endl;
424 std::cout << std::setiosflags(std::ios::showpoint | std::ios::uppercase);
425 std::cout << std::setprecision(3) << std::setw(6);
426 cout.setf(std::ios::dec, std::ios::basefield);
427 cout.setf(std::ios::fixed, std::ios::floatfield);
428 cout.setf(std::ios::left, std::ios::adjustfield);
429 cout.setf(std::ios::right, std::ios::adjustfield);
431 std::cout <<
"EcnaAnalyzer::~EcnaAnalyzer()> destructor is going to be executed." << std::endl;
440 std::cout << std::endl <<
"!EcnaAnalyzer-destructor> **** ERROR **** fMyCnaEBSM = " <<
fMyCnaEBSM
441 <<
". !===> ECNA HAS NOT BEEN INITIALIZED." << std::endl
446 <<
", last event fFedId(+601) = " <<
fFedId+601 << std::endl << std::endl;
463 if(
fMyCnaEBSM[iSM]->WriteRootFile() == kFALSE )
465 std::cout <<
"!EcnaAnalyzer-destructor> PROBLEM with write ROOT file for SM" << iSM+1
471 std::cout <<
"*EcnaAnalyzer-destructor> Calculations and writing on file already done for SM "
472 << iSM+1 << std::endl;
481 std::cout << std::endl <<
"!EcnaAnalyzer-destructor> **** ERROR **** fMyCnaEEDee = " <<
fMyCnaEEDee
482 <<
". !===> ECNA HAS NOT BEEN INITIALIZED." << std::endl
487 <<
", last event fFedId(+601) = " <<
fFedId+601 << std::endl << std::endl;
506 std::cout <<
"!EcnaAnalyzer-destructor> PROBLEM with write ROOT file for Dee" << iDee+1
512 std::cout <<
"*EcnaAnalyzer-destructor> Calculations and writing on file already done for Dee "
513 << iDee+1 << std::endl;
522 std::cout <<
"*EcnaAnalyzer-destructor> Status of events returned by GetSampleAdcValues(): "
529 if( fBuildEventDistribBad[i0Stex] > 0 )
534 std::cout << std::endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
536 std::cout <<
"*EcnaAnalyzer-destructor> Run types seen in event headers before selection:" << std::endl;
541 <<
" event header(s) with run type " <<
runtype(
i) << std::endl;
544 std::cout << std::endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
546 std::cout <<
"*EcnaAnalyzer-destructor> Mgpa gains seen in event headers before selection:" << std::endl;
551 <<
" event header(s) with gain " <<
gainvalue(
i) << std::endl;
554 std::cout << std::endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
556 std::cout <<
"*EcnaAnalyzer-destructor> Numbers of selected events for each FED:" << std::endl;
564 std::cout << std::endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
577 std::cout << std::endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << std::endl;
587 std::cout <<
"*EcnaAnalyzer-destructor> End of execution." << std::endl;
601 std::cout << std::setiosflags(std::ios::showpoint | std::ios::uppercase);
602 std::cout << std::setprecision(3) << std::setw(6);
603 cout.setf(std::ios::dec, std::ios::basefield);
604 cout.setf(std::ios::fixed, std::ios::floatfield);
605 cout.setf(std::ios::left, std::ios::adjustfield);
606 cout.setf(std::ios::right, std::ios::adjustfield);
613 if( iFreq <= 0 ){iFreq = 10000;}
622 myEventHeader = pEventHeader.product();
628 headerItr != myEventHeader->end();++headerItr)
632 fRunNumber = (Int_t)headerItr->getRunNumber();
636 fFedId = (Int_t)headerItr->fedId() - 601;
683 fFedTcc = (Int_t)headerItr->getDccInTCCCommand();
689 if( fFedTcc < 10 || fFedTcc > 45 )
return;
734 Int_t MaxNbOfStex = 0;
757 if( Int_t(digisEB->
end()-digisEB->
begin()) >= 0 &&
758 Int_t(digisEB->
end()-digisEB->
begin()) <= Int_t(digisEB->
size()) )
769 EBDetId id_crystal(digiItr->id());
772 Int_t i0SM = id_crystal.
ism() - 1;
784 std::cout <<
"*EcnaAnalyzer::analyze(...)> ********* INIT ECNA EB ********* " << std::endl
786 <<
" fRunNumber = " <<
fRunNumber << std::endl
790 <<
" SM = " << i0SM+1 << std::endl
806 time_t i_current_ev_time = (time_t)(t_current_ev_time>>32);
807 const time_t* p_current_ev_time = &i_current_ev_time;
808 char* astime = ctime(p_current_ev_time);
819 <<
". First analyzed event date : " << astime << std::endl;
827 if( i_current_ev_time >
fTimeLast[i0SM] )
833 Int_t iEta = id_crystal.ietaSM();
834 Int_t iPhi = id_crystal.iphiSM();
841 Int_t NbOfSamplesFromDigis = digiItr->size();
845 if( NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEBEcal->MaxSampADC() )
847 Double_t adcDBLS = (Double_t)0;
851 for (Int_t i0Sample=0; i0Sample<3; i0Sample++)
852 {adcDBLS += (Double_t)(df.
sample(i0Sample).
adc());}
853 adcDBLS /= (Double_t)3;
856 for (Int_t i0Sample=0; i0Sample<
fNbOfSamples; i0Sample++)
858 Double_t
adc = (Double_t)(df.
sample(i0Sample).
adc()) - adcDBLS;
873 std::cout <<
"EcnaAnalyzer::analyze(...)> NbOfSamplesFromDigis out of bounds = "
874 << NbOfSamplesFromDigis << std::endl;
909 if( Int_t(digisEE->
end()-digisEE->
begin()) >= 0 &&
910 Int_t(digisEE->
end()-digisEE->
begin()) <= Int_t(digisEE->
size()) )
920 EEDetId id_crystal(digiItr->id());
922 Int_t iX_data = id_crystal.
ix();
923 Int_t iY_data = id_crystal.iy();
924 Int_t i_quad = id_crystal.iquadrant();
925 Int_t i_sgnZ = id_crystal.zside();
931 if( i_quad == 1 || i_quad == 4 ){iX = iX_data - 50;}
932 if( i_quad == 3 || i_quad == 2 ){iX = 51 - iX_data;}
937 Int_t n1DeeNumber = 0;
938 if( i_quad == 1 && i_sgnZ == 1 ){n1DeeNumber = 2;}
939 if( i_quad == 1 && i_sgnZ == -1 ){n1DeeNumber = 3;}
940 if( i_quad == 2 && i_sgnZ == 1 ){n1DeeNumber = 1;}
941 if( i_quad == 2 && i_sgnZ == -1 ){n1DeeNumber = 4;}
942 if( i_quad == 3 && i_sgnZ == 1 ){n1DeeNumber = 1;}
943 if( i_quad == 3 && i_sgnZ == -1 ){n1DeeNumber = 4;}
944 if( i_quad == 4 && i_sgnZ == 1 ){n1DeeNumber = 2;}
945 if( i_quad == 4 && i_sgnZ == -1 ){n1DeeNumber = 3;}
947 Int_t i0Dee = n1DeeNumber-1;
959 std::cout <<
"*EcnaAnalyzer::analyze(...)> ********* INIT ECNA EE ********* " << std::endl
961 <<
" fRunNumber = " <<
fRunNumber << std::endl
965 <<
" Dee = " << i0Dee+1 << std::endl
973 Bool_t cOKForTreatment = kFALSE;
982 if( !(fESFromFedTcc[
fFedTcc-1] == 5 || fESFromFedTcc[
fFedTcc-1] == 14) )
992 cOKForTreatment = kTRUE;
995 if( fESFromFedTcc[
fFedTcc-1] == 5 || fESFromFedTcc[
fFedTcc-1] == 14 )
1019 cOKForTreatment = kTRUE;
1030 {cOKForTreatment = kTRUE;}
1033 if( cOKForTreatment== kTRUE )
1038 time_t i_current_ev_time = (time_t)(t_current_ev_time>>32);
1039 const time_t* p_current_ev_time = &i_current_ev_time;
1040 char* astime = ctime(p_current_ev_time);
1056 std::cout <<
"----- beginning of analysis for " <<
fStexName << i0Dee+1 <<
"-------" << std::endl
1060 <<
" First event date = " << astime << std::endl
1062 <<
"---------------------------------------------------------------" << std::endl;
1068 if( i_current_ev_time >
fTimeLast[i0Dee] )
1078 Int_t NbOfSamplesFromDigis = digiItr->size();
1082 if( NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEEEcal->MaxSampADC() )
1084 Double_t adcDBLS = (Double_t)0;
1088 for (Int_t i0Sample=0; i0Sample<3; i0Sample++)
1089 {adcDBLS += (Double_t)(df.
sample(i0Sample).
adc());}
1090 adcDBLS /= (Double_t)3;
1093 for (Int_t i0Sample = 0; i0Sample <
fNbOfSamples; i0Sample++)
1095 Double_t
adc = (Double_t)(df.
sample(i0Sample).
adc()) - adcDBLS;
1110 std::cout <<
"EcnaAnalyzer::analyze(...)> NbOfSamplesFromDigis out of bounds = "
1111 << NbOfSamplesFromDigis << std::endl;
1188 for( Int_t i0FedES= 0; i0FedES<= 3; i0FedES++ )
1197 for( Int_t i0FedES= 5; i0FedES<= 8; i0FedES++ )
1201 for( Int_t i0FedES= 9; i0FedES<=12; i0FedES++ )
1210 for( Int_t i0FedES=14; i0FedES<=17; i0FedES++ )
1214 for( Int_t i0Dee=0; i0Dee<4; i0Dee++ )
1243 std::cout <<
"---------- End of analysis for " <<
fStexName << i0Stex+1 <<
" -----------" << std::endl;
1244 Int_t n3 = 3;
CheckMsg(n3, i0Stex);
1251 <<
"'s with " <<
fReqNbOfEvts <<
" events analyzed." << std::endl
1252 <<
"---------------------------------------------------------" << std::endl;
1268 if(
fMyCnaEBSM[i0Stex]->WriteRootFile() == kFALSE )
1270 std::cout <<
"!EcnaAnalyzer::analyze> PROBLEM with write ROOT file for SM" << i0Stex+1
1276 std::cout <<
"!EcnaAnalyzer::analyze> Set memory free: delete done for SM " << i0Stex+1 << std::endl;
1292 if(
fMyCnaEEDee[i0Stex]->WriteRootFile() == kFALSE )
1294 std::cout <<
"!EcnaAnalyzer::analyze> PROBLEM with write ROOT file for Dee" << i0Stex+1
1300 std::cout <<
"!EcnaAnalyzer::analyze> Set memory free: delete done for Dee " << i0Stex+1 << std::endl;
1304 std::cout <<
"*---------------------------------------------------------------------------- " << std::endl;
1317 if( s_opt ==
"EVT" )
1319 Int_t MaxNbOfStex = 0;
1330 <<
"**************************** ANALYSIS REPORT > OK **************************************" << std::endl
1331 <<
"*EcnaAnalyzer::AnalysisOutcome(...)> The maximum requested number of events and the maximum" << std::endl
1333 <<
"'s have been reached." << std::endl
1334 <<
" Analysis successfully ended from EcnaAnalyzer " << std::endl
1335 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << std::endl
1337 <<
" Last requested event number = " <<
fLastReqEvent << std::endl
1342 std::cout <<
"****************************************************************************************" << std::endl
1346 kill(getpid(),SIGUSR2);
1354 <<
"**************************** ANALYSIS REPORT >>> *** WARNING *** WARNING *** WARNING ***" << std::endl
1355 <<
"*EcnaAnalyzer::AnalysisOutcome(...)> Last event reached before completion of analysis." << std::endl
1356 <<
" Analysis ended from EcnaAnalyzer " << std::endl
1357 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << std::endl
1359 <<
" Last requested event number = " <<
fLastReqEvent << std::endl
1364 std::cout <<
"****************************************************************************************" << std::endl
1368 kill(getpid(),SIGUSR2);
1373 if( s_opt ==
"ERR_FNEG" )
1376 <<
"**************************** ANALYSIS REPORT >>> **** ERROR **** ERROR **** ERROR ******" << std::endl
1377 <<
"*EcnaAnalyzer::AnalysisOutcome(...)> First event number = " <<
fFirstReqEvent
1378 <<
". Should be strictly potitive." << std::endl
1379 <<
" Analysis ended from EcnaAnalyzer " << std::endl
1380 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << std::endl;
1382 std::cout <<
"****************************************************************************************" << std::endl
1386 kill(getpid(),SIGUSR2);
1388 if( s_opt ==
"ERR_LREQ" )
1391 <<
"**************************** ANALYSIS REPORT >>> **** ERROR **** ERROR **** ERROR ******" << std::endl
1392 <<
"*EcnaAnalyzer::analyze(...)> Requested number of events = " <<
fReqNbOfEvts <<
"." << std::endl
1393 <<
" Too large compared to the event range: "
1395 <<
" Analysis ended from EcnaAnalyzer " << std::endl
1396 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << std::endl;
1398 std::cout <<
"****************************************************************************************" << std::endl
1402 kill(getpid(),SIGUSR2);
1409 {Int_t nm1 = -1;
CheckMsg(MsgNum, nm1);}
1416 {
std::cout <<
"---------------- CROSS-CHECK A ------------------ " << std::endl
1417 <<
"**************** CURRENT EVENT ****************** " << std::endl;}
1419 {
std::cout <<
"---------------- CROSS-CHECK B ------------------ " << std::endl
1420 <<
"**** FIRST EVENT PASSING USER'S ANALYSIS CUT **** " << std::endl;}
1422 {
std::cout <<
"---------------- CROSS-CHECK C ------------------ " << std::endl
1423 <<
"*** CURRENT VALUES BEFORE RESULT FILE WRITING *** " << std::endl;}
1424 if( MsgNum == 3 || MsgNum == 4 )
1426 <<
" fEvtNumber = " <<
fEvtNumber << std::endl;}
1430 <<
" fRunNumber = " <<
fRunNumber << std::endl
1433 <<
" fFedTcc = " <<
fFedTcc << std::endl
1434 <<
" fFedId(+601) = " <<
fFedId+601 << std::endl
1435 <<
" fStexName = " <<
fStexName << std::endl
1451 << std::setw(5) << nStexNbOfTreatedEvents <<
" events. "
1453 if( j0Stex == i0Stex ){
std::cout <<
" (going to write file for this " <<
fStexName <<
").";}
1466 std::cout <<
"Fed (ES) " << std::setw(3) << i0FedES+1 <<
": "
1467 << std::setw(5) << nFedNbOfTreatedEvents <<
" events."
1478 if( j0Stex == i0Stex ){
std::cout <<
" (going to write file for this " <<
fStexName <<
").";}
1487 if( MsgNum == 1 || MsgNum == 2 )
1488 {
std::cout <<
"*---------------------------------------------------------------------------- " << std::endl;}
1490 {
std::cout <<
"*............................................................................ " << std::endl;}
1496 TString cType =
"?";
1498 if( numtype == 0 ){cType =
"COSMICS";}
1499 if( numtype == 1 ){cType =
"BEAMH4";}
1500 if( numtype == 2 ){cType =
"BEAMH2";}
1501 if( numtype == 3 ){cType =
"MTCC";}
1502 if( numtype == 4 ){cType =
"LASER_STD";}
1503 if( numtype == 5 ){cType =
"LASER_POWER_SCAN";}
1504 if( numtype == 6 ){cType =
"LASER_DELAY_SCAN";}
1505 if( numtype == 7 ){cType =
"TESTPULSE_SCAN_MEM";}
1506 if( numtype == 8 ){cType =
"TESTPULSE_MGPA";}
1507 if( numtype == 9 ){cType =
"PEDESTAL_STD";}
1508 if( numtype == 10 ){cType =
"PEDESTAL_OFFSET_SCAN";}
1509 if( numtype == 11 ){cType =
"PEDESTAL_25NS_SCAN";}
1510 if( numtype == 12 ){cType =
"LED_STD";}
1512 if( numtype == 13 ){cType =
"PHYSICS_GLOBAL";}
1513 if( numtype == 14 ){cType =
"COSMICS_GLOBAL";}
1514 if( numtype == 15 ){cType =
"HALO_GLOBAL";}
1516 if( numtype == 16 ){cType =
"LASER_GAP";}
1517 if( numtype == 17 ){cType =
"TESTPULSE_GAP";}
1518 if( numtype == 18 ){cType =
"PEDESTAL_GAP";}
1519 if( numtype == 19 ){cType =
"LED_GAP";}
1521 if( numtype == 20 ){cType =
"PHYSICS_LOCAL";}
1522 if( numtype == 21 ){cType =
"COSMICS_LOCAL";}
1523 if( numtype == 22 ){cType =
"HALO_LOCAL";}
1524 if( numtype == 23 ){cType =
"CALIB_LOCAL";}
1527 if( numtype == 24 ){cType =
"PEDSIM";}
1528 if( numtype == 25 ){cType =
"ANY_RUN";}
1537 if( numgain == 1 ){value = 12;}
1538 if( numgain == 2 ){value = 6;}
1539 if( numgain == 3 ){value = 1;}
int adc(sample_type sample)
get the ADC sample (12 bits)
T getParameter(std::string const &) const
EventNumber_t event() const
Int_t * fStexNbOfTreatedEvents
std::string digiProducer_
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
void GetReadyToReadData(const TString &, const Int_t &, const Int_t &, const Int_t &, const Int_t &, const Int_t &)
Int_t * fBuildEventDistribBad
TString runtype(const Int_t &)
Int_t fChozenRunTypeNumber
EcnaAnalyzer(const edm::ParameterSet &)
Int_t fMaxMgpaGainCounter
TString GetDeeDirViewedFromIP(const Int_t &)
std::vector< EcalDCCHeaderBlock >::const_iterator const_iterator
EcalMGPASample sample(int i) const
Int_t * fFedNbOfTreatedEvents
TEcnaNumbering * fMyEENumbering
const_iterator begin() const
Int_t Get0TowEchaFrom1SMCrys(const Int_t &)
Int_t gainvalue(const Int_t &)
Int_t Get1DeeSCEcnaFrom1DeeCrys(const Int_t &, const TString &)
Bool_t AnalysisOutcome(const TString &)
void CheckMsg(const Int_t &, const Int_t &)
Int_t fCurrentEventNumber
Int_t Get1SMTowFrom1SMCrys(const Int_t &)
int ism() const
get the ECAL/SM id
std::string EBdigiCollection_
Int_t fMaxTreatedStexCounter
unsigned long long Time_t
Int_t Get1SCEchaFrom1DeeCrys(const Int_t &, const TString &)
Int_t fNbOfSelectedEvents
TEcnaNumbering * fMyEBNumbering
Int_t * fBuildEventDistribGood
unsigned long long TimeValue_t
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Int_t * fNbOfTreatedFedsInStex
std::string eventHeaderProducer_
T const * product() const
TString * fDeeNumberString
const_iterator end() const
std::string eventHeaderCollection_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::string EEdigiCollection_
Int_t * fMemoDateFirstEvent
void StartStopTime(time_t, time_t)
TimeValue_t value() const
TEcnaObject * fMyEcnaEBObjectManager
edm::Timestamp time() const
TEcnaObject * fMyEcnaEEObjectManager
int adc() const
get the ADC sample (12 bits)
void StartStopDate(const TString &, const TString &)
Int_t * fNbOfTreatedFedsInDee