CMS 3D CMS Logo

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) override
 ! Analyze More...
 
void beginJob () override
 BeginJob. More...
 
void endJob (void) override
 EndJob. More...
 
void subscribe (void)
 Subscribe/Unsubscribe to Monitoring Elements. More...
 
void subscribeNew (void)
 
 testChannel (const edm::ParameterSet &ps)
 Constructor. More...
 
void unsubscribe (void)
 
 ~testChannel () override
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 18 of file testChannel.cc.

References m_bestPed, m_DACmax, m_DACmin, and m_RMSmax.

18  :
19  m_digiCollection (paramSet.getParameter<std::string> ("digiCollection")) ,
20  m_digiProducer (paramSet.getParameter<std::string> ("digiProducer")) ,
21  m_headerProducer (paramSet.getParameter<std::string> ("headerProducer")) ,
22  m_xmlFile (paramSet.getParameter<std::string> ("xmlFile")) ,
23  m_DACmin (paramSet.getParameter<int> ("DACmin")) ,
24  m_DACmax (paramSet.getParameter<int> ("DACmax")) ,
25  m_RMSmax (paramSet.getParameter<double> ("RMSmax")) ,
26  m_bestPed (paramSet.getParameter<int> ("bestPed")) ,
27  m_xtal (paramSet.getParameter<int> ("xtal")) ,
28  m_pedVSDAC ("pedVSDAC","pedVSDAC",100,150,250,m_DACmax-m_DACmin,m_DACmin,m_DACmax) ,
29  m_singlePedVSDAC_1 ("singlePedVSDAC_1","pedVSDAC (g1) for xtal "+TString(m_xtal),100,150,250,m_DACmax-m_DACmin,m_DACmin,m_DACmax) ,
30  m_singlePedVSDAC_2 ("singlePedVSDAC_2","pedVSDAC (g2) for xtal "+TString(m_xtal),100,150,250,m_DACmax-m_DACmin,m_DACmin,m_DACmax) ,
31  m_singlePedVSDAC_3 ("singlePedVSDAC_3","pedVSDAC (g3) for xtal "+TString(m_xtal),100,150,250,m_DACmax-m_DACmin,m_DACmin,m_DACmax)
32 {
33  edm::LogInfo ("testChannel") << " reading "
34  << " m_DACmin: " << m_DACmin
35  << " m_DACmax: " << m_DACmax
36  << " m_RMSmax: " << m_RMSmax
37  << " m_bestPed: " << m_bestPed ;
38 }
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 ( )
override

Destructor.

dtor

Definition at line 42 of file testChannel.cc.

43 {
44 }

Member Function Documentation

void testChannel::analyze ( edm::Event const &  event,
edm::EventSetup const &  eventSetup 
)
overridevirtual

! Analyze

perform te analysis

loop over the headers

Implements edm::EDAnalyzer.

Definition at line 55 of file testChannel.cc.

References EcalMGPASample::adc(), edm::SortedCollection< T, SORT >::begin(), edm::DataFrameContainer::begin(), edm::SortedCollection< T, SORT >::end(), edm::DataFrameContainer::end(), 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().

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

BeginJob.

begin the job

Reimplemented from edm::EDAnalyzer.

Definition at line 48 of file testChannel.cc.

References LogDebug.

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

EndJob.

perform the minimiation and write results

Reimplemented from edm::EDAnalyzer.

Definition at line 125 of file testChannel.cc.

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

Referenced by o2olib.O2ORunMgr::executeJob().

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

Definition at line 150 of file testChannel.cc.

Referenced by analyze().

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

Subscribe/Unsubscribe to Monitoring Elements.

Definition at line 160 of file testChannel.cc.

161 {}
void testChannel::subscribeNew ( void  )

Definition at line 163 of file testChannel.cc.

164 {}
void testChannel::unsubscribe ( void  )

Definition at line 166 of file testChannel.cc.

167 {}

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