CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
testChannel Class Reference

calculate the best DAC value to obtain a pedestal = 200 More...

#include <testChannel.h>

Inheritance diagram for testChannel:
edm::EDAnalyzer

Public Member Functions

void analyze (edm::Event const &event, edm::EventSetup const &eventSetup)
 ! Analyze More...
 
void beginJob ()
 BeginJob. More...
 
void endJob (void)
 EndJob. More...
 
void subscribe (void)
 Subscribe/Unsubscribe to Monitoring Elements. More...
 
void subscribeNew (void)
 
 testChannel (const edm::ParameterSet &ps)
 Constructor. More...
 
void unsubscribe (void)
 
virtual ~testChannel ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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 More...
 
std::string m_digiCollection
 
std::string m_digiProducer
 secondary name given to collection of digis More...
 
std::string m_headerProducer
 name of module/plugin/producer making digis More...
 
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 More...
 
int m_xtal
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

calculate the best DAC value to obtain a pedestal = 200

Date:
2011/05/20 17:17:23
Revision:
1.7
Author
P. Govoni (testC.nosp@m.hann.nosp@m.el.go.nosp@m.voni.nosp@m.@cern.nosp@m.NOSP.nosp@m.AM.ch)

Definition at line 38 of file testChannel.h.

Constructor & Destructor Documentation

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.

19  :
20  m_digiCollection (paramSet.getParameter<std::string> ("digiCollection")) ,
21  m_digiProducer (paramSet.getParameter<std::string> ("digiProducer")) ,
22  m_headerProducer (paramSet.getParameter<std::string> ("headerProducer")) ,
23  m_xmlFile (paramSet.getParameter<std::string> ("xmlFile")) ,
24  m_DACmin (paramSet.getParameter<int> ("DACmin")) ,
25  m_DACmax (paramSet.getParameter<int> ("DACmax")) ,
26  m_RMSmax (paramSet.getParameter<double> ("RMSmax")) ,
27  m_bestPed (paramSet.getParameter<int> ("bestPed")) ,
28  m_xtal (paramSet.getParameter<int> ("xtal")) ,
29  m_pedVSDAC ("pedVSDAC","pedVSDAC",100,150,250,m_DACmax-m_DACmin,m_DACmin,m_DACmax) ,
30  m_singlePedVSDAC_1 ("singlePedVSDAC_1","pedVSDAC (g1) for xtal "+m_xtal,100,150,250,m_DACmax-m_DACmin,m_DACmin,m_DACmax) ,
31  m_singlePedVSDAC_2 ("singlePedVSDAC_2","pedVSDAC (g2) for xtal "+m_xtal,100,150,250,m_DACmax-m_DACmin,m_DACmin,m_DACmax) ,
32  m_singlePedVSDAC_3 ("singlePedVSDAC_3","pedVSDAC (g3) for xtal "+m_xtal,100,150,250,m_DACmax-m_DACmin,m_DACmin,m_DACmax)
33 {
34  edm::LogInfo ("testChannel") << " reading "
35  << " m_DACmin: " << m_DACmin
36  << " m_DACmax: " << m_DACmax
37  << " m_RMSmax: " << m_RMSmax
38  << " m_bestPed: " << m_bestPed ;
39 }
std::string m_digiProducer
secondary name given to collection of digis
Definition: testChannel.h:68
TH2F m_pedVSDAC
Definition: testChannel.h:80
double m_RMSmax
Definition: testChannel.h:75
std::string m_headerProducer
name of module/plugin/producer making digis
Definition: testChannel.h:69
TH2F m_singlePedVSDAC_3
Definition: testChannel.h:83
TH2F m_singlePedVSDAC_1
Definition: testChannel.h:81
int m_DACmin
name of the xml file to be saved
Definition: testChannel.h:73
std::string m_digiCollection
Definition: testChannel.h:67
std::string m_xmlFile
name of module/plugin/producer making headers
Definition: testChannel.h:71
TH2F m_singlePedVSDAC_2
Definition: testChannel.h:82
testChannel::~testChannel ( )
virtual

