#include <CalibCalorimetry/EcalPedestalOffsets/interface/testChannel.h>
Public Member Functions | |
void | analyze (edm::Event const &event, edm::EventSetup const &eventSetup) |
! Analyze | |
void | beginJob (edm::EventSetup const &eventSetup) |
BeginJob. | |
void | endJob (void) |
EndJob. | |
void | subscribe (void) |
Subscribe/Unsubscribe to Monitoring Elements. | |
void | subscribeNew (void) |
testChannel (const edm::ParameterSet &ps) | |
Constructor. | |
void | unsubscribe (void) |
virtual | ~testChannel () |
Destructor. | |
Private Member Functions | |
int | getHeaderSMId (const int headerId) |
Private Attributes | |
int | m_bestPed |
int | m_DACmax |
int | m_DACmin |
name of the xml file to be saved | |
std::string | m_digiCollection |
std::string | m_digiProducer |
secondary name given to collection of digis | |
std::string | m_headerProducer |
name of module/plugin/producer making digis | |
TH2F | m_pedVSDAC |
double | m_RMSmax |
TH2F | m_singlePedVSDAC_1 |
TH2F | m_singlePedVSDAC_2 |
TH2F | m_singlePedVSDAC_3 |
std::string | m_xmlFile |
name of module/plugin/producer making headers | |
int | m_xtal |
Definition at line 39 of file testChannel.h.
testChannel::testChannel | ( | const edm::ParameterSet & | ps | ) |
Constructor.
ctor
Definition at line 19 of file testChannel.cc.
References m_bestPed, m_DACmax, m_DACmin, and m_RMSmax.
00019 : 00020 m_digiCollection (paramSet.getParameter<std::string> ("digiCollection")) , 00021 m_digiProducer (paramSet.getParameter<std::string> ("digiProducer")) , 00022 m_headerProducer (paramSet.getParameter<std::string> ("headerProducer")) , 00023 m_xmlFile (paramSet.getParameter<std::string> ("xmlFile")) , 00024 m_DACmin (paramSet.getParameter<int> ("DACmin")) , 00025 m_DACmax (paramSet.getParameter<int> ("DACmax")) , 00026 m_RMSmax (paramSet.getParameter<double> ("RMSmax")) , 00027 m_bestPed (paramSet.getParameter<int> ("bestPed")) , 00028 m_xtal (paramSet.getParameter<int> ("xtal")) , 00029 m_pedVSDAC ("pedVSDAC","pedVSDAC",100,150,250,m_DACmax-m_DACmin,m_DACmin,m_DACmax) , 00030 m_singlePedVSDAC_1 ("singlePedVSDAC_1","pedVSDAC (g1) for xtal "+m_xtal,100,150,250,m_DACmax-m_DACmin,m_DACmin,m_DACmax) , 00031 m_singlePedVSDAC_2 ("singlePedVSDAC_2","pedVSDAC (g2) for xtal "+m_xtal,100,150,250,m_DACmax-m_DACmin,m_DACmin,m_DACmax) , 00032 m_singlePedVSDAC_3 ("singlePedVSDAC_3","pedVSDAC (g3) for xtal "+m_xtal,100,150,250,m_DACmax-m_DACmin,m_DACmin,m_DACmax) 00033 { 00034 edm::LogInfo ("testChannel") << " reading " 00035 << " m_DACmin: " << m_DACmin 00036 << " m_DACmax: " << m_DACmax 00037 << " m_RMSmax: " << m_RMSmax 00038 << " m_bestPed: " << m_bestPed ; 00039 }
testChannel::~testChannel | ( | ) | [virtual] |
void testChannel::analyze | ( | edm::Event const & | event, | |
edm::EventSetup const & | eventSetup | |||
) | [virtual] |
! Analyze
perform te analysis
loop over the headers
Implements edm::EDAnalyzer.
Definition at line 56 of file testChannel.cc.
References EcalMGPASample::adc(), EcalMGPASample::gainId(), ecalMGPA::gainId(), getHeaderSMId(), edm::Handle< T >::isValid(), LogDebug, m_digiCollection, m_digiProducer, m_headerProducer, m_pedVSDAC, m_singlePedVSDAC_1, m_singlePedVSDAC_2, m_singlePedVSDAC_3, m_xtal, EcalDataFrame::MAXSAMPLES, EcalDCCHeaderBlock::EcalDCCEventSettings::ped_offset, and EcalDataFrame::sample().
00058 { 00059 LogDebug ("testChannel") << "entering analyze ..." ; 00060 00061 // get the headers 00062 // (one header for each supermodule) 00063 edm::Handle<EcalRawDataCollection> DCCHeaders ; 00064 event.getByLabel (m_headerProducer, DCCHeaders) ; 00065 if(!DCCHeaders.isValid()) 00066 { 00067 edm::LogError ("testChannel") << "Error! can't get the product " 00068 << m_headerProducer.c_str () ; 00069 } 00070 00071 std::map <int,int> DACvalues ; 00072 00073 // loop over the headers 00074 for ( EcalRawDataCollection::const_iterator headerItr= DCCHeaders->begin () ; 00075 headerItr != DCCHeaders->end () ; 00076 ++headerItr ) 00077 { 00078 EcalDCCHeaderBlock::EcalDCCEventSettings settings = headerItr->getEventSettings () ; 00079 DACvalues[getHeaderSMId (headerItr->id ())] = settings.ped_offset ; 00080 // std::cout << "DCCid: " << headerItr->id () << "" ; 00081 // std::cout << "Ped offset DAC: " << settings.ped_offset << "" ; 00082 } 00083 00084 // get the digis 00085 // (one digi for each crystal) 00086 edm::Handle<EBDigiCollection> pDigis; 00087 event.getByLabel (m_digiProducer, pDigis) ; 00088 if(!pDigis.isValid()) 00089 { 00090 edm::LogError ("testChannel") << "Error! can't get the product " 00091 << m_digiCollection.c_str () ; 00092 } 00093 00094 // loop over the digis 00095 for (EBDigiCollection::const_iterator itdigi = pDigis->begin () ; 00096 itdigi != pDigis->end () ; 00097 ++itdigi) 00098 { 00099 EBDataFrame df( *itdigi ); 00100 int gainId = df.sample (0).gainId () ; 00101 int crystalId = EBDetId(itdigi->id ()).ic () ; 00102 int smId = EBDetId(itdigi->id ()).ism () ; 00103 00104 edm::LogInfo ("testChannel") << "channel " << event.id () 00105 << "\tcry: " << crystalId 00106 << "\tG: " << gainId 00107 << "\tDAC: " << DACvalues[smId] ; 00108 00109 // loop over the samples 00110 for (int iSample = 0; iSample < EBDataFrame::MAXSAMPLES ; ++iSample) 00111 { 00112 edm::LogInfo ("testChannel") << "\t`-->" << df.sample (iSample).adc () ; 00113 m_pedVSDAC.Fill (df.sample (iSample).adc (),DACvalues[smId]) ; 00114 if (crystalId == m_xtal) 00115 { 00116 if (gainId == 1) m_singlePedVSDAC_1.Fill (df.sample (iSample).adc (),DACvalues[smId]) ; 00117 if (gainId == 2) m_singlePedVSDAC_2.Fill (df.sample (iSample).adc (),DACvalues[smId]) ; 00118 if (gainId == 3) m_singlePedVSDAC_3.Fill (df.sample (iSample).adc (),DACvalues[smId]) ; 00119 } 00120 } // loop over the samples 00121 } // loop over the digis 00122 00123 }
void testChannel::beginJob | ( | edm::EventSetup const & | eventSetup | ) | [virtual] |
BeginJob.
begin the job
Reimplemented from edm::EDAnalyzer.
Definition at line 49 of file testChannel.cc.
References LogDebug.
00050 { 00051 LogDebug ("testChannel") << "entering beginJob ..." ; 00052 }
EndJob.
perform the minimiation and write results
Reimplemented from edm::EDAnalyzer.
Definition at line 126 of file testChannel.cc.
References m_pedVSDAC, m_singlePedVSDAC_1, m_singlePedVSDAC_2, m_singlePedVSDAC_3, m_xtal, and out.
00127 { 00128 char ccout[80] ; 00129 sprintf (ccout,"out_%d.root",m_xtal) ; 00130 TFile out (ccout,"RECREATE") ; 00131 out.cd () ; 00132 m_pedVSDAC.Write () ; 00133 m_singlePedVSDAC_1.Write () ; 00134 m_singlePedVSDAC_2.Write () ; 00135 m_singlePedVSDAC_3.Write () ; 00136 TProfile * profilo1 = m_singlePedVSDAC_1.ProfileX () ; 00137 TProfile * profilo2 = m_singlePedVSDAC_2.ProfileX () ; 00138 TProfile * profilo3 = m_singlePedVSDAC_3.ProfileX () ; 00139 profilo1->Write ("singleProfile_1") ; 00140 profilo2->Write ("singleProfile_2") ; 00141 profilo3->Write ("singleProfile_3") ; 00142 out.Close () ; 00143 }
Definition at line 151 of file testChannel.cc.
Referenced by analyze().
00152 { 00153 //PG FIXME temporary solution 00154 //PG FIXME check it is consistent with the TB! 00155 return 1 ; 00156 }
int testChannel::m_bestPed [private] |
int testChannel::m_DACmax [private] |
int testChannel::m_DACmin [private] |
name of the xml file to be saved
Definition at line 74 of file testChannel.h.
Referenced by testChannel().
std::string testChannel::m_digiCollection [private] |
std::string testChannel::m_digiProducer [private] |
secondary name given to collection of digis
Definition at line 69 of file testChannel.h.
Referenced by analyze().
std::string testChannel::m_headerProducer [private] |
name of module/plugin/producer making digis
Definition at line 70 of file testChannel.h.
Referenced by analyze().
TH2F testChannel::m_pedVSDAC [private] |
double testChannel::m_RMSmax [private] |
TH2F testChannel::m_singlePedVSDAC_1 [private] |
TH2F testChannel::m_singlePedVSDAC_2 [private] |
TH2F testChannel::m_singlePedVSDAC_3 [private] |
std::string testChannel::m_xmlFile [private] |
int testChannel::m_xtal [private] |