CMS 3D CMS Logo

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

#include <EcalLaserAnalyzer2.h>

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

Public Types

enum  VarCol { iBlue, iRed, nColor }
 
- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void beginJob () override
 
 EcalLaserAnalyzer2 (const edm::ParameterSet &iConfig)
 
void endJob () override
 
void setGeomEB (int etaG, int phiG, int module, int tower, int strip, int xtal, int apdRefTT, int channel, int lmr)
 
void setGeomEE (int etaG, int phiG, int iX, int iY, int iZ, int module, int tower, int ch, int apdRefTT, int channel, int lmr)
 
 ~EcalLaserAnalyzer2 () 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 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 Member Functions

bool getShapes ()
 

Private Attributes

const int _debug
 
const bool _docorpn
 
const std::string _ecalPart
 
const int _fedid
 
const unsigned int _firstsample
 
const unsigned int _firstsamplePN
 
const unsigned int _lastsample
 
const unsigned int _lastsamplePN
 
const unsigned int _niter
 
const double _noise
 
const unsigned int _nsamples
 
const unsigned int _nsamplesPN
 
unsigned int _presample
 
const double _presamplecut
 
const unsigned int _presamplePN
 
const double _qualpercent
 
const double _ratiomaxcutlow
 
const double _ratiomincuthigh
 
const double _ratiomincutlow
 
const bool _saveallevents
 
const bool _saveshapes
 
const unsigned int _timingcuthigh
 
const unsigned int _timingcutlow
 
const unsigned int _timingqualhigh
 
const unsigned int _timingquallow
 
double adc [10]
 
int adcC [1700]
 
std::string ADCfile
 
TFile * ADCFile
 
int adcG [10]
 
double adcMean [1700][10]
 
double * adcNoPed
 
TTree * ADCtrees [1700]
 
double APD [6]
 
double apdAmpl
 
double apdAmplA
 
double apdAmplB
 
TAPDAPDAnal [1700][nColor]
 
std::string APDfile
 
TFile * APDFile
 
TAPDAPDFirstAnal [1700][nColor]
 
double APDoAPDA [6]
 
double APDoAPDB [6]
 
double APDoPN [6]
 
double APDoPNA [6]
 
double APDoPNB [6]
 
TAPDPulseAPDPulse
 
std::map< int, unsigned int > apdRefMap [2]
 
double apdTime
 
TTree * APDtrees [1700]
 
int channelID
 
int channelIteratorEE
 
std::map< int, int > channelMapEE
 
int color
 
int colorref
 
std::vector< int > colors
 
int dccID
 
std::vector< int > dccMEM
 
TMomDelta01
 
TMomDelta12
 
const std::string digiCollection_
 
const std::string digiPNCollection_
 
const std::string digiProducer_
 
edm::EDGetTokenT< EBDigiCollectionebDigiToken_
 
edm::EDGetTokenT< EEDigiCollectioneeDigiToken_
 
const std::string elecfile_
 
int eta
 
int event
 
const std::string eventHeaderCollection_
 
const std::string eventHeaderProducer_
 
int eventref
 
int fedID
 
unsigned int firstChanMod [21]
 
int flag
 
int iChannelID [1700]
 
int idccID [1700]
 
int iEta [1700]
 
int iEvent
 
unsigned int iModule [1700]
 
int iPhi [1700]
 
unsigned int isFirstChanModFilled [21]
 
bool isGainOK
 
int iside [1700]
 
bool IsMatacqOK
 
bool isMatacqOK
 
bool isSPRFine
 
int IsThereDataADC [1700][nColor]
 
bool isTimingOK
 
int iTowerID [1700]
 
int iZ
 
int laserEvents
 
int lightside
 
const edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcdmappingToken_
 
std::string matfile
 
TMemMem
 
int moduleID
 
std::vector< int > modules
 
unsigned int nCrys
 
int nEvtBadGain [1700]
 
int nEvtBadTiming [1700]
 
int nEvtTot [1700]
 
unsigned int nMod
 
unsigned int nPNPerMod
 
unsigned int nRefChan
 
unsigned int nRefTrees
 
unsigned int nSamplesShapes
 
unsigned int nSides
 
int phi
 
double pn [50]
 
double PN [6]
 
double pn0
 
double pn1
 
double pnAmpl
 
TPNPNAnal [9][2][nColor]
 
const std::string pncorfile_
 
TPNCorpnCorrector
 
const edm::EDGetTokenT< EcalPnDiodeDigiCollectionpnDiodeDigiToken_
 
TPNPNFirstAnal [9][2][nColor]
 
int pnG [50]
 
int pnID
 
double * pnNoPed
 
double PNoPN [6]
 
double PNoPNA [6]
 
double PNoPNB [6]
 
TPNPulsePNPulse
 
TProfile * PulseShape
 
const edm::EDGetTokenT< EcalRawDataCollectionrawDataToken_
 
TTree * RefAPDtrees [2][21]
 
const std::string resdir_
 
std::string resfile
 
TFile * resFile
 
TTree * respntrees [nColor]
 
TTree * restrees [nColor]
 
int runNum
 
int runType
 
double ShapeCor
 
double shapeCorrection
 
std::string shapefile
 
TFile * ShapeFile
 
double shapes [250]
 
std::vector< double > shapesVec
 
int side
 
double Time [6]
 
int towerID
 
bool wasGainOK [1700]
 
bool wasTimingOK [1700]
 

Additional Inherited Members

- 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 54 of file EcalLaserAnalyzer2.h.

Member Enumeration Documentation

◆ VarCol

Constructor & Destructor Documentation

◆ EcalLaserAnalyzer2()

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

Definition at line 48 of file EcalLaserAnalyzer2.cc.

References _ecalPart, _fedid, _firstsample, _lastsample, _nsamples, _nsamplesPN, _presample, _presamplePN, _ratiomaxcutlow, _ratiomincuthigh, _ratiomincutlow, _timingcuthigh, _timingcutlow, _timingqualhigh, _timingquallow, APDPulse, Delta01, Delta12, digiCollection_, digiProducer_, ebDigiToken_, eeDigiToken_, firstChanMod, iChannelID, idccID, iEta, cuy::ii, iModule, ProducerED_cfi::InputTag, iPhi, isFirstChanModFilled, isGainOK, iside, isTimingOK, iTowerID, iZ, dqmiolumiharvest::j, ME::lmmodFromDcc(), Mem, nCrys, NCRYSEB, NCRYSEE, nMod, NREFCHAN, nRefChan, pncorfile_, pnCorrector, PNPulse, wasGainOK, and wasTimingOK.

50  : iEvent(0),
51  eventHeaderCollection_(iConfig.getParameter<std::string>("eventHeaderCollection")),
52  eventHeaderProducer_(iConfig.getParameter<std::string>("eventHeaderProducer")),
53  digiCollection_(iConfig.getParameter<std::string>("digiCollection")),
54  digiProducer_(iConfig.getParameter<std::string>("digiProducer")),
55  digiPNCollection_(iConfig.getParameter<std::string>("digiPNCollection")),
56  rawDataToken_(consumes<EcalRawDataCollection>(edm::InputTag(eventHeaderProducer_, eventHeaderCollection_))),
57  pnDiodeDigiToken_(consumes<EcalPnDiodeDigiCollection>(edm::InputTag(digiProducer_, digiPNCollection_))),
59  // Framework parameters with default values
60  _nsamples(iConfig.getUntrackedParameter<unsigned int>("nSamples", 10)),
61  _presample(iConfig.getUntrackedParameter<unsigned int>("nPresamples", 2)),
62  _firstsample(iConfig.getUntrackedParameter<unsigned int>("firstSample", 1)),
63  _lastsample(iConfig.getUntrackedParameter<unsigned int>("lastSample", 2)),
64  _nsamplesPN(iConfig.getUntrackedParameter<unsigned int>("nSamplesPN", 50)),
65  _presamplePN(iConfig.getUntrackedParameter<unsigned int>("nPresamplesPN", 6)),
66  _firstsamplePN(iConfig.getUntrackedParameter<unsigned int>("firstSamplePN", 7)),
67  _lastsamplePN(iConfig.getUntrackedParameter<unsigned int>("lastSamplePN", 8)),
68  _timingcutlow(iConfig.getUntrackedParameter<unsigned int>("timingCutLow", 2)),
69  _timingcuthigh(iConfig.getUntrackedParameter<unsigned int>("timingCutHigh", 9)),
70  _timingquallow(iConfig.getUntrackedParameter<unsigned int>("timingQualLow", 3)),
71  _timingqualhigh(iConfig.getUntrackedParameter<unsigned int>("timingQualHigh", 8)),
72  _ratiomincutlow(iConfig.getUntrackedParameter<double>("ratioMinCutLow", 0.4)),
73  _ratiomincuthigh(iConfig.getUntrackedParameter<double>("ratioMinCutHigh", 0.95)),
74  _ratiomaxcutlow(iConfig.getUntrackedParameter<double>("ratioMaxCutLow", 0.8)),
75  _presamplecut(iConfig.getUntrackedParameter<double>("presampleCut", 5.0)),
76  _niter(iConfig.getUntrackedParameter<unsigned int>("nIter", 5)),
77  _noise(iConfig.getUntrackedParameter<double>("noise", 2.0)),
78  _ecalPart(iConfig.getUntrackedParameter<std::string>("ecalPart", "EB")),
79  _saveshapes(iConfig.getUntrackedParameter<bool>("saveShapes", true)),
80  _docorpn(iConfig.getUntrackedParameter<bool>("doCorPN", false)),
81  _fedid(iConfig.getUntrackedParameter<int>("fedID", -999)),
82  _saveallevents(iConfig.getUntrackedParameter<bool>("saveAllEvents", false)),
83  _qualpercent(iConfig.getUntrackedParameter<double>("qualPercent", 0.2)),
84  _debug(iConfig.getUntrackedParameter<int>("debug", 0)),
85  resdir_(iConfig.getUntrackedParameter<std::string>("resDir")),
86  elecfile_(iConfig.getUntrackedParameter<std::string>("elecFile")),
87  pncorfile_(iConfig.getUntrackedParameter<std::string>("pnCorFile")),
88  nCrys(NCRYSEB),
90  nMod(NMODEB),
91  nSides(NSIDES),
93  IsMatacqOK(false),
94  runType(-1),
95  runNum(0),
96  towerID(-1),
97  channelID(-1),
98  fedID(-1),
99  dccID(-1),
100  side(2),
101  lightside(2),
102  iZ(1),
103  phi(-1),
104  eta(-1),
105  event(0),
106  color(0),
107  pn0(0),
108  pn1(0),
109  apdAmpl(0),
110  apdTime(0),
111  pnAmpl(0),
112  pnID(-1),
113  moduleID(-1),
114  flag(0),
116  ShapeCor(0)
117 
118 //========================================================================
119 
120 {
121  if (_ecalPart == "EB") {
122  ebDigiToken_ = consumes<EBDigiCollection>(edm::InputTag(digiProducer_, digiCollection_));
123  } else if (_ecalPart == "EE") {
124  eeDigiToken_ = consumes<EEDigiCollection>(edm::InputTag(digiProducer_, digiCollection_));
125  }
126 
127  // Geometrical constants initialization
128  if (_ecalPart == "EB") {
129  nCrys = NCRYSEB;
130  } else {
131  nCrys = NCRYSEE;
132  }
133  iZ = 1;
134  if (_fedid <= 609)
135  iZ = -1;
137  nMod = modules.size();
138  nRefChan = NREFCHAN;
139 
140  for (unsigned int j = 0; j < nCrys; j++) {
141  iEta[j] = -1;
142  iPhi[j] = -1;
143  iModule[j] = 10;
144  iTowerID[j] = -1;
145  iChannelID[j] = -1;
146  idccID[j] = -1;
147  iside[j] = -1;
148  wasTimingOK[j] = true;
149  wasGainOK[j] = true;
150  }
151 
152  for (unsigned int j = 0; j < nMod; j++) {
153  int ii = modules[j];
154  firstChanMod[ii - 1] = 0;
155  isFirstChanModFilled[ii - 1] = 0;
156  }
157 
158  // Quality check flags
159 
160  isGainOK = true;
161  isTimingOK = true;
162 
163  // PN linearity corrector
164 
166 
167  // Objects dealing with pulses
168 
170  _presample,
171  _firstsample,
172  _lastsample,
181 
182  // Object dealing with MEM numbering
183 
184  Mem = new TMem(_fedid);
185 
186  // Objects needed for npresample calculation
187 
188  Delta01 = new TMom();
189  Delta12 = new TMom();
190 }
const std::string eventHeaderCollection_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const std::string _ecalPart
const std::string digiPNCollection_
const unsigned int _firstsamplePN
#define NSIDES
const std::string pncorfile_
#define NCRYSEE
const std::string resdir_
const unsigned int _firstsample
unsigned int isFirstChanModFilled[21]
const unsigned int _lastsamplePN
Definition: TMom.h:7
const unsigned int _lastsample
const double _ratiomaxcutlow
const unsigned int _presamplePN
const unsigned int _timingcuthigh
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< EBDigiCollection > ebDigiToken_
Definition: TMem.h:7
const std::string eventHeaderProducer_
#define NCRYSEB
const unsigned int _timingqualhigh
const unsigned int _nsamples
#define NMODEB
const std::string digiProducer_
edm::EDGetTokenT< EEDigiCollection > eeDigiToken_
#define NREFCHAN
const std::string elecfile_
const double _presamplecut
ii
Definition: cuy.py:589
const std::string digiCollection_
const edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > mappingToken_
unsigned int firstChanMod[21]
#define NSAMPSHAPES
const unsigned int _niter
unsigned int nSamplesShapes
const double _ratiomincutlow
const double _ratiomincuthigh
const unsigned int _timingquallow
const unsigned int _timingcutlow
#define NPNPERMOD
unsigned int iModule[1700]
const unsigned int _nsamplesPN
const edm::EDGetTokenT< EcalRawDataCollection > rawDataToken_
const edm::EDGetTokenT< EcalPnDiodeDigiCollection > pnDiodeDigiToken_
Definition: TPNCor.h:7
static std::vector< ME::LMMid > lmmodFromDcc(ME::DCCid idcc)
Definition: ME.cc:574

