65 #include "StFgtQaAdcVsChannel.h"
74 #include "StRoot/StFgtPool/StFgtCosmicTestStandGeom/StFgtCosmicTestStandGeom.h"
76 #include "StRoot/StEvent/StFgtCollection.h"
77 #include "StRoot/StEvent/StFgtStripCollection.h"
81 StFgtQaAdcVsChannel::StFgtQaAdcVsChannel(
const Char_t* name,
84 const Char_t* quadName ) :
86 mPath(
""), mFileNameBase(
""), mFileNameKey( quadName ), mHist(0) {
99 std::cerr <<
"TODO" << endl;
104 StFgtQaAdcVsChannel::~StFgtQaAdcVsChannel(){
111 std::cerr <<
"TODO" << endl;
115 Int_t StFgtQaAdcVsChannel::Init(){
116 Int_t ierr = StFgtQaMaker::Init();
124 std::string name, title;
126 std::stringstream ss;
127 ss <<
GetName() <<
"_" << mDiscId <<
"_" << mQuadId <<
"_" << mDoVsStrip << mDoSubtrPeds;
132 std::stringstream ss;
134 if( mDoVsStrip ==
'r' )
135 ss <<
"r-strips, cham. 1: ";
136 else if( mDoVsStrip ==
'R' )
137 ss <<
"r-strips, cham. 2: ";
138 else if( mDoVsStrip ==
'P' )
139 ss <<
"#phi-strips: ";
144 if( mDoVsStrip ==
'R' || mDoVsStrip ==
'r' || mDoVsStrip ==
'P' )
145 ss <<
"vs. Position";
149 ss <<
", Quad " << mQuadName;
151 if( mDoVsStrip ==
'R' || mDoVsStrip ==
'r' )
153 else if( mDoVsStrip ==
'P' )
154 ss <<
"; #phi [rad]";
156 ss <<
"; 128x(APV Num) + Channel Id.";
166 if( mDoVsStrip ==
'r' || mDoVsStrip ==
'R' ){
170 }
else if ( mDoVsStrip ==
'P' ){
176 mHist =
new TH2F( name.data(), title.data(), mXbins/mBinFactorX, mXmin, mXmax, mYbins/mBinFactorY, mYmin, mYmax );
187 stripCollectionPtr = mFgtCollectionPtr->getStripCollection( mDiscId );
190 if( stripCollectionPtr ){
192 const StSPtrVecFgtStrip &stripVec = stripCollectionPtr->getStripVec();
193 StSPtrVecFgtStripConstIterator stripIter;
195 for( stripIter = stripVec.begin(); stripIter != stripVec.end(); ++stripIter ){
196 Int_t geoId = (*stripIter)->getGeoId();
197 Short_t adc = (*stripIter)->getAdc( mTimeBin );
203 Double_t pos, high, low;
206 StFgtGeom::getPhysicalCoordinate( geoId, disc, quad, layer, pos, high, low );
208 if( disc == mDiscId && quad == mQuadId ){
212 if( mDoVsStrip ==
'R' || mDoVsStrip ==
'r' ){
213 pass = ( layer ==
'R' );
214 pass &= ( mDoVsStrip ==
'R' ? (low > 0.785) : (low < 0.785) );
216 }
else if( mDoVsStrip ==
'P' ){
217 pass = ( layer ==
'P' );
222 Int_t rdo, arm, apv, channel;
223 StFgtCosmicTestStandGeom::getNaiveElecCoordFromGeoId(geoId,rdo,arm,apv,channel);
224 bin = 128*(apv%12) + channel;
229 if( mDoSubtrPeds && pass ){
231 Float_t ped = 0, err = 0;
233 mPedReader->getPed( geoId, mTimeBin, ped, err );
235 pass = (adc > mPedThres*err );
239 mHist->Fill( bin, adc );
251 if( !mFileNameBase.empty() ){
254 std::string filename;
256 filename = mPath +
"/";
257 filename += mFileNameBase;
258 if( !mFileNameKey.empty() )
259 filename += std::string(
"." ) + mFileNameKey;
263 gROOT->SetStyle(
"Plain");
264 TCanvas *can =
new TCanvas(
"fgtQAcan",
"fgtQAcan", 900, 400 );
266 gStyle->SetOptStat(0);
267 gStyle->SetPalette(1);
270 can->Print( filename.data() );
virtual const char * GetName() const
special overload