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) {
184 TFile* fAB =
nullptr;
185 TTree* ABInit =
nullptr;
187 fAB =
new TFile(nameabinitfile.str().c_str());
190 ABInit = (TTree*)fAB->Get(
"ABCol0");
212 link <<
"ln -s " <<
resdir_ <<
"/ABInit.root " <<
resdir_ <<
"/AB.root";
213 system(link.str().c_str());
218 std::stringstream namefile;
219 namefile <<
resdir_ <<
"/AB.root";
237 DCCHeader = pDCCHeader.
product();
275 int fed = headerItr->fedId();
279 runType = headerItr->getRunType();
280 runNum = headerItr->getRunNumber();
281 event = headerItr->getLV1();
283 dccID = headerItr->getDccInTCCCommand();
284 fedID = headerItr->fedId();
306 if (iter ==
colors.end()) {
332 EBDetId id_crystal(digiItr->id());
335 int etaG = id_crystal.ieta();
336 int phiG = id_crystal.iphi();
342 etaL = LocalCoord.first;
343 phiL = LocalCoord.second;
356 int xtal = elecid_crystal.
xtalId();
357 int channelID = 5 * (
strip - 1) + xtal - 1;
375 for (
unsigned int i = 0;
i < (*digiItr).size(); ++
i) {
377 adc[
i] = samp_crystal.adc();
378 adcG[
i] = samp_crystal.gainId();
424 EEDetId id_crystal(digiItr->id());
427 phi = id_crystal.ix();
428 eta = id_crystal.iy();
430 int iX = (
phi - 1) / 5 + 1;
431 int iY = (
eta - 1) / 5 + 1;
437 int channelID = elecid_crystal.
channelId() - 1;
460 if ((*digiItr).size() > 10)
461 edm::LogVerbatim(
"EcalABAnalyzer") <<
"SAMPLES SIZE > 10!" << (*digiItr).size();
465 for (
unsigned int i = 0;
i < (*digiItr).size(); ++
i) {
467 adc[
i] = samp_crystal.adc();
468 adcG[
i] = samp_crystal.gainId();
511 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+";
512 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\t+=+ Analyzing data: getting (alpha, beta) +=+";
540 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+";
541 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\t+=+ Analyzing data: getting (alpha, beta) +=+";
542 TFile* fAB =
nullptr;
543 TTree* ABInit =
nullptr;
548 ABInit = (TTree*)fAB->Get(
"ABCol0");
554 double BadGainEvtPercentage = 0.0;
555 double BadTimingEvtPercentage = 0.0;
557 int nChanBadGain = 0;
558 int nChanBadTiming = 0;
560 for (
unsigned int i = 0;
i <
nCrys;
i++) {
575 double BadGainChanPercentage = double(nChanBadGain) / double(
nCrys);
576 double BadTimingChanPercentage = double(nChanBadTiming) / double(
nCrys);
584 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+";
586 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\t+=+ ............................ WARNING! TIMING WAS BAD +=+";
588 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\t+=+ .................................... done +=+";
589 edm::LogVerbatim(
"EcalABAnalyzer") <<
"\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+";
void addEntry(double val)
Log< level::Info, true > LogVerbatim
static XYCoord localCoord(int icr)
const double _qualpercent
std::string alphainitfile
const double _ratiomincuthigh
double getDelta(int, int)
const unsigned int _nevtmax
const std::string digiCollection_
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)
T const * product() const
std::vector< T >::const_iterator const_iterator
const unsigned int _timingcuthigh
const double _ratiomincutlow
void computeShape(std::string namefile, TTree *)
const unsigned int _firstsample
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
const unsigned int _timingqualhigh
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_
int towerId() const
get the tower id
const edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > mappingToken_
edm::EDGetTokenT< EBDigiCollection > ebDigiToken_
int channelId() const
so far for EndCap only :
#define DEFINE_FWK_MODULE(type)
const unsigned int _timingquallow
const_iterator begin() const
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)
int stripId() const
get the tower id
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)
void analyze(const edm::Event &e, const edm::EventSetup &c) override
int xtalId() const
get the channel id
const std::string eventHeaderProducer_
const std::string eventHeaderCollection_
EcalLogicID towerID(EcalElectronicsId const &)
const std::string digiProducer_
const double _ratiomaxcutlow