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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (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::testChannel ( const edm::ParameterSet ps)

Constructor.

ctor

Definition at line 17 of file testChannel.cc.

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",
29  "pedVSDAC (g1) for xtal " + TString(m_xtal),
30  100,
31  150,
32  250,
34  m_DACmin,
35  m_DACmax),
36  m_singlePedVSDAC_2("singlePedVSDAC_2",
37  "pedVSDAC (g2) for xtal " + TString(m_xtal),
38  100,
39  150,
40  250,
42  m_DACmin,
43  m_DACmax),
44  m_singlePedVSDAC_3("singlePedVSDAC_3",
45  "pedVSDAC (g3) for xtal " + TString(m_xtal),
46  100,
47  150,
48  250,
50  m_DACmin,
51  m_DACmax) {
52  edm::LogInfo("testChannel") << " reading "
53  << " m_DACmin: " << m_DACmin << " m_DACmax: " << m_DACmax << " m_RMSmax: " << m_RMSmax
54  << " m_bestPed: " << m_bestPed;
55 }

References m_bestPed, m_DACmax, m_DACmin, and m_RMSmax.

◆ ~testChannel()

testChannel::~testChannel ( )
override

Destructor.

dtor

Definition at line 58 of file testChannel.cc.

58 {}

Member Function Documentation

◆ analyze()

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 64 of file testChannel.cc.

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

References edm::SortedCollection< T, SORT >::begin(), edm::DataFrameContainer::begin(), hgcalPerformanceValidation::df, edm::SortedCollection< T, SORT >::end(), edm::DataFrameContainer::end(), ecalLiteDTU::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, and EcalDCCHeaderBlock::EcalDCCEventSettings::ped_offset.

◆ beginJob()

void testChannel::beginJob ( void  )
overridevirtual

BeginJob.

begin the job

Reimplemented from edm::EDAnalyzer.

Definition at line 61 of file testChannel.cc.

61 { LogDebug("testChannel") << "entering beginJob ..."; }

References LogDebug.

◆ endJob()

void testChannel::endJob ( void  )
overridevirtual

EndJob.

perform the minimiation and write results

Reimplemented from edm::EDAnalyzer.

Definition at line 121 of file testChannel.cc.

121  {
122  char ccout[80];
123  sprintf(ccout, "out_%d.root", m_xtal);
124  TFile out(ccout, "RECREATE");
125  out.cd();
126  m_pedVSDAC.Write();
127  m_singlePedVSDAC_1.Write();
128  m_singlePedVSDAC_2.Write();
129  m_singlePedVSDAC_3.Write();
130  TProfile *profilo1 = m_singlePedVSDAC_1.ProfileX();
131  TProfile *profilo2 = m_singlePedVSDAC_2.ProfileX();
132  TProfile *profilo3 = m_singlePedVSDAC_3.ProfileX();
133  profilo1->Write("singleProfile_1");
134  profilo2->Write("singleProfile_2");
135  profilo3->Write("singleProfile_3");
136  out.Close();
137 }

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

Referenced by o2olib.O2ORunMgr::executeJob().

◆ getHeaderSMId()

int testChannel::getHeaderSMId ( const int  headerId)
private

Definition at line 145 of file testChannel.cc.

145  {
146  // PG FIXME temporary solution
147  // PG FIXME check it is consistent with the TB!
148  return 1;
149 }

Referenced by analyze().

◆ subscribe()

void testChannel::subscribe ( void  )

Subscribe/Unsubscribe to Monitoring Elements.

Definition at line 151 of file testChannel.cc.

151 {}

◆ subscribeNew()

void testChannel::subscribeNew ( void  )

Definition at line 153 of file testChannel.cc.

153 {}

◆ unsubscribe()

void testChannel::unsubscribe ( void  )

Definition at line 155 of file testChannel.cc.

155 {}

Member Data Documentation

◆ m_bestPed

int testChannel::m_bestPed
private

Definition at line 70 of file testChannel.h.

Referenced by testChannel().

◆ m_DACmax

int testChannel::m_DACmax
private

Definition at line 68 of file testChannel.h.

Referenced by testChannel().

◆ m_DACmin

int testChannel::m_DACmin
private

name of the xml file to be saved

Definition at line 67 of file testChannel.h.

