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 edm::EDConsumerBase

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

calculate the best DAC value to obtain a pedestal = 200

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 36 of file testChannel.h.

Constructor & Destructor Documentation

testChannel::testChannel ( const edm::ParameterSet ps)

Constructor.

ctor

Definition at line 17 of file testChannel.cc.

References m_bestPed, m_DACmax, m_DACmin, and m_RMSmax.

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

Destructor.

dtor

Definition at line 41 of file testChannel.cc.

42 {
43 }

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 54 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().

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

BeginJob.

begin the job

Reimplemented from edm::EDAnalyzer.

Definition at line 47 of file testChannel.cc.

References LogDebug.

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

EndJob.

perform the minimiation and write results

Reimplemented from edm::EDAnalyzer.

Definition at line 124 of file testChannel.cc.

References m_pedVSDAC, m_singlePedVSDAC_1, m_singlePedVSDAC_2, m_singlePedVSDAC_3, m_xtal, and dbtoconf::out.

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

Definition at line 149 of file testChannel.cc.

Referenced by analyze().

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

Subscribe/Unsubscribe to Monitoring Elements.

Definition at line 159 of file testChannel.cc.

160 {}
void testChannel::subscribeNew ( void  )

Definition at line 162 of file testChannel.cc.

163 {}
void testChannel::unsubscribe ( void  )

Definition at line 165 of file testChannel.cc.

166 {}

Member Data Documentation

int testChannel::m_bestPed
private

Definition at line 74 of file testChannel.h.

Referenced by testChannel().

int testChannel::m_DACmax
private

Definition at line 72 of file testChannel.h.

Referenced by testChannel().

int testChannel::m_DACmin
private

name of the xml file to be saved

Definition at line 71 of file testChannel.h.

Referenced by testChannel().

std::string testChannel::m_digiCollection
private

Definition at line 65 of file testChannel.h.

Referenced by analyze().

std::string testChannel::m_digiProducer
private

secondary name given to collection of digis

Definition at line 66 of file testChannel.h.

Referenced by analyze().

std::string testChannel::m_headerProducer
private

name of module/plugin/producer making digis

Definition at line 67 of file testChannel.h.

Referenced by analyze().

TH2F testChannel::m_pedVSDAC
private

Definition at line 78 of file testChannel.h.

Referenced by analyze(), and endJob().

double testChannel::m_RMSmax
private

Definition at line 73 of file testChannel.h.

Referenced by testChannel().

TH2F testChannel::m_singlePedVSDAC_1
private

Definition at line 79 of file testChannel.h.

Referenced by analyze(), and endJob().

TH2F testChannel::m_singlePedVSDAC_2
private

Definition at line 80 of file testChannel.h.

Referenced by analyze(), and endJob().

TH2F testChannel::m_singlePedVSDAC_3
private

Definition at line 81 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 69 of file testChannel.h.

int testChannel::m_xtal
private

Definition at line 76 of file testChannel.h.

Referenced by analyze(), and endJob().