CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
EcalPerEvtMatacqAnalyzer Class Reference

#include <EcalPerEvtMatacqAnalyzer.h>

Inheritance diagram for EcalPerEvtMatacqAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &e, const edm::EventSetup &c)
 
virtual void beginJob ()
 
 EcalPerEvtMatacqAnalyzer (const edm::ParameterSet &iConfig)
 
virtual void endJob ()
 
 ~EcalPerEvtMatacqAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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 [N_samples]
 
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::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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

Definition at line 15 of file EcalPerEvtMatacqAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file EcalPerEvtMatacqAnalyzer.cc.

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

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

Definition at line 68 of file EcalPerEvtMatacqAnalyzer.cc.

68  {
69 //========================================================================
70 
71  // do anything here that needs to be done at desctruction time
72  // (e.g. close files, deallocate resources etc.)
73 
74 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 91 of file EcalPerEvtMatacqAnalyzer.cc.

References EcalMatacqDigi::adcCount(), edm::SortedCollection< T, SORT >::begin(), dtNoiseDBValidation_cfg::cerr, digiCollection_, digiProducer_, edm::SortedCollection< T, SORT >::end(), event, eventHeaderCollection_, cppFunctionSkipper::exception, edm::Event::getByLabel(), i, iEvent, IsFileCreated, IsTreeCreated, laser_color, EcalDCCHeaderBlock::LASER_DELAY_SCAN, EcalDCCHeaderBlock::LASER_GAP, EcalDCCHeaderBlock::LASER_POWER_SCAN, EcalDCCHeaderBlock::LASER_STD, matacq, max(), maxsamp, N_channels, prof2calltree::namefile, nsamples, outfile, outFile, edm::Handle< T >::product(), resdir_, runNum, runType, EcalMatacqDigi::size(), tree, ttrig, EcalMatacqDigi::tTrig(), and EcalDCCHeaderBlock::EcalDCCEventSettings::wavelength.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 79 of file EcalPerEvtMatacqAnalyzer.cc.

References IsFileCreated, and IsTreeCreated.

79  {
80 //========================================================================
81 
82  //Initializations
83 
84  IsFileCreated=0;
85  IsTreeCreated=0;
86 
87 }
void EcalPerEvtMatacqAnalyzer::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 225 of file EcalPerEvtMatacqAnalyzer.cc.

References outFile, and tree.

226 {
227 
228  tree->Write();
229  outFile->Close();
230 
231 
232 }

Member Data Documentation

unsigned int EcalPerEvtMatacqAnalyzer::_highlev
private

Definition at line 77 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_lowlev
private

Definition at line 76 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_nevlasers
private

Definition at line 78 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_noiseCut
private

Definition at line 72 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_nsamplesaftmax
private

Definition at line 70 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_nsamplesbefmax
private

Definition at line 71 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_parabnaftmax
private

Definition at line 74 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_parabnbefmax
private

Definition at line 73 of file EcalPerEvtMatacqAnalyzer.h.

double EcalPerEvtMatacqAnalyzer::_presample
private

Definition at line 69 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::_thres
private

Definition at line 75 of file EcalPerEvtMatacqAnalyzer.h.

double EcalPerEvtMatacqAnalyzer::ampl
private

Definition at line 60 of file EcalPerEvtMatacqAnalyzer.h.

std::string EcalPerEvtMatacqAnalyzer::digiCollection_
private

Definition at line 31 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and EcalPerEvtMatacqAnalyzer().

std::string EcalPerEvtMatacqAnalyzer::digiProducer_
private

Definition at line 32 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and EcalPerEvtMatacqAnalyzer().

int EcalPerEvtMatacqAnalyzer::event
private

Definition at line 47 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and Types.EventID::cppID().

std::string EcalPerEvtMatacqAnalyzer::eventHeaderCollection_
private

Definition at line 33 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and EcalPerEvtMatacqAnalyzer().

std::string EcalPerEvtMatacqAnalyzer::eventHeaderProducer_
private

Definition at line 34 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by EcalPerEvtMatacqAnalyzer().

double EcalPerEvtMatacqAnalyzer::fit
private

Definition at line 60 of file EcalPerEvtMatacqAnalyzer.h.

int EcalPerEvtMatacqAnalyzer::iEvent
private

Definition at line 38 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

int EcalPerEvtMatacqAnalyzer::IsFileCreated
private

Definition at line 56 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and beginJob().

int EcalPerEvtMatacqAnalyzer::IsTreeCreated
private

Definition at line 57 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and beginJob().

int EcalPerEvtMatacqAnalyzer::laser_color
private

Definition at line 48 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

double EcalPerEvtMatacqAnalyzer::matacq[N_samples]
private

Definition at line 49 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

unsigned int EcalPerEvtMatacqAnalyzer::maxsamp
private

Definition at line 50 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

TTree* EcalPerEvtMatacqAnalyzer::mtqShape
private

Definition at line 61 of file EcalPerEvtMatacqAnalyzer.h.

unsigned int EcalPerEvtMatacqAnalyzer::nsamples
private

Definition at line 51 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

std::string EcalPerEvtMatacqAnalyzer::outfile
private

Definition at line 36 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

TFile* EcalPerEvtMatacqAnalyzer::outFile
private

Definition at line 58 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and endJob().

double EcalPerEvtMatacqAnalyzer::peak
private

Definition at line 60 of file EcalPerEvtMatacqAnalyzer.h.

std::string EcalPerEvtMatacqAnalyzer::resdir_
private

Definition at line 30 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze(), and EcalPerEvtMatacqAnalyzer().

int EcalPerEvtMatacqAnalyzer::runNum
private

Definition at line 43 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

int EcalPerEvtMatacqAnalyzer::runType
private

Definition at line 42 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().

TFile* EcalPerEvtMatacqAnalyzer::sampFile
private

Definition at line 53 of file EcalPerEvtMatacqAnalyzer.h.

double EcalPerEvtMatacqAnalyzer::sigma
private

Definition at line 60 of file EcalPerEvtMatacqAnalyzer.h.

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

Definition at line 60 of file EcalPerEvtMatacqAnalyzer.h.

double EcalPerEvtMatacqAnalyzer::ttrig
private

Definition at line 60 of file EcalPerEvtMatacqAnalyzer.h.

Referenced by analyze().