Referenced by testChannel().

◆ m_digiCollection

std::string testChannel::m_digiCollection
private

Definition at line 61 of file testChannel.h.

Referenced by analyze().

◆ m_digiProducer

std::string testChannel::m_digiProducer
private

secondary name given to collection of digis

Definition at line 62 of file testChannel.h.

Referenced by analyze().

◆ m_headerProducer

std::string testChannel::m_headerProducer
private

name of module/plugin/producer making digis

Definition at line 63 of file testChannel.h.

Referenced by analyze().

◆ m_pedVSDAC

TH2F testChannel::m_pedVSDAC
private

Definition at line 74 of file testChannel.h.

Referenced by analyze(), and endJob().

◆ m_RMSmax

double testChannel::m_RMSmax
private

Definition at line 69 of file testChannel.h.

Referenced by testChannel().

◆ m_singlePedVSDAC_1

TH2F testChannel::m_singlePedVSDAC_1
private

Definition at line 75 of file testChannel.h.

Referenced by analyze(), and endJob().

◆ m_singlePedVSDAC_2

TH2F testChannel::m_singlePedVSDAC_2
private

Definition at line 76 of file testChannel.h.

Referenced by analyze(), and endJob().

◆ m_singlePedVSDAC_3

TH2F testChannel::m_singlePedVSDAC_3
private

Definition at line 77 of file testChannel.h.

Referenced by analyze(), and endJob().

◆ m_xmlFile

std::string testChannel::m_xmlFile
private

name of module/plugin/producer making headers

Definition at line 65 of file testChannel.h.

◆ m_xtal

int testChannel::m_xtal
private

Definition at line 72 of file testChannel.h.

Referenced by analyze(), and endJob().

EcalDataFrame::MAXSAMPLES
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
testChannel::m_DACmax
int m_DACmax
Definition: testChannel.h:68
ecalLiteDTU::gainId
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
Definition: EcalLiteDTUSample.h:14
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
testChannel::m_digiProducer
std::string m_digiProducer
secondary name given to collection of digis
Definition: testChannel.h:62
edm::DataFrameContainer::const_iterator
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
Definition: DataFrameContainer.h:61
EBDetId
Definition: EBDetId.h:17
EBDataFrame
Definition: EBDataFrame.h:11
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
testChannel::m_headerProducer
std::string m_headerProducer
name of module/plugin/producer making digis
Definition: testChannel.h:63
testChannel::m_xtal
int m_xtal
Definition: testChannel.h:72
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
testChannel::m_pedVSDAC
TH2F m_pedVSDAC
Definition: testChannel.h:74
testChannel::getHeaderSMId
int getHeaderSMId(const int headerId)
Definition: testChannel.cc:145
testChannel::m_singlePedVSDAC_3
TH2F m_singlePedVSDAC_3
Definition: testChannel.h:77
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalDCCHeaderBlock::EcalDCCEventSettings
Definition: EcalDCCHeaderBlock.h:64
testChannel::m_RMSmax
double m_RMSmax
Definition: testChannel.h:69
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
testChannel::m_DACmin
int m_DACmin
name of the xml file to be saved
Definition: testChannel.h:67
testChannel::m_bestPed
int m_bestPed
Definition: testChannel.h:70
edm::DataFrameContainer::begin
const_iterator begin() const
The iterator returned can not safely be used across threads.
Definition: DataFrameContainer.h:149
testChannel::m_xmlFile
std::string m_xmlFile
name of module/plugin/producer making headers
Definition: testChannel.h:65
testChannel::m_singlePedVSDAC_1
TH2F m_singlePedVSDAC_1
Definition: testChannel.h:75
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
EcalDCCHeaderBlock::EcalDCCEventSettings::ped_offset
short ped_offset
Definition: EcalDCCHeaderBlock.h:71
ecalpyutils::ism
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:51
testChannel::m_singlePedVSDAC_2
TH2F m_singlePedVSDAC_2
Definition: testChannel.h:76
hgcalPerformanceValidation.df
df
Definition: hgcalPerformanceValidation.py:733
testChannel::m_digiCollection
std::string m_digiCollection
Definition: testChannel.h:61
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::DataFrameContainer::end
const_iterator end() const
Definition: DataFrameContainer.h:152