#pragma link C++ class Alieve::TPCSectorData::RowIterator;
#pragma link C++ class Alieve::TPCSectorData::SegmentInfo;
+#pragma link C++ class Alieve::TPCSectorData::PadRowHack;
+
#pragma link C++ class Alieve::TPCSectorViz+;
#pragma link C++ class Alieve::TPCSectorVizEditor+;
#pragma link C++ class Alieve::TPCSector2D+;
Bool_t lastTimeWarn = kFALSE;
TPCSectorData* secData = 0;
+ Short_t threshold = fLoadThreshold;
+
while (input.Next()) {
if (input.IsNewSector()) {
if(inFill) {
- secData->EndPad(fAutoPedestal, fLoadThreshold);
+ secData->EndPad(fAutoPedestal, threshold);
inFill = kFALSE;
}
sector = input.GetSector();
if (input.IsNewPad()) {
if(inFill) {
- secData->EndPad(fAutoPedestal, fLoadThreshold);
+ secData->EndPad(fAutoPedestal, threshold);
inFill = kFALSE;
}
row = input.GetRow() + rowOffset;
continue;
}
+ TPCSectorData::PadRowHack* prh = secData->GetPadRowHack(row, pad);
+ if(prh != 0) {
+ printf ("hakahaka s=%d, r=%d, p=%d\n", sector, row, pad);
+ threshold = prh->fThrExt + Short_t(prh->fThrFac*fLoadThreshold);
+ } else {
+ threshold = fLoadThreshold;
+ }
+
secData->BeginPad(row, pad, kTRUE);
inFill = kTRUE;
lastTime = 1024; lastTimeWarn = kFALSE;
if(fAutoPedestal) {
secData->RegisterData(time, signal);
} else {
- if(signal > fLoadThreshold)
+ if(signal > threshold)
secData->RegisterData(time, signal - fLoadPedestal);
}
}
if(inFill) {
- secData->EndPad(fAutoPedestal, fLoadThreshold);
+ secData->EndPad(fAutoPedestal, threshold);
inFill = kFALSE;
}
}
if(fDoubleSR)
s->SetMaxTime(1023);
+ // Hack for front/back pulse
+ s->SetMinTime(50);
+ s->SetMaxTime(980);
+ s->SetThreshold(10);
+
s->SetTrans(kTRUE);
s->SetFrameColor(36);
TPCSectorData::TPCSectorData(Int_t sector, Int_t bsize) :
fSectorID(sector), fNPadsFilled(0),
fBlockSize(bsize), fBlockPos(0),
- fCurrentRow(0), fCurrentPad(0), fCurrentPos(0)
+ fCurrentRow(0), fCurrentPad(0), fCurrentPos(0),
+ fPadRowHackSet(0)
{
if(fgParam == 0) InitStatics();
{
for(std::vector<Short_t*>::iterator b=fBlocks.begin(); b!=fBlocks.end(); ++b)
delete [] *b;
+ DeletePadRowHack();
}
void TPCSectorData::DropData()
{
memset(this, sizeof(SegmentInfo), 0);
}
+
+/**************************************************************************/
+// TPCSectorData::PadRowHack
+/**************************************************************************/
+
+#include <set>
+
+TPCSectorData::PadRowHack* TPCSectorData::GetPadRowHack(Int_t r, Int_t p)
+{
+ if(fPadRowHackSet == 0) return 0;
+ std::set<PadRowHack>* hs = static_cast<std::set<PadRowHack>*>(fPadRowHackSet);
+ std::set<PadRowHack>::iterator i = hs->find(PadRowHack(r,p));
+ return (i == hs->end()) ? 0 : const_cast<PadRowHack*>(&*i);
+}
+
+void TPCSectorData::AddPadRowHack(Int_t r, Int_t p, Int_t te, Float_t tf)
+{
+ if(fPadRowHackSet == 0) fPadRowHackSet = new std::set<PadRowHack>;
+
+ PadRowHack* prh = GetPadRowHack(r, p);
+ if(prh == 0) {
+ std::set<PadRowHack>* hs = static_cast<std::set<PadRowHack>*>(fPadRowHackSet);
+ hs->insert(PadRowHack(r, p, te, tf));
+ } else {
+ prh->fThrExt += te;
+ prh->fThrFac *= tf;
+ }
+}
+
+void TPCSectorData::RemovePadRowHack(Int_t r, Int_t p)
+{
+ if(fPadRowHackSet == 0) return;
+ std::set<PadRowHack>*hs = static_cast<std::set<PadRowHack>*>(fPadRowHackSet);
+ std::set<PadRowHack>::iterator i = hs->find(PadRowHack(r,p));
+ if(i != hs->end()) hs->erase(i);
+}
+
+void TPCSectorData::DeletePadRowHack()
+{
+ if(fPadRowHackSet != 0) {
+ std::set<PadRowHack>*hs = static_cast<std::set<PadRowHack>*>(fPadRowHackSet);
+ delete hs;
+ fPadRowHackSet = 0;
+ }
+}
static void InitStatics();
+
+ //----------------------------------------------------------------
+ // Hack for noisy pad-row removal
+ //----------------------------------------------------------------
+
+ class PadRowHack
+ {
+ public:
+ Int_t fRow, fPad;
+ Int_t fThrExt;
+ Float_t fThrFac; // Actual threshold = fThrExt + fThrFac*thr
+
+ PadRowHack(Int_t r, Int_t p, Int_t te=0, Float_t tf=1) :
+ fRow(r), fPad(r), fThrExt(te), fThrFac(tf) {}
+ bool operator<(const PadRowHack& a) const
+ { return (fRow == a.fRow) ? fPad < a.fPad : fRow < a.fRow; }
+ };
+
+ PadRowHack* GetPadRowHack(Int_t r, Int_t p);
+ void AddPadRowHack(Int_t r, Int_t p, Int_t te=0, Float_t tf=1);
+ void RemovePadRowHack(Int_t r, Int_t p);
+ void DeletePadRowHack();
+
+protected:
+ void* fPadRowHackSet;
+
+
ClassDef(TPCSectorData, 0);
}; // endclass TPCSectorData