◆ ~EcalLaserAnalyzer2()

EcalLaserAnalyzer2::~EcalLaserAnalyzer2 ( )
override

Definition at line 193 of file EcalLaserAnalyzer2.cc.

193  {
194  //========================================================================
195 
196  // do anything here that needs to be done at destruction time
197  // (e.g. close files, deallocate resources etc.)
198 }

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 275 of file EcalLaserAnalyzer2.cc.

References _debug, _docorpn, _ecalPart, _fedid, _firstsamplePN, _lastsamplePN, _nsamplesPN, adc, adcG, ADCtrees, TMom::addEntry(), APDPulse, MEEBGeom::apdRefTower(), MEEEGeom::apdRefTower(), cms::cuda::assert(), edm::SortedCollection< T, SORT >::begin(), DummyCfis::c, EcalElectronicsId::channelId(), channelID, channelIteratorEE, channelMapEE, color, alignCSCRings::corr, dccID, MEEEGeom::dee(), Delta01, Delta12, hgcalPerformanceValidation::df, digiCollection_, digiPNCollection_, TPNFit::doFit(), MillePedeFileConverter_cfg::e, CollectionTags_cfi::EBDigi, ebDigiToken_, CollectionTags_cfi::EEDigi, eeDigiToken_, MEEBGeom::electronic_channel(), edm::SortedCollection< T, SORT >::end(), eta, eventHeaderCollection_, fedID, spr::find(), TPNPulse::getAdcWithoutPedestal(), TPNFit::getAmpl(), TAPDPulse::getDelta(), TPNPulse::getMaxSample(), TPNCor::getPNCorrectionFactor(), ecalpyutils::hashedIndex(), mps_fire::i, EcalPnDiodeDetId::iDCCId(), iEvent, TPNFit::init(), createfilelist::int, EcalPnDiodeDetId::iPnId(), IsMatacqOK, TMem::isMemRelevant(), TAPDPulse::isPulseOK(), TAPDPulse::isTimingQualOK(), edm::HandleBase::isValid(), iZ, EcalDCCHeaderBlock::LASER_DELAY_SCAN, EcalDCCHeaderBlock::LASER_GAP, EcalDCCHeaderBlock::LASER_POWER_SCAN, EcalDCCHeaderBlock::LASER_STD, laserEvents, lightside, MEEEGeom::lmmod(), MEEBGeom::lmmod(), MEEBGeom::lmr(), MEEEGeom::lmr(), MEEBGeom::localCoord(), mappingToken_, METSkim_cff::Max, TMem::Mem(), Mem, nCrys, nEvtBadGain, nEvtBadTiming, nEvtTot, phi, MEEBGeom::pn(), MEEEGeom::pn(), pn, pn0, pn1, pnAmpl, pnCorrector, pnDiodeDigiToken_, pnG, pnNoPed, PNPulse, edm::Handle< T >::product(), rawDataToken_, runNum, runType, setGeomEB(), setGeomEE(), TPNPulse::setPulse(), TAPDPulse::setPulse(), side, findQualityFiles::size, nano_mu_digi_cff::strip, EcalElectronicsId::stripId(), l1tHGCalTowerProducer_cfi::tower, EcalElectronicsId::towerId(), towerID, EcalDCCHeaderBlock::EcalDCCEventSettings::wavelength, and EcalElectronicsId::xtalId().

