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;
121 delete theCommonMode;
128 cout <<
"ApvAnalysisFactory: algorithm " << theAlgorithmType_ <<
" not supported" << endl;
129 delete theCommonMode;
134 theCM->
setCM(theCommonMode);
146 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
147 if (apvAnalysisIt != apvMap_.end()) {
150 for (vector<ApvAnalysis*>::const_iterator apvIt = (apvAnalysisIt->second).begin();
151 apvIt != (apvAnalysisIt->second).end();
153 if (iter == pairNumber * 2 || iter == (2 * pairNumber + 1)) {
158 tmpRawDigi.
data.reserve(128);
160 size_t startStrip = 128 * (iter % 2);
161 size_t stopStrip = startStrip + 128;
163 for (
size_t istrip = startStrip; istrip < stopStrip; istrip++) {
164 if (
in.data.size() <= istrip)
167 tmpRawDigi.
data.push_back(
in.data[istrip]);
170 (*apvIt)->newEvent();
171 (*apvIt)->updateCalibration(tmpRawDigi);
181 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
182 if (apvAnalysisIt != apvMap_.end()) {
184 for (vector<ApvAnalysis*>::const_iterator apvIt = (apvAnalysisIt->second).begin();
185 apvIt != (apvAnalysisIt->second).end();
189 tmpRawDigi.
data.reserve(128);
190 size_t startStrip = 128 *
i;
191 size_t stopStrip = startStrip + 128;
193 for (
size_t istrip = startStrip; istrip < stopStrip; istrip++) {
194 if (
in.data.size() <= istrip)
197 tmpRawDigi.
data.push_back(
in.data[istrip]);
200 (*apvIt)->newEvent();
201 (*apvIt)->updateCalibration(tmpRawDigi);
210 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
211 if (apvAnalysisIt != apvMap_.end()) {
212 vector<ApvAnalysis*> myApvs = apvAnalysisIt->second;
213 peds = myApvs[apvNumber]->pedestalCalculator().pedestal();
220 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
221 if (apvAnalysisIt != apvMap_.end()) {
222 vector<ApvAnalysis*> theApvs = apvAnalysisIt->second;
223 for (vector<ApvAnalysis*>::const_iterator
it = theApvs.begin();
it != theApvs.end();
it++) {
225 for (ApvAnalysis::PedestalType::const_iterator pit =
tmp.begin(); pit !=
tmp.end(); pit++)
226 peds.push_back(*pit);
233 int apvNumb =
int(stripNumber / 128.);
234 int stripN = (stripNumber - apvNumb * 128);
242 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
243 if (apvAnalysisIt != apvMap_.end()) {
244 vector<ApvAnalysis*> theApvs = apvAnalysisIt->second;
246 noise = theApvs[apvNumber]->noiseCalculator().noise();
253 int apvNumb =
int(stripNumber / 128.);
254 int stripN = (stripNumber - apvNumb * 128);
263 map<uint32_t, vector<ApvAnalysis*> >::const_iterator theApvs_map = apvMap_.find(
detId);
264 if (theApvs_map != apvMap_.end()) {
265 vector<ApvAnalysis*>::const_iterator theApvs = (theApvs_map->second).begin();
266 for (; theApvs != (theApvs_map->second).end(); theApvs++) {
268 for (ApvAnalysis::PedestalType::const_iterator pit =
tmp.begin(); pit !=
tmp.end(); pit++)
269 peds.push_back(*pit);
277 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
278 if (apvAnalysisIt != apvMap_.end()) {
279 vector<ApvAnalysis*> theApvs = apvAnalysisIt->second;
281 noise = theApvs[apvNumber]->pedestalCalculator().rawNoise();
288 int apvNumb =
int(stripNumber / 128.);
289 int stripN = (stripNumber - apvNumb * 128);
298 map<uint32_t, vector<ApvAnalysis*> >::const_iterator theApvs_map = apvMap_.find(
detId);
299 if (theApvs_map != apvMap_.end()) {
300 vector<ApvAnalysis*>::const_iterator theApvs = (theApvs_map->second).begin();
301 for (; theApvs != (theApvs_map->second).end(); theApvs++) {
303 for (ApvAnalysis::PedestalType::const_iterator pit =
tmp.begin(); pit !=
tmp.end(); pit++)
304 peds.push_back(*pit);
312 map<uint32_t, vector<ApvAnalysis*> >::const_iterator theApvs_map = apvMap_.find(
detId);
313 if (theApvs_map != apvMap_.end()) {
314 vector<ApvAnalysis*> theApvs = theApvs_map->second;
316 tmp = theApvs[apvNumber]->commonModeCalculator().commonMode()->returnAsVector();
321 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
322 if (apvAnalysisIt != apvMap_.end()) {
323 vector<ApvAnalysis*> theApvs = apvAnalysisIt->second;
324 for (
unsigned int i = 0;
i < theApvs.size();
i++) {
326 vector<float> tmp_cm = theApvs[
i]->commonModeCalculator().commonMode()->returnAsVector();
327 for (
unsigned int it = 0;
it < tmp_cm.size();
it++)
328 tmp.push_back(tmp_cm[
it]);
334 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(det_id);
335 if (apvAnalysisIt != apvMap_.end()) {
336 vector<ApvAnalysis*> theApvs = apvAnalysisIt->second;
337 for (
unsigned int i = 0;
i < theApvs.size();
i++) {
341 for (
unsigned int ii = 0;
ii < theMaskType.size();
ii++) {
342 tmp.push_back(theMaskType[
ii]);
349 bool updating =
true;
350 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
351 if (apvAnalysisIt != apvMap_.end()) {
352 for (vector<ApvAnalysis*>::const_iterator apvIt = (apvAnalysisIt->second).begin();
353 apvIt != (apvAnalysisIt->second).end();
355 if (!((*apvIt)->pedestalCalculator().status()->isUpdating()))
365 delete &(apv->
mask());
375 map<uint32_t, vector<ApvAnalysis*> >::const_iterator theApvs_map = apvMap_.find(
detId);
377 if (theApvs_map != apvMap_.end()) {
378 vector<ApvAnalysis*> theApvs = theApvs_map->second;
379 tmp = theApvs[apvNumber]->commonModeCalculator().getCMSlope();
386 map<uint32_t, vector<ApvAnalysis*> >::const_iterator apvAnalysisIt = apvMap_.find(
detId);
387 if (apvAnalysisIt != apvMap_.end()) {
388 vector<ApvAnalysis*> theApvs = apvAnalysisIt->second;
389 for (
unsigned int i = 0;
i < theApvs.size();
i++) {
390 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()