CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalPerEvtMatacqAnalyzer Class Reference

#include <EcalPerEvtMatacqAnalyzer.h>

Inheritance diagram for EcalPerEvtMatacqAnalyzer:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void beginJob () override
 
 EcalPerEvtMatacqAnalyzer (const edm::ParameterSet &iConfig)
 
void endJob () override
 
 ~EcalPerEvtMatacqAnalyzer () override=default
 
- 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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

const unsigned int _highlev
 
const unsigned int _lowlev
 
const unsigned int _nevlasers
 
const unsigned int _noiseCut
 
const unsigned int _nsamplesaftmax
 
const unsigned int _nsamplesbefmax
 
const unsigned int _parabnaftmax
 
const unsigned int _parabnbefmax
 
const double _presample
 
const unsigned int _thres
 
double ampl
 
const edm::EDGetTokenT< EcalRawDataCollectiondccToken_
 
const std::string digiCollection_
 
const std::string digiProducer_
 
int event
 
const std::string eventHeaderCollection_
 
const std::string eventHeaderProducer_
 
double fit
 
int iEvent
 
int IsFileCreated
 
int IsTreeCreated
 
int laser_color
 
double matacq [2560]
 
unsigned int maxsamp
 
TTree * mtqShape
 
unsigned int nsamples
 
std::string outfile
 
TFile * outFile
 
double peak
 
const edm::EDGetTokenT< EcalMatacqDigiCollectionpmatToken_
 
const std::string resdir_
 
int runNum
 
int runType
 
TFile * sampFile
 
double sigma
 
int status
 
TTree * tree
 
double trise
 
