CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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::one::EDAnalyzer<> edm::one::EDAnalyzerBase 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::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
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...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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.

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 }
std::string m_digiProducer
secondary name given to collection of digis
Definition: testChannel.h:62
TH2F m_pedVSDAC
Definition: testChannel.h:74
double m_RMSmax
Definition: testChannel.h:69
std::string m_headerProducer
name of module/plugin/producer making digis
Definition: testChannel.h:63
TH2F m_singlePedVSDAC_3
Definition: testChannel.h:77
TH2F m_singlePedVSDAC_1
Definition: testChannel.h:75
int m_DACmin
name of the xml file to be saved
Definition: testChannel.h:67
Log< level::Info, false > LogInfo
std::string m_digiCollection
Definition: testChannel.h:61
std::string m_xmlFile
name of module/plugin/producer making headers
Definition: testChannel.h:65
TH2F m_singlePedVSDAC_2
Definition: testChannel.h:76
testChannel::~testChannel ( )
override

Destructor.

dtor

Definition at line 58 of file testChannel.cc.

58 {}

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::one::EDAnalyzerBase.

Definition at line 64 of file testChannel.cc.

References EcalMGPASample::adc(), isotrackApplyRegressor::df, ecalLiteDTU::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().

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 }
std::string m_digiProducer
secondary name given to collection of digis
Definition: testChannel.h:62
std::vector< T >::const_iterator const_iterator
TH2F m_pedVSDAC
Definition: testChannel.h:74
Log< level::Error, false > LogError
int getHeaderSMId(const int headerId)
Definition: testChannel.cc:145
std::string m_headerProducer
name of module/plugin/producer making digis
Definition: testChannel.h:63
TH2F m_singlePedVSDAC_3
Definition: testChannel.h:77
TH2F m_singlePedVSDAC_1
Definition: testChannel.h:75
bool isValid() const
Definition: HandleBase.h:70
Log< level::Info, false > LogInfo
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
std::string m_digiCollection
Definition: testChannel.h:61
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:49
TH2F m_singlePedVSDAC_2
Definition: testChannel.h:76
#define LogDebug(id)
void testChannel::beginJob ( void  )
overridevirtual

BeginJob.

begin the job

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 61 of file testChannel.cc.

References LogDebug.

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

EndJob.

perform the minimiation and write results

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 121 of file testChannel.cc.

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

Referenced by o2olib.O2ORunMgr::executeJob().

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 }
TH2F m_pedVSDAC
Definition: testChannel.h:74
TH2F m_singlePedVSDAC_3
Definition: testChannel.h:77
TH2F m_singlePedVSDAC_1
Definition: testChannel.h:75
TH2F m_singlePedVSDAC_2
Definition: testChannel.h:76
int testChannel::getHeaderSMId ( const int  headerId)
private

Definition at line 145 of file testChannel.cc.

Referenced by analyze().

145  {
146  // PG FIXME temporary solution
147  // PG FIXME check it is consistent with the TB!
148  return 1;
149 }
void testChannel::subscribe ( void  )

Subscribe/Unsubscribe to Monitoring Elements.

Definition at line 151 of file testChannel.cc.

151 {}
void testChannel::subscribeNew ( void  )

Definition at line 153 of file testChannel.cc.

153 {}
void testChannel::unsubscribe ( void  )

Definition at line 155 of file testChannel.cc.

155 {}

Member Data Documentation

int testChannel::m_bestPed
private

Definition at line 70 of file testChannel.h.

Referenced by testChannel().

int testChannel::m_DACmax
private

Definition at line 68 of file testChannel.h.

Referenced by testChannel().

int testChannel::m_DACmin
private

name of the xml file to be saved

Definition at line 67 of file testChannel.h.

Referenced by testChannel().

std::string testChannel::m_digiCollection
private

Definition at line 61 of file testChannel.h.

Referenced by analyze().

std::string testChannel::m_digiProducer
private

secondary name given to collection of digis

Definition at line 62 of file testChannel.h.

Referenced by analyze().

std::string testChannel::m_headerProducer
private

name of module/plugin/producer making digis

Definition at line 63 of file testChannel.h.

Referenced by analyze().

TH2F testChannel::m_pedVSDAC
private

Definition at line 74 of file testChannel.h.

Referenced by analyze(), and endJob().

double testChannel::m_RMSmax
private

Definition at line 69 of file testChannel.h.

Referenced by testChannel().

TH2F testChannel::m_singlePedVSDAC_1
private

Definition at line 75 of file testChannel.h.

Referenced by analyze(), and endJob().

TH2F testChannel::m_singlePedVSDAC_2
private

Definition at line 76 of file testChannel.h.

Referenced by analyze(), and endJob().

TH2F testChannel::m_singlePedVSDAC_3
private

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

int testChannel::m_xtal
private

Definition at line 72 of file testChannel.h.

Referenced by analyze(), and endJob().