Destructor.

dtor

Definition at line 43 of file testChannel.cc.

44 {
45 }

Member Function Documentation

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(), ecalMGPA::gainId(), EcalMGPASample::gainId(), getHeaderSMId(), ecalpyutils::ism(), edm::HandleBase::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().

58 {
59  LogDebug ("testChannel") << "entering analyze ..." ;
60 
61  // get the headers
62  // (one header for each supermodule)
64  event.getByLabel (m_headerProducer, DCCHeaders) ;
65  if(!DCCHeaders.isValid())
66  {
67  edm::LogError ("testChannel") << "Error! can't get the product "
68  << m_headerProducer.c_str () ;
69  }
70 
71  std::map <int,int> DACvalues ;
72 
73  // loop over the headers
74  for ( EcalRawDataCollection::const_iterator headerItr= DCCHeaders->begin () ;
75  headerItr != DCCHeaders->end () ;
76  ++headerItr )
77  {
78  EcalDCCHeaderBlock::EcalDCCEventSettings settings = headerItr->getEventSettings () ;
79  DACvalues[getHeaderSMId (headerItr->id ())] = settings.ped_offset ;
80 // std::cout << "DCCid: " << headerItr->id () << "" ;
81 // std::cout << "Ped offset DAC: " << settings.ped_offset << "" ;
82  }
83 
84  // get the digis
85  // (one digi for each crystal)
87  event.getByLabel (m_digiProducer, pDigis) ;
88  if(!pDigis.isValid())
89  {
90  edm::LogError ("testChannel") << "Error! can't get the product "
91  << m_digiCollection.c_str () ;
92  }
93 
94  // loop over the digis
95  for (EBDigiCollection::const_iterator itdigi = pDigis->begin () ;
96  itdigi != pDigis->end () ;
97  ++itdigi)
98  {
99  EBDataFrame df( *itdigi );
100  int gainId = df.sample (0).gainId () ;
101  int crystalId = EBDetId(itdigi->id ()).ic () ;
102  int smId = EBDetId(itdigi->id ()).ism () ;
103 
104  edm::LogInfo ("testChannel") << "channel " << event.id ()
105  << "\tcry: " << crystalId
106  << "\tG: " << gainId
107  << "\tDAC: " << DACvalues[smId] ;
108 
109  // loop over the samples
110  for (int iSample = 0; iSample < EBDataFrame::MAXSAMPLES ; ++iSample)
111  {
112  edm::LogInfo ("testChannel") << "\t`-->" << df.sample (iSample).adc () ;
113  m_pedVSDAC.Fill (df.sample (iSample).adc (),DACvalues[smId]) ;
114  if (crystalId == m_xtal)
115  {
116  if (gainId == 1) m_singlePedVSDAC_1.Fill (df.sample (iSample).adc (),DACvalues[smId]) ;
117  if (gainId == 2) m_singlePedVSDAC_2.Fill (df.sample (iSample).adc (),DACvalues[smId]) ;
118  if (gainId == 3) m_singlePedVSDAC_3.Fill (df.sample (iSample).adc (),DACvalues[smId]) ;
119  }
120  } // loop over the samples
121  } // loop over the digis
122 
123 }
#define LogDebug(id)
std::string m_digiProducer
secondary name given to collection of digis
Definition: testChannel.h:68
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
int gainId(sample_type sample)
get the gainId (2 bits)
std::vector< T >::const_iterator const_iterator
TH2F m_pedVSDAC
Definition: testChannel.h:80
int getHeaderSMId(const int headerId)
Definition: testChannel.cc:151
std::string m_headerProducer
name of module/plugin/producer making digis
Definition: testChannel.h:69
TH2F m_singlePedVSDAC_3
Definition: testChannel.h:83
TH2F m_singlePedVSDAC_1
Definition: testChannel.h:81
bool isValid() const
Definition: HandleBase.h:76
std::string m_digiCollection
Definition: testChannel.h:67
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
TH2F m_singlePedVSDAC_2
Definition: testChannel.h:82
static const int MAXSAMPLES
Definition: EcalDataFrame.h:49
void testChannel::beginJob ( void  )
virtual

