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 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
 
- 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 Attributes

unsigned int _highlev
 
unsigned int _lowlev
 
unsigned int _nevlasers
 
unsigned int _noiseCut
 
unsigned int _nsamplesaftmax
 
unsigned int _nsamplesbefmax
 
unsigned int _parabnaftmax
 
unsigned int _parabnbefmax
 
double _presample
 
unsigned int _thres
 
double ampl
 
std::string digiCollection_
 
std::string digiProducer_
 
int event
 
std::string eventHeaderCollection_
 
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
 
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 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 ()
 
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 12 of file EcalPerEvtMatacqAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 33 of file EcalPerEvtMatacqAnalyzer.cc.

References digiCollection_, digiProducer_, eventHeaderCollection_, eventHeaderProducer_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), resdir_, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 62 of file EcalPerEvtMatacqAnalyzer.cc.

62  {
63  //========================================================================
64 
65  // do anything here that needs to be done at desctruction time
66  // (e.g. close files, deallocate resources etc.)
67 }

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 80 of file EcalPerEvtMatacqAnalyzer.cc.

References EcalMatacqDigi::adcCount(), edm::SortedCollection< T, SORT >::begin(), EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, digiCollection_, digiProducer_, edm::SortedCollection< T, SORT >::end(), event, eventHeaderCollection_, cppFunctionSkipper::exception, edm::Event::getByLabel(), mps_fire::i, iEvent, IsFileCreated, IsTreeCreated, 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, edm::Handle< T >::product(), resdir_, runNum, runType, EcalMatacqDigi::size(), tree, ttrig, EcalMatacqDigi::tTrig(), and EcalDCCHeaderBlock::EcalDCCEventSettings::wavelength.

80  {
81  //========================================================================
82 
83  ++iEvent;
84 
85  // retrieving MATACQ :
87  const EcalMatacqDigiCollection* matacqDigi = nullptr;
88  try {
89  e.getByLabel(digiProducer_, digiCollection_, pmatacqDigi);
90  matacqDigi = pmatacqDigi.product();
91  } catch (std::exception& ex) {
92  std::cerr << "Error! can't get the product " << digiCollection_.c_str() << std::endl;
93  }
94 
95  // retrieving DCC header
96 
98  const EcalRawDataCollection* DCCHeader = nullptr;
99  try {
100  e.getByLabel(digiProducer_, pDCCHeader);
101  //e.getByLabel(eventHeaderProducer_,eventHeaderCollection_, pDCCHeader);
102  DCCHeader = pDCCHeader.product();
103  } catch (std::exception& ex) {
104  std::cerr << "Error! can't get the product " << eventHeaderCollection_.c_str() << std::endl;
105  }
106 
107  // ====================================
108  // Decode Basic DCCHeader Information
109  // ====================================
110 
111  for (EcalRawDataCollection::const_iterator headerItr = DCCHeader->begin(); headerItr != DCCHeader->end();
112  ++headerItr) {
113  event = headerItr->getLV1();
114  EcalDCCHeaderBlock::EcalDCCEventSettings settings = headerItr->getEventSettings();
115 
116  laser_color = (int)settings.wavelength;
117 
118  // Get run type and run number
119 
120  runType = headerItr->getRunType();
121  runNum = headerItr->getRunNumber();
122 
123  // Cut on runType
124 
127  return;
128 
129  // Define output results files' names
130 
131  if (IsFileCreated == 0) {
132  stringstream namefile;
133 
134  namefile << resdir_ << "/MatacqPerEvt-Run" << runNum << ".root";
135  outfile = namefile.str();
136 
137  outFile = new TFile(outfile.c_str(), "RECREATE");
138 
139  // declaration of the tree to fill
140 
141  tree = new TTree("MatacqTree", "MatacqTree");
142 
143  IsFileCreated = 1;
144  }
145  }
146 
147  // ===========================
148  // Decode Matacq Information
149  // ===========================
150 
151  int iCh = 0;
152  double max = 0;
153 
154  for (EcalMatacqDigiCollection::const_iterator it = matacqDigi->begin(); it != matacqDigi->end();
155  ++it) { // Loop on matacq channel
156 
157  //
158  const EcalMatacqDigi& digis = *it;
159 
160  if (digis.size() == 0 || iCh >= N_channels)
161  continue;
162 
163  max = 0;
164  maxsamp = 0;
165  nsamples = digis.size();
166 
167  if (IsTreeCreated == 0) {
168  //List of branches
169 
170  stringstream mat;
171  mat << "matacq[" << nsamples << "]/D" << endl;
172 
173  tree->Branch("event", &event, "event/I");
174  tree->Branch("laser_color", &laser_color, "laser_color/I");
175  // tree->Branch( "nsamples", &nsamples , "nsamples/I" );
176  tree->Branch("matacq", &matacq, mat.str().c_str());
177  tree->Branch("maxsamp", &maxsamp, "maxsamp/I");
178  tree->Branch("ttrig", &ttrig, "ttrig/D");
179 
180  tree->SetBranchAddress("event", &event);
181  tree->SetBranchAddress("laser_color", &laser_color);
182  tree->SetBranchAddress("matacq", matacq);
183  // tree->SetBranchAddress( "nsamples", &nsamples );
184  tree->SetBranchAddress("maxsamp", &maxsamp);
185  tree->SetBranchAddress("ttrig", &ttrig);
186 
187  IsTreeCreated = 1;
188  }
189 
190  ttrig = digis.tTrig();
191 
192  for (int i = 0; i < digis.size(); ++i) { // Loop on matacq samples
193  matacq[i] = digis.adcCount(i);
194  if (matacq[i] > max) {
195  max = matacq[i];
196  maxsamp = i;
197  }
198  }
199 
200  iCh++;
201  }
202 
203  tree->Fill();
204 
205 } // analyze
std::vector< T >::const_iterator const_iterator
float tTrig() const
float adcCount(const int &i) const
#define N_channels
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:500
const_iterator end() const
T const * product() const
Definition: Handle.h:70
int size() const
const_iterator begin() const
void EcalPerEvtMatacqAnalyzer::beginJob ( )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 70 of file EcalPerEvtMatacqAnalyzer.cc.

