//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // Implementation of class TpcSimplePSAStrategy // see TpcSimplePSAStrategy.hh for details // // Environment: // Software developed for the PANDA Detector at FAIR. // // Author List: // Sebastian Neubert TUM (original author) // // //----------------------------------------------------------- // This Class' Header ------------------ #include "TpcSimplePSAStrategy.h" // C/C++ Headers ---------------------- #include "assert.h" #include #include using std::max; // Collaborating Class Headers -------- #include "TpcSample.h" #include "TpcDigi.h" // Class Member definitions ----------- TpcSimplePSAStrategy::TpcSimplePSAStrategy(const unsigned int threshold) : TpcAbsPSAStrategy(), _currentPadID(0), _inprogress(false), _amp(0),_t(0),_threshold(threshold) {} TpcDigi* TpcSimplePSAStrategy::ProcessNext(const TpcSample* sample) { unsigned int newPadID=sample->padId(); unsigned int newamp=sample->amp(); // std::cout << newPadID << " " << newamp << std::endl; if(_inprogress){ if(newPadID==_currentPadID && newamp>=_threshold){ if(newamp>_amp){ _amp=newamp; //_t=sample->t(); } _mcid.AddID(sample->mcId()); } else{ TpcDigi* digi=new TpcDigi(_amp,_t,_currentPadID,_mcid); if(newamp>=_threshold){ // start new pulse on different pad _currentPadID=newPadID; _amp=sample->amp(); _t=sample->t(); } else _inprogress=false; return digi; } } else if(newamp>_threshold){ // start new pulse! _currentPadID=newPadID; _amp=newamp; _t=sample->t(); _mcid.ClearData(); _mcid.AddID(sample->mcId()); _inprogress=true; } return 0; } void TpcSimplePSAStrategy::Process(const std::vector & samples, std::vector& digis) { /* for(int i=0;ipadId() << " " << samples[i]->amp() << std::endl; } */ int startIndex; for(int i=0;ipadId(); unsigned int newamp=samples[i]->amp(); if(_inprogress){ if(newPadID==_currentPadID && newamp>=_threshold){ if(newamp>_amp){ _amp=newamp; } _mcid.AddID(samples[i]->mcId()); } else{ TpcDigi* digi=new TpcDigi(_amp,_t,_currentPadID,_mcid); _inprogress=false; digis.push_back(digi); } } else if(newamp>_threshold){ // start new pulse! _currentPadID=newPadID; _amp=newamp; _t=samples[i]->t(); _mcid.ClearData(); _mcid.AddID(samples[i]->mcId()); startIndex = i; _inprogress=true; } } }