275  {
276  //========================================================================
277 
278  ++iEvent;
279 
280  // retrieving DCC header
282  const EcalRawDataCollection* DCCHeader = nullptr;
283  e.getByToken(rawDataToken_, pDCCHeader);
284  if (!pDCCHeader.isValid()) {
285  edm::LogError("nodata") << "Error! can't get the product retrieving DCC header" << eventHeaderCollection_.c_str();
286  } else {
287  DCCHeader = pDCCHeader.product();
288  }
289 
290  //retrieving crystal data from Event
292  const EBDigiCollection* EBDigi = nullptr;
294  const EEDigiCollection* EEDigi = nullptr;
295  if (_ecalPart == "EB") {
296  e.getByToken(ebDigiToken_, pEBDigi);
297  if (!pEBDigi.isValid()) {
298  edm::LogError("nodata") << "Error! can't get the product retrieving EB crystal data " << digiCollection_.c_str();
299  } else {
300  EBDigi = pEBDigi.product();
301  }
302  } else if (_ecalPart == "EE") {
303  e.getByToken(eeDigiToken_, pEEDigi);
304  if (!pEEDigi.isValid()) {
305  edm::LogError("nodata") << "Error! can't get the product retrieving EE crystal data " << digiCollection_.c_str();
306  } else {
307  EEDigi = pEEDigi.product();
308  }
309  } else {
310  edm::LogError("cfg_error") << " Wrong ecalPart in cfg file ";
311  return;
312  }
313 
314  // retrieving crystal PN diodes from Event
316  const EcalPnDiodeDigiCollection* PNDigi = nullptr;
317  e.getByToken(pnDiodeDigiToken_, pPNDigi);
318  if (!pPNDigi.isValid()) {
319  edm::LogError("nodata") << "Error! can't get the product " << digiPNCollection_.c_str();
320  } else {
321  PNDigi = pPNDigi.product();
322  }
323 
324  // retrieving electronics mapping
325  const auto& TheMapping = c.getData(mappingToken_);
326 
327  // ====================================
328  // Decode Basic DCCHeader Information
329  // ====================================
330 
331  for (EcalRawDataCollection::const_iterator headerItr = DCCHeader->begin(); headerItr != DCCHeader->end();
332  ++headerItr) {
333  // Get run type and run number
334 
335  int fed = headerItr->fedId();
336  if (fed != _fedid && _fedid != -999)
337  continue;
338 
339  runType = headerItr->getRunType();
340  runNum = headerItr->getRunNumber();
341  event = headerItr->getLV1();
342 
343  dccID = headerItr->getDccInTCCCommand();
344  fedID = headerItr->fedId();
345  lightside = headerItr->getRtHalf();
346 
347  // Check fed corresponds to the DCC in TCC
348 
349  if (600 + dccID != fedID)
350  continue;
351 
352  // Cut on runType
353 
356  return;
357 
358  // Retrieve laser color and event number
359 
360  EcalDCCHeaderBlock::EcalDCCEventSettings settings = headerItr->getEventSettings();
361  color = settings.wavelength;
362  if (color < 0)
363  return;
364 
365  vector<int>::iterator iter = find(colors.begin(), colors.end(), color);
366  if (iter == colors.end()) {
367  colors.push_back(color);
368  edm::LogVerbatim("EcalLaserAnalyzer2") << " new color found " << color << " " << colors.size();
369  }
370  }
371 
372  // Check Matacq shape exists
373 
374  if (!IsMatacqOK)
375  return;
376 
377  // Cut on fedID
378 
379  if (fedID != _fedid && _fedid != -999)
380  return;
381 
382  // Count laser events
383 
384  laserEvents++;
385 
386  // ======================
387  // Decode PN Information
388  // ======================
389 
390  TPNFit* pnfit = new TPNFit();
392 
393  double chi2pn = 0;
394  unsigned int samplemax = 0;
395  int pnGain = 0;
396 
397  map<int, vector<double> > allPNAmpl;
398  map<int, vector<double> > allPNGain;
399 
400  // Loop on PNs digis
401 
402  for (EcalPnDiodeDigiCollection::const_iterator pnItr = PNDigi->begin(); pnItr != PNDigi->end(); ++pnItr) {
403  EcalPnDiodeDetId pnDetId = EcalPnDiodeDetId((*pnItr).id());
404 
405  if (_debug == 1)
406  edm::LogVerbatim("EcalLaserAnalyzer2")
407  << "-- debug test -- Inside PNDigi - pnID=" << pnDetId.iPnId() << ", dccID=" << pnDetId.iDCCId();
408 
409  // Skip MEM DCC without relevant data
410 
411  bool isMemRelevant = Mem->isMemRelevant(pnDetId.iDCCId());
412  if (!isMemRelevant)
413  continue;
414 
415  // Loop on PN samples
416 
417  for (int samId = 0; samId < (*pnItr).size(); samId++) {
418  pn[samId] = (*pnItr).sample(samId).adc();
419  pnG[samId] = (*pnItr).sample(samId).gainId();
420  if (samId == 0)
421  pnGain = pnG[samId];
422  if (samId > 0)
423  pnGain = int(TMath::Max(pnG[samId], pnGain));
424  }
425 
426  if (pnGain != 1)
427  edm::LogVerbatim("EcalLaserAnalyzer2") << "PN gain different from 1";
428 
429  // Calculate amplitude from pulse
430 
431  PNPulse->setPulse(pn);
433  samplemax = PNPulse->getMaxSample();
434  chi2pn = pnfit->doFit(samplemax, &pnNoPed[0]);
435  if (chi2pn == 101 || chi2pn == 102 || chi2pn == 103)
436  pnAmpl = 0.;
437  else
438  pnAmpl = pnfit->getAmpl();
439 
440  // Apply linearity correction
441 
442  double corr = 1.0;
443  if (_docorpn)
445  pnAmpl *= corr;
446 
447  // Fill PN ampl vector
448 
449  allPNAmpl[pnDetId.iDCCId()].push_back(pnAmpl);
450 
451  if (_debug == 1)
452  edm::LogVerbatim("EcalLaserAnalyzer2")
453  << "-- debug -- Inside PNDigi - PNampl=" << pnAmpl << ", PNgain=" << pnGain;
454  }
455 
456  // ===========================
457  // Decode EBDigis Information
458  // ===========================
459 
460  int adcGain = 0;
461 
462  if (EBDigi) {
463  // Loop on crystals
464  //===================
465 
466  for (EBDigiCollection::const_iterator digiItr = EBDigi->begin(); digiItr != EBDigi->end();
467  ++digiItr) { // Loop on crystals
468 
469  // Retrieve geometry
470  //===================
471 
472  EBDetId id_crystal(digiItr->id());
473  EBDataFrame df(*digiItr);
474  EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal);
475 
476  int etaG = id_crystal.ieta(); // global
477  int phiG = id_crystal.iphi(); // global
478 
479  std::pair<int, int> LocalCoord = MEEBGeom::localCoord(etaG, phiG);
480 
481  int etaL = LocalCoord.first; // local
482  int phiL = LocalCoord.second; // local
483 
484  int strip = elecid_crystal.stripId();
485  int xtal = elecid_crystal.xtalId();
486 
487  int module = MEEBGeom::lmmod(etaG, phiG);
488  int tower = elecid_crystal.towerId();
489 
490  int apdRefTT = MEEBGeom::apdRefTower(module);
491 
492  std::pair<int, int> pnpair = MEEBGeom::pn(module);
493  unsigned int MyPn0 = pnpair.first;
494  unsigned int MyPn1 = pnpair.second;
495 
496  int lmr = MEEBGeom::lmr(etaG, phiG);
497  unsigned int channel = MEEBGeom::electronic_channel(etaL, phiL);
498  assert(channel < nCrys);
499 
500  setGeomEB(etaG, phiG, module, tower, strip, xtal, apdRefTT, channel, lmr);
501 
502  if (_debug == 1)
503  edm::LogVerbatim("EcalLaserAnalyzer2")
504  << "-- debug -- Inside EBDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module
505  << " modules:" << modules.size();
506 
507  // APD Pulse
508  //===========
509 
510  // Loop on adc samples
511 
512  for (unsigned int i = 0; i < (*digiItr).size(); ++i) {
513  EcalMGPASample samp_crystal(df.sample(i));
514  adc[i] = samp_crystal.adc();
515  adcG[i] = samp_crystal.gainId();
516  adc[i] *= adcG[i];
517  if (i == 0)
518  adcGain = adcG[i];
519  if (i > 0)
520  adcGain = TMath::Max(adcG[i], adcGain);
521  }
522 
524 
525  // Quality checks
526  //================
527 
528  if (adcGain != 1)
529  nEvtBadGain[channel]++;
530  if (!APDPulse->isTimingQualOK())
531  nEvtBadTiming[channel]++;
532  nEvtTot[channel]++;
533 
534  // Associate PN ampl
535  //===================
536 
537  int mem0 = Mem->Mem(lmr, 0);
538  int mem1 = Mem->Mem(lmr, 1);
539 
540  if (allPNAmpl[mem0].size() > MyPn0)
541  pn0 = allPNAmpl[mem0][MyPn0];
542  else
543  pn0 = 0;
544  if (allPNAmpl[mem1].size() > MyPn1)
545  pn1 = allPNAmpl[mem1][MyPn1];
546  else
547  pn1 = 0;
548 
549  // Fill if Pulse is fine
550  //=======================
551 
552  if (APDPulse->isPulseOK() && lightside == side) {
553  ADCtrees[channel]->Fill();
554 
557  }
558  }
559 
560  } else if (EEDigi) {
561  // Loop on crystals
562  //===================
563 
564  for (EEDigiCollection::const_iterator digiItr = EEDigi->begin(); digiItr != EEDigi->end(); ++digiItr) {
565  // Retrieve geometry
566  //===================
567 
568  EEDetId id_crystal(digiItr->id());
569  EEDataFrame df(*digiItr);
570  EcalElectronicsId elecid_crystal = TheMapping.getElectronicsId(id_crystal);
571 
572  int etaG = id_crystal.iy();
573  int phiG = id_crystal.ix();
574 
575  int iX = (phiG - 1) / 5 + 1;
576  int iY = (etaG - 1) / 5 + 1;
577 
578  int tower = elecid_crystal.towerId();
579  int ch = elecid_crystal.channelId() - 1;
580 
581  int module = MEEEGeom::lmmod(iX, iY);
582  if (module >= 18 && side == 1)
583  module += 2;
584  int lmr = MEEEGeom::lmr(iX, iY, iZ);
585  int dee = MEEEGeom::dee(lmr);
586  int apdRefTT = MEEEGeom::apdRefTower(lmr, module);
587 
588  std::pair<int, int> pnpair = MEEEGeom::pn(dee, module);
589  unsigned int MyPn0 = pnpair.first;
590  unsigned int MyPn1 = pnpair.second;
591 
592  int hashedIndex = 100000 * eta + phi;
593  if (channelMapEE.count(hashedIndex) == 0) {
596  }
597  unsigned int channel = channelMapEE[hashedIndex];
598  assert(channel < nCrys);
599 
600  setGeomEE(etaG, phiG, iX, iY, iZ, module, tower, ch, apdRefTT, channel, lmr);
601 
602  if (_debug == 1)
603  edm::LogVerbatim("EcalLaserAnalyzer2")
604  << "-- debug -- Inside EEDigi - towerID:" << towerID << " channelID:" << channelID << " module:" << module
605  << " modules:" << modules.size();
606 
607  // APD Pulse
608  //===========
609 
610  if ((*digiItr).size() > 10)
611  edm::LogVerbatim("EcalLaserAnalyzer2") << "SAMPLES SIZE > 10!" << (*digiItr).size();
612 
613  // Loop on adc samples
614 
615  for (unsigned int i = 0; i < (*digiItr).size(); ++i) {
616  EcalMGPASample samp_crystal(df.sample(i));
617  adc[i] = samp_crystal.adc();
618  adcG[i] = samp_crystal.gainId();
619  adc[i] *= adcG[i];
620 
621  if (i == 0)
622  adcGain = adcG[i];
623  if (i > 0)
624  adcGain = TMath::Max(adcG[i], adcGain);
625  }
626 
628 
629  // Quality checks
630  //================
631 
632  if (adcGain != 1)
633  nEvtBadGain[channel]++;
634  if (!APDPulse->isTimingQualOK())
635  nEvtBadTiming[channel]++;
636  nEvtTot[channel]++;
637 
638  // Associate PN ampl
639  //===================
640 
641  int mem0 = Mem->Mem(lmr, 0);
642  int mem1 = Mem->Mem(lmr, 1);
643 
644  if (allPNAmpl[mem0].size() > MyPn0)
645  pn0 = allPNAmpl[mem0][MyPn0];
646  else
647  pn0 = 0;
648  if (allPNAmpl[mem1].size() > MyPn1)
649  pn1 = allPNAmpl[mem1][MyPn1];
650  else
651  pn1 = 0;
652 
653  // Fill if Pulse is fine
654  //=======================
655 
656  if (APDPulse->isPulseOK() && lightside == side) {
657  ADCtrees[channel]->Fill();
658 
661  }
662  }
663  }
664 }
size
Write out results.
void addEntry(double val)
Definition: TMom.cc:88
Log< level::Info, true > LogVerbatim
static XYCoord localCoord(int icr)
Definition: MEEBGeom.cc:142
const std::string eventHeaderCollection_
static int lmmod(SuperCrysCoord iX, SuperCrysCoord iY)
Definition: MEEEGeom.cc:112
const std::string _ecalPart
std::map< int, int > channelMapEE
const std::string digiPNCollection_
const unsigned int _firstsamplePN
static int apdRefTower(int ilmr, int ilmmod)
Definition: MEEEGeom.cc:1208
double getDelta(int, int)
Definition: TAPDPulse.cc:116
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
bool setPulse(double *)
Definition: TAPDPulse.cc:86
T const * product() const
Definition: Handle.h:70
double getPNCorrectionFactor(double val0, int gain)
Definition: TPNCor.cc:62
std::vector< T >::const_iterator const_iterator
void init(int, int, int)
Definition: TPNFit.cc:24
double * getAdcWithoutPedestal()
Definition: TPNPulse.cc:89
void setGeomEE(int etaG, int phiG, int iX, int iY, int iZ, int module, int tower, int ch, int apdRefTT, int channel, int lmr)
const unsigned int _lastsamplePN
static int lmr(EBGlobalCoord ieta, EBGlobalCoord iphi)
Definition: MEEBGeom.cc:110
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
assert(be >=bs)
bool setPulse(double *)
Definition: TPNPulse.cc:45
static std::pair< int, int > pn(int ilmmod)
Definition: MEEBGeom.cc:447
edm::EDGetTokenT< EBDigiCollection > ebDigiToken_
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:36
static std::pair< int, int > pn(int dee, int ilmod)
Definition: MEEEGeom.cc:574
int Mem(int, int)
Definition: TMem.cc:41
static int electronic_channel(EBLocalCoord ix, EBLocalCoord iy)
Definition: MEEBGeom.cc:326
dictionary corr
double getAmpl()
Definition: TPNFit.h:32
int towerId() const
get the tower id
edm::EDGetTokenT< EEDigiCollection > eeDigiToken_
static int apdRefTower(int ilmmod)
Definition: MEEBGeom.cc:490
int channelId() const
so far for EndCap only :
const_iterator begin() const
static int lmmod(EBGlobalCoord ieta, EBGlobalCoord iphi)
Definition: MEEBGeom.cc:90
const_iterator end() const
const std::string digiCollection_
const edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > mappingToken_
void setGeomEB(int etaG, int phiG, int module, int tower, int strip, int xtal, int apdRefTT, int channel, int lmr)
bool isTimingQualOK()
Definition: TAPDPulse.cc:145
int stripId() const
get the tower id
int iPnId() const
get the PnId
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
bool isValid() const
Definition: HandleBase.h:70
int xtalId() const
get the channel id
bool isPulseOK()
Definition: TAPDPulse.cc:162
Definition: colors.py:1
Definition: TPNFit.h:6
static int dee(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
Definition: MEEEGeom.cc:292
bool isMemRelevant(int)
Definition: TMem.cc:30
int getMaxSample()
Definition: TPNPulse.cc:70
double doFit(int, double *)
Definition: TPNFit.cc:39
const unsigned int _nsamplesPN
const edm::EDGetTokenT< EcalRawDataCollection > rawDataToken_
const edm::EDGetTokenT< EcalPnDiodeDigiCollection > pnDiodeDigiToken_
int iDCCId() const
get the DCCId
static int lmr(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
Definition: MEEEGeom.cc:254

◆ beginJob()

void EcalLaserAnalyzer2::beginJob ( )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 201 of file EcalLaserAnalyzer2.cc.

References adc, ADCfile, ADCFile, ADCtrees, APDfile, channelID, color, dccID, eta, getShapes(), mps_fire::i, IsMatacqOK, laserEvents, matfile, Skims_PA_cff::name, nCrys, phi, pn0, pn1, resdir_, resfile, shapefile, side, and towerID.

201  {
202  //========================================================================
203 
204  // Create temporary files and trees to save adc samples
205  //======================================================
206 
207  ADCfile = resdir_;
208  ADCfile += "/APDSamplesLaser.root";
209 
210  APDfile = resdir_;
211  APDfile += "/APDPNLaserAllEvents.root";
212 
213  ADCFile = new TFile(ADCfile.c_str(), "RECREATE");
214 
215  for (unsigned int i = 0; i < nCrys; i++) {
216  stringstream name;
217  name << "ADCTree" << i + 1;
218  ADCtrees[i] = new TTree(name.str().c_str(), name.str().c_str());
219 
220  ADCtrees[i]->Branch("iphi", &phi, "phi/I");
221  ADCtrees[i]->Branch("ieta", &eta, "eta/I");
222  ADCtrees[i]->Branch("towerID", &towerID, "towerID/I");
223  ADCtrees[i]->Branch("channelID", &channelID, "channelID/I");
224  ADCtrees[i]->Branch("dccID", &dccID, "dccID/I");
225  ADCtrees[i]->Branch("side", &side, "side/I");
226  ADCtrees[i]->Branch("event", &event, "event/I");
227  ADCtrees[i]->Branch("color", &color, "color/I");
228  ADCtrees[i]->Branch("adc", &adc, "adc[10]/D");
229  ADCtrees[i]->Branch("pn0", &pn0, "pn0/D");
230  ADCtrees[i]->Branch("pn1", &pn1, "pn1/D");
231 
232  ADCtrees[i]->SetBranchAddress("ieta", &eta);
233  ADCtrees[i]->SetBranchAddress("iphi", &phi);
234  ADCtrees[i]->SetBranchAddress("towerID", &towerID);
235  ADCtrees[i]->SetBranchAddress("channelID", &channelID);
236  ADCtrees[i]->SetBranchAddress("dccID", &dccID);
237  ADCtrees[i]->SetBranchAddress("side", &side);
238  ADCtrees[i]->SetBranchAddress("event", &event);
239  ADCtrees[i]->SetBranchAddress("color", &color);
240  ADCtrees[i]->SetBranchAddress("adc", adc);
241  ADCtrees[i]->SetBranchAddress("pn0", &pn0);
242  ADCtrees[i]->SetBranchAddress("pn1", &pn1);
243  }
244 
245  // Define output results filenames
246  //==================================
247  stringstream namefile1;
248  namefile1 << resdir_ << "/SHAPE_LASER.root";
249  shapefile = namefile1.str();
250 
251  stringstream namefile2;
252  namefile2 << resdir_ << "/APDPN_LASER.root";
253  resfile = namefile2.str();
254 
255  stringstream namefile3;
256  namefile3 << resdir_ << "/MATACQ.root";
257 
258  matfile = namefile3.str();
259 
260  // Get Pulse Shapes
261  //==================
262 
263  IsMatacqOK = getShapes();
264  if (!IsMatacqOK) {
265  edm::LogError("noshape") << " ERROR! No matacq shape available: analysis aborted !";
266  return;
267  }
268 
269  // Laser events counter
270 
271  laserEvents = 0;
272 }
const std::string resdir_
Log< level::Error, false > LogError
Definition: event.py:1

◆ endJob()

void EcalLaserAnalyzer2::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 668 of file EcalLaserAnalyzer2.cc.

References _debug, _ecalPart, _firstsample, _lastsample, _niter, _noise, _nsamples, _presample, _presamplecut, _qualpercent, _saveallevents, adc, ADCfile, ADCFile, adcNoPed, ADCtrees, TAPD::addEntry(), TPN::addEntry(), APD, apdAmpl, apdAmplA, apdAmplB, APDAnal, APDfile, APDFile, APDFirstAnal, APDoAPDA, APDoAPDB, APDoPN, APDoPNA, APDoPNB, APDPulse, apdRefMap, apdTime, APDtrees, cms::cuda::assert(), channelID, channelMapEE, color, colorref, TkAlMuonSelectors_cfi::cut, dccID, Delta01, Delta12, PulseFitWithShape::doFit(), eta, event, eventref, firstChanMod, flag, TAPDPulse::getAdcWithoutPedestal(), PulseFitWithShape::getAmpl(), TAPD::getAPD(), TAPD::getAPDoAPD0(), TAPD::getAPDoAPD1(), TAPD::getAPDoPN(), TAPD::getAPDoPN0(), TAPD::getAPDoPN1(), TMom::getMean(), TPN::getPN(), TPN::getPNoPN(), TPN::getPNoPN0(), TPN::getPNoPN1(), PulseFitWithShape::getTime(), TAPD::getTime(), edmStreamStallGrapher::getTime(), mps_fire::i, iChannelID, idccID, hcalRecHitTable_cff::ieta, iEta, iModule, PulseFitWithShape::init(), hcalRecHitTable_cff::iphi, iPhi, isGainOK, iside, IsMatacqOK, TAPDPulse::isPulseOK(), isSPRFine, IsThereDataADC, isTimingOK, iTowerID, laserEvents, moduleID, Skims_PA_cff::name, nColor, nCrys, nEvtBadGain, nEvtBadTiming, nEvtTot, nMod, nPNPerMod, nRefChan, nSamplesShapes, phi, PN, pn0, pn1, PNAnal, PNFirstAnal, pnID, PNoPN, PNoPNA, PNoPNB, RefAPDtrees, resfile, resFile, respntrees, restrees, TAPD::set2DAPDoAPD0Cut(), TAPD::set2DAPDoAPD1Cut(), TAPD::setAPDCut(), TAPD::setAPDoPN0Cut(), TAPD::setAPDoPN1Cut(), TAPD::setAPDoPNCut(), TPN::setPNCut(), TAPDPulse::setPresamples(), TAPDPulse::setPulse(), TAPD::setTimeCut(), ShapeCor, shapeCorrection, shapesVec, side, Time, towerID, wasGainOK, and wasTimingOK.

Referenced by o2olib.O2ORunMgr::executeJob().

668  {
669  //========================================================================
670 
671  if (!IsMatacqOK) {
672  edm::LogVerbatim("EcalLaserAnalyzer2") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+";
673  edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ WARNING! NO MATACQ +=+";
674  edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+";
675  return;
676  }
677 
678  // Adjust channel numbers for EE
679  //===============================
680 
681  if (_ecalPart == "EE") {
682  nCrys = channelMapEE.size();
683  }
684 
685  // Set presamples number
686  //======================
687 
688  double delta01 = Delta01->getMean();
689  double delta12 = Delta12->getMean();
690  if (delta12 > _presamplecut) {
691  _presample = 2;
692  if (delta01 > _presamplecut)
693  _presample = 1;
694  }
695 
697 
698  // Don't do anything if there is no events
699  //=========================================
700 
701  if (laserEvents == 0) {
702  ADCFile->Close();
703  stringstream del;
704  del << "rm " << ADCfile;
705  system(del.str().c_str());
706  edm::LogVerbatim("EcalLaserAnalyzer2") << " No Laser Events ";
707  return;
708  }
709 
710  // Set quality flags for gains and timing
711  //=========================================
712 
713  double BadGainEvtPercentage = 0.0;
714  double BadTimingEvtPercentage = 0.0;
715 
716  int nChanBadGain = 0;
717  int nChanBadTiming = 0;
718 
719  for (unsigned int i = 0; i < nCrys; i++) {
720  if (nEvtTot[i] != 0) {
721  BadGainEvtPercentage = double(nEvtBadGain[i]) / double(nEvtTot[i]);
722  BadTimingEvtPercentage = double(nEvtBadTiming[i]) / double(nEvtTot[i]);
723  }
724  if (BadGainEvtPercentage > _qualpercent) {
725  wasGainOK[i] = false;
726  nChanBadGain++;
727  }
728  if (BadTimingEvtPercentage > _qualpercent) {
729  wasTimingOK[i] = false;
730  nChanBadTiming++;
731  }
732  }
733 
734  double BadGainChanPercentage = double(nChanBadGain) / double(nCrys);
735  double BadTimingChanPercentage = double(nChanBadTiming) / double(nCrys);
736 
737  if (BadGainChanPercentage > _qualpercent)
738  isGainOK = false;
739  if (BadTimingChanPercentage > _qualpercent)
740  isTimingOK = false;
741 
742  // Analyze adc samples to get amplitudes
743  //=======================================
744 
745  edm::LogVerbatim("EcalLaserAnalyzer2") << "\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+";
746  edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ Analyzing laser data: getting APD, PN, APD/PN, PN/PN +=+";
747 
748  if (!isGainOK)
749  edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+";
750  if (!isTimingOK)
751  edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ ............................ WARNING! TIMING WAS BAD +=+";
752 
753  APDFile = new TFile(APDfile.c_str(), "RECREATE");
754 
755  int ieta, iphi;
756 
757  int flagfit;
758  for (unsigned int i = 0; i < nCrys; i++) {
759  stringstream name;
760  name << "APDTree" << i + 1;
761 
762  APDtrees[i] = new TTree(name.str().c_str(), name.str().c_str());
763 
764  //List of branches
765 
766  APDtrees[i]->Branch("event", &event, "event/I");
767  APDtrees[i]->Branch("color", &color, "color/I");
768  APDtrees[i]->Branch("iphi", &iphi, "iphi/I");
769  APDtrees[i]->Branch("ieta", &ieta, "ieta/I");
770  APDtrees[i]->Branch("side", &side, "side/I");
771  APDtrees[i]->Branch("dccID", &dccID, "dccID/I");
772  APDtrees[i]->Branch("towerID", &towerID, "towerID/I");
773  APDtrees[i]->Branch("channelID", &channelID, "channelID/I");
774  APDtrees[i]->Branch("apdAmpl", &apdAmpl, "apdAmpl/D");
775  APDtrees[i]->Branch("apdTime", &apdTime, "apdTime/D");
776  if (_saveallevents)
777  APDtrees[i]->Branch("adc", &adc, "adc[10]/D");
778  APDtrees[i]->Branch("flagfit", &flagfit, "flagfit/I");
779  APDtrees[i]->Branch("pn0", &pn0, "pn0/D");
780  APDtrees[i]->Branch("pn1", &pn1, "pn1/D");
781 
782  APDtrees[i]->SetBranchAddress("event", &event);
783  APDtrees[i]->SetBranchAddress("color", &color);
784  APDtrees[i]->SetBranchAddress("iphi", &iphi);
785  APDtrees[i]->SetBranchAddress("ieta", &ieta);
786  APDtrees[i]->SetBranchAddress("side", &side);
787  APDtrees[i]->SetBranchAddress("dccID", &dccID);
788  APDtrees[i]->SetBranchAddress("towerID", &towerID);
789  APDtrees[i]->SetBranchAddress("channelID", &channelID);
790  APDtrees[i]->SetBranchAddress("apdAmpl", &apdAmpl);
791  APDtrees[i]->SetBranchAddress("apdTime", &apdTime);
792  if (_saveallevents)
793  APDtrees[i]->SetBranchAddress("adc", adc);
794  APDtrees[i]->SetBranchAddress("flagfit", &flagfit);
795  APDtrees[i]->SetBranchAddress("pn0", &pn0);
796  APDtrees[i]->SetBranchAddress("pn1", &pn1);
797  }
798 
799  for (unsigned int iref = 0; iref < nRefChan; iref++) {
800  for (unsigned int imod = 0; imod < nMod; imod++) {
801  int jmod = modules[imod];
802 
803  stringstream nameref;
804  nameref << "refAPDTree" << imod << "_" << iref;
805 
806  RefAPDtrees[iref][jmod] = new TTree(nameref.str().c_str(), nameref.str().c_str());
807 
808  RefAPDtrees[iref][jmod]->Branch("eventref", &eventref, "eventref/I");
809  RefAPDtrees[iref][jmod]->Branch("colorref", &colorref, "colorref/I");
810  if (iref == 0)
811  RefAPDtrees[iref][jmod]->Branch("apdAmplA", &apdAmplA, "apdAmplA/D");
812  if (iref == 1)
813  RefAPDtrees[iref][jmod]->Branch("apdAmplB", &apdAmplB, "apdAmplB/D");
814 
815  RefAPDtrees[iref][jmod]->SetBranchAddress("eventref", &eventref);
816  RefAPDtrees[iref][jmod]->SetBranchAddress("colorref", &colorref);
817  if (iref == 0)
818  RefAPDtrees[iref][jmod]->SetBranchAddress("apdAmplA", &apdAmplA);
819  if (iref == 1)
820  RefAPDtrees[iref][jmod]->SetBranchAddress("apdAmplB", &apdAmplB);
821  }
822  }
823 
824  assert(colors.size() <= nColor);
825  unsigned int nCol = colors.size();
826 
827  // Declare PN stuff
828  //===================
829 
830  for (unsigned int iM = 0; iM < nMod; iM++) {
831  unsigned int iMod = modules[iM] - 1;
832 
833  for (unsigned int ich = 0; ich < nPNPerMod; ich++) {
834  for (unsigned int icol = 0; icol < nCol; icol++) {
835  PNFirstAnal[iMod][ich][icol] = new TPN(ich);
836  PNAnal[iMod][ich][icol] = new TPN(ich);
837  }
838  }
839  }
840 
841  // Declare function for APD ampl fit
842  //===================================
843 
844  PulseFitWithShape* psfit = new PulseFitWithShape();
845 
846  for (unsigned int iCry = 0; iCry < nCrys; iCry++) {
847  for (unsigned int icol = 0; icol < nCol; icol++) {
848  // Declare APD stuff
849  //===================
850 
851  APDFirstAnal[iCry][icol] = new TAPD();
852  IsThereDataADC[iCry][icol] = 1;
853  stringstream cut;
854  cut << "color==" << colors.at(icol);
855  if (ADCtrees[iCry]->GetEntries(cut.str().c_str()) < 10)
856  IsThereDataADC[iCry][icol] = 0;
857  }
858 
859  unsigned int iMod = iModule[iCry] - 1;
860  assert(iMod <= nMod);
861 
862  if (isSPRFine)
864 
865  // Loop on events
866  //================
867 
868  for (Long64_t jentry = 0; jentry < ADCtrees[iCry]->GetEntriesFast(); jentry++) { // Loop on events
869  ADCtrees[iCry]->GetEntry(jentry);
870 
871  flagfit = 1;
872  apdAmpl = 0.0;
873  apdTime = 0.0;
874  ieta = eta;
875  iphi = phi;
876 
877  // Get back color
878 
879  unsigned int iCol = 0;
880  for (unsigned int i = 0; i < nCol; i++) {
881  if (color == colors[i]) {
882  iCol = i;
883  i = colors.size();
884  }
885  }
886 
887  // Amplitude calculation
888 
891 
892  if (isSPRFine && APDPulse->isPulseOK()) {
893  psfit->doFit(&adcNoPed[0]);
894  apdAmpl = psfit->getAmpl();
895  apdTime = psfit->getTime();
896 
897  } else {
898  apdAmpl = 0;
899  apdTime = 0;
900  flagfit = 0;
901  }
902 
903  if (_debug >= 1)
904  edm::LogVerbatim("EcalLaserAnalyzer2")
905  << "-- debug test -- endJob -- apdAmpl:" << apdAmpl << " apdTime:" << apdTime;
906  double pnmean;
907  if (pn0 < 10 && pn1 > 10) {
908  pnmean = pn1;
909  } else if (pn1 < 10 && pn0 > 10) {
910  pnmean = pn0;
911  } else
912  pnmean = 0.5 * (pn0 + pn1);
913 
914  if (_debug >= 1)
915  edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- pnMean:" << pnmean;
916 
917  // Fill PN stuff
918  //===============
919 
920  if (firstChanMod[iMod] == iCry && IsThereDataADC[iCry][iCol] == 1) {
921  for (unsigned int ichan = 0; ichan < nPNPerMod; ichan++) {
922  PNFirstAnal[iMod][ichan][iCol]->addEntry(pnmean, pn0, pn1);
923  }
924  }
925 
926  // Fill APD stuff
927  //================
928 
929  if (apdAmpl != 0.0)
930  APDFirstAnal[iCry][iCol]->addEntry(apdAmpl, pnmean, pn0, pn1, apdTime);
931  if (_debug >= 1)
932  edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- filling APDTree";
933 
934  APDtrees[iCry]->Fill();
935 
936  // Fill reference trees
937  //=====================
938 
939  if (apdRefMap[0][iMod + 1] == iCry || apdRefMap[1][iMod + 1] == iCry) {
940  apdAmplA = 0.0;
941  apdAmplB = 0.0;
942  eventref = event;
943  colorref = color;
944 
945  for (unsigned int ir = 0; ir < nRefChan; ir++) {
946  if (_debug >= 1)
947  edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- ir:" << ir << " tt:" << towerID
948  << " refmap:" << apdRefMap[ir][iMod + 1] << " iCry:" << iCry;
949 
950  if (apdRefMap[ir][iMod + 1] == iCry) {
951  if (_debug >= 1)
952  edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- cut passed ";
953  if (ir == 0)
954  apdAmplA = apdAmpl;
955  else if (ir == 1)
956  apdAmplB = apdAmpl;
957  if (_debug >= 1)
958  edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- apdAmplA=" << apdAmplA;
959  if (_debug >= 1)
960  edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- apdAmplB=" << apdAmplB;
961  if (_debug >= 1)
962  edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- color=" << color << ", event:" << event
963  << ", ir:" << ir << " tt-1:" << towerID - 1;
964 
965  RefAPDtrees[ir][iMod + 1]->Fill();
966 
967  if (_debug >= 1)
968  edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- tree filled" << event;
969  }
970  }
971  }
972  }
973  }
974 
975  delete psfit;
976 
977  ADCFile->Close();
978 
979  if (_debug == 1)
980  edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- after apdAmpl Loop";
981 
982  // Remove temporary file
983  //=======================
984  stringstream del;
985  del << "rm " << ADCfile;
986  system(del.str().c_str());
987 
988  // Create output trees
989  //=====================
990 
991  resFile = new TFile(resfile.c_str(), "RECREATE");
992 
993  for (unsigned int iColor = 0; iColor < nCol; iColor++) {
994  stringstream nametree;
995  nametree << "APDCol" << colors.at(iColor);
996  stringstream nametree2;
997  nametree2 << "PNCol" << colors.at(iColor);
998 
999  restrees[iColor] = new TTree(nametree.str().c_str(), nametree.str().c_str());
1000  respntrees[iColor] = new TTree(nametree2.str().c_str(), nametree2.str().c_str());
1001 
1002  restrees[iColor]->Branch("iphi", &iphi, "iphi/I");
1003  restrees[iColor]->Branch("ieta", &ieta, "ieta/I");
1004  restrees[iColor]->Branch("side", &side, "side/I");
1005  restrees[iColor]->Branch("dccID", &dccID, "dccID/I");
1006  restrees[iColor]->Branch("moduleID", &moduleID, "moduleID/I");
1007  restrees[iColor]->Branch("towerID", &towerID, "towerID/I");
1008  restrees[iColor]->Branch("channelID", &channelID, "channelID/I");
1009  restrees[iColor]->Branch("APD", &APD, "APD[6]/D");
1010  restrees[iColor]->Branch("Time", &Time, "Time[6]/D");
1011  restrees[iColor]->Branch("APDoPN", &APDoPN, "APDoPN[6]/D");
1012  restrees[iColor]->Branch("APDoPNA", &APDoPNA, "APDoPNA[6]/D");
1013  restrees[iColor]->Branch("APDoPNB", &APDoPNB, "APDoPNB[6]/D");
1014  restrees[iColor]->Branch("APDoAPDA", &APDoAPDA, "APDoAPDA[6]/D");
1015  restrees[iColor]->Branch("APDoAPDB", &APDoAPDB, "APDoAPDB[6]/D");
1016  restrees[iColor]->Branch("ShapeCor", &ShapeCor, "ShapeCor/D");
1017  restrees[iColor]->Branch("flag", &flag, "flag/I");
1018 
1019  respntrees[iColor]->Branch("moduleID", &moduleID, "moduleID/I");
1020  respntrees[iColor]->Branch("pnID", &pnID, "pnID/I");
1021  respntrees[iColor]->Branch("PN", &PN, "PN[6]/D");
1022  respntrees[iColor]->Branch("PNoPN", &PNoPN, "PNoPN[6]/D");
1023  respntrees[iColor]->Branch("PNoPNA", &PNoPNA, "PNoPNA[6]/D");
1024  respntrees[iColor]->Branch("PNoPNB", &PNoPNB, "PNoPNB[6]/D");
1025 
1026  restrees[iColor]->SetBranchAddress("iphi", &iphi);
1027  restrees[iColor]->SetBranchAddress("ieta", &ieta);
1028  restrees[iColor]->SetBranchAddress("dccID", &dccID);
1029  restrees[iColor]->SetBranchAddress("moduleID", &moduleID);
1030  restrees[iColor]->SetBranchAddress("towerID", &towerID);
1031  restrees[iColor]->SetBranchAddress("channelID", &channelID);
1032  restrees[iColor]->SetBranchAddress("APD", APD);
1033  restrees[iColor]->SetBranchAddress("Time", Time);
1034  restrees[iColor]->SetBranchAddress("APDoPN", APDoPN);
1035  restrees[iColor]->SetBranchAddress("APDoPNA", APDoPNA);
1036  restrees[iColor]->SetBranchAddress("APDoPNB", APDoPNB);
1037  restrees[iColor]->SetBranchAddress("APDoAPDA", APDoAPDA);
1038  restrees[iColor]->SetBranchAddress("APDoAPDB", APDoAPDB);
1039  restrees[iColor]->SetBranchAddress("ShapeCor", &ShapeCor);
1040  restrees[iColor]->SetBranchAddress("flag", &flag);
1041 
1042  respntrees[iColor]->SetBranchAddress("moduleID", &moduleID);
1043  respntrees[iColor]->SetBranchAddress("pnID", &pnID);
1044  respntrees[iColor]->SetBranchAddress("PN", PN);
1045  respntrees[iColor]->SetBranchAddress("PNoPN", PNoPN);
1046  respntrees[iColor]->SetBranchAddress("PNoPNA", PNoPNA);
1047  respntrees[iColor]->SetBranchAddress("PNoPNB", PNoPNB);
1048  }
1049 
1050  // Set Cuts for PN stuff
1051  //=======================
1052 
1053  for (unsigned int iM = 0; iM < nMod; iM++) {
1054  unsigned int iMod = modules[iM] - 1;
1055 
1056  for (unsigned int ich = 0; ich < nPNPerMod; ich++) {
1057  for (unsigned int icol = 0; icol < nCol; icol++) {
1058  PNAnal[iMod][ich][icol]->setPNCut(PNFirstAnal[iMod][ich][icol]->getPN().at(0),
1059  PNFirstAnal[iMod][ich][icol]->getPN().at(1));
1060  }
1061  }
1062  }
1063 
1064  // Build ref trees indexes
1065  //========================
1066  for (unsigned int imod = 0; imod < nMod; imod++) {
1067  int jmod = modules[imod];
1068  if (RefAPDtrees[0][jmod]->GetEntries() != 0 && RefAPDtrees[1][jmod]->GetEntries() != 0) {
1069  RefAPDtrees[0][jmod]->BuildIndex("eventref");
1070  RefAPDtrees[1][jmod]->BuildIndex("eventref");
1071  }
1072  }
1073 
1074  // Final loop on crystals
1075  //=======================
1076 
1077  for (unsigned int iCry = 0; iCry < nCrys; iCry++) {
1078  unsigned int iMod = iModule[iCry] - 1;
1079 
1080  // Set cuts on APD stuff
1081  //=======================
1082 
1083  for (unsigned int iCol = 0; iCol < nCol; iCol++) {
1084  std::vector<double> lowcut;
1085  std::vector<double> highcut;
1086  double cutMin;
1087  double cutMax;
1088 
1089  cutMin = APDFirstAnal[iCry][iCol]->getAPD().at(0) - 2.0 * APDFirstAnal[iCry][iCol]->getAPD().at(1);
1090  if (cutMin < 0)
1091  cutMin = 0;
1092  cutMax = APDFirstAnal[iCry][iCol]->getAPD().at(0) + 2.0 * APDFirstAnal[iCry][iCol]->getAPD().at(1);
1093 
1094  lowcut.push_back(cutMin);
1095  highcut.push_back(cutMax);
1096 
1097  cutMin = APDFirstAnal[iCry][iCol]->getTime().at(0) - 2.0 * APDFirstAnal[iCry][iCol]->getTime().at(1);
1098  cutMax = APDFirstAnal[iCry][iCol]->getTime().at(0) + 2.0 * APDFirstAnal[iCry][iCol]->getTime().at(1);
1099  lowcut.push_back(cutMin);
1100  highcut.push_back(cutMax);
1101 
1102  APDAnal[iCry][iCol] = new TAPD();
1103  APDAnal[iCry][iCol]->setAPDCut(APDFirstAnal[iCry][iCol]->getAPD().at(0),
1104  APDFirstAnal[iCry][iCol]->getAPD().at(1));
1105  APDAnal[iCry][iCol]->setAPDoPNCut(APDFirstAnal[iCry][iCol]->getAPDoPN().at(0),
1106  APDFirstAnal[iCry][iCol]->getAPDoPN().at(1));
1107  APDAnal[iCry][iCol]->setAPDoPN0Cut(APDFirstAnal[iCry][iCol]->getAPDoPN0().at(0),
1108  APDFirstAnal[iCry][iCol]->getAPDoPN0().at(1));
1109  APDAnal[iCry][iCol]->setAPDoPN1Cut(APDFirstAnal[iCry][iCol]->getAPDoPN1().at(0),
1110  APDFirstAnal[iCry][iCol]->getAPDoPN1().at(1));
1111  APDAnal[iCry][iCol]->setTimeCut(APDFirstAnal[iCry][iCol]->getTime().at(0),
1112  APDFirstAnal[iCry][iCol]->getTime().at(1));
1113  APDAnal[iCry][iCol]->set2DAPDoAPD0Cut(lowcut, highcut);
1114  APDAnal[iCry][iCol]->set2DAPDoAPD1Cut(lowcut, highcut);
1115  }
1116 
1117  // Final loop on events
1118  //=======================
1119 
1120  for (Long64_t jentry = 0; jentry < APDtrees[iCry]->GetEntriesFast(); jentry++) {
1121  APDtrees[iCry]->GetEntry(jentry);
1122 
1123  double pnmean;
1124  if (pn0 < 10 && pn1 > 10) {
1125  pnmean = pn1;
1126  } else if (pn1 < 10 && pn0 > 10) {
1127  pnmean = pn0;
1128  } else
1129  pnmean = 0.5 * (pn0 + pn1);
1130 
1131  // Get back color
1132  //================
1133 
1134  unsigned int iCol = 0;
1135  for (unsigned int i = 0; i < nCol; i++) {
1136  if (color == colors[i]) {
1137  iCol = i;
1138  i = colors.size();
1139  }
1140  }
1141 
1142  // Fill PN stuff
1143  //===============
1144 
1145  if (firstChanMod[iMod] == iCry && IsThereDataADC[iCry][iCol] == 1) {
1146  for (unsigned int ichan = 0; ichan < nPNPerMod; ichan++) {
1147  PNAnal[iMod][ichan][iCol]->addEntry(pnmean, pn0, pn1);
1148  }
1149  }
1150 
1151  // Get ref amplitudes
1152  //===================
1153 
1154  if (_debug >= 1)
1155  edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- LastLoop event:" << event << " apdAmpl:" << apdAmpl;
1156  apdAmplA = 0.0;
1157  apdAmplB = 0.0;
1158 
1159  for (unsigned int iRef = 0; iRef < nRefChan; iRef++) {
1160  RefAPDtrees[iRef][iMod + 1]->GetEntryWithIndex(event);
1161  }
1162 
1163  if (_debug == 1)
1164  edm::LogVerbatim("EcalLaserAnalyzer2")
1165  << "-- debug test -- LastLoop apdAmplA:" << apdAmplA << " apdAmplB:" << apdAmplB << ", event:" << event
1166  << ", eventref:" << eventref;
1167 
1168  // Fill APD stuff
1169  //===============
1170 
1171  APDAnal[iCry][iCol]->addEntry(apdAmpl, pnmean, pn0, pn1, apdTime, apdAmplA, apdAmplB);
1172  }
1173 
1174  moduleID = iMod + 1;
1175 
1176  if (moduleID >= 20)
1177  moduleID -= 2; // Trick to fix endcap specificity
1178 
1179  // Get final results for APD
1180  //===========================
1181 
1182  for (unsigned int iColor = 0; iColor < nCol; iColor++) {
1183  std::vector<double> apdvec = APDAnal[iCry][iColor]->getAPD();
1184  std::vector<double> apdpnvec = APDAnal[iCry][iColor]->getAPDoPN();
1185  std::vector<double> apdpn0vec = APDAnal[iCry][iColor]->getAPDoPN0();
1186  std::vector<double> apdpn1vec = APDAnal[iCry][iColor]->getAPDoPN1();
1187  std::vector<double> timevec = APDAnal[iCry][iColor]->getTime();
1188  std::vector<double> apdapd0vec = APDAnal[iCry][iColor]->getAPDoAPD0();
1189  std::vector<double> apdapd1vec = APDAnal[iCry][iColor]->getAPDoAPD1();
1190 
1191  for (unsigned int i = 0; i < apdvec.size(); i++) {
1192  APD[i] = apdvec.at(i);
1193  APDoPN[i] = apdpnvec.at(i);
1194  APDoPNA[i] = apdpn0vec.at(i);
1195  APDoPNB[i] = apdpn1vec.at(i);
1196  APDoAPDA[i] = apdapd0vec.at(i);
1197  APDoAPDB[i] = apdapd1vec.at(i);
1198  Time[i] = timevec.at(i);
1200  }
1201 
1202  // Fill APD results trees
1203  //========================
1204 
1205  iphi = iPhi[iCry];
1206  ieta = iEta[iCry];
1207  dccID = idccID[iCry];
1208  towerID = iTowerID[iCry];
1209  side = iside[iCry];
1210  channelID = iChannelID[iCry];
1211 
1212  if (!wasGainOK[iCry] || !wasTimingOK[iCry] || IsThereDataADC[iCry][iColor] == 0)
1213  flag = 1;
1214  else
1215  flag = 0;
1216 
1217  if (_debug >= 1)
1218  edm::LogVerbatim("EcalLaserAnalyzer2") << "-- debug test -- endJob -- APD[0]" << APD[0] << " APDoPN[0] "
1219  << APDoPN[0] << " APDoAPDA[0] " << APDoAPDA[0] << " flag " << flag;
1220  restrees[iColor]->Fill();
1221  }
1222  }
1223 
1224  // Get final results for PN
1225  //==========================
1226 
1227  for (unsigned int iM = 0; iM < nMod; iM++) {
1228  unsigned int iMod = modules[iM] - 1;
1229 
1230  side = iside[firstChanMod[iMod]];
1231 
1232  for (unsigned int ch = 0; ch < nPNPerMod; ch++) {
1233  pnID = ch;
1234  moduleID = iMod + 1;
1235 
1236  if (moduleID >= 20)
1237  moduleID -= 2; // Trick to fix endcap specificity
1238 
1239  for (unsigned int iColor = 0; iColor < nCol; iColor++) {
1240  std::vector<double> pnvec = PNAnal[iMod][ch][iColor]->getPN();
1241  std::vector<double> pnopnvec = PNAnal[iMod][ch][iColor]->getPNoPN();
1242  std::vector<double> pnopn0vec = PNAnal[iMod][ch][iColor]->getPNoPN0();
1243  std::vector<double> pnopn1vec = PNAnal[iMod][ch][iColor]->getPNoPN1();
1244 
1245  for (unsigned int i = 0; i < pnvec.size(); i++) {
1246  PN[i] = pnvec.at(i);
1247  PNoPN[i] = pnopnvec.at(i);
1248  PNoPNA[i] = pnopn0vec.at(i);
1249  PNoPNB[i] = pnopn1vec.at(i);
1250  }
1251 
1252  if (_debug >= 1)
1253  edm::LogVerbatim("EcalLaserAnalyzer2")
1254  << "-- debug test -- endJob -- filling pn results'tree: PN[0]:" << PN[0] << " iModule:" << iMod
1255  << " iColor:" << iColor << " ch:" << ch;
1256 
1257  // Fill PN results trees
1258  //========================
1259 
1260  respntrees[iColor]->Fill();
1261  }
1262  }
1263  }
1264 
1265  // Remove temporary files
1266  //========================
1267  if (!_saveallevents) {
1268  APDFile->Close();
1269  stringstream del2;
1270  del2 << "rm " << APDfile;
1271  system(del2.str().c_str());
1272 
1273  } else {
1274  APDFile->cd();
1275  APDtrees[0]->Write();
1276 
1277  APDFile->Close();
1278  resFile->cd();
1279  }
1280 
1281  // Save results
1282  //===============
1283 
1284  for (unsigned int i = 0; i < nCol; i++) {
1285  restrees[i]->Write();
1286  respntrees[i]->Write();
1287  }
1288 
1289  resFile->Close();
1290 
1291  edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+ .................................................. done +=+";
1292  edm::LogVerbatim("EcalLaserAnalyzer2") << "\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+";
1293 }
Log< level::Info, true > LogVerbatim
TPN * PNAnal[9][2][nColor]
Definition: TPN.h:8
void setAPDCut(double, double)
Definition: TAPD.cc:141
const std::string _ecalPart
std::map< int, int > channelMapEE
std::vector< double > getPN()
Definition: TPN.cc:90
Definition: TAPD.h:8
void addEntry(double, double, double)
Definition: TPN.cc:33
TAPD * APDAnal[1700][nColor]
std::vector< double > getPNoPN1()
Definition: TPN.cc:102
bool setPulse(double *)
Definition: TAPDPulse.cc:86
TAPD * APDFirstAnal[1700][nColor]
TPN * PNFirstAnal[9][2][nColor]
void setPNCut(double, double)
Definition: TPN.cc:70
void addEntry(double, double, double, double, double, double, double)
Definition: TAPD.cc:42
const unsigned int _firstsample
const unsigned int _lastsample
assert(be >=bs)
std::vector< double > getAPDoPN0()
Definition: TAPD.cc:224
void setTimeCut(double, double)
Definition: TAPD.cc:145
std::vector< double > shapesVec
void set2DAPDoAPD1Cut(const std::vector< double > &, const std::vector< double > &)
Definition: TAPD.cc:181
void setAPDoPN0Cut(double, double)
Definition: TAPD.cc:143
virtual double doFit(double *, double *cova=nullptr)
std::vector< double > getPNoPN0()
Definition: TPN.cc:98
std::vector< double > getAPDoPN1()
Definition: TAPD.cc:228
std::vector< double > getAPDoAPD0()
Definition: TAPD.cc:236
void set2DAPDoAPD0Cut(const std::vector< double > &, const std::vector< double > &)
Definition: TAPD.cc:173
virtual void init(int, int, int, int, int, const std::vector< double > &, double)
const unsigned int _nsamples
double * getAdcWithoutPedestal()
Definition: TAPDPulse.cc:237
std::vector< double > getAPDoAPD1()
Definition: TAPD.cc:241
const double _presamplecut
std::vector< double > getAPD()
Definition: TAPD.cc:216
unsigned int firstChanMod[21]
const unsigned int _niter
unsigned int nSamplesShapes
int IsThereDataADC[1700][nColor]
TTree * respntrees[nColor]
TTree * RefAPDtrees[2][21]
void setPresamples(int)
Definition: TAPDPulse.cc:251
bool isPulseOK()
Definition: TAPDPulse.cc:162
Definition: colors.py:1
TTree * restrees[nColor]
std::vector< double > getPNoPN()
Definition: TPN.cc:94
unsigned int iModule[1700]
std::vector< double > getAPDoPN()
Definition: TAPD.cc:220
std::map< int, unsigned int > apdRefMap[2]
std::vector< double > getTime()
Definition: TAPD.cc:232
double getMean()
Definition: TMom.cc:121
void setAPDoPNCut(double, double)
Definition: TAPD.cc:142
Definition: event.py:1
void setAPDoPN1Cut(double, double)
Definition: TAPD.cc:144

◆ getShapes()

bool EcalLaserAnalyzer2::getShapes ( )
private

Definition at line 1296 of file EcalLaserAnalyzer2.cc.

References _saveshapes, cms::cuda::assert(), elecfile_, Exception, cuy::ii, createfilelist::int, IsMatacqOK, isSPRFine, findQualityFiles::jj, matfile, Skims_PA_cff::name, seedmultiplicitymonitor_newtracking_cfi::nBins, nSamplesShapes, PulseShape, l1tEGammaCrystalsEmulatorProducer_cfi::scale, shapeCorrection, shapefile, ShapeFile, shapes, shapesVec, ctpps_dqm_sourceclient-live_cfg::test, x, and y.

Referenced by beginJob().

1296  {
1297  //========================================================================
1298 
1299  // Get Pulse From Matacq Analysis:
1300  //================================
1301 
1302  bool IsMatacqOK = false;
1303 
1304  int doesMatFileExist = 0;
1305  int doesMatShapeExist = 0;
1306  FILE* test2;
1307  TProfile* laserShape = nullptr;
1308  test2 = fopen(matfile.c_str(), "r");
1309  if (test2)
1310  doesMatFileExist = 1;
1311 
1312  TFile* MatShapeFile;
1313  if (doesMatFileExist == 1) {
1314  MatShapeFile = new TFile(matfile.c_str());
1315  laserShape = (TProfile*)MatShapeFile->Get("shapeLaser");
1316  if (laserShape) {
1317  doesMatShapeExist = 1;
1318  double y = laserShape->Integral("w");
1319  if (y != 0)
1320  laserShape->Scale(1.0 / y);
1321  }
1322  } else {
1323  edm::LogError("file_not_found") << " ERROR! Matacq shape file not found !";
1324  }
1325  if (doesMatShapeExist)
1326  IsMatacqOK = true;
1327 
1328  // Get SPR from the average elec shape in SM6:
1329  //============================================
1330 
1331  int doesElecFileExist = 0;
1332  FILE* test;
1333  test = fopen(elecfile_.c_str(), "r");
1334  if (test)
1335  doesElecFileExist = 1;
1336 
1337  TFile* ElecShapesFile;
1338  TH1D* elecShape = nullptr;
1339 
1340  if (doesElecFileExist == 1) {
1341  ElecShapesFile = new TFile(elecfile_.c_str());
1342  stringstream name;
1343  name << "MeanElecShape";
1344  elecShape = (TH1D*)ElecShapesFile->Get(name.str().c_str());
1345  if (elecShape && doesMatShapeExist == 1) {
1346  double x = elecShape->GetMaximum();
1347  if (x != 0)
1348  elecShape->Scale(1.0 / x);
1349  isSPRFine = true;
1350  } else {
1351  isSPRFine = false;
1352  }
1353 
1354  } else {
1355  throw cms::Exception("file_not_found") << " ERROR! Elec shape file not found !";
1356  }
1357 
1358  if (IsMatacqOK) {
1359  ShapeFile = new TFile(shapefile.c_str(), "RECREATE");
1360 
1361  unsigned int nBins = int(laserShape->GetEntries());
1363  double elec_jj, laser_iiMinusjj;
1364  double sum_jj;
1365 
1366  if (isSPRFine == true) {
1367  unsigned int nBins2 = int(elecShape->GetNbinsX());
1368 
1369  if (nBins2 < nBins) {
1370  edm::LogError("cfg_error")
1371  << "EcalLaserAnalyzer2::getShapes: wrong configuration of the shapes' number of bins";
1372  isSPRFine = false;
1373  }
1374  assert(nSamplesShapes == nBins2);
1375 
1376  stringstream name;
1377  name << "PulseShape";
1378 
1379  PulseShape = new TProfile(name.str().c_str(), name.str().c_str(), nBins, -0.5, double(nBins) - 0.5);
1380 
1381  // shift shapes to have max close to the real APD max
1382 
1383  for (int ii = 0; ii < 50; ii++) {
1384  shapes[ii] = 0.0;
1385  PulseShape->Fill(ii, 0.0);
1386  }
1387 
1388  for (unsigned int ii = 0; ii < nBins - 50; ii++) {
1389  sum_jj = 0.0;
1390  for (unsigned int jj = 0; jj < ii; jj++) {
1391  elec_jj = elecShape->GetBinContent(jj + 1);
1392  laser_iiMinusjj = laserShape->GetBinContent(ii - jj + 1);
1393  sum_jj += elec_jj * laser_iiMinusjj;
1394  }
1395  PulseShape->Fill(ii + 50, sum_jj);
1396  shapes[ii + 50] = sum_jj;
1397  }
1398 
1399  double scale = PulseShape->GetMaximum();
1401 
1402  if (scale != 0) {
1403  PulseShape->Scale(1.0 / scale);
1404  for (unsigned int ii = 0; ii < nBins; ii++) {
1405  shapesVec.push_back(shapes[ii] / scale);
1406  }
1407  }
1408 
1409  if (_saveshapes)
1410  PulseShape->Write();
1411  }
1412  }
1413  ShapeFile->Close();
1414 
1415  if (!_saveshapes) {
1416  stringstream del;
1417  del << "rm " << shapefile;
1418  system(del.str().c_str());
1419  }
1420 
1421  return IsMatacqOK;
1422 }
Log< level::Error, false > LogError
assert(be >=bs)
std::vector< double > shapesVec
const std::string elecfile_
ii
Definition: cuy.py:589
unsigned int nSamplesShapes

◆ setGeomEB()

void EcalLaserAnalyzer2::setGeomEB ( int  etaG,
int  phiG,
int  module,
int  tower,
int  strip,
int  xtal,
int  apdRefTT,
int  channel,
int  lmr 
)

Definition at line 1424 of file EcalLaserAnalyzer2.cc.

References ME::apdRefChannels(), apdRefMap, cms::cuda::assert(), channelID, submitPVResolutionJobs::count, dccID, eta, firstChanMod, iChannelID, idccID, iEta, iModule, iPhi, isFirstChanModFilled, iside, iTowerID, callgraph::module, nRefChan, phi, MEEBGeom::side(), side, nano_mu_digi_cff::strip, l1tHGCalTowerProducer_cfi::tower, and towerID.

Referenced by analyze().

1425  {
1426  side = MEEBGeom::side(etaG, phiG);
1427 
1428  assert(module >= *min_element(modules.begin(), modules.end()) &&
1429  module <= *max_element(modules.begin(), modules.end()));
1430 
1431  eta = etaG;
1432  phi = phiG;
1433  channelID = 5 * (strip - 1) + xtal - 1;
1434  towerID = tower;
1435 
1436  vector<int> apdRefChan = ME::apdRefChannels(module, lmr);
1437  for (unsigned int iref = 0; iref < nRefChan; iref++) {
1438  if (channelID == apdRefChan[iref] && towerID == apdRefTT && apdRefMap[iref].count(module) == 0) {
1439  apdRefMap[iref][module] = channel;
1440  }
1441  }
1442 
1443  if (isFirstChanModFilled[module - 1] == 0) {
1444  firstChanMod[module - 1] = channel;
1445  isFirstChanModFilled[module - 1] = 1;
1446  }
1447 
1448  iEta[channel] = eta;
1449  iPhi[channel] = phi;
1450  iModule[channel] = module;
1451  iTowerID[channel] = towerID;
1452  iChannelID[channel] = channelID;
1453  idccID[channel] = dccID;
1454  iside[channel] = side;
1455 }
unsigned int isFirstChanModFilled[21]
assert(be >=bs)
unsigned int firstChanMod[21]
static int side(EBGlobalCoord ieta, EBGlobalCoord iphi)
Definition: MEEBGeom.cc:105
unsigned int iModule[1700]
std::map< int, unsigned int > apdRefMap[2]
static std::vector< int > apdRefChannels(ME::LMMid ilmmod, ME::LMRid ilmr)
Definition: ME.cc:545

◆ setGeomEE()

void EcalLaserAnalyzer2::setGeomEE ( int  etaG,
int  phiG,
int  iX,
int  iY,
int  iZ,
int  module,
int  tower,
int  ch,
int  apdRefTT,
int  channel,
int  lmr 
)

Definition at line 1457 of file EcalLaserAnalyzer2.cc.

References ME::apdRefChannels(), apdRefMap, cms::cuda::assert(), channelID, submitPVResolutionJobs::count, dccID, eta, firstChanMod, iChannelID, idccID, iEta, iModule, iPhi, isFirstChanModFilled, iside, iTowerID, iZ, callgraph::module, nRefChan, phi, MEEEGeom::side(), side, l1tHGCalTowerProducer_cfi::tower, and towerID.

Referenced by analyze().

1458  {
1459  side = MEEEGeom::side(iX, iY, iZ);
1460 
1461  assert(module >= *min_element(modules.begin(), modules.end()) &&
1462  module <= *max_element(modules.begin(), modules.end()));
1463 
1464  eta = etaG;
1465  phi = phiG;
1466  channelID = ch;
1467  towerID = tower;
1468 
1469  vector<int> apdRefChan = ME::apdRefChannels(module, lmr);
1470  for (unsigned int iref = 0; iref < nRefChan; iref++) {
1471  if (channelID == apdRefChan[iref] && towerID == apdRefTT && apdRefMap[iref].count(module) == 0) {
1472  apdRefMap[iref][module] = channel;
1473  }
1474  }
1475 
1476  if (isFirstChanModFilled[module - 1] == 0) {
1477  firstChanMod[module - 1] = channel;
1478  isFirstChanModFilled[module - 1] = 1;
1479  }
1480 
1481  iEta[channel] = eta;
1482  iPhi[channel] = phi;
1483  iModule[channel] = module;
1484  iTowerID[channel] = towerID;
1485  iChannelID[channel] = channelID;
1486  idccID[channel] = dccID;
1487  iside[channel] = side;
1488 }
static int side(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
Definition: MEEEGeom.cc:1155
unsigned int isFirstChanModFilled[21]
assert(be >=bs)
unsigned int firstChanMod[21]
unsigned int iModule[1700]
std::map< int, unsigned int > apdRefMap[2]
static std::vector< int > apdRefChannels(ME::LMMid ilmmod, ME::LMRid ilmr)
Definition: ME.cc:545

Member Data Documentation

◆ _debug

const int EcalLaserAnalyzer2::_debug
private

◆ _docorpn

const bool EcalLaserAnalyzer2::_docorpn
private

Definition at line 106 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ _ecalPart

const std::string EcalLaserAnalyzer2::_ecalPart
private

Definition at line 104 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), EcalLaserAnalyzer2(), and endJob().

◆ _fedid

const int EcalLaserAnalyzer2::_fedid
private

Definition at line 107 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), and EcalLaserAnalyzer2().

◆ _firstsample

const unsigned int EcalLaserAnalyzer2::_firstsample
private

Definition at line 88 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), and endJob().

