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 _niter(iConfig.getUntrackedParameter<unsigned
int>(
"nIter", 3)),
62 _chi2max(iConfig.getUntrackedParameter<double>(
"chi2Max", 10.0)),
63 _timeofmax(iConfig.getUntrackedParameter<double>(
"timeOfMax", 4.5)),
64 _ecalPart(iConfig.getUntrackedParameter<
std::
string>(
"ecalPart",
"EB")),
65 _fedid(iConfig.getUntrackedParameter<
int>(
"fedID", -999)),
137 rootfile +=
"/TmpTreeTestPulseAnalyzer.root";
141 for (
unsigned int i = 0;
i <
nCrys;
i++) {
142 std::stringstream
name;
162 trees[
i]->SetBranchAddress(
"ieta", &
eta);
163 trees[
i]->SetBranchAddress(
"iphi", &
phi);
178 for (
unsigned int j = 0;
j <
nCrys;
j++) {
188 for (
unsigned int j = 0;
j <
nMod;
j++) {
195 std::stringstream namefile;
196 namefile <<
resdir_ <<
"/APDPN_TESTPULSE.root";
214 DCCHeader = pDCCHeader.
product();
258 TheMapping = ecalmapping.
product();
260 std::cerr <<
"Error! can't get the product EcalMappingRcd" << std::endl;
269 int fed = headerItr->fedId();
274 runType = headerItr->getRunType();
275 runNum = headerItr->getRunNumber();
276 event = headerItr->getLV1();
278 dccID = headerItr->getDccInTCCCommand();
279 fedID = headerItr->fedId();
317 std::map<int, std::vector<double> > allPNAmpl;
318 std::map<int, std::vector<int> > allPNGain;
325 bool isMemRelevant =
false;
326 for (
unsigned int imem = 0; imem <
dccMEM.size(); imem++) {
328 isMemRelevant =
true;
336 for (
int samId = 0; samId < (*pnItr).size(); samId++) {
337 pn[samId] = (*pnItr).sample(samId).adc();
338 pnG[samId] = (*pnItr).sample(samId).gainId();
341 std::cout <<
"PN gain different from 1 for sample " << samId << std::endl;
354 ypnrange[
k] =
pn[
k] - bl;
356 if (ypnrange[
k] > val_max) {
357 val_max = ypnrange[
k];
362 chi2pn = pnfit->
doFit(samplemax, &ypnrange[0]);
364 if (chi2pn == 101 || chi2pn == 102 || chi2pn == 103)
391 EBDetId id_crystal(digiItr->id());
394 int etaG = id_crystal.ieta();
395 int phiG = id_crystal.iphi();
401 etaL = LocalCoord.first;
402 phiL = LocalCoord.second;
413 int xtal = elecid_crystal.
xtalId();
417 int iMod = module - 1;
423 unsigned int MyPn0 = pnpair.first;
424 unsigned int MyPn1 = pnpair.second;
444 for (
unsigned int i = 0;
i < (*digiItr).size(); ++
i) {
446 adc[
i] = samp_crystal.adc();
447 adcG[
i] = samp_crystal.gainId();
465 yrange[
k] =
adc[
k] - bl;
466 if (yrange[
k] > val_max) {
496 if (val_max > 100000. ||
chi2 < 0. ||
chi2 == 102) {
505 trees[channel]->Fill();
512 EEDetId id_crystal(digiItr->id());
515 phi = id_crystal.ix();
516 eta = id_crystal.iy();
518 int iX = (
phi - 1) / 5 + 1;
519 int iY = (
eta - 1) / 5 + 1;
531 if (module >= 18 &&
side == 1)
533 int iMod = module - 1;
540 unsigned int MyPn0 = pnpair.first;
541 unsigned int MyPn1 = pnpair.second;
570 for (
unsigned int i = 0;
i < (*digiItr).size(); ++
i) {
572 adc[
i] = samp_crystal.adc();
573 adcG[
i] = samp_crystal.gainId();
592 yrange[
k] =
adc[
k] - bl;
593 if (yrange[
k] > val_max) {
604 if (allPNAmpl[
dccMEM[dccMEMIndex]].
size() > MyPn0)
608 if (allPNAmpl[
dccMEM[dccMEMIndex + 1]].
size() > MyPn1)
613 if (allPNGain[
dccMEM[dccMEMIndex]].
size() > MyPn0)
626 if (val_max > 100000. ||
chi2 < 0. ||
chi2 == 102) {
635 trees[channel]->Fill();
651 std::stringstream del;
653 system(del.str().c_str());
655 std::cout <<
" No TP Events " << std::endl;
659 std::cout <<
"\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl;
660 std::cout <<
"\t+=+ Analyzing test pulse data: getting APD, PN +=+" << std::endl;
668 restrees =
new TTree(
"TPAPD",
"TPAPD");
703 TMom* APDAnal[1700][10];
704 TMom* PNAnal[9][2][10];
706 for (
unsigned int iMod = 0; iMod <
nMod; iMod++) {
707 for (
unsigned int ich = 0; ich < 2; ich++) {
708 for (
unsigned int ig = 0; ig <
nGainPN; ig++) {
709 PNAnal[iMod][ich][ig] =
new TMom();
714 for (
unsigned int iCry = 0; iCry <
nCrys; iCry++) {
716 for (
unsigned int iG = 0; iG <
nGainAPD; iG++) {
717 APDAnal[iCry][iG] =
new TMom();
722 unsigned int iMod =
iModule[iCry] - 1;
728 Long64_t nbytes = 0, nb = 0;
729 for (Long64_t jentry = 0; jentry <
trees[iCry]->GetEntriesFast(); jentry++) {
730 nb =
trees[iCry]->GetEntry(jentry);
745 if (
trees[iCry]->GetEntries() < 10) {
747 for (
int j = 0;
j < 6;
j++) {
760 for (
unsigned int ig = 0; ig <
nGainAPD; ig++) {
763 APD[2] = APDAnal[iCry][ig]->
getM3();
777 for (
unsigned int ig = 0; ig <
nGainPN; ig++) {
778 for (
unsigned int iMod = 0; iMod <
nMod; iMod++) {
779 for (
int ch = 0; ch < 2; ch++) {
786 PN[1] = PNAnal[iMod][ch][ig]->
getRMS();
787 PN[2] = PNAnal[iMod][ch][ig]->
getM3();
789 PN[4] = PNAnal[iMod][ch][ig]->
getMin();
790 PN[5] = PNAnal[iMod][ch][ig]->
getMax();
803 std::stringstream del;
805 system(del.str().c_str());
813 std::cout <<
"\t+=+ ...................................... done +=+" << std::endl;
814 std::cout <<
"\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl;