59 _nsamples( iConfig.getUntrackedParameter< unsigned
int >(
"nSamples", 10 ) ),
60 _presample( iConfig.getUntrackedParameter< unsigned
int >(
"nPresamples", 2 ) ),
61 _firstsample( iConfig.getUntrackedParameter< unsigned
int >(
"firstSample", 1 ) ),
62 _lastsample( iConfig.getUntrackedParameter< unsigned
int >(
"lastSample", 2 ) ),
63 _timingcutlow( iConfig.getUntrackedParameter< unsigned
int >(
"timingCutLow", 2 ) ),
64 _timingcuthigh( iConfig.getUntrackedParameter< unsigned
int >(
"timingCutHigh", 9 ) ),
65 _timingquallow( iConfig.getUntrackedParameter< unsigned
int >(
"timingQualLow", 3 ) ),
66 _timingqualhigh( iConfig.getUntrackedParameter< unsigned
int >(
"timingQualHigh", 8 ) ),
67 _ratiomincutlow( iConfig.getUntrackedParameter< double >(
"ratioMinCutLow", 0.4 ) ),
68 _ratiomincuthigh( iConfig.getUntrackedParameter< double >(
"ratioMinCutHigh", 0.95 ) ),
69 _ratiomaxcutlow( iConfig.getUntrackedParameter< double >(
"ratioMaxCutLow", 0.8 ) ),
70 _presamplecut( iConfig.getUntrackedParameter< double >(
"presampleCut", 5.0 ) ),
71 _niter( iConfig.getUntrackedParameter< unsigned
int >(
"nIter", 3 ) ),
72 _alpha( iConfig.getUntrackedParameter< double >(
"alpha", 1.5076494 ) ),
73 _beta( iConfig.getUntrackedParameter< double >(
"beta", 1.5136036 ) ),
74 _nevtmax( iConfig.getUntrackedParameter< unsigned
int >(
"nEvtMax", 200 ) ),
75 _noise( iConfig.getUntrackedParameter< double >(
"noise", 2.0 ) ),
76 _chi2cut( iConfig.getUntrackedParameter< double >(
"chi2cut", 100.0 ) ),
77 _ecalPart( iConfig.getUntrackedParameter<
std::
string >(
"ecalPart",
"EB" ) ),
78 _qualpercent( iConfig.getUntrackedParameter< double >(
"qualPercent", 0.2 ) ),
79 _debug( iConfig.getUntrackedParameter<
int >(
"debug", 0 ) ),
81 runType(-1), runNum(0), fedID(-1), dccID(-1), side(2), lightside(2), iZ(1),
113 for(
unsigned int j=0;j<
nCrys;j++){
172 std::stringstream nameabinitfile;
173 nameabinitfile <<
resdir_ <<
"/ABInit.root";
176 std::stringstream nameabfile;
177 std::stringstream link;
178 nameabfile << resdir_ <<
"/AB.root";
181 test = fopen(nameabinitfile.str().c_str(),
"r");
182 if(test ==
nullptr) {
189 TFile *fAB=
nullptr; TTree *ABInit=
nullptr;
191 fAB=
new TFile(nameabinitfile.str().c_str());
194 ABInit = (TTree*) fAB->Get(
"ABCol0");
216 link<<
"ln -s "<<resdir_<<
"/ABInit.root "<< resdir_<<
"/AB.root";
217 system(link.str().c_str());
222 std::stringstream namefile;
223 namefile << resdir_ <<
"/AB.root";
239 DCCHeader=pDCCHeader.
product();
264 std::cout <<
" Wrong ecalPart in cfg file " << std::endl;
273 TheMapping = ecalmapping.
product();
275 std::cerr <<
"Error! can't get the product EcalMappingRcd"<< std::endl;
288 int fed = headerItr->fedId();
291 runType=headerItr->getRunType();
292 runNum=headerItr->getRunNumber();
293 event=headerItr->getLV1();
295 dccID=headerItr->getDccInTCCCommand();
296 fedID=headerItr->fedId();
314 if(
color <0 )
return;
344 EBDetId id_crystal(digiItr->id()) ;
347 int etaG = id_crystal.ieta() ;
348 int phiG = id_crystal.iphi() ;
354 etaL=LocalCoord.first ;
355 phiL=LocalCoord.second ;
368 int xtal=elecid_crystal.
xtalId();
369 int channelID= 5*(strip-1) + xtal-1;
373 assert( channel <
nCrys );
387 for (
unsigned int i=0;
i< (*digiItr).size() ; ++
i ) {
390 adc[
i]=samp_crystal.adc() ;
391 adcG[
i]=samp_crystal.gainId();
393 if (
i==0) adcGain=
adcG[
i];
434 EEDetId id_crystal(digiItr->id()) ;
437 phi = id_crystal.ix() ;
438 eta = id_crystal.iy() ;
440 int iX = (
phi-1)/5+1;
441 int iY = (
eta-1)/5+1;
447 int channelID=elecid_crystal.
channelId()-1;
458 assert ( channel <
nCrys );
470 if( (*digiItr).size()>10)
std::cout <<
"SAMPLES SIZE > 10!" << (*digiItr).size()<< std::endl;
474 for (
unsigned int i=0;
i< (*digiItr).size() ; ++
i ) {
477 adc[
i]=samp_crystal.adc() ;
478 adcG[
i]=samp_crystal.gainId();
481 if (
i==0) adcGain=
adcG[
i];
517 std::cout <<
"\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl;
518 std::cout <<
"\t+=+ Analyzing data: getting (alpha, beta) +=+" << std::endl;
546 std::cout <<
"\n\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl;
547 std::cout <<
"\t+=+ Analyzing data: getting (alpha, beta) +=+" << std::endl;
548 TFile *fAB=
nullptr; TTree *ABInit=
nullptr;
553 ABInit = (TTree*) fAB->Get(
"ABCol0");
559 double BadGainEvtPercentage=0.0;
560 double BadTimingEvtPercentage=0.0;
563 int nChanBadTiming=0;
580 double BadGainChanPercentage=double(nChanBadGain)/double(nCrys);
581 double BadTimingChanPercentage=double(nChanBadTiming)/double(nCrys);
588 std::cout <<
"\t+=+ ............................ WARNING! APD GAIN WAS NOT 1 +=+" << std::endl;
590 std::cout <<
"\t+=+ ............................ WARNING! TIMING WAS BAD +=+" << std::endl;
592 std::cout <<
"\t+=+ .................................... done +=+" << std::endl;
593 std::cout <<
"\t+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" << std::endl;
void addEntry(double val)
static XYCoord localCoord(int icr)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string digiProducer_
std::string alphainitfile
int xtalId() const
get the channel id
std::string eventHeaderProducer_
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
int stripId() const
get the tower id
double getDelta(int, int)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
static int side(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
std::vector< T >::const_iterator const_iterator
void computeShape(std::string namefile, TTree *)
int towerId() const
get the tower id
unsigned int _firstsample
const_iterator begin() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
int hashedIndex(int ieta, int iphi)
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
~EcalABAnalyzer() override
#define DEFINE_FWK_MODULE(type)
static int electronic_channel(EBLocalCoord ix, EBLocalCoord iy)
EcalABAnalyzer(const edm::ParameterSet &iConfig)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
unsigned int nevtAB[1700]
unsigned int _timingcuthigh
const_iterator end() const
static int side(EBGlobalCoord ieta, EBGlobalCoord iphi)
T const * product() const
std::map< int, int > channelMapEE
const_iterator end() const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
std::string digiCollection_
unsigned int _timingqualhigh
std::string eventHeaderCollection_
unsigned int _timingcutlow
EcalLogicID towerID(EcalElectronicsId const &)
T const * product() const
unsigned int _timingquallow
int channelId() const
so far for EndCap only :
const_iterator begin() const