8 int theNumCMstripsInGroup,
10 float theMaskNoiseCut,
12 float theMaskTruncCut,
13 float theCutToAvoidSignal,
14 int theEventInitNumber,
15 int theEventIterNumber) {
16 theAlgorithmType_ = theAlgorithmType;
17 theNumCMstripsInGroup_ = theNumCMstripsInGroup;
18 theMaskCalcFlag_ = theMaskCalcFlag;
19 theMaskNoiseCut_ = theMaskNoiseCut;
20 theMaskDeadCut_ = theMaskDeadCut;
21 theMaskTruncCut_ = theMaskTruncCut;
22 theCutToAvoidSignal_ = theCutToAvoidSignal;
23 theEventInitNumber_ = theEventInitNumber;
24 theEventIterNumber_ = theEventIterNumber;
28 theCMType_ =
pset.getParameter<
string>(
"CMType");
29 useDB_ =
pset.getParameter<
bool>(
"useDB");
31 theAlgorithmType_ =
pset.getParameter<
string>(
"CalculatorAlgorithm");
32 theNumCMstripsInGroup_ =
pset.getParameter<
int>(
"NumCMstripsInGroup");
33 theMaskCalcFlag_ =
pset.getParameter<
int>(
"MaskCalculationFlag");
35 theMaskNoiseCut_ =
pset.getParameter<
double>(
"MaskNoiseCut");
36 theMaskDeadCut_ =
pset.getParameter<
double>(
"MaskDeadCut");
37 theMaskTruncCut_ =
pset.getParameter<
double>(
"MaskTruncationCut");
38 theCutToAvoidSignal_ =
pset.getParameter<
double>(
"CutToAvoidSignal");
40 theEventInitNumber_ =
pset.getParameter<
int>(
"NumberOfEventsForInit");
41 theEventIterNumber_ =
pset.getParameter<
int>(
"NumberOfEventsForIteration");
46 ApvAnalysisFactory::ApvAnalysisMap::iterator
it = apvMap_.begin();
47 for (;
it != apvMap_.end();
it++) {
48 vector<ApvAnalysis*>::iterator myApv = (*it).second.begin();
49 for (; myApv != (*it).second.end(); myApv++)
58 ApvAnalysisFactory::ApvAnalysisMap::iterator CPos = apvMap_.find(
detId);
59 if (CPos != apvMap_.end()) {
60 cout <<
" APVs for Detector Id " <<
detId <<
" already created !!!" << endl;
64 vector<ApvAnalysis*>
temp;
65 for (
int i = 0;
i < numberOfApvs;
i++) {
68 constructAuxiliaryApvClasses(apvTmp,
detId,
i);
69 temp.push_back(apvTmp);
71 apvMap_.insert(pair<uint32_t, vector<ApvAnalysis*> >(
detId,
temp));
76 ApvAnalysisMap::const_iterator _apvAnalysisIter = apvMap_.find(nDET_ID);
78 return apvMap_.end() != _apvAnalysisIter ? _apvAnalysisIter->second : std::vector<ApvAnalysis*>();
99 if (theAlgorithmType_ ==
"TT6") {
100 theMask =
new TT6ApvMask(theMaskCalcFlag_, theMaskNoiseCut_, theMaskDeadCut_, theMaskTruncCut_);
101 theNoise =
new TT6NoiseCalculator(theEventInitNumber_, theEventIterNumber_, theCutToAvoidSignal_);
102 thePedestal =
new TT6PedestalCalculator(theEventInitNumber_, theEventIterNumber_, theCutToAvoidSignal_);
104 }
else if (
"TT6NT" == theAlgorithmType_) {
105 theMask =
new TT6ApvMask(theMaskCalcFlag_, theMaskNoiseCut_, theMaskDeadCut_, theMaskTruncCut_);
106 theNoise =
new TT6NoiseCalculator(theEventInitNumber_, theEventIterNumber_, theCutToAvoidSignal_);
109 }
else if (theAlgorithmType_ ==
"MIX") {
111 theMask =
new TT6ApvMask(theMaskCalcFlag_, theMaskNoiseCut_, theMaskDeadCut_, theMaskTruncCut_);
117 if (theCMType_ ==
"Median") {
120 cout <<
"Sorry Only Median is available for now, Mean and FastLinear are coming soon" << endl;
125 theCM->
setCM(theCommonMode);
137 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
138 if (apvAnalysisIt != apvMap_.end()) {
141 for (vector<ApvAnalysis*>::const_iterator apvIt = (apvAnalysisIt->second).begin();
142 apvIt != (apvAnalysisIt->second).end();
144 if (iter == pairNumber * 2 || iter == (2 * pairNumber + 1)) {
149 tmpRawDigi.
data.reserve(128);
151 size_t startStrip = 128 * (iter % 2);
152 size_t stopStrip = startStrip + 128;
154 for (
size_t istrip = startStrip; istrip < stopStrip; istrip++) {
155 if (
in.data.size() <= istrip)
158 tmpRawDigi.
data.push_back(
in.data[istrip]);
161 (*apvIt)->newEvent();
162 (*apvIt)->updateCalibration(tmpRawDigi);
172 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
173 if (apvAnalysisIt != apvMap_.end()) {
175 for (vector<ApvAnalysis*>::const_iterator apvIt = (apvAnalysisIt->second).begin();
176 apvIt != (apvAnalysisIt->second).end();
180 tmpRawDigi.
data.reserve(128);
181 size_t startStrip = 128 *
i;
182 size_t stopStrip = startStrip + 128;
184 for (
size_t istrip = startStrip; istrip < stopStrip; istrip++) {
185 if (
in.data.size() <= istrip)
188 tmpRawDigi.
data.push_back(
in.data[istrip]);
191 (*apvIt)->newEvent();
192 (*apvIt)->updateCalibration(tmpRawDigi);
201 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
202 if (apvAnalysisIt != apvMap_.end()) {
203 vector<ApvAnalysis*> myApvs = apvAnalysisIt->second;
204 peds = myApvs[apvNumber]->pedestalCalculator().pedestal();
211 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
212 if (apvAnalysisIt != apvMap_.end()) {
213 vector<ApvAnalysis*> theApvs = apvAnalysisIt->second;
214 for (vector<ApvAnalysis*>::const_iterator
it = theApvs.begin();
it != theApvs.end();
it++) {
216 for (ApvAnalysis::PedestalType::const_iterator pit =
tmp.begin(); pit !=
tmp.end(); pit++)
217 peds.push_back(*pit);
224 int apvNumb =
int(stripNumber / 128.);
225 int stripN = (stripNumber - apvNumb * 128);
233 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
234 if (apvAnalysisIt != apvMap_.end()) {
235 vector<ApvAnalysis*> theApvs = apvAnalysisIt->second;
237 noise = theApvs[apvNumber]->noiseCalculator().noise();
244 int apvNumb =
int(stripNumber / 128.);
245 int stripN = (stripNumber - apvNumb * 128);
254 map<uint32_t, vector<ApvAnalysis*> >::const_iterator theApvs_map = apvMap_.find(
detId);
255 if (theApvs_map != apvMap_.end()) {
256 vector<ApvAnalysis*>::const_iterator theApvs = (theApvs_map->second).begin();
257 for (; theApvs != (theApvs_map->second).end(); theApvs++) {
259 for (ApvAnalysis::PedestalType::const_iterator pit =
tmp.begin(); pit !=
tmp.end(); pit++)
260 peds.push_back(*pit);
268 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
269 if (apvAnalysisIt != apvMap_.end()) {
270 vector<ApvAnalysis*> theApvs = apvAnalysisIt->second;
272 noise = theApvs[apvNumber]->pedestalCalculator().rawNoise();
279 int apvNumb =
int(stripNumber / 128.);
280 int stripN = (stripNumber - apvNumb * 128);
289 map<uint32_t, vector<ApvAnalysis*> >::const_iterator theApvs_map = apvMap_.find(
detId);
290 if (theApvs_map != apvMap_.end()) {
291 vector<ApvAnalysis*>::const_iterator theApvs = (theApvs_map->second).begin();
292 for (; theApvs != (theApvs_map->second).end(); theApvs++) {
294 for (ApvAnalysis::PedestalType::const_iterator pit =
tmp.begin(); pit !=
tmp.end(); pit++)
295 peds.push_back(*pit);
303 map<uint32_t, vector<ApvAnalysis*> >::const_iterator theApvs_map = apvMap_.find(
detId);
304 if (theApvs_map != apvMap_.end()) {
305 vector<ApvAnalysis*> theApvs = theApvs_map->second;
307 tmp = theApvs[apvNumber]->commonModeCalculator().commonMode()->returnAsVector();
312 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
313 if (apvAnalysisIt != apvMap_.end()) {
314 vector<ApvAnalysis*> theApvs = apvAnalysisIt->second;
315 for (
unsigned int i = 0;
i < theApvs.size();
i++) {
317 vector<float> tmp_cm = theApvs[
i]->commonModeCalculator().commonMode()->returnAsVector();
318 for (
unsigned int it = 0;
it < tmp_cm.size();
it++)
319 tmp.push_back(tmp_cm[
it]);
325 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(det_id);
326 if (apvAnalysisIt != apvMap_.end()) {
327 vector<ApvAnalysis*> theApvs = apvAnalysisIt->second;
328 for (
unsigned int i = 0;
i < theApvs.size();
i++) {
332 for (
unsigned int ii = 0;
ii < theMaskType.size();
ii++) {
333 tmp.push_back(theMaskType[
ii]);
340 bool updating =
true;
341 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
342 if (apvAnalysisIt != apvMap_.end()) {
343 for (vector<ApvAnalysis*>::const_iterator apvIt = (apvAnalysisIt->second).begin();
344 apvIt != (apvAnalysisIt->second).end();
346 if (!((*apvIt)->pedestalCalculator().status()->isUpdating()))
356 delete &(apv->
mask());
366 map<uint32_t, vector<ApvAnalysis*> >::const_iterator theApvs_map = apvMap_.find(
detId);
368 if (theApvs_map != apvMap_.end()) {
369 vector<ApvAnalysis*> theApvs = theApvs_map->second;
370 tmp = theApvs[apvNumber]->commonModeCalculator().getCMSlope();
377 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
378 if (apvAnalysisIt != apvMap_.end()) {
379 vector<ApvAnalysis*> theApvs = apvAnalysisIt->second;
380 for (
unsigned int i = 0;
i < theApvs.size();
i++) {
381 tmp.push_back(theApvs[
i]->commonModeCalculator().getCMSlope());
std::vector< StripMaskType > MaskType
std::vector< float > PedestalType
virtual void setCM(TkCommonMode *)=0
TkCommonModeCalculator & commonModeCalculator()
void getPedestal(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &peds)
void getCommonModeSlope(uint32_t det_id, ApvAnalysis::PedestalType &tmp)
void getNoise(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &noise)
void update(uint32_t det_id, const edm::DetSet< SiStripRawDigi > &in)
void getMask(uint32_t det_id, TkApvMask::MaskType &tmp)
float getStripNoise(uint32_t det_id, int stripNumber)
virtual TkCommonMode * commonMode()=0
void getRawNoise(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &noise)
void deleteApv(ApvAnalysis *apv)
float getStripRawNoise(uint32_t det_id, int stripNumber)
virtual void setTopology(TkCommonModeTopology *in)
void updatePair(uint32_t det_id, size_t apvPair, const edm::DetSet< SiStripRawDigi > &in)
void setMask(TkApvMask &in)
bool instantiateApvs(uint32_t det_id, int numberOfApvs)
void setPedestalCalculator(TkPedestalCalculator &in)
void setNoiseCalculator(TkNoiseCalculator &in)
void setCommonModeCalculator(TkCommonModeCalculator &in)
TkPedestalCalculator & pedestalCalculator()
void getCommonMode(uint32_t det_id, ApvAnalysis::PedestalType &tmp)
virtual TkCommonModeTopology & topology()
ApvAnalysisVector getApvAnalysis(const uint32_t nDET_ID)
ApvAnalysisFactory(std::string theAlgorithmType, int theNumCMstripsInGroup, int theMaskCalcFlag, float theMaskNoiseCut, float theMaskDeadCut, float theMaskTruncCut, float theCutToAvoidSignal, int theEventInitNumber, int theEventIterNumber)
void constructAuxiliaryApvClasses(ApvAnalysis *theApv, uint32_t det_id, int thisApv)
float getStripPedestal(uint32_t det_id, int stripNumber)
bool isUpdating(uint32_t detId)
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
TkNoiseCalculator & noiseCalculator()