45 verbosity_(pSet.getUntrackedParameter(
"verbosity", 1U)),
46 nChannels_(0), iEvent_(0)
59 std::cout <<
"*EcnaAnalyzer-constructor> Check path for resultsq Root files." << endl;
61 if( myPathEB->GetPathForResultsRootFiles() == kFALSE )
63 std::cout <<
"*EcnaAnalyzer-constructor> *** ERROR *** Path for result files not found." << endl;
64 kill(getpid(),SIGUSR2);
68 std::cout <<
"*EcnaAnalyzer-constructor> Path for result files found = " << myPathEB->ResultsRootFilePath() << endl;
71 if( myPathEE->GetPathForResultsRootFiles() == kFALSE )
73 std::cout <<
"*EcnaAnalyzer-constructor> *** ERROR *** Path for result files not found." << endl;
74 kill(getpid(),SIGUSR2);
78 std::cout <<
"*EcnaAnalyzer-constructor> Path for result files found = " << myPathEE->ResultsRootFilePath() << endl;
82 std::cout <<
"*EcnaAnalyzer-constructor> Parameter initialization." << 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;}
394 std::cout <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> fStexName = " <<
fStexName << endl;
399 std::cout <<
"*EcnaAnalyzer::EcnaAnalyzer-constructor> Init done. " << endl;
410 cout << setiosflags(ios::showpoint | ios::uppercase);
411 cout << setprecision(3) << setw(6);
412 cout.setf(ios::dec, ios::basefield);
413 cout.setf(ios::fixed, ios::floatfield);
414 cout.setf(ios::left, ios::adjustfield);
415 cout.setf(ios::right, ios::adjustfield);
417 std::cout <<
"EcnaAnalyzer::~EcnaAnalyzer()> destructor is going to be executed." << endl;
426 std::cout << endl <<
"!EcnaAnalyzer-destructor> **** ERROR **** fMyCnaEBSM = " <<
fMyCnaEBSM
428 <<
", last event fFedId(+601) = " <<
fFedId+601 << endl
446 if(
fMyCnaEBSM[iSM]->WriteRootFile() == kFALSE )
448 std::cout <<
"!EcnaAnalyzer-destructor> PROBLEM with write ROOT file for SM" << iSM+1
454 std::cout <<
"*EcnaAnalyzer-destructor> Calculations and writing on file already done for SM "
466 <<
", last event fFedId(+601) = " <<
fFedId+601 << endl
486 std::cout <<
"!EcnaAnalyzer-destructor> PROBLEM with write ROOT file for Dee" << iDee+1
492 std::cout <<
"*EcnaAnalyzer-destructor> Calculations and writing on file already done for Dee "
502 std::cout <<
"*EcnaAnalyzer-destructor> Status of events returned by GetSampleAdcValues(): "
509 if( fBuildEventDistribBad[i0Stex] > 0 )
514 std::cout << endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << endl;
516 std::cout <<
"*EcnaAnalyzer-destructor> Run types seen in event headers before selection:" << endl;
521 <<
" event header(s) with run type " <<
runtype(
i) << endl;
524 std::cout << endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << endl;
526 std::cout <<
"*EcnaAnalyzer-destructor> Mgpa gains seen in event headers before selection:" << endl;
531 <<
" event header(s) with gain " <<
gainvalue(
i) << endl;
534 std::cout << endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << endl;
536 std::cout <<
"*EcnaAnalyzer-destructor> Numbers of selected events for each FED:" << endl;
544 std::cout << endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << endl;
557 std::cout << endl<<
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " << endl;
567 std::cout <<
"*EcnaAnalyzer-destructor> End of execution." << endl;
581 cout << setiosflags(ios::showpoint | ios::uppercase);
582 cout << setprecision(3) << setw(6);
583 cout.setf(ios::dec, ios::basefield);
584 cout.setf(ios::fixed, ios::floatfield);
585 cout.setf(ios::left, ios::adjustfield);
586 cout.setf(ios::right, ios::adjustfield);
593 if( iFreq <= 0 ){iFreq = 10000;}
602 myEventHeader = pEventHeader.product();
608 headerItr != myEventHeader->end();++headerItr)
612 fRunNumber = (Int_t)headerItr->getRunNumber();
616 fFedId = (Int_t)headerItr->fedId() - 601;
662 fFedTcc = (Int_t)headerItr->getDccInTCCCommand();
668 if( fFedTcc < 10 || fFedTcc > 45 )
return;
713 Int_t MaxNbOfStex = 0;
736 if( Int_t(digisEB->
end()-digisEB->
begin()) >= 0 &&
737 Int_t(digisEB->
end()-digisEB->
begin()) <= Int_t(digisEB->
size()) )
748 EBDetId id_crystal(digiItr->id());
751 Int_t i0SM = id_crystal.
ism() - 1;
763 std::cout <<
"*EcnaAnalyzer::analyze(...)> ********* INIT ECNA EB ********* " << endl
769 <<
" SM = " << i0SM+1 << endl
785 time_t i_current_ev_time = (time_t)(t_current_ev_time>>32);
786 const time_t* p_current_ev_time = &i_current_ev_time;
787 char* astime = ctime(p_current_ev_time);
798 <<
". First analyzed event date : " << astime << endl;
806 if( i_current_ev_time >
fTimeLast[i0SM] )
812 Int_t iEta = id_crystal.ietaSM();
813 Int_t iPhi = id_crystal.iphiSM();
820 Int_t NbOfSamplesFromDigis = digiItr->size();
824 if( NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEBEcal->MaxSampADC() )
826 Double_t adcDBLS = (Double_t)0;
830 for (Int_t i0Sample=0; i0Sample<3; i0Sample++)
831 {adcDBLS += (Double_t)(df.
sample(i0Sample).
adc());}
832 adcDBLS /= (Double_t)3;
835 for (Int_t i0Sample=0; i0Sample<
fNbOfSamples; i0Sample++)
837 Double_t
adc = (Double_t)(df.
sample(i0Sample).
adc()) - adcDBLS;
852 std::cout <<
"EcnaAnalyzer::analyze(...)> NbOfSamplesFromDigis out of bounds = "
853 << NbOfSamplesFromDigis << endl;
888 if( Int_t(digisEE->
end()-digisEE->
begin()) >= 0 &&
889 Int_t(digisEE->
end()-digisEE->
begin()) <= Int_t(digisEE->
size()) )
899 EEDetId id_crystal(digiItr->id());
901 Int_t iX_data = id_crystal.
ix();
902 Int_t iY_data = id_crystal.iy();
903 Int_t i_quad = id_crystal.iquadrant();
904 Int_t i_sgnZ = id_crystal.zside();
910 if( i_quad == 1 || i_quad == 4 ){iX = iX_data - 50;}
911 if( i_quad == 3 || i_quad == 2 ){iX = 51 - iX_data;}
916 Int_t n1DeeNumber = 0;
917 if( i_quad == 1 && i_sgnZ == 1 ){n1DeeNumber = 2;}
918 if( i_quad == 1 && i_sgnZ == -1 ){n1DeeNumber = 3;}
919 if( i_quad == 2 && i_sgnZ == 1 ){n1DeeNumber = 1;}
920 if( i_quad == 2 && i_sgnZ == -1 ){n1DeeNumber = 4;}
921 if( i_quad == 3 && i_sgnZ == 1 ){n1DeeNumber = 1;}
922 if( i_quad == 3 && i_sgnZ == -1 ){n1DeeNumber = 4;}
923 if( i_quad == 4 && i_sgnZ == 1 ){n1DeeNumber = 2;}
924 if( i_quad == 4 && i_sgnZ == -1 ){n1DeeNumber = 3;}
926 Int_t i0Dee = n1DeeNumber-1;
938 std::cout <<
"*EcnaAnalyzer::analyze(...)> ********* INIT ECNA EE ********* " << endl
944 <<
" Dee = " << i0Dee+1 << endl
952 Bool_t cOKForTreatment = kFALSE;
960 if( !(fESFromFedTcc[
fFedTcc-1] == 5 || fESFromFedTcc[
fFedTcc-1] == 14) )
970 cOKForTreatment = kTRUE;
973 if( fESFromFedTcc[
fFedTcc-1] == 5 || fESFromFedTcc[
fFedTcc-1] == 14 )
997 cOKForTreatment = kTRUE;
1008 {cOKForTreatment = kTRUE;}
1011 if( cOKForTreatment== kTRUE )
1016 time_t i_current_ev_time = (time_t)(t_current_ev_time>>32);
1017 const time_t* p_current_ev_time = &i_current_ev_time;
1018 char* astime = ctime(p_current_ev_time);
1032 std::cout <<
"----- beginning of analysis for " <<
fStexName << i0Dee+1 <<
"-------" << endl
1036 <<
" First event date = " << astime << endl
1038 <<
"---------------------------------------------------------------" << endl;
1044 if( i_current_ev_time >
fTimeLast[i0Dee] )
1054 Int_t NbOfSamplesFromDigis = digiItr->size();
1058 if( NbOfSamplesFromDigis > 0 && NbOfSamplesFromDigis <= fMyEEEcal->MaxSampADC() )
1060 Double_t adcDBLS = (Double_t)0;
1064 for (Int_t i0Sample=0; i0Sample<3; i0Sample++)
1065 {adcDBLS += (Double_t)(df.
sample(i0Sample).
adc());}
1066 adcDBLS /= (Double_t)3;
1069 for (Int_t i0Sample = 0; i0Sample <
fNbOfSamples; i0Sample++)
1071 Double_t
adc = (Double_t)(df.
sample(i0Sample).
adc()) - adcDBLS;
1086 std::cout <<
"EcnaAnalyzer::analyze(...)> NbOfSamplesFromDigis out of bounds = "
1087 << NbOfSamplesFromDigis << endl;
1161 for( Int_t i0FedES= 0; i0FedES<= 3; i0FedES++ )
1170 for( Int_t i0FedES= 5; i0FedES<= 8; i0FedES++ )
1174 for( Int_t i0FedES= 9; i0FedES<=12; i0FedES++ )
1183 for( Int_t i0FedES=14; i0FedES<=17; i0FedES++ )
1187 for( Int_t i0Dee=0; i0Dee<4; i0Dee++ )
1216 std::cout <<
"---------- End of analysis for " <<
fStexName << i0Stex+1 <<
" -----------" << endl;
1217 Int_t n3 = 3;
CheckMsg(n3, i0Stex);
1224 <<
"'s with " <<
fReqNbOfEvts <<
" events analyzed." << endl
1225 <<
"---------------------------------------------------------" << endl;
1241 if(
fMyCnaEBSM[i0Stex]->WriteRootFile() == kFALSE )
1243 std::cout <<
"!EcnaAnalyzer::analyze> PROBLEM with write ROOT file for SM" << i0Stex+1
1249 std::cout <<
"!EcnaAnalyzer::analyze> Set memory free: delete done for SM " << i0Stex+1 << endl;
1265 if(
fMyCnaEEDee[i0Stex]->WriteRootFile() == kFALSE )
1267 std::cout <<
"!EcnaAnalyzer::analyze> PROBLEM with write ROOT file for Dee" << i0Stex+1
1273 std::cout <<
"!EcnaAnalyzer::analyze> Set memory free: delete done for Dee " << i0Stex+1 << endl;
1277 std::cout <<
"*---------------------------------------------------------------------------- " << endl;
1290 if( s_opt ==
"EVT" )
1292 Int_t MaxNbOfStex = 0;
1303 <<
"**************************** ANALYSIS REPORT > OK **************************************" << endl
1304 <<
"*EcnaAnalyzer::AnalysisOutcome(...)> The maximum requested number of events and the maximum" << endl
1306 <<
"'s have been reached." << endl
1307 <<
" Analysis successfully ended from EcnaAnalyzer " << endl
1308 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << endl
1310 <<
" Last requested event number = " <<
fLastReqEvent << endl
1315 std::cout <<
"****************************************************************************************" << endl
1319 kill(getpid(),SIGUSR2);
1327 <<
"**************************** ANALYSIS REPORT >>> *** WARNING *** WARNING *** WARNING ***" << endl
1328 <<
"*EcnaAnalyzer::AnalysisOutcome(...)> Last event reached before completion of analysis." << endl
1329 <<
" Analysis ended from EcnaAnalyzer " << endl
1330 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << endl
1332 <<
" Last requested event number = " <<
fLastReqEvent << endl
1337 std::cout <<
"****************************************************************************************" << endl
1341 kill(getpid(),SIGUSR2);
1346 if( s_opt ==
"ERR_FNEG" )
1349 <<
"**************************** ANALYSIS REPORT >>> **** ERROR **** ERROR **** ERROR ******" << endl
1350 <<
"*EcnaAnalyzer::AnalysisOutcome(...)> First event number = " <<
fFirstReqEvent
1351 <<
". Should be strictly potitive." << endl
1352 <<
" Analysis ended from EcnaAnalyzer " << endl
1353 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << endl;
1355 std::cout <<
"****************************************************************************************" << endl
1359 kill(getpid(),SIGUSR2);
1361 if( s_opt ==
"ERR_LREQ" )
1364 <<
"**************************** ANALYSIS REPORT >>> **** ERROR **** ERROR **** ERROR ******" << endl
1365 <<
"*EcnaAnalyzer::analyze(...)> Requested number of events = " <<
fReqNbOfEvts <<
"." << endl
1366 <<
" Too large compared to the event range: "
1368 <<
" Analysis ended from EcnaAnalyzer " << endl
1369 <<
" by SIGNAL: kill(getpid(),SIGUSR2)." << endl;
1371 std::cout <<
"****************************************************************************************" << endl
1375 kill(getpid(),SIGUSR2);
1382 {Int_t nm1 = -1;
CheckMsg(MsgNum, nm1);}
1389 {
std::cout <<
"---------------- CROSS-CHECK A ------------------ " << endl
1390 <<
"**************** CURRENT EVENT ****************** " << endl;}
1392 {
std::cout <<
"---------------- CROSS-CHECK B ------------------ " << endl
1393 <<
"**** FIRST EVENT PASSING USER'S ANALYSIS CUT **** " << endl;}
1395 {
std::cout <<
"---------------- CROSS-CHECK C ------------------ " << endl
1396 <<
"*** CURRENT VALUES BEFORE RESULT FILE WRITING *** " << endl;}
1397 if( MsgNum == 3 || MsgNum == 4 )
1406 <<
" fFedTcc = " <<
fFedTcc << endl
1407 <<
" fFedId(+601) = " <<
fFedId+601 << endl
1423 << setw(5) << nStexNbOfTreatedEvents <<
" events. "
1425 if( j0Stex == i0Stex ){
std::cout <<
" (going to write file for this " <<
fStexName <<
").";}
1438 std::cout <<
"Fed (ES) " << setw(3) << i0FedES+1 <<
": "
1439 << setw(5) << nFedNbOfTreatedEvents <<
" events."
1450 if( j0Stex == i0Stex ){
std::cout <<
" (going to write file for this " <<
fStexName <<
").";}
1459 if( MsgNum == 1 || MsgNum == 2 )
1460 {
std::cout <<
"*---------------------------------------------------------------------------- " << endl;}
1462 {
std::cout <<
"*............................................................................ " << endl;}
1468 TString cType =
"?";
1470 if( numtype == 0 ){cType =
"COSMICS";}
1471 if( numtype == 1 ){cType =
"BEAMH4";}
1472 if( numtype == 2 ){cType =
"BEAMH2";}
1473 if( numtype == 3 ){cType =
"MTCC";}
1474 if( numtype == 4 ){cType =
"LASER_STD";}
1475 if( numtype == 5 ){cType =
"LASER_POWER_SCAN";}
1476 if( numtype == 6 ){cType =
"LASER_DELAY_SCAN";}
1477 if( numtype == 7 ){cType =
"TESTPULSE_SCAN_MEM";}
1478 if( numtype == 8 ){cType =
"TESTPULSE_MGPA";}
1479 if( numtype == 9 ){cType =
"PEDESTAL_STD";}
1480 if( numtype == 10 ){cType =
"PEDESTAL_OFFSET_SCAN";}
1481 if( numtype == 11 ){cType =
"PEDESTAL_25NS_SCAN";}
1482 if( numtype == 12 ){cType =
"LED_STD";}
1484 if( numtype == 13 ){cType =
"PHYSICS_GLOBAL";}
1485 if( numtype == 14 ){cType =
"COSMICS_GLOBAL";}
1486 if( numtype == 15 ){cType =
"HALO_GLOBAL";}
1488 if( numtype == 16 ){cType =
"LASER_GAP";}
1489 if( numtype == 17 ){cType =
"TESTPULSE_GAP";}
1490 if( numtype == 18 ){cType =
"PEDESTAL_GAP";}
1491 if( numtype == 19 ){cType =
"LED_GAP";}
1493 if( numtype == 20 ){cType =
"PHYSICS_LOCAL";}
1494 if( numtype == 21 ){cType =
"COSMICS_LOCAL";}
1495 if( numtype == 22 ){cType =
"HALO_LOCAL";}
1496 if( numtype == 23 ){cType =
"CALIB_LOCAL";}
1498 if( numtype == 24 ){cType =
"PEDSIM";}
1507 if( numgain == 1 ){value = 12;}
1508 if( numgain == 2 ){value = 6;}
1509 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
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< T >::const_iterator const_iterator
EcalMGPASample sample(int i) const
Int_t * fFedNbOfTreatedEvents
TEcnaNumbering * fMyEENumbering
const_iterator begin() const
Int_t Get0TowEchaFrom1SMCrys(const Int_t &)
string eventHeaderCollection_
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
Int_t fMaxTreatedStexCounter
unsigned long long Time_t
Int_t Get1SCEchaFrom1DeeCrys(const Int_t &, const TString &)
string eventHeaderProducer_
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
TimeValue_t value() const
T const * product() const
TString * fDeeNumberString
const_iterator end() const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
Int_t * fMemoDateFirstEvent
void StartStopTime(time_t, time_t)
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