BeginJob.

begin the job

Reimplemented from edm::EDAnalyzer.

Definition at line 49 of file testChannel.cc.

References LogDebug.

50 {
51  LogDebug ("testChannel") << "entering beginJob ..." ;
52 }
#define LogDebug(id)
void testChannel::endJob ( void  )
virtual

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 dbtoconf::out.

127 {
128  char ccout[80] ;
129  sprintf (ccout,"out_%d.root",m_xtal) ;
130  TFile out (ccout,"RECREATE") ;
131  out.cd () ;
132  m_pedVSDAC.Write () ;
133  m_singlePedVSDAC_1.Write () ;
134  m_singlePedVSDAC_2.Write () ;
135  m_singlePedVSDAC_3.Write () ;
136  TProfile * profilo1 = m_singlePedVSDAC_1.ProfileX () ;
137  TProfile * profilo2 = m_singlePedVSDAC_2.ProfileX () ;
138  TProfile * profilo3 = m_singlePedVSDAC_3.ProfileX () ;
139  profilo1->Write ("singleProfile_1") ;
140  profilo2->Write ("singleProfile_2") ;
141  profilo3->Write ("singleProfile_3") ;
142  out.Close () ;
143 }
TH2F m_pedVSDAC
Definition: testChannel.h:80
TH2F m_singlePedVSDAC_3
Definition: testChannel.h:83
TH2F m_singlePedVSDAC_1
Definition: testChannel.h:81
tuple out
Definition: dbtoconf.py:99
TH2F m_singlePedVSDAC_2
Definition: testChannel.h:82
int testChannel::getHeaderSMId ( const int  headerId)
private

Definition at line 151 of file testChannel.cc.

Referenced by analyze().

152 {
153  //PG FIXME temporary solution
154  //PG FIXME check it is consistent with the TB!
155  return 1 ;
156 }
void testChannel::subscribe ( void  )

Subscribe/Unsubscribe to Monitoring Elements.

Definition at line 161 of file testChannel.cc.

162 {}
void testChannel::subscribeNew ( void  )

Definition at line 164 of file testChannel.cc.

165 {}
void testChannel::unsubscribe ( void  )

Definition at line 167 of file testChannel.cc.

168 {}

Member Data Documentation

int testChannel::m_bestPed
private

Definition at line 76 of file testChannel.h.

Referenced by testChannel().

int testChannel::m_DACmax
private

Definition at line 74 of file testChannel.h.

Referenced by testChannel().

int testChannel::m_DACmin
private

name of the xml file to be saved

Definition at line 73 of file testChannel.h.

Referenced by testChannel().

std::string testChannel::m_digiCollection
private

Definition at line 67 of file testChannel.h.

Referenced by analyze().

std::string testChannel::m_digiProducer
private

secondary name given to collection of digis

Definition at line 68 of file testChannel.h.

Referenced by analyze().

std::string testChannel::m_headerProducer
private

name of module/plugin/producer making digis

Definition at line 69 of file testChannel.h.

Referenced by analyze().

TH2F testChannel::m_pedVSDAC
private

Definition at line 80 of file testChannel.h.

Referenced by analyze(), and endJob().

double testChannel::m_RMSmax
private

Definition at line 75 of file testChannel.h.

Referenced by testChannel().

TH2F testChannel::m_singlePedVSDAC_1
private

Definition at line 81 of file testChannel.h.

Referenced by analyze(), and endJob().

TH2F testChannel::m_singlePedVSDAC_2
private

Definition at line 82 of file testChannel.h.

Referenced by analyze(), and endJob().

TH2F testChannel::m_singlePedVSDAC_3
private

Definition at line 83 of file testChannel.h.

Referenced by analyze(), and endJob().

std::string testChannel::m_xmlFile
private

name of module/plugin/producer making headers

Definition at line 71 of file testChannel.h.

int testChannel::m_xtal
private

Definition at line 78 of file testChannel.h.

Referenced by analyze(), and endJob().