◆ _firstsamplePN

const unsigned int EcalLaserAnalyzer2::_firstsamplePN
private

Definition at line 92 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ _lastsample

const unsigned int EcalLaserAnalyzer2::_lastsample
private

Definition at line 89 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), and endJob().

◆ _lastsamplePN

const unsigned int EcalLaserAnalyzer2::_lastsamplePN
private

Definition at line 93 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ _niter

const unsigned int EcalLaserAnalyzer2::_niter
private

Definition at line 102 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ _noise

const double EcalLaserAnalyzer2::_noise
private

Definition at line 103 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ _nsamples

const unsigned int EcalLaserAnalyzer2::_nsamples
private

Definition at line 86 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), and endJob().

◆ _nsamplesPN

const unsigned int EcalLaserAnalyzer2::_nsamplesPN
private

Definition at line 90 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), and EcalLaserAnalyzer2().

◆ _presample

unsigned int EcalLaserAnalyzer2::_presample
private

Definition at line 87 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), and endJob().

◆ _presamplecut

const double EcalLaserAnalyzer2::_presamplecut
private

Definition at line 101 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ _presamplePN

const unsigned int EcalLaserAnalyzer2::_presamplePN
private

Definition at line 91 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2().

◆ _qualpercent

const double EcalLaserAnalyzer2::_qualpercent
private

Definition at line 109 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ _ratiomaxcutlow

const double EcalLaserAnalyzer2::_ratiomaxcutlow
private

Definition at line 100 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2().

◆ _ratiomincuthigh

const double EcalLaserAnalyzer2::_ratiomincuthigh
private

Definition at line 99 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2().

◆ _ratiomincutlow

const double EcalLaserAnalyzer2::_ratiomincutlow
private

Definition at line 98 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2().

◆ _saveallevents

const bool EcalLaserAnalyzer2::_saveallevents
private

Definition at line 108 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ _saveshapes

const bool EcalLaserAnalyzer2::_saveshapes
private

Definition at line 105 of file EcalLaserAnalyzer2.h.

Referenced by getShapes().

◆ _timingcuthigh

const unsigned int EcalLaserAnalyzer2::_timingcuthigh
private

Definition at line 95 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2().

◆ _timingcutlow

const unsigned int EcalLaserAnalyzer2::_timingcutlow
private

Definition at line 94 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2().

◆ _timingqualhigh

const unsigned int EcalLaserAnalyzer2::_timingqualhigh
private

Definition at line 97 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2().

◆ _timingquallow

const unsigned int EcalLaserAnalyzer2::_timingquallow
private

Definition at line 96 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2().

◆ adc

double EcalLaserAnalyzer2::adc[10]
private