References IsFileCreated, and IsTreeCreated.

70  {
71  //========================================================================
72 
73  //Initializations
74 
75  IsFileCreated = 0;
76  IsTreeCreated = 0;
77 }
void EcalPerEvtMatacqAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 208 of file EcalPerEvtMatacqAnalyzer.cc.

References outFile, and tree.

Referenced by o2olib.O2ORunMgr::executeJob().

208  {
209  tree->Write();
210  outFile->Close();
211 }

Member Data Documentation

unsigned int EcalPerEvtMatacqAnalyzer::_highlev
private

Definition at line 68 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_lowlev
private

Definition at line 67 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_nevlasers
private

Definition at line 69 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_noiseCut
private

Definition at line 63 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_nsamplesaftmax
private

Definition at line 61 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_nsamplesbefmax
private

Definition at line 62 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_parabnaftmax
private

Definition at line 65 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_parabnbefmax
private

Definition at line 64 of file EcalPerEvtMatacqAnalyzer.h.

double EcalPerEvtMatacqAnalyzer::_presample
private

Definition at line 60 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_thres
private

Definition at line 66 of file EcalPerEvtMatacqAnalyzer.h.

double EcalPerEvtMatacqAnalyzer::ampl
private

Definition at line 52 of file EcalPerEvtMatacqAnalyzer.h.

std::string EcalPerEvtMatacqAnalyzer::digiCollection_
private

Definition at line 23 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and EcalPerEvtMatacqAnalyzer().

std::string EcalPerEvtMatacqAnalyzer::digiProducer_
private

Definition at line 24 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and EcalPerEvtMatacqAnalyzer().

int EcalPerEvtMatacqAnalyzer::event
private
std::string EcalPerEvtMatacqAnalyzer::eventHeaderCollection_
private

Definition at line 25 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and EcalPerEvtMatacqAnalyzer().

std::string EcalPerEvtMatacqAnalyzer::eventHeaderProducer_
private

Definition at line 26 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by EcalPerEvtMatacqAnalyzer().

double EcalPerEvtMatacqAnalyzer::fit
private

Definition at line 52 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by trackingPlots.Iteration::modules().

int EcalPerEvtMatacqAnalyzer::iEvent
private

Definition at line 30 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

int EcalPerEvtMatacqAnalyzer::IsFileCreated
private

Definition at line 48 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and beginJob().

int EcalPerEvtMatacqAnalyzer::IsTreeCreated
private

Definition at line 49 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and beginJob().

int EcalPerEvtMatacqAnalyzer::laser_color
private

Definition at line 40 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

double EcalPerEvtMatacqAnalyzer::matacq[2560]
private

Definition at line 41 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

unsigned int EcalPerEvtMatacqAnalyzer::maxsamp
private

Definition at line 42 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

TTree* EcalPerEvtMatacqAnalyzer::mtqShape
private

Definition at line 53 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::nsamples
private

Definition at line 43 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

std::string EcalPerEvtMatacqAnalyzer::outfile
private

Definition at line 28 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

TFile* EcalPerEvtMatacqAnalyzer::outFile
private

Definition at line 50 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and endJob().

double EcalPerEvtMatacqAnalyzer::peak
private

Definition at line 52 of file EcalPerEvtMatacqAnalyzer.h.

std::string EcalPerEvtMatacqAnalyzer::resdir_
private

Definition at line 22 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and EcalPerEvtMatacqAnalyzer().

int EcalPerEvtMatacqAnalyzer::runNum
private

Definition at line 35 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

int EcalPerEvtMatacqAnalyzer::runType
private

Definition at line 34 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

TFile* EcalPerEvtMatacqAnalyzer::sampFile
private

Definition at line 45 of file EcalPerEvtMatacqAnalyzer.h.

double EcalPerEvtMatacqAnalyzer::sigma
private

Definition at line 52 of file EcalPerEvtMatacqAnalyzer.h.

int EcalPerEvtMatacqAnalyzer::status
private
TTree* EcalPerEvtMatacqAnalyzer::tree
private
double EcalPerEvtMatacqAnalyzer::trise
private

Definition at line 52 of file EcalPerEvtMatacqAnalyzer.h.

double EcalPerEvtMatacqAnalyzer::ttrig
private

Definition at line 52 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().