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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) 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 [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::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 &)
 
- 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 34 of file EcalPerEvtMatacqAnalyzer.cc.

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

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

Definition at line 67 of file EcalPerEvtMatacqAnalyzer.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 90 of file EcalPerEvtMatacqAnalyzer.cc.

References EcalMatacqDigi::adcCount(), edm::SortedCollection< T, SORT >::begin(), ecal_dqm_sourceclient-live_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, bookConverter::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.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 78 of file EcalPerEvtMatacqAnalyzer.cc.

References IsFileCreated, and IsTreeCreated.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 224 of file EcalPerEvtMatacqAnalyzer.cc.

References outFile, and tree.

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

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
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[2560]
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().