51 _nsamples(iConfig.getUntrackedParameter<unsigned
int>(
"nSamples", 10)),
52 _presample(iConfig.getUntrackedParameter<unsigned
int>(
"nPresamples", 3)),
53 _firstsample(iConfig.getUntrackedParameter<unsigned
int>(
"firstSample", 1)),
54 _lastsample(iConfig.getUntrackedParameter<unsigned
int>(
"lastSample", 2)),
55 _samplemin(iConfig.getUntrackedParameter<unsigned
int>(
"sampleMin", 3)),
56 _samplemax(iConfig.getUntrackedParameter<unsigned
int>(
"sampleMax", 9)),
57 _nsamplesPN(iConfig.getUntrackedParameter<unsigned
int>(
"nSamplesPN", 50)),
58 _presamplePN(iConfig.getUntrackedParameter<unsigned
int>(
"nPresamplesPN", 6)),
59 _firstsamplePN(iConfig.getUntrackedParameter<unsigned
int>(
"firstSamplePN", 7)),
60 _lastsamplePN(iConfig.getUntrackedParameter<unsigned
int>(
"lastSamplePN", 8)),
61 _timingcutlow(iConfig.getUntrackedParameter<unsigned
int>(
"timingCutLow", 3)),
62 _timingcuthigh(iConfig.getUntrackedParameter<unsigned
int>(
"timingCutHigh", 7)),
63 _niter(iConfig.getUntrackedParameter<unsigned
int>(
"nIter", 3)),
64 _fedid(iConfig.getUntrackedParameter<unsigned
int>(
"fedID", 0)),
65 _tower(iConfig.getUntrackedParameter<unsigned
int>(
"tower", 1)),
66 _channel(iConfig.getUntrackedParameter<unsigned
int>(
"channel", 1)),
67 _ecalPart(iConfig.getUntrackedParameter<
std::
string>(
"ecalPart",
"EB")),
123 stringstream namefile1;
124 namefile1 <<
resdir_ <<
"/ADCSamples.root";
174 DCCHeader = pDCCHeader.
product();
216 TheMapping = ecalmapping.
product();
218 std::cerr <<
"Error! can't get the product EcalMappingRcd" << std::endl;
229 int fed = headerItr->fedId();
234 runType = headerItr->getRunType();
235 runNum = headerItr->getRunNumber();
236 event = headerItr->getLV1();
237 dccID = headerItr->getDccInTCCCommand();
238 fedID = headerItr->fedId();
251 stringstream namefile2;
257 stringstream namefile;
263 test = fopen(namefile.str().c_str(),
"r");
268 matacqFile =
new TFile((namefile.str().c_str()));
286 if (iter ==
colors.end()) {
311 unsigned int samplemax = 0;
314 std::vector<double> allPNAmpl;
319 for (
int samId = 0; samId < (*pnItr).size(); samId++) {
320 pn[samId] = (*pnItr).sample(samId).adc();
329 ypnrange[
k] =
pn[
k] - bl;
331 if (ypnrange[
k] > val_max) {
332 val_max = ypnrange[
k];
337 chi2pn = pnfit->
doFit(samplemax, &ypnrange[0]);
339 if (chi2pn == 101 || chi2pn == 102 || chi2pn == 103)
344 allPNAmpl.push_back(
pnAmpl);
376 EBDetId id_crystal(digiItr->id());
379 int etaG = id_crystal.ieta();
380 int phiG = id_crystal.iphi();
386 etaL = LocalCoord.first;
387 phiL = LocalCoord.second;
399 int xtal = elecid_crystal.
xtalId();
400 int channelID = 5 * (
strip - 1) + xtal - 1;
405 unsigned int MyPn0 = pnpair.first;
406 unsigned int MyPn1 = pnpair.second;
418 for (
unsigned int i = 0;
i < (*digiItr).size(); ++
i) {
421 adc[
i] = samp_crystal.adc();
422 adcG[
i] = samp_crystal.gainId();
429 if (
adc[
i] > adcmax) {
444 yrange[
k] =
adc[
k] - bl;
445 if (yrange[
k] > val_max) {
451 if (samplemax == 4 || samplemax == 5) {
452 val_max = val_max + bl - bl1;
454 yrange[
k] = yrange[
k] + bl - bl1;
462 pn0 = allPNAmpl[MyPn0];
463 pn1 = allPNAmpl[MyPn1];
473 EEDetId id_crystal(digiItr->id());
476 phi = id_crystal.ix() - 1;
477 eta = id_crystal.iy() - 1;
485 int channelID = elecid_crystal.
channelId() - 1;
490 unsigned int MyPn0 = pnpair.first;
491 unsigned int MyPn1 = pnpair.second;
503 for (
unsigned int i = 0;
i < (*digiItr).size(); ++
i) {
506 adc[
i] = samp_crystal.adc();
507 adcG[
i] = samp_crystal.gainId();
514 if (
adc[
i] > adcmax) {
529 yrange[
k] =
adc[
k] - bl;
530 if (yrange[
k] > val_max) {
536 if (samplemax == 4 || samplemax == 5) {
537 val_max = val_max + bl - bl1;
539 yrange[
k] = yrange[
k] + bl - bl1;
547 pn0 = allPNAmpl[MyPn0];
548 pn1 = allPNAmpl[MyPn1];
562 unsigned int nCol =
colors.size();
566 cout <<
"\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << endl;
567 cout <<
"\t+=+ Analyzing laser data: getting per event +=+" << endl;
568 cout <<
"\t+=+ APD Amplitudes and ADC samples +=+" << endl;
580 for (
unsigned int i = 0;
i < nCol;
i++) {
582 name1 <<
"headerCol" <<
colors[
i];
584 header[
i] =
new TTree(name1.str().c_str(), name1.str().c_str());
592 header[
i]->Branch(
"channelID", &channelID,
"channelID/I");
600 header[
i]->SetBranchAddress(
"channelID", &channelID);
636 Double_t alphaRun, betaRun;
637 int ietaRun, iphiRun, channelIDRun, towerIDRun, dccIDRun, flagRun;
639 for (
unsigned int i = 0;
i < nCol;
i++) {
641 name3 <<
"ABCol" <<
i;
642 alphaTree[
i] = (TTree*)alphaFile->Get(name3.str().c_str());
643 alphaTree[
i]->SetBranchStatus(
"*",
false);
644 alphaTree[
i]->SetBranchStatus(
"alpha",
true);
645 alphaTree[
i]->SetBranchStatus(
"beta",
true);
646 alphaTree[
i]->SetBranchStatus(
"iphi",
true);
647 alphaTree[
i]->SetBranchStatus(
"ieta",
true);
648 alphaTree[
i]->SetBranchStatus(
"dccID",
true);
649 alphaTree[
i]->SetBranchStatus(
"towerID",
true);
650 alphaTree[
i]->SetBranchStatus(
"channelID",
true);
651 alphaTree[
i]->SetBranchStatus(
"flag",
true);
653 alphaTree[
i]->SetBranchAddress(
"alpha", &alphaRun);
654 alphaTree[
i]->SetBranchAddress(
"beta", &betaRun);
655 alphaTree[
i]->SetBranchAddress(
"iphi", &iphiRun);
656 alphaTree[
i]->SetBranchAddress(
"ieta", &ietaRun);
657 alphaTree[
i]->SetBranchAddress(
"dccID", &dccIDRun);
658 alphaTree[
i]->SetBranchAddress(
"towerID", &towerIDRun);
659 alphaTree[
i]->SetBranchAddress(
"channelID", &channelIDRun);
660 alphaTree[
i]->SetBranchAddress(
"flag", &flagRun);
667 for (
unsigned int icol = 0; icol < nCol; icol++) {
678 Long64_t nbytes = 0, nb = 0;
679 for (Long64_t jentry = 0; jentry <
ADCtrees->GetEntriesFast(); jentry++) {
687 unsigned int iCol = 0;
688 for (
unsigned int i = 0;
i < nCol;
i++) {
695 alphaTree[iCol]->GetEntry(iCry);
701 channelID = channelIDRun;
740 system(del.str().c_str());
742 cout <<
"\t+=+ .................................................. done +=+" << endl;
743 cout <<
"\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << endl;