56 _nsamples( iConfig.getUntrackedParameter< unsigned int >(
"nSamples", 10 ) ),
57 _presample( iConfig.getUntrackedParameter< unsigned int >(
"nPresamples", 3 ) ),
58 _firstsample( iConfig.getUntrackedParameter< unsigned int >(
"firstSample", 1 ) ),
59 _lastsample( iConfig.getUntrackedParameter< unsigned int >(
"lastSample", 2 ) ),
60 _samplemin( iConfig.getUntrackedParameter< unsigned int >(
"sampleMin", 3 ) ),
61 _samplemax( iConfig.getUntrackedParameter< unsigned int >(
"sampleMax", 9 ) ),
62 _nsamplesPN( iConfig.getUntrackedParameter< unsigned int >(
"nSamplesPN", 50 ) ),
63 _presamplePN( iConfig.getUntrackedParameter< unsigned int >(
"nPresamplesPN", 6 ) ),
64 _firstsamplePN( iConfig.getUntrackedParameter< unsigned int >(
"firstSamplePN", 7 ) ),
65 _lastsamplePN( iConfig.getUntrackedParameter< unsigned int >(
"lastSamplePN", 8 ) ),
66 _niter( iConfig.getUntrackedParameter< unsigned int >(
"nIter", 3 ) ),
67 _chi2max( iConfig.getUntrackedParameter< double >(
"chi2Max", 10.0 ) ),
68 _timeofmax( iConfig.getUntrackedParameter< double >(
"timeOfMax", 4.5 ) ),
69 _ecalPart( iConfig.getUntrackedParameter< std::
string >(
"ecalPart",
"EB" ) ),
70 _fedid( iConfig.getUntrackedParameter< int >(
"fedID", -999 ) ),
76 towerID(-1), channelID(-1),
runType(-1), runNum(0), fedID(-1), dccID(-1), side(-1), iZ(1),
77 phi(-1),
eta(-1),
event(0), apdAmpl(0),apdTime(0),pnAmpl(0),
78 pnID(-1), moduleID(-1), channelIteratorEE(0)
135 rootfile+=
"/TmpTreeTestPulseAnalyzer.root";
141 std::stringstream
name;
144 trees[
i]=
new TTree(name.str().c_str(),name.str().c_str());
148 trees[
i]->Branch(
"iphi", &
phi,
"phi/I" );
149 trees[
i]->Branch(
"ieta", &
eta,
"eta/I" );
161 trees[
i]->SetBranchAddress(
"ieta", &
eta );
162 trees[
i]->SetBranchAddress(
"iphi", &
phi );
188 for(
unsigned int j=0;
j<
nMod;
j++){
196 namefile <<
resdir_ <<
"/APDPN_TESTPULSE.root";
216 DCCHeader=pDCCHeader.
product();
263 TheMapping = ecalmapping.
product();
265 std::cerr <<
"Error! can't get the product EcalMappingRcd"<< std::endl;
276 int fed = headerItr->fedId();
280 runType=headerItr->getRunType();
281 runNum=headerItr->getRunNumber();
282 event=headerItr->getLV1();
284 dccID=headerItr->getDccInTCCCommand();
285 fedID=headerItr->fedId();
322 std::map <int, std::vector<double> > allPNAmpl;
323 std::map <int, std::vector<int> > allPNGain;
329 bool isMemRelevant=
false;
330 for (
unsigned int imem=0;imem<
dccMEM.size();imem++){
337 if(!isMemRelevant)
continue;
339 for (
int samId=0; samId < (*pnItr).size() ; samId++ ) {
340 pn[samId]=(*pnItr).sample(samId).adc();
341 pnG[samId]=(*pnItr).sample(samId).gainId();
343 if(pnG[samId]!=1)
std::cout <<
"PN gain different from 1 for sample "<<samId<< std::endl;
344 if (samId==0) pngain=pnG[samId];
345 if (samId>0) pngain=
TMath::Max(pnG[samId],pngain);
351 bl=dsum/((double) _presamplePN);
355 ypnrange[
k]=
pn[
k] - bl;
357 if(ypnrange[k] > val_max) {
358 val_max= ypnrange[
k]; samplemax=
k;
362 chi2pn = pnfit -> doFit(samplemax,&ypnrange[0]);
364 if(chi2pn == 101 || chi2pn == 102 || chi2pn == 103)
pnAmpl=0.;
365 else pnAmpl= pnfit -> getAmpl();
368 allPNGain[pnDetId.
iDCCId()].push_back(pngain);
378 pstpfit -> init_errmat(10.);
389 EBDetId id_crystal(digiItr->id()) ;
392 int etaG = id_crystal.ieta() ;
393 int phiG = id_crystal.iphi() ;
399 etaL=LocalCoord.first ;
400 phiL=LocalCoord.second ;
410 int strip=elecid_crystal.
stripId();
411 int xtal=elecid_crystal.
xtalId();
422 unsigned int MyPn0=pnpair.first;
423 unsigned int MyPn1=pnpair.second;
445 for (
unsigned int i=0;
i< (*digiItr).size() ; ++
i ) {
448 adc[
i]=samp_crystal.adc() ;
449 adcG[
i]=samp_crystal.gainId();
451 if (
i==0) adcgain=adcG[
i];
458 if(k<_presample-1) dsum1+=
adc[
k];
461 bl=dsum/((double)_presample);
464 yrange[
k]=
adc[
k] - bl;
465 if(yrange[k] > val_max) {
466 val_max= yrange[
k]; samplemax=
k;
483 chi2 = pstpfit -> fit_third_degree_polynomial(&yrange[0],
ret_data);
488 if( val_max > 100000. || chi2 < 0. || chi2 == 102 ) {
500 trees[channel]->Fill();
508 EEDetId id_crystal(digiItr->id()) ;
511 phi = id_crystal.ix() ;
512 eta = id_crystal.iy() ;
514 int iX = (
phi-1)/5+1;
515 int iY = (
eta-1)/5+1;
529 if( module>=18 &&
side==1 ) module+=2;
536 unsigned int MyPn0=pnpair.first;
537 unsigned int MyPn1=pnpair.second;
566 for (
unsigned int i=0;
i< (*digiItr).size() ; ++
i ) {
569 adc[
i]=samp_crystal.adc() ;
570 adcG[
i]=samp_crystal.gainId();
572 if (
i==0) adcgain=adcG[
i];
581 if(k<_presample-1) dsum1+=
adc[
k];
584 bl=dsum/((double)_presample);
587 yrange[
k]=
adc[
k] - bl;
588 if(yrange[k] > val_max) {
589 val_max= yrange[
k]; samplemax=
k;
595 if(
side==1) dccMEMIndex+=2;
609 chi2 = pstpfit -> fit_third_degree_polynomial(&yrange[0],
ret_data);
614 if( val_max > 100000. || chi2 < 0. || chi2 == 102 ) {
626 trees[channel]->Fill();
646 std::stringstream del;
648 system(del.str().c_str());
650 std::cout <<
" No TP Events "<< std::endl;
654 std::cout <<
"\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl;
655 std::cout <<
"\t+=+ Analyzing test pulse data: getting APD, PN +=+" << std::endl;
664 restrees=
new TTree(
"TPAPD",
"TPAPD");
667 restrees->Branch(
"iphi", &
iphi,
"iphi/I" );
668 restrees->Branch(
"ieta", &
ieta,
"ieta/I" );
669 restrees->Branch(
"dccID", &
dccID,
"dccID/I" );
670 restrees->Branch(
"side", &
side,
"side/I" );
671 restrees->Branch(
"towerID", &
towerID,
"towerID/I" );
672 restrees->Branch(
"channelID", &
channelID,
"channelID/I" );
673 restrees->Branch(
"moduleID", &
moduleID,
"moduleID/I" );
674 restrees->Branch(
"flag", &
flag,
"flag/I" );
675 restrees->Branch(
"gain", &
gain,
"gain/I" );
676 restrees->Branch(
"APD", &
APD,
"APD[6]/D" );
683 restrees->SetBranchAddress(
"iphi", &
iphi );
684 restrees->SetBranchAddress(
"ieta", &
ieta );
685 restrees->SetBranchAddress(
"dccID", &
dccID );
686 restrees->SetBranchAddress(
"side", &
side );
687 restrees->SetBranchAddress(
"towerID", &
towerID );
688 restrees->SetBranchAddress(
"channelID", &
channelID );
689 restrees->SetBranchAddress(
"moduleID", &
moduleID );
690 restrees->SetBranchAddress(
"flag", &
flag );
691 restrees->SetBranchAddress(
"gain", &
gain );
692 restrees->SetBranchAddress(
"APD",
APD );
701 TMom *APDAnal[1700][10];
702 TMom *PNAnal[9][2][10];
705 for (
unsigned int iMod=0;iMod<
nMod;iMod++){
706 for (
unsigned int ich=0;ich<2;ich++){
707 for (
unsigned int ig=0;ig<
nGainPN;ig++){
708 PNAnal[iMod][ich][ig]=
new TMom();
713 for (
unsigned int iCry=0;iCry<
nCrys;iCry++){
715 for(
unsigned int iG=0;iG<
nGainAPD;iG++){
716 APDAnal[iCry][iG]=
new TMom();
723 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); nbytes += nb;
745 if (
trees[iCry]->GetEntries()<10){
747 for (
int j=0;
j<6;
j++){
760 for (
unsigned int ig=0;ig<
nGainAPD;ig++){
779 for (
unsigned int ig=0;ig<
nGainPN;ig++){
780 for (
unsigned int iMod=0;iMod<
nMod;iMod++){
781 for (
int ch=0;ch<2;ch++){
788 PN[1]= PNAnal[iMod][ch][ig]->
getRMS();
789 PN[2]= PNAnal[iMod][ch][ig]->
getM3();
791 PN[4]= PNAnal[iMod][ch][ig]->
getMin();
792 PN[5]= PNAnal[iMod][ch][ig]->
getMax();
806 std::stringstream del;
808 system(del.str().c_str());
817 std::cout <<
"\t+=+ ...................................... done +=+" << std::endl;
818 std::cout <<
"\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl;
std::string eventHeaderProducer_
void addEntry(double val)
static XYCoord localCoord(int icr)
T getParameter(std::string const &) const
std::map< int, int > channelMapEE
T getUntrackedParameter(std::string const &, T const &) const
static int lmmod(SuperCrysCoord iX, SuperCrysCoord iY)
static std::vector< ME::DCCid > memFromDcc(ME::DCCid idcc)
int xtalId() const
get the channel id
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
unsigned int iModule[1700]
std::vector< int > modules
int stripId() const
get the tower id
#define DEFINE_FWK_MODULE(type)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
std::string digiCollection_
static int side(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
std::vector< EcalDCCHeaderBlock >::const_iterator const_iterator
unsigned int _firstsample
int towerId() const
get the tower id
unsigned int _presamplePN
const_iterator begin() const
std::string digiProducer_
std::string eventHeaderCollection_
EcalTestPulseAnalyzer(const edm::ParameterSet &iConfig)
unsigned int _lastsamplePN
unsigned int _firstsamplePN
static std::pair< int, int > pn(int ilmmod)
int hashedIndex(int ieta, int iphi)
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
static std::pair< int, int > pn(int dee, int ilmod)
static int electronic_channel(EBLocalCoord ix, EBLocalCoord iy)
std::string digiPNCollection_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
int iDCCId() const
get the DCCId
static int lmmod(EBGlobalCoord ieta, EBGlobalCoord iphi)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
unsigned int firstChanMod[9]
const_iterator end() const
static int side(EBGlobalCoord ieta, EBGlobalCoord iphi)
T const * product() const
T const * product() const
const_iterator end() const
std::vector< int > dccMEM
EcalLogicID towerID(EcalElectronicsId const &)
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
unsigned int isFirstChanModFilled[9]
static std::vector< ME::LMMid > lmmodFromDcc(ME::DCCid idcc)
tuple size
Write out results.
int channelId() const
so far for EndCap only :
const_iterator begin() const