Definition at line 197 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), beginJob(), and endJob().

◆ adcC

int EcalLaserAnalyzer2::adcC[1700]
private

Definition at line 242 of file EcalLaserAnalyzer2.h.

◆ ADCfile

std::string EcalLaserAnalyzer2::ADCfile
private

Definition at line 126 of file EcalLaserAnalyzer2.h.

Referenced by beginJob(), and endJob().

◆ ADCFile

TFile* EcalLaserAnalyzer2::ADCFile
private

Definition at line 178 of file EcalLaserAnalyzer2.h.

Referenced by beginJob(), and endJob().

◆ adcG

int EcalLaserAnalyzer2::adcG[10]
private

Definition at line 198 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ adcMean

double EcalLaserAnalyzer2::adcMean[1700][10]
private

Definition at line 241 of file EcalLaserAnalyzer2.h.

◆ adcNoPed

double* EcalLaserAnalyzer2::adcNoPed
private

Definition at line 211 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ ADCtrees

TTree* EcalLaserAnalyzer2::ADCtrees[1700]
private

Definition at line 179 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), beginJob(), and endJob().

◆ APD

double EcalLaserAnalyzer2::APD[6]
private

Definition at line 237 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ apdAmpl

double EcalLaserAnalyzer2::apdAmpl
private

