44 eventHeaderCollection_(iConfig.getParameter<std::
string>(
"eventHeaderCollection")),
45 eventHeaderProducer_(iConfig.getParameter<std::
string>(
"eventHeaderProducer")),
46 digiCollection_(iConfig.getParameter<std::
string>(
"digiCollection")),
47 digiProducer_(iConfig.getParameter<std::
string>(
"digiProducer")),
51 _nsamples(iConfig.getUntrackedParameter<unsigned int>(
"nSamples", 10)),
52 _presample(iConfig.getUntrackedParameter<unsigned int>(
"nPresamples", 2)),
53 _firstsample(iConfig.getUntrackedParameter<unsigned int>(
"firstSample", 1)),
54 _lastsample(iConfig.getUntrackedParameter<unsigned int>(
"lastSample", 2)),
55 _timingcutlow(iConfig.getUntrackedParameter<unsigned int>(
"timingCutLow", 2)),
56 _timingcuthigh(iConfig.getUntrackedParameter<unsigned int>(
"timingCutHigh", 9)),
57 _timingquallow(iConfig.getUntrackedParameter<unsigned int>(
"timingQualLow", 3)),
58 _timingqualhigh(iConfig.getUntrackedParameter<unsigned int>(
"timingQualHigh", 8)),
59 _ratiomincutlow(iConfig.getUntrackedParameter<double>(
"ratioMinCutLow", 0.4)),
60 _ratiomincuthigh(iConfig.getUntrackedParameter<double>(
"ratioMinCutHigh", 0.95)),
61 _ratiomaxcutlow(iConfig.getUntrackedParameter<double>(
"ratioMaxCutLow", 0.8)),
62 _presamplecut(iConfig.getUntrackedParameter<double>(
"presampleCut", 5.0)),
63 _niter(iConfig.getUntrackedParameter<unsigned int>(
"nIter", 3)),
64 _alpha(iConfig.getUntrackedParameter<double>(
"alpha", 1.5076494)),
65 _beta(iConfig.getUntrackedParameter<double>(
"beta", 1.5136036)),
66 _nevtmax(iConfig.getUntrackedParameter<unsigned int>(
"nEvtMax", 200)),
67 _noise(iConfig.getUntrackedParameter<double>(
"noise", 2.0)),
68 _chi2cut(iConfig.getUntrackedParameter<double>(
"chi2cut", 100.0)),
69 _ecalPart(iConfig.getUntrackedParameter<std::
string>(
"ecalPart",
"EB")),
70 _fedid(iConfig.getUntrackedParameter<int>(
"fedId", -999)),
71 _qualpercent(iConfig.getUntrackedParameter<double>(
"qualPercent", 0.2)),
72 _debug(iConfig.getUntrackedParameter<int>(
"debug", 0)),
73 resdir_(iConfig.getUntrackedParameter<std::
string>(
"resDir")),
108 for (
unsigned int j = 0;
j <
nCrys;
j++) {
167 std::stringstream nameabinitfile;
168 nameabinitfile <<
resdir_ <<
"/ABInit.root";
171 std::stringstream nameabfile;
172 std::stringstream
link;
173 nameabfile << resdir_ <<
"/AB.root";
176 test = fopen(nameabinitfile.str().c_str(),
"r");
177 if (test ==
nullptr) {
183 TFile* fAB =
nullptr;
184 TTree* ABInit =
nullptr;
186 fAB =
new TFile(nameabinitfile.str().c_str());
189 ABInit = (TTree*)fAB->Get(
"ABCol0");
211 link <<
"ln -s " << resdir_ <<
"/ABInit.root " << resdir_ <<
"/AB.root";
212 system(link.str().c_str());
217 std::stringstream namefile;
218 namefile << resdir_ <<
"/AB.root";
236 DCCHeader = pDCCHeader.
product();
274 int fed = headerItr->fedId();
278 runType = headerItr->getRunType();
279 runNum = headerItr->getRunNumber();
280 event = headerItr->getLV1();
282 dccID = headerItr->getDccInTCCCommand();
283 fedID = headerItr->fedId();
305 if (iter ==
colors.end()) {
331 EBDetId id_crystal(digiItr->id());
334 int etaG = id_crystal.ieta();
335 int phiG = id_crystal.iphi();
341 etaL = LocalCoord.first;
342 phiL = LocalCoord.second;
355 int xtal = elecid_crystal.
xtalId();
356 int channelID = 5 * (strip - 1) + xtal - 1;
374 for (
unsigned int i = 0;
i < (*digiItr).size(); ++
i) {
376 adc[
i] = samp_crystal.adc();
377 adcG[
i] = samp_crystal.gainId();
423 EEDetId id_crystal(digiItr->id());
426 phi = id_crystal.ix();
427 eta = id_crystal.iy();
429 int iX = (
phi - 1) / 5 + 1;
430 int iY = (
eta - 1) / 5 + 1;
436 int channelID = elecid_crystal.
channelId() - 1;
459 if ((*digiItr).size() > 10)
460 edm::LogVerbatim(
"EcalABAnalyzer") <<
"SAMPLES SIZE > 10!" << (*digiItr).size();
464 for (
unsigned int i = 0;
i < (*digiItr).size(); ++
i) {
466 adc[
i] = samp_crystal.adc();
467 adcG[
i] = samp_crystal.gainId();
510 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+";
511 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\t+=+ Analyzing data: getting (alpha, beta) +=+";
539 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+";
540 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\t+=+ Analyzing data: getting (alpha, beta) +=+";
541 TFile* fAB =
nullptr;
542 TTree* ABInit =
nullptr;
547 ABInit = (TTree*)fAB->Get(
"ABCol0");
553 double BadGainEvtPercentage = 0.0;
554 double BadTimingEvtPercentage = 0.0;
556 int nChanBadGain = 0;
557 int nChanBadTiming = 0;
559 for (
unsigned int i = 0;
i <
nCrys;
i++) {
574 double BadGainChanPercentage = double(nChanBadGain) / double(nCrys);
575 double BadTimingChanPercentage = double(nChanBadTiming) / double(nCrys);
583 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+";
585 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\t+=+ ............................ WARNING! TIMING WAS BAD +=+";
587 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\t+=+ .................................... done +=+";
588 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+";
void addEntry(double val)
Log< level::Info, true > LogVerbatim
static XYCoord localCoord(int icr)
const double _qualpercent
const edm::EventSetup & c
std::string alphainitfile
int xtalId() const
get the channel id
const double _ratiomincuthigh
int stripId() const
get the tower id
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double getDelta(int, int)
const unsigned int _nevtmax
const std::string digiCollection_
#define DEFINE_FWK_MODULE(type)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
static int side(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
std::vector< T >::const_iterator const_iterator
const unsigned int _timingcuthigh
const double _ratiomincutlow
void computeShape(std::string namefile, TTree *)
int towerId() const
get the tower id
const unsigned int _firstsample
const_iterator begin() const
The iterator returned can not safely be used across threads.
void putAllVals(int, double *, int, int)
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const std::string _ecalPart
const unsigned int _lastsample
std::vector< int > colors
const unsigned int _timingqualhigh
bool getData(T &iHolder) const
int hashedIndex(int ieta, int iphi)
~EcalABAnalyzer() override
const unsigned int _nsamples
static int electronic_channel(EBLocalCoord ix, EBLocalCoord iy)
const double _presamplecut
const std::string resdir_
const edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > mappingToken_
edm::EDGetTokenT< EBDigiCollection > ebDigiToken_
const unsigned int _timingquallow
EcalABAnalyzer(const edm::ParameterSet &iConfig)
edm::EDGetTokenT< EEDigiCollection > eeDigiToken_
const edm::EDGetTokenT< EcalRawDataCollection > rawDataToken_
unsigned int nevtAB[1700]
const_iterator end() const
static int side(EBGlobalCoord ieta, EBGlobalCoord iphi)
T const * product() const
const unsigned int _timingcutlow
std::map< int, int > channelMapEE
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
void set_const(int, int, int, int, int, double, double)
const_iterator end() const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
const std::string eventHeaderProducer_
const std::string eventHeaderCollection_
EcalLogicID towerID(EcalElectronicsId const &)
const std::string digiProducer_
int channelId() const
so far for EndCap only :
const double _ratiomaxcutlow
const_iterator begin() const