double ttrig
 

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< Bconsumes (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 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 ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
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

Definition at line 14 of file EcalPerEvtMatacqAnalyzer.h.

Constructor & Destructor Documentation

◆ EcalPerEvtMatacqAnalyzer()

EcalPerEvtMatacqAnalyzer::EcalPerEvtMatacqAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 29 of file EcalPerEvtMatacqAnalyzer.cc.

30  : iEvent(0),
31  // framework parameters with default values
32 
33  _presample(iConfig.getUntrackedParameter<double>("nPresamples", 6.7)),
34  _nsamplesaftmax(iConfig.getUntrackedParameter<unsigned int>("nSamplesAftMax", 80)),
35  _nsamplesbefmax(iConfig.getUntrackedParameter<unsigned int>("nSamplesBefMax", 20)),
36  _noiseCut(iConfig.getUntrackedParameter<unsigned int>("noiseCut", 7)),
37  _parabnbefmax(iConfig.getUntrackedParameter<unsigned int>("paraBeforeMax", 8)),
38  _parabnaftmax(iConfig.getUntrackedParameter<unsigned int>("paraAfterMax", 7)),
39  _thres(iConfig.getUntrackedParameter<unsigned int>("threshold", 10)),
40  _lowlev(iConfig.getUntrackedParameter<unsigned int>("lowLevel", 20)),
41  _highlev(iConfig.getUntrackedParameter<unsigned int>("highLevel", 80)),
42  _nevlasers(iConfig.getUntrackedParameter<unsigned int>("nEventLaser", 600)),
43  resdir_(iConfig.getUntrackedParameter<std::string>("resDir")),
44  digiCollection_(iConfig.getParameter<std::string>("digiCollection")),
45  digiProducer_(iConfig.getParameter<std::string>("digiProducer")),
46  eventHeaderCollection_(iConfig.getParameter<std::string>("eventHeaderCollection")),
47  eventHeaderProducer_(iConfig.getParameter<std::string>("eventHeaderProducer")),
48  pmatToken_(consumes<EcalMatacqDigiCollection>(edm::InputTag(digiProducer_, digiCollection_))),
49  dccToken_(consumes<EcalRawDataCollection>(edm::InputTag(digiProducer_)))
50 
51 //========================================================================
52 {
53  //now do what ever initialization is needed
54 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< EcalRawDataCollection > dccToken_
T getUntrackedParameter(std::string const &, T const &) const
const std::string eventHeaderProducer_
const std::string eventHeaderCollection_
const edm::EDGetTokenT< EcalMatacqDigiCollection > pmatToken_

◆ ~EcalPerEvtMatacqAnalyzer()

EcalPerEvtMatacqAnalyzer::~EcalPerEvtMatacqAnalyzer ( )
overridedefault

Member Function Documentation

◆ analyze()

void EcalPerEvtMatacqAnalyzer::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 67 of file EcalPerEvtMatacqAnalyzer.cc.

References EcalMatacqDigi::adcCount(), edm::SortedCollection< T, SORT >::begin(), dccToken_, digiCollection_, MillePedeFileConverter_cfg::e, edm::SortedCollection< T, SORT >::end(), eventHeaderCollection_, mps_fire::i, iEvent, createfilelist::int, IsFileCreated, IsTreeCreated, edm::HandleBase::isValid(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, laser_color, EcalDCCHeaderBlock::LASER_DELAY_SCAN, EcalDCCHeaderBlock::LASER_GAP, EcalDCCHeaderBlock::LASER_POWER_SCAN, EcalDCCHeaderBlock::LASER_STD, matacq, SiStripPI::max, maxsamp, N_channels, nsamples, outfile, outFile, pmatToken_, edm::Handle< T >::product(), resdir_, runNum, runType, EcalMatacqDigi::size(), ttrig, EcalMatacqDigi::tTrig(), and EcalDCCHeaderBlock::EcalDCCEventSettings::wavelength.

67  {
68  //========================================================================
69 
70  ++iEvent;
71 
72  // retrieving MATACQ :
73  const edm::Handle<EcalMatacqDigiCollection>& pmatacqDigi = e.getHandle(pmatToken_);
74  const EcalMatacqDigiCollection* matacqDigi = (pmatacqDigi.isValid()) ? pmatacqDigi.product() : nullptr;
75  if (!(pmatacqDigi.isValid()))
76  edm::LogWarning("EcalPerEvtMatacqAnalyzer") << "Error! can't get the product " << digiCollection_.c_str();
77 
78  // retrieving DCC header
79 
80  const edm::Handle<EcalRawDataCollection>& pDCCHeader = e.getHandle(dccToken_);
81  const EcalRawDataCollection* DCCHeader = (pDCCHeader.isValid()) ? pDCCHeader.product() : nullptr;
82  if (!pDCCHeader.isValid())
83  edm::LogWarning("EcalPerEvtMatacqAnalyzer") << "Error! can't get the product " << eventHeaderCollection_.c_str();
84 
85  // ====================================
86  // Decode Basic DCCHeader Information
87  // ====================================
88 
89  for (EcalRawDataCollection::const_iterator headerItr = DCCHeader->begin(); headerItr != DCCHeader->end();
90  ++headerItr) {
91  event = headerItr->getLV1();
92  EcalDCCHeaderBlock::EcalDCCEventSettings settings = headerItr->getEventSettings();
93 
94  laser_color = (int)settings.wavelength;
95 
96  // Get run type and run number
97 
98  runType = headerItr->getRunType();
99  runNum = headerItr->getRunNumber();
100 
101  // Cut on runType
102 
105  return;
106 
107  // Define output results files' names
108 
109  if (IsFileCreated == 0) {
110  std::stringstream namefile;
111 
112  namefile << resdir_ << "/MatacqPerEvt-Run" << runNum << ".root";
113  outfile = namefile.str();
114 
115  outFile = new TFile(outfile.c_str(), "RECREATE");
116 
117  // declaration of the tree to fill
118 
119  tree = new TTree("MatacqTree", "MatacqTree");
120 
121  IsFileCreated = 1;
122  }
123  }
124 
125  // ===========================
126  // Decode Matacq Information
127  // ===========================
128 
129  int iCh = 0;
130  double max = 0;
131 
132  for (EcalMatacqDigiCollection::const_iterator it = matacqDigi->begin(); it != matacqDigi->end();
133  ++it) { // Loop on matacq channel
134 
135  //
136  const EcalMatacqDigi& digis = *it;
137 
138  if (digis.size() == 0 || iCh >= N_channels)
139  continue;
140 
141  max = 0;
142  maxsamp = 0;
143  nsamples = digis.size();
144 
145  if (IsTreeCreated == 0) {
146  //List of branches
147 
148  std::stringstream mat;
149  mat << "matacq[" << nsamples << "]/D" << std::endl;
150 
151  tree->Branch("event", &event, "event/I");
152  tree->Branch("laser_color", &laser_color, "laser_color/I");
153  // tree->Branch( "nsamples", &nsamples , "nsamples/I" );
154  tree->Branch("matacq", &matacq, mat.str().c_str());
155  tree->Branch("maxsamp", &maxsamp, "maxsamp/I");
156  tree->Branch("ttrig", &ttrig, "ttrig/D");
157 
158  tree->SetBranchAddress("event", &event);
159  tree->SetBranchAddress("laser_color", &laser_color);
160  tree->SetBranchAddress("matacq", matacq);
161  // tree->SetBranchAddress( "nsamples", &nsamples );
162  tree->SetBranchAddress("maxsamp", &maxsamp);
163  tree->SetBranchAddress("ttrig", &ttrig);
164 
165  IsTreeCreated = 1;
166  }
167 
168  ttrig = digis.tTrig();
169 
170  for (int i = 0; i < digis.size(); ++i) { // Loop on matacq samples
171  matacq[i] = digis.adcCount(i);
172  if (matacq[i] > max) {
173  max = matacq[i];
174  maxsamp = i;
175  }
176  }
177 
178  iCh++;
179  }
180 
181  tree->Fill();
182 
183 } // analyze
const edm::EDGetTokenT< EcalRawDataCollection > dccToken_
T const * product() const
Definition: Handle.h:70
std::vector< T >::const_iterator const_iterator
float adcCount(const int &i) const
#define N_channels
const_iterator begin() const
float tTrig() const
const_iterator end() const
const std::string eventHeaderCollection_
bool isValid() const
Definition: HandleBase.h:70
int size() const
Definition: tree.py:1
Log< level::Warning, false > LogWarning
const edm::EDGetTokenT< EcalMatacqDigiCollection > pmatToken_
Definition: event.py:1

◆ beginJob()

void EcalPerEvtMatacqAnalyzer::beginJob ( )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 57 of file EcalPerEvtMatacqAnalyzer.cc.

References IsFileCreated, and IsTreeCreated.

57  {
58  //========================================================================
59 
60  //Initializations
61 
62  IsFileCreated = 0;
63  IsTreeCreated = 0;
64 }

◆ endJob()

void EcalPerEvtMatacqAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 186 of file EcalPerEvtMatacqAnalyzer.cc.

References outFile.

Referenced by o2olib.O2ORunMgr::executeJob().

186  {
187  tree->Write();
188  outFile->Close();
189 }
Definition: tree.py:1

Member Data Documentation

◆ _highlev

const unsigned int EcalPerEvtMatacqAnalyzer::_highlev
private

Definition at line 64 of file EcalPerEvtMatacqAnalyzer.h.

◆ _lowlev

const unsigned int EcalPerEvtMatacqAnalyzer::_lowlev
private

Definition at line 63 of file EcalPerEvtMatacqAnalyzer.h.

◆ _nevlasers

const unsigned int EcalPerEvtMatacqAnalyzer::_nevlasers
private

Definition at line 65 of file EcalPerEvtMatacqAnalyzer.h.

◆ _noiseCut

const unsigned int EcalPerEvtMatacqAnalyzer::_noiseCut
private

Definition at line 59 of file EcalPerEvtMatacqAnalyzer.h.

◆ _nsamplesaftmax

const unsigned int EcalPerEvtMatacqAnalyzer::_nsamplesaftmax
private

Definition at line 57 of file EcalPerEvtMatacqAnalyzer.h.

◆ _nsamplesbefmax

const unsigned int EcalPerEvtMatacqAnalyzer::_nsamplesbefmax
private

Definition at line 58 of file EcalPerEvtMatacqAnalyzer.h.

◆ _parabnaftmax

const unsigned int EcalPerEvtMatacqAnalyzer::_parabnaftmax
private

Definition at line 61 of file EcalPerEvtMatacqAnalyzer.h.

◆ _parabnbefmax

const unsigned int EcalPerEvtMatacqAnalyzer::_parabnbefmax
private

Definition at line 60 of file EcalPerEvtMatacqAnalyzer.h.

◆ _presample

const double EcalPerEvtMatacqAnalyzer::_presample
private

Definition at line 56 of file EcalPerEvtMatacqAnalyzer.h.

◆ _thres

const unsigned int EcalPerEvtMatacqAnalyzer::_thres
private

Definition at line 62 of file EcalPerEvtMatacqAnalyzer.h.

◆ ampl

double EcalPerEvtMatacqAnalyzer::ampl
private

Definition at line 48 of file EcalPerEvtMatacqAnalyzer.h.

◆ dccToken_

const edm::EDGetTokenT<EcalRawDataCollection> EcalPerEvtMatacqAnalyzer::dccToken_
private

Definition at line 74 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

◆ digiCollection_

const std::string EcalPerEvtMatacqAnalyzer::digiCollection_
private

Definition at line 68 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

◆ digiProducer_

const std::string EcalPerEvtMatacqAnalyzer::digiProducer_
private

Definition at line 69 of file EcalPerEvtMatacqAnalyzer.h.

◆ event

int EcalPerEvtMatacqAnalyzer::event
private

◆ eventHeaderCollection_

const std::string EcalPerEvtMatacqAnalyzer::eventHeaderCollection_
private

Definition at line 70 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

◆ eventHeaderProducer_

const std::string EcalPerEvtMatacqAnalyzer::eventHeaderProducer_
private

Definition at line 71 of file EcalPerEvtMatacqAnalyzer.h.

◆ fit

double EcalPerEvtMatacqAnalyzer::fit
private

Definition at line 48 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by trackingPlots.Iteration::modules().

◆ iEvent

int EcalPerEvtMatacqAnalyzer::iEvent
private

Definition at line 26 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

◆ IsFileCreated

int EcalPerEvtMatacqAnalyzer::IsFileCreated
private

Definition at line 44 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and beginJob().

◆ IsTreeCreated

int EcalPerEvtMatacqAnalyzer::IsTreeCreated
private

Definition at line 45 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and beginJob().

◆ laser_color

int EcalPerEvtMatacqAnalyzer::laser_color
private

Definition at line 36 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

◆ matacq

double EcalPerEvtMatacqAnalyzer::matacq[2560]
private

Definition at line 37 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

◆ maxsamp

unsigned int EcalPerEvtMatacqAnalyzer::maxsamp
private

Definition at line 38 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

◆ mtqShape

TTree* EcalPerEvtMatacqAnalyzer::mtqShape
private

Definition at line 49 of file EcalPerEvtMatacqAnalyzer.h.

◆ nsamples

unsigned int EcalPerEvtMatacqAnalyzer::nsamples
private

Definition at line 39 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

◆ outfile

std::string EcalPerEvtMatacqAnalyzer::outfile
private

Definition at line 24 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

◆ outFile

TFile* EcalPerEvtMatacqAnalyzer::outFile
private

◆ peak

double EcalPerEvtMatacqAnalyzer::peak
private

Definition at line 48 of file EcalPerEvtMatacqAnalyzer.h.

◆ pmatToken_

const edm::EDGetTokenT<EcalMatacqDigiCollection> EcalPerEvtMatacqAnalyzer::pmatToken_
private

Definition at line 73 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

◆ resdir_

const std::string EcalPerEvtMatacqAnalyzer::resdir_
private

Definition at line 67 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

◆ runNum

int EcalPerEvtMatacqAnalyzer::runNum
private

Definition at line 31 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

◆ runType

int EcalPerEvtMatacqAnalyzer::runType
private

Definition at line 30 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

◆ sampFile

TFile* EcalPerEvtMatacqAnalyzer::sampFile
private

Definition at line 41 of file EcalPerEvtMatacqAnalyzer.h.

◆ sigma

double EcalPerEvtMatacqAnalyzer::sigma
private

Definition at line 48 of file EcalPerEvtMatacqAnalyzer.h.

◆ status

int EcalPerEvtMatacqAnalyzer::status
private

◆ tree

TTree* EcalPerEvtMatacqAnalyzer::tree
private

◆ trise

double EcalPerEvtMatacqAnalyzer::trise
private

Definition at line 48 of file EcalPerEvtMatacqAnalyzer.h.

◆ ttrig

double EcalPerEvtMatacqAnalyzer::ttrig
private

Definition at line 48 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().