Definition at line 202 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ apdAmplA

double EcalLaserAnalyzer2::apdAmplA
private

Definition at line 203 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ apdAmplB

double EcalLaserAnalyzer2::apdAmplB
private

Definition at line 204 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ APDAnal

TAPD* EcalLaserAnalyzer2::APDAnal[1700][nColor]
private

Definition at line 220 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ APDfile

std::string EcalLaserAnalyzer2::APDfile
private

Definition at line 127 of file EcalLaserAnalyzer2.h.

Referenced by beginJob(), and endJob().

◆ APDFile

TFile* EcalLaserAnalyzer2::APDFile
private

Definition at line 181 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ APDFirstAnal

TAPD* EcalLaserAnalyzer2::APDFirstAnal[1700][nColor]
private

Definition at line 219 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ APDoAPDA

double EcalLaserAnalyzer2::APDoAPDA[6]
private

Definition at line 237 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ APDoAPDB

double EcalLaserAnalyzer2::APDoAPDB[6]
private

Definition at line 237 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ APDoPN

double EcalLaserAnalyzer2::APDoPN[6]
private

Definition at line 237 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ APDoPNA

double EcalLaserAnalyzer2::APDoPNA[6]
private

Definition at line 237 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ APDoPNB

double EcalLaserAnalyzer2::APDoPNB[6]
private

Definition at line 237 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ APDPulse

TAPDPulse* EcalLaserAnalyzer2::APDPulse
private

Definition at line 112 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), EcalLaserAnalyzer2(), and endJob().

◆ apdRefMap

std::map<int, unsigned int> EcalLaserAnalyzer2::apdRefMap[2]
private

Definition at line 166 of file EcalLaserAnalyzer2.h.

Referenced by endJob(), setGeomEB(), and setGeomEE().

◆ apdTime

double EcalLaserAnalyzer2::apdTime
private

Definition at line 205 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ APDtrees

TTree* EcalLaserAnalyzer2::APDtrees[1700]
private

Definition at line 182 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ channelID

int EcalLaserAnalyzer2::channelID
private

Definition at line 152 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), beginJob(), endJob(), setGeomEB(), and setGeomEE().

◆ channelIteratorEE

int EcalLaserAnalyzer2::channelIteratorEE
private

Definition at line 235 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ channelMapEE

std::map<int, int> EcalLaserAnalyzer2::channelMapEE
private

Definition at line 163 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), and endJob().

◆ color

int EcalLaserAnalyzer2::color
private

◆ colorref

int EcalLaserAnalyzer2::colorref
private

Definition at line 209 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ colors

std::vector<int> EcalLaserAnalyzer2::colors
private

Definition at line 162 of file EcalLaserAnalyzer2.h.

◆ dccID

