39 eventHeaderCollection_(iConfig.getParameter<
std::
string>(
"eventHeaderCollection")),
40 eventHeaderProducer_(iConfig.getParameter<
std::
string>(
"eventHeaderProducer")),
41 digiCollection_(iConfig.getParameter<
std::
string>(
"digiCollection")),
42 digiProducer_(iConfig.getParameter<
std::
string>(
"digiProducer")),
43 digiPNCollection_(iConfig.getParameter<
std::
string>(
"digiPNCollection")),
48 _nsamples(iConfig.getUntrackedParameter<unsigned
int>(
"nSamples", 10)),
49 _presample(iConfig.getUntrackedParameter<unsigned
int>(
"nPresamples", 3)),
50 _firstsample(iConfig.getUntrackedParameter<unsigned
int>(
"firstSample", 1)),
51 _lastsample(iConfig.getUntrackedParameter<unsigned
int>(
"lastSample", 2)),
52 _nsamplesPN(iConfig.getUntrackedParameter<unsigned
int>(
"nSamplesPN", 50)),
53 _presamplePN(iConfig.getUntrackedParameter<unsigned
int>(
"nPresamplesPN", 6)),
54 _firstsamplePN(iConfig.getUntrackedParameter<unsigned
int>(
"firstSamplePN", 7)),
55 _lastsamplePN(iConfig.getUntrackedParameter<unsigned
int>(
"lastSamplePN", 8)),
56 _timingcutlow(iConfig.getUntrackedParameter<unsigned
int>(
"timingCutLow", 3)),
57 _timingcuthigh(iConfig.getUntrackedParameter<unsigned
int>(
"timingCutHigh", 7)),
58 _niter(iConfig.getUntrackedParameter<unsigned
int>(
"nIter", 3)),
59 _fedid(iConfig.getUntrackedParameter<unsigned
int>(
"fedID", 0)),
60 _tower(iConfig.getUntrackedParameter<unsigned
int>(
"tower", 1)),
61 _channel(iConfig.getUntrackedParameter<unsigned
int>(
"channel", 1)),
62 _ecalPart(iConfig.getUntrackedParameter<
std::
string>(
"ecalPart",
"EB")),
63 resdir_(iConfig.getUntrackedParameter<
std::
string>(
"resDir")),
64 refalphabeta_(iConfig.getUntrackedParameter<
std::
string>(
"refAlphaBeta")),
109 stringstream namefile1;
110 namefile1 <<
resdir_ <<
"/ADCSamples.root";
161 DCCHeader = pDCCHeader.
product();
206 int fed = headerItr->fedId();
211 runType = headerItr->getRunType();
212 runNum = headerItr->getRunNumber();
213 event = headerItr->getLV1();
214 dccID = headerItr->getDccInTCCCommand();
215 fedID = headerItr->fedId();
228 stringstream namefile2;
234 stringstream namefile;
240 test = fopen(namefile.str().c_str(),
"r");
245 matacqFile =
new TFile((namefile.str().c_str()));
263 if (iter ==
colors.end()) {
288 unsigned int samplemax = 0;
291 std::vector<double> allPNAmpl;
296 for (
int samId = 0; samId < (*pnItr).size(); samId++) {
297 pn[samId] = (*pnItr).sample(samId).adc();
306 ypnrange[
k] =
pn[
k] - bl;
308 if (ypnrange[
k] > val_max) {
309 val_max = ypnrange[
k];
314 chi2pn = pnfit->
doFit(samplemax, &ypnrange[0]);
316 if (chi2pn == 101 || chi2pn == 102 || chi2pn == 103)
321 allPNAmpl.push_back(
pnAmpl);
353 EBDetId id_crystal(digiItr->id());
356 int etaG = id_crystal.ieta();
357 int phiG = id_crystal.iphi();
363 etaL = LocalCoord.first;
364 phiL = LocalCoord.second;
376 int xtal = elecid_crystal.
xtalId();
377 int channelID = 5 * (
strip - 1) + xtal - 1;
382 unsigned int MyPn0 = pnpair.first;
383 unsigned int MyPn1 = pnpair.second;
395 for (
unsigned int i = 0;
i < (*digiItr).size(); ++
i) {
398 adc[
i] = samp_crystal.adc();
399 adcG[
i] = samp_crystal.gainId();
406 if (
adc[
i] > adcmax) {
421 yrange[
k] =
adc[
k] - bl;
422 if (yrange[
k] > val_max) {
428 if (samplemax == 4 || samplemax == 5) {
430 yrange[
k] = yrange[
k] + bl - bl1;
438 pn0 = allPNAmpl[MyPn0];
439 pn1 = allPNAmpl[MyPn1];
449 EEDetId id_crystal(digiItr->id());
452 phi = id_crystal.ix() - 1;
453 eta = id_crystal.iy() - 1;
461 int channelID = elecid_crystal.
channelId() - 1;
466 unsigned int MyPn0 = pnpair.first;
467 unsigned int MyPn1 = pnpair.second;
479 for (
unsigned int i = 0;
i < (*digiItr).size(); ++
i) {
482 adc[
i] = samp_crystal.adc();
483 adcG[
i] = samp_crystal.gainId();
490 if (
adc[
i] > adcmax) {
505 yrange[
k] =
adc[
k] - bl;
506 if (yrange[
k] > val_max) {
512 if (samplemax == 4 || samplemax == 5) {
514 yrange[
k] = yrange[
k] + bl - bl1;
522 pn0 = allPNAmpl[MyPn0];
523 pn1 = allPNAmpl[MyPn1];
537 unsigned int nCol =
colors.size();
542 <<
"\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+";
544 <<
"\t+=+ Analyzing laser data: getting per event +=+";
546 <<
"\t+=+ APD Amplitudes and ADC samples +=+";
559 for (
unsigned int i = 0;
i < nCol;
i++) {
561 name1 <<
"headerCol" <<
colors[
i];
563 header[
i] =
new TTree(name1.str().c_str(), name1.str().c_str());
571 header[
i]->Branch(
"channelID", &channelID,
"channelID/I");
579 header[
i]->SetBranchAddress(
"channelID", &channelID);
615 Double_t alphaRun, betaRun;
616 int ietaRun, iphiRun, channelIDRun, towerIDRun, dccIDRun, flagRun;
618 for (
unsigned int i = 0;
i < nCol;
i++) {
620 name3 <<
"ABCol" <<
i;
621 alphaTree[
i] = (TTree*)alphaFile->Get(name3.str().c_str());
622 alphaTree[
i]->SetBranchStatus(
"*",
false);
623 alphaTree[
i]->SetBranchStatus(
"alpha",
true);
624 alphaTree[
i]->SetBranchStatus(
"beta",
true);
625 alphaTree[
i]->SetBranchStatus(
"iphi",
true);
626 alphaTree[
i]->SetBranchStatus(
"ieta",
true);
627 alphaTree[
i]->SetBranchStatus(
"dccID",
true);
628 alphaTree[
i]->SetBranchStatus(
"towerID",
true);
629 alphaTree[
i]->SetBranchStatus(
"channelID",
true);
630 alphaTree[
i]->SetBranchStatus(
"flag",
true);
632 alphaTree[
i]->SetBranchAddress(
"alpha", &alphaRun);
633 alphaTree[
i]->SetBranchAddress(
"beta", &betaRun);
634 alphaTree[
i]->SetBranchAddress(
"iphi", &iphiRun);
635 alphaTree[
i]->SetBranchAddress(
"ieta", &ietaRun);
636 alphaTree[
i]->SetBranchAddress(
"dccID", &dccIDRun);
637 alphaTree[
i]->SetBranchAddress(
"towerID", &towerIDRun);
638 alphaTree[
i]->SetBranchAddress(
"channelID", &channelIDRun);
639 alphaTree[
i]->SetBranchAddress(
"flag", &flagRun);
646 for (
unsigned int icol = 0; icol < nCol; icol++) {
657 Long64_t nbytes = 0, nb = 0;
658 for (Long64_t jentry = 0; jentry <
ADCtrees->GetEntriesFast(); jentry++) {
666 unsigned int iCol = 0;
667 for (
unsigned int i = 0;
i < nCol;
i++) {
674 alphaTree[iCol]->GetEntry(iCry);
680 channelID = channelIDRun;
719 system(del.str().c_str());
722 <<
"\t+=+ .................................................. done +=+";
724 <<
"\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+";
const std::string eventHeaderCollection_
Log< level::Info, true > LogVerbatim
static XYCoord localCoord(int icr)
static int lmmod(SuperCrysCoord iX, SuperCrysCoord iY)
const unsigned int _tower
static int crystal(CrysCoord ix, CrysCoord iy)
const std::string digiCollection_
edm::EDGetTokenT< EBDigiCollection > ebDigiToken_
const unsigned int _firstsample
#define DEFINE_FWK_MODULE(type)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
T const * product() const
std::vector< T >::const_iterator const_iterator
const unsigned int _presamplePN
const unsigned int _timingcuthigh
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void analyze(const edm::Event &e, const edm::EventSetup &c) override
static std::pair< int, int > pn(int ilmmod)
const unsigned int _presample
~EcalPerEvtLaserAnalyzer() override
const std::string _ecalPart
static std::pair< int, int > pn(int dee, int ilmod)
const unsigned int _lastsample
static int electronic_channel(EBLocalCoord ix, EBLocalCoord iy)
int IsHeaderFilled[nColor]
const unsigned int _channel
const unsigned int _timingcutlow
int towerId() const
get the tower id
const unsigned int _firstsamplePN
int channelId() const
so far for EndCap only :
const std::string digiPNCollection_
const_iterator begin() const
static int lmmod(EBGlobalCoord ieta, EBGlobalCoord iphi)
virtual void init(int, int, int, int, double, double)
const unsigned int _nsamples
const_iterator end() const
const std::string digiProducer_
static int side(EBGlobalCoord ieta, EBGlobalCoord iphi)
EcalPerEvtLaserAnalyzer(const edm::ParameterSet &iConfig)
int stripId() const
get the tower id
const std::string resdir_
virtual double doFit(double *)
const unsigned int _niter
const unsigned int _nsamplesPN
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
int xtalId() const
get the channel id
const std::string refalphabeta_
edm::EDGetTokenT< EEDigiCollection > eeDigiToken_
const edm::EDGetTokenT< EcalRawDataCollection > rawDataToken_
double doFit(int, double *)
EcalLogicID towerID(EcalElectronicsId const &)
const edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > mappingToken_
const unsigned int _lastsamplePN
int IsThereDataADC[nColor]
const edm::EDGetTokenT< EcalPnDiodeDigiCollection > pnDiodeDigiToken_