48 _presample( iConfig.getUntrackedParameter< double >(
"nPresamples", 6.7 ) ),
49 _nsamplesaftmax(iConfig.getUntrackedParameter< unsigned int >(
"nSamplesAftMax", 80 ) ),
50 _noiseCut( iConfig.getUntrackedParameter< unsigned int >(
"noiseCut", 7 ) ),
51 _parabnbefmax( iConfig.getUntrackedParameter< unsigned int >(
"paraBeforeMax", 8 ) ),
52 _parabnaftmax( iConfig.getUntrackedParameter< unsigned int >(
"paraAfterMax", 7 ) ),
53 _thres( iConfig.getUntrackedParameter< unsigned int >(
"threshold", 10 ) ),
54 _lowlev( iConfig.getUntrackedParameter< unsigned int >(
"lowLevel", 20 ) ),
55 _highlev( iConfig.getUntrackedParameter< unsigned int >(
"highLevel", 80 ) ),
56 _nevlasers( iConfig.getUntrackedParameter< unsigned int >(
"nEventLaser", 600 ) ),
57 _timebefmax( iConfig.getUntrackedParameter< unsigned int >(
"timeBefMax", 100 ) ),
58 _timeaftmax( iConfig.getUntrackedParameter< unsigned int >(
"timeAftMax", 250 ) ),
59 _cutwindow( iConfig.getUntrackedParameter< double >(
"cutWindow", 0.1 ) ),
60 _nsamplesshape( iConfig.getUntrackedParameter< unsigned int >(
"nSamplesShape", 250 ) ),
61 _presampleshape(iConfig.getUntrackedParameter< unsigned int >(
"nPresamplesShape",50 ) ),
62 _slide( iConfig.getUntrackedParameter< unsigned int >(
"nSlide", 100 ) ),
63 _fedid( iConfig.getUntrackedParameter< int >(
"fedID", -999 ) ),
64 _debug( iConfig.getUntrackedParameter< int >(
"debug", 0 ) ),
102 sampfile+=
"/TmpTreeMatacqAnalyzer.root";
109 tree =
new TTree(
"MatacqTree",
"MatacqTree");
114 tree->Branch(
"event", &
event,
"event/I" );
115 tree->Branch(
"color", &
color ,
"color/I" );
116 tree->Branch(
"matacq", &
matacq ,
"matacq[2560]/D" );
117 tree->Branch(
"nsamples", &
nsamples ,
"nsamples/I" );
118 tree->Branch(
"maxsamp", &
maxsamp ,
"maxsamp/I" );
119 tree->Branch(
"tt", &
tt ,
"tt/D" );
120 tree->Branch(
"lightside", &
lightside ,
"lightside/I" );
122 tree->SetBranchAddress(
"event", &
event );
123 tree->SetBranchAddress(
"color", &
color );
124 tree->SetBranchAddress(
"matacq",
matacq );
125 tree->SetBranchAddress(
"nsamples", &
nsamples );
126 tree->SetBranchAddress(
"maxsamp", &
maxsamp );
127 tree->SetBranchAddress(
"tt", &
tt );
128 tree->SetBranchAddress(
"lightside", &
lightside );
135 namefile <<
resdir_ <<
"/MATACQ.root";
159 matacqDigi=pmatacqDigi.
product();
160 if (
_debug==1 )
std::cout <<
"-- debug test -- Matacq Digis Found -- "<< std::endl;
164 if (
_debug==1 )
std::cout <<
"-- debug test -- No Matacq Digis Found -- "<< std::endl;
174 DCCHeader=pDCCHeader.
product();
184 if (
_debug==1)
std::cout <<
"-- debug test -- Before header -- "<< std::endl;
191 if(
color<0 )
return;
195 int fed = headerItr->fedId();
199 runType=headerItr->getRunType();
200 runNum=headerItr->getRunNumber();
201 event=headerItr->getLV1();
205 dccID=headerItr->getDccInTCCCommand();
206 fedID=headerItr->fedId();
260 std::cout <<
"-- debug test -- Inside digis -- digi size="<<digis.
size()<< std::endl;
263 if(digis.
size()== 0 )
continue;
271 for(
int i=0;
i<digis.
size(); ++
i){
279 std::cout <<
"-- debug test -- Inside digis -- nsamples="<<
nsamples<<
", max="<<max<< std::endl;
298 std::cout <<
"\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl;
299 std::cout <<
"\t+=+ WARNING! NO MATACQ +=+" << std::endl;
300 std::cout <<
"\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl;
307 std::stringstream del2;
309 system(del2.str().c_str());
315 unsigned int nCol=
colors.size();
317 for(
unsigned int iCol=0;iCol<nCol;iCol++){
318 for(
unsigned int iSide=0;iSide<
nSide;iSide++){
328 std::cout <<
"\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl;
329 std::cout <<
"\t+=+ Analyzing MATACQ data +=+" << std::endl;
336 mtqShape =
new TTree(
"MatacqShape",
"MatacqShape");
374 unsigned int endsample;
375 unsigned int presample;
380 TChain* fChain = (TChain*)
tree;
381 Long64_t nentries = fChain->GetEntriesFast();
382 Long64_t nbytes = 0, nb = 0;
384 for( Long64_t jentry=0; jentry<nentries; jentry++ )
387 Long64_t ientry = fChain->LoadTree(jentry);
388 if (ientry < 0)
break;
389 nb = fChain->GetEntry( jentry ); nbytes += nb;
406 if (
_debug==1)
std::cout <<
"-- debug test -- inside loop 1 -- jentry:"<<jentry<<
" over nentries="<<nentries<< std::endl;
417 if (
_debug==1)
std::cout <<
"-- debug test -- inside loop 2 -- "<< std::endl;
433 if( mtq->
doFit()==0 )
459 if (
_debug==1)
std::cout <<
"-- debug test -- inside loop 7 -- firstS:"<<firstS<<
", nsamples:"<<
nsamples<< std::endl;
463 for (
int i=firstS;
i<lastS;
i++){
464 shapeMatTmp->Fill(
double(
i)-firstS,
matacq[
i]);
478 for(
int i=firstS;
i<0;
i++){
479 shapeMatTmp->Fill(
double(
i)-firstS,thisped);
491 shapeMatTmp->Fill(
double(
i)-firstS,
matacq[
i]);
500 shapeMatTmp->Fill(
double(
i)-firstS,matacqval);
505 for (
int i=firstSBis;
i<lastS;
i++){
506 shapeMatTmp->Fill(
double(
i)-firstS,
matacq[
i]);
512 if (
_debug==1)
std::cout <<
"-- debug test -- inside loop 8"<< std::endl;
517 for(
unsigned int i=0;
i<nCol;
i++){
523 if (
_debug==1)
std::cout <<
"-- debug test -- inside loop 8bis color:"<<
color<<
" iCol:"<<iCol<<
" nCol:"<< nCol<< std::endl;
527 if(
status == 1 && mtq->
findPeak()==0 && mtq->
doFit()==0 && mtq->
compute_trise()==0 )
MTQ[iCol][
lightside]->
addEntry(
peak,
sigma,
fit,
ampl,
trise,
fwhm,
fw20,
fw80,
ped,
pedsig,
sliding);
531 if (
_debug==1)
std::cout <<
"-- debug test -- inside loop 9"<< std::endl;
541 double Peak[6], Sigma[6],
Fit[6], Ampl[6], Trise[6], Fwhm[6], Fw20[6], Fw80[6], Ped[6], Pedsig[6], Sliding[6];
544 for (
unsigned int iColor=0;iColor<nCol;iColor++){
546 std::stringstream nametree;
547 nametree <<
"MatacqCol"<<
colors[iColor];
548 meanTree[iColor]=
new TTree(nametree.str().c_str(),nametree.str().c_str());
549 meanTree[iColor]->Branch(
"side", &Side ,
"Side/I" );
550 meanTree[iColor]->Branch(
"peak", &Peak ,
"Peak[6]/D" );
551 meanTree[iColor]->Branch(
"sigma", &Sigma ,
"Sigma[6]/D" );
552 meanTree[iColor]->Branch(
"fit", &Fit ,
"Fit[6]/D" );
553 meanTree[iColor]->Branch(
"ampl", &Ampl ,
"Ampl[6]/D" );
554 meanTree[iColor]->Branch(
"trise", &Trise ,
"Trise[6]/D" );
555 meanTree[iColor]->Branch(
"fwhm", &Fwhm ,
"Fwhm[6]/D" );
556 meanTree[iColor]->Branch(
"fw20", &Fw20 ,
"Fw20[6]/D" );
557 meanTree[iColor]->Branch(
"fw80", &Fw80 ,
"Fw80[6]/D" );
558 meanTree[iColor]->Branch(
"ped", &Ped ,
"Ped[6]/D" );
559 meanTree[iColor]->Branch(
"pedsig", &Pedsig ,
"Pedsig[6]/D" );
560 meanTree[iColor]->Branch(
"sliding", &Sliding ,
"Sliding[6]/D" );
562 meanTree[iColor]->SetBranchAddress(
"side", &Side );
563 meanTree[iColor]->SetBranchAddress(
"peak", Peak );
564 meanTree[iColor]->SetBranchAddress(
"sigma", Sigma );
565 meanTree[iColor]->SetBranchAddress(
"fit", Fit );
566 meanTree[iColor]->SetBranchAddress(
"ampl", Ampl );
567 meanTree[iColor]->SetBranchAddress(
"fwhm", Fwhm );
568 meanTree[iColor]->SetBranchAddress(
"fw20", Fw20 );
569 meanTree[iColor]->SetBranchAddress(
"fw80", Fw80 );
570 meanTree[iColor]->SetBranchAddress(
"trise", Trise );
571 meanTree[iColor]->SetBranchAddress(
"ped", Ped );
572 meanTree[iColor]->SetBranchAddress(
"pedsig", Pedsig );
573 meanTree[iColor]->SetBranchAddress(
"sliding", Sliding );
577 for(
unsigned int iCol=0;iCol<nCol;iCol++){
578 for(
unsigned int iSide=0;iSide<
nSides;iSide++){
584 val[iVar] =
MTQ[iCol][iSide]->
get(iVar);
586 for(
unsigned int i=0;
i<val[iVar].size();
i++){
605 if (
_debug==1)
std::cout <<
"-- debug test -- inside final loop "<< std::endl;
611 int im = shapeMatTmp->GetMaximumBin();
612 double q1=shapeMatTmp->GetBinContent(im-1);
613 double q2=shapeMatTmp->GetBinContent(im);
614 double q3=shapeMatTmp->GetBinContent(im+1);
616 double a2=(q3+
q1)/2.0-q2;
617 double a1=q2-q1+a2*(1-2*im);
618 double a0=q2-a1*im-a2*im*im;
620 double am=a0-a1*a1/(4*a2);
627 bl+=shapeMatTmp->GetBinContent(
i);
633 if (
_debug==1)
std::cout <<
"-- debug test -- computing shape "<< std::endl;
639 height=shapeMatTmp->GetBinContent(
i)-bl;
649 for(
unsigned int i=firstBin;
i<lastBin;
i++){
650 shapeMat->Fill(
i-firstBin,shapeMatTmp->GetBinContent(
i)-bl);
654 for (
unsigned int iColor=0;iColor<nCol;iColor++){
667 std::stringstream del2;
669 system(del2.str().c_str());
672 std::cout <<
"\t+=+ .................... done +=+" << std::endl;
673 std::cout <<
"\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
unsigned int _presampleshape
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
EcalMatacqAnalyzer(const edm::ParameterSet &iConfig)
std::vector< int > colors
#define DEFINE_FWK_MODULE(type)
unsigned int _nsamplesshape
std::vector< T >::const_iterator const_iterator
std::string eventHeaderProducer_
TMTQ * MTQ[nColor][nSide]
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const float adcCount(const int &i) const
std::string eventHeaderCollection_
std::string digiProducer_
const T & max(const T &a, const T &b)
std::vector< double > get(int)
int rawPulseAnalysis(Int_t, Double_t *)
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const_iterator end() const
unsigned int _parabnaftmax
T const * product() const
std::string digiCollection_
unsigned int _nsamplesaftmax
const_iterator begin() const
unsigned int _parabnbefmax