int EcalLaserAnalyzer2::dccID
private

Definition at line 154 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), beginJob(), endJob(), setGeomEB(), and setGeomEE().

◆ dccMEM

std::vector<int> EcalLaserAnalyzer2::dccMEM
private

Definition at line 164 of file EcalLaserAnalyzer2.h.

◆ Delta01

TMom* EcalLaserAnalyzer2::Delta01
private

Definition at line 115 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), EcalLaserAnalyzer2(), and endJob().

◆ Delta12

TMom* EcalLaserAnalyzer2::Delta12
private

Definition at line 116 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), EcalLaserAnalyzer2(), and endJob().

◆ digiCollection_

const std::string EcalLaserAnalyzer2::digiCollection_
private

Definition at line 74 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), and EcalLaserAnalyzer2().

◆ digiPNCollection_

const std::string EcalLaserAnalyzer2::digiPNCollection_
private

Definition at line 76 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ digiProducer_

const std::string EcalLaserAnalyzer2::digiProducer_
private

Definition at line 75 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2().

◆ ebDigiToken_

edm::EDGetTokenT<EBDigiCollection> EcalLaserAnalyzer2::ebDigiToken_
private

Definition at line 79 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), and EcalLaserAnalyzer2().

◆ eeDigiToken_

edm::EDGetTokenT<EEDigiCollection> EcalLaserAnalyzer2::eeDigiToken_
private

Definition at line 80 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), and EcalLaserAnalyzer2().

◆ elecfile_

const std::string EcalLaserAnalyzer2::elecfile_
private

Definition at line 119 of file EcalLaserAnalyzer2.h.

Referenced by getShapes().

◆ eta

int EcalLaserAnalyzer2::eta
private

◆ event

int EcalLaserAnalyzer2::event
private

◆ eventHeaderCollection_

const std::string EcalLaserAnalyzer2::eventHeaderCollection_
private

Definition at line 72 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ eventHeaderProducer_

const std::string EcalLaserAnalyzer2::eventHeaderProducer_
private

Definition at line 73 of file EcalLaserAnalyzer2.h.

◆ eventref

int EcalLaserAnalyzer2::eventref
private

Definition at line 208 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ fedID

int EcalLaserAnalyzer2::fedID
private

Definition at line 153 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ firstChanMod

unsigned int EcalLaserAnalyzer2::firstChanMod[21]
private

Definition at line 247 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), endJob(), setGeomEB(), and setGeomEE().

◆ flag

int EcalLaserAnalyzer2::flag
private

Definition at line 234 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ iChannelID

int EcalLaserAnalyzer2::iChannelID[1700]
private

Definition at line 246 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), endJob(), setGeomEB(), and setGeomEE().

◆ idccID

int EcalLaserAnalyzer2::idccID[1700]
private

Definition at line 246 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), endJob(), setGeomEB(), and setGeomEE().

◆ iEta

int EcalLaserAnalyzer2::iEta[1700]
private

Definition at line 244 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), endJob(), setGeomEB(), and setGeomEE().

◆ iEvent

int EcalLaserAnalyzer2::iEvent
private

Definition at line 70 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ iModule

unsigned int EcalLaserAnalyzer2::iModule[1700]
private

Definition at line 245 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), endJob(), setGeomEB(), and setGeomEE().

◆ iPhi

int EcalLaserAnalyzer2::iPhi[1700]
private

Definition at line 244 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), endJob(), setGeomEB(), and setGeomEE().

◆ isFirstChanModFilled

unsigned int EcalLaserAnalyzer2::isFirstChanModFilled[21]
private

Definition at line 248 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), setGeomEB(), and setGeomEE().

◆ isGainOK

bool EcalLaserAnalyzer2::isGainOK
private

Definition at line 259 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), and endJob().

◆ iside

int EcalLaserAnalyzer2::iside[1700]
private

Definition at line 246 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), endJob(), setGeomEB(), and setGeomEE().

◆ IsMatacqOK

bool EcalLaserAnalyzer2::IsMatacqOK
private

Definition at line 142 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), beginJob(), endJob(), and getShapes().

◆ isMatacqOK

bool EcalLaserAnalyzer2::isMatacqOK
private

Definition at line 229 of file EcalLaserAnalyzer2.h.

◆ isSPRFine

bool EcalLaserAnalyzer2::isSPRFine
private

Definition at line 230 of file EcalLaserAnalyzer2.h.

Referenced by endJob(), and getShapes().

◆ IsThereDataADC

int EcalLaserAnalyzer2::IsThereDataADC[1700][nColor]
private

Definition at line 222 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ isTimingOK

bool EcalLaserAnalyzer2::isTimingOK
private

Definition at line 260 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), and endJob().

◆ iTowerID

int EcalLaserAnalyzer2::iTowerID[1700]
private

Definition at line 246 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), endJob(), setGeomEB(), and setGeomEE().

◆ iZ

int EcalLaserAnalyzer2::iZ
private

Definition at line 157 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), EcalLaserAnalyzer2(), and setGeomEE().

◆ laserEvents

int EcalLaserAnalyzer2::laserEvents
private

Definition at line 160 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), beginJob(), and endJob().

◆ lightside

int EcalLaserAnalyzer2::lightside
private

Definition at line 156 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ mappingToken_

const edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> EcalLaserAnalyzer2::mappingToken_
private

Definition at line 82 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ matfile

std::string EcalLaserAnalyzer2::matfile
private

Definition at line 125 of file EcalLaserAnalyzer2.h.

Referenced by beginJob(), and getShapes().

◆ Mem

TMem* EcalLaserAnalyzer2::Mem
private

Definition at line 114 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), and EcalLaserAnalyzer2().

◆ moduleID

int EcalLaserAnalyzer2::moduleID
private

◆ modules

std::vector<int> EcalLaserAnalyzer2::modules
private

◆ nCrys

unsigned int EcalLaserAnalyzer2::nCrys
private

Definition at line 133 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), beginJob(), EcalLaserAnalyzer2(), and endJob().

◆ nEvtBadGain

int EcalLaserAnalyzer2::nEvtBadGain[1700]
private

Definition at line 252 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), and endJob().

◆ nEvtBadTiming

int EcalLaserAnalyzer2::nEvtBadTiming[1700]
private

Definition at line 253 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), and endJob().

◆ nEvtTot

int EcalLaserAnalyzer2::nEvtTot[1700]
private

Definition at line 254 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), and endJob().

◆ nMod

unsigned int EcalLaserAnalyzer2::nMod
private

Definition at line 137 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), and endJob().

◆ nPNPerMod

unsigned int EcalLaserAnalyzer2::nPNPerMod
private

Definition at line 134 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ nRefChan

unsigned int EcalLaserAnalyzer2::nRefChan
private

Definition at line 135 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), endJob(), setGeomEB(), and setGeomEE().

◆ nRefTrees

unsigned int EcalLaserAnalyzer2::nRefTrees
private

Definition at line 136 of file EcalLaserAnalyzer2.h.

◆ nSamplesShapes

unsigned int EcalLaserAnalyzer2::nSamplesShapes
private

Definition at line 140 of file EcalLaserAnalyzer2.h.

Referenced by endJob(), and getShapes().

◆ nSides

unsigned int EcalLaserAnalyzer2::nSides
private

Definition at line 138 of file EcalLaserAnalyzer2.h.

◆ phi

int EcalLaserAnalyzer2::phi
private

◆ pn

double EcalLaserAnalyzer2::pn[50]
private

Definition at line 200 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ PN

double EcalLaserAnalyzer2::PN[6]
private

Definition at line 237 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ pn0

double EcalLaserAnalyzer2::pn0
private

Definition at line 199 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), beginJob(), and endJob().

◆ pn1

double EcalLaserAnalyzer2::pn1
private

Definition at line 199 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), beginJob(), and endJob().

◆ pnAmpl

double EcalLaserAnalyzer2::pnAmpl
private

Definition at line 206 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ PNAnal

TPN* EcalLaserAnalyzer2::PNAnal[9][2][nColor]
private

Definition at line 216 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ pncorfile_

const std::string EcalLaserAnalyzer2::pncorfile_
private

Definition at line 120 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2().

◆ pnCorrector

TPNCor* EcalLaserAnalyzer2::pnCorrector
private

Definition at line 170 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), and EcalLaserAnalyzer2().

◆ pnDiodeDigiToken_

const edm::EDGetTokenT<EcalPnDiodeDigiCollection> EcalLaserAnalyzer2::pnDiodeDigiToken_
private

Definition at line 81 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ PNFirstAnal

TPN* EcalLaserAnalyzer2::PNFirstAnal[9][2][nColor]
private

Definition at line 215 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ pnG

int EcalLaserAnalyzer2::pnG[50]
private

Definition at line 201 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ pnID

int EcalLaserAnalyzer2::pnID
private

Definition at line 234 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ pnNoPed

double* EcalLaserAnalyzer2::pnNoPed
private

Definition at line 212 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ PNoPN

double EcalLaserAnalyzer2::PNoPN[6]
private

Definition at line 237 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ PNoPNA

double EcalLaserAnalyzer2::PNoPNA[6]
private

Definition at line 237 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ PNoPNB

double EcalLaserAnalyzer2::PNoPNB[6]
private

Definition at line 237 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ PNPulse

TPNPulse* EcalLaserAnalyzer2::PNPulse
private

Definition at line 113 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), and EcalLaserAnalyzer2().

◆ PulseShape

TProfile* EcalLaserAnalyzer2::PulseShape
private

Definition at line 190 of file EcalLaserAnalyzer2.h.

Referenced by getShapes().

◆ rawDataToken_

const edm::EDGetTokenT<EcalRawDataCollection> EcalLaserAnalyzer2::rawDataToken_
private

Definition at line 78 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ RefAPDtrees

TTree* EcalLaserAnalyzer2::RefAPDtrees[2][21]
private

Definition at line 183 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ resdir_

const std::string EcalLaserAnalyzer2::resdir_
private

Definition at line 118 of file EcalLaserAnalyzer2.h.

Referenced by beginJob().

◆ resfile

std::string EcalLaserAnalyzer2::resfile
private

Definition at line 128 of file EcalLaserAnalyzer2.h.

Referenced by beginJob(), and endJob().

◆ resFile

TFile* EcalLaserAnalyzer2::resFile
private

Definition at line 185 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ respntrees

TTree* EcalLaserAnalyzer2::respntrees[nColor]
private

Definition at line 187 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ restrees

TTree* EcalLaserAnalyzer2::restrees[nColor]
private

Definition at line 186 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ runNum

int EcalLaserAnalyzer2::runNum
private

Definition at line 147 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ runType

int EcalLaserAnalyzer2::runType
private

Definition at line 146 of file EcalLaserAnalyzer2.h.

Referenced by analyze().

◆ ShapeCor

double EcalLaserAnalyzer2::ShapeCor
private

Definition at line 237 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ shapeCorrection

double EcalLaserAnalyzer2::shapeCorrection
private

Definition at line 228 of file EcalLaserAnalyzer2.h.

Referenced by endJob(), and getShapes().

◆ shapefile

std::string EcalLaserAnalyzer2::shapefile
private

Definition at line 124 of file EcalLaserAnalyzer2.h.

Referenced by beginJob(), and getShapes().

◆ ShapeFile

TFile* EcalLaserAnalyzer2::ShapeFile
private

Definition at line 189 of file EcalLaserAnalyzer2.h.

Referenced by getShapes().

◆ shapes

double EcalLaserAnalyzer2::shapes[250]
private

Definition at line 227 of file EcalLaserAnalyzer2.h.

Referenced by getShapes().

◆ shapesVec

std::vector<double> EcalLaserAnalyzer2::shapesVec
private

Definition at line 226 of file EcalLaserAnalyzer2.h.

Referenced by endJob(), and getShapes().

◆ side

int EcalLaserAnalyzer2::side
private

Definition at line 155 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), beginJob(), endJob(), setGeomEB(), and setGeomEE().

◆ Time

double EcalLaserAnalyzer2::Time[6]
private

Definition at line 237 of file EcalLaserAnalyzer2.h.

Referenced by endJob().

◆ towerID

int EcalLaserAnalyzer2::towerID
private

Definition at line 151 of file EcalLaserAnalyzer2.h.

Referenced by analyze(), beginJob(), endJob(), setGeomEB(), and setGeomEE().

◆ wasGainOK

bool EcalLaserAnalyzer2::wasGainOK[1700]
private

Definition at line 256 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), and endJob().

◆ wasTimingOK

bool EcalLaserAnalyzer2::wasTimingOK[1700]
private

Definition at line 257 of file EcalLaserAnalyzer2.h.

Referenced by EcalLaserAnalyzer2(), and endJob().