55 #include "StFgtCosmicTrackQA.h"
66 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
67 #include "StRoot/StFgtPool/StFgtCosmicTestStandGeom/StFgtCosmicTestStandGeom.h"
70 #include "StRoot/StEvent/StFgtCollection.h"
71 #include "StRoot/StEvent/StFgtHit.h"
72 #include "StRoot/StEvent/StFgtPoint.h"
75 StFgtCosmicTrackQA::StFgtCosmicTrackQA(
const Char_t* name,
78 const Char_t* quadName ) :
80 mPath(
""), mFileNameBase(
""), mFileNameKey( quadName ){
83 gROOT->SetStyle(
"Plain");
96 std::cerr <<
"TODO" << endl;
101 StFgtCosmicTrackQA::~StFgtCosmicTrackQA(){
122 std::cerr <<
"TODO" << endl;
127 Int_t StFgtCosmicTrackQA::Init(){
128 Int_t ierr = StFgtQaMaker::Init();
150 std::string name, nameforhist, title;
152 std::stringstream ss;
153 ss <<
GetName() <<
"_" << mDiscId <<
"_" << mQuadId;
168 string channelId[10]={
"0-127",
"128-255",
"256-383",
"384-511",
"512-639",
"640-767",
"768-895",
"896-1023",
"1024-1151",
"1152-1279"};
171 for(
int i=0;i<10;i++) {
172 std::stringstream sx, sy, ss, sn, snx, sny;
173 ss <<
" Quad " << mQuadName <<
", APV " << i
174 <<
", Channels " << channelId[i] <<
"; adc-ped";
181 mHistAPV[i] =
new TH1F( nameforhist.data(), title.data(), mXbins/mBinFactorX, mXmin, mXmax );
186 std::string name1DR, name1DP, title1DR, title1DP;
188 std::stringstream ss, sr, sp;
189 ss <<
GetName() <<
"_" << mDiscId <<
"_" << mQuadId;
190 sr << ss.str() <<
"_Rtest";
191 sp << ss.str() <<
"_Ptest";
201 std::stringstream ss, sr ,sp;
202 ss <<
" Quad " << mQuadName <<
" hits";
203 sr << ss.str() <<
" in R; strip";
204 sp << ss.str() <<
" in Phi; strip";
209 testHist[0] =
new TH1F( name1DR.data(), title1DR.data(), mXbins/mBinFactorX, 0,720 );
210 testHist[1] =
new TH1F( name1DP.data(), title1DP.data(), mXbins/mBinFactorX, 0,720 );
215 std::string name1D, name1DR, name1DP, title1D, title1DR, title1DP;
217 std::stringstream ss, sr, sp;
218 ss <<
GetName() <<
"_" << mDiscId <<
"_" << mQuadId;
219 sr << ss.str() <<
"_R";
220 sp << ss.str() <<
"_P";
240 std::stringstream ss, sr ,sp;
241 ss <<
" Quad " << mQuadName <<
" clusters";
242 sr << ss.str() <<
" in R; adc sum";
243 sp << ss.str() <<
" in Phi; adc sum";
244 ss <<
" in R & Phi; adc sum";
250 mHist1Dclusters =
new TH1F( name1D.data(), title1D.data(), mXbins/mBinFactorX, mXmin, mXmax );
251 mHist1Dcluster[0] =
new TH1F( name1DR.data(), title1DR.data(), mXbins/mBinFactorX, mXmin, mXmax );
252 mHist1Dcluster[1] =
new TH1F( name1DP.data(), title1DP.data(), mXbins/mBinFactorX, mXmin, mXmax );
256 std::string name2D, title2D;
258 std::stringstream ss;
259 ss <<
GetName() <<
"_" << mDiscId <<
"_" << mQuadId;
268 std::stringstream sstream;
269 sstream <<
" Quad " << mQuadName <<
" cluster points; cm; cm";
270 title2D = sstream.str();
273 mHist2Dpoint =
new TH2F( name2D.data(), title2D.data(), mXbins/mBinFactorX, mXmin, mXmax, mXbins/mBinFactorX, mXmin, mXmax );
285 stripCollectionPtr = mFgtCollectionPtr->getStripCollection( mDiscId );
288 if( stripCollectionPtr ){
290 const StSPtrVecFgtStrip &stripVec = stripCollectionPtr->getStripVec();
291 StSPtrVecFgtStripConstIterator stripIter;
293 for( stripIter = stripVec.begin(); stripIter != stripVec.end(); ++stripIter ){
295 Int_t geoId = (*stripIter)->getGeoId();
296 Short_t adc = (*stripIter)->getAdc( mTimeBin );
302 Double_t pos, high, low;
305 StFgtGeom::getPhysicalCoordinate( geoId, disc, quad, layer, pos, high, low );
306 if( disc == mDiscId && quad == mQuadId ){
307 Int_t rdo, arm, apv, channel;
308 StFgtCosmicTestStandGeom::getNaiveElecCoordFromGeoId(geoId,rdo,arm,apv,channel);
311 if(disc==2) apv -= 12;
312 mHistAPV[apv]->Fill ( adc );
317 StFgtGeom::decodeGeoId(geoId,disc,quad,layer,stripId);
318 if(layer==
'R') testHist[0]->Fill( stripId );
319 else testHist[1]->Fill( stripId );
326 hitCollectionPtr = mFgtCollectionPtr->getHitCollection( mDiscId );
329 if( hitCollectionPtr ){
330 const StSPtrVecFgtHit &hitVec = hitCollectionPtr->getHitVec();
331 StSPtrVecFgtHitConstIterator hitIter;
335 for( hitIter = hitVec.begin(); hitIter != hitVec.end(); ++hitIter ){
338 haveR=((*hitIter)->getLayer()==
'R');
351 if( haveR ) mHist1Dcluster[0]->Fill( (*hitIter)->charge() );
352 else mHist1Dcluster[1]->Fill( (*hitIter)->charge() );
353 adcSum += (*hitIter)->charge();
356 if(adcSum!=0) mHist1Dclusters->Fill( adcSum );
361 pointCollectionPtr = mFgtCollectionPtr->getPointCollection();
364 if( pointCollectionPtr ){
365 const StSPtrVecFgtPoint &pointVec = pointCollectionPtr->getPointVec();
366 StSPtrVecFgtPointConstIterator pointIter;
369 for( pointIter = pointVec.begin(); pointIter != pointVec.end(); ++pointIter ){
370 if( (*pointIter)->getDisc() == mDiscId ){
371 Float_t R = (*pointIter)->getPositionR();
372 Float_t Phi = (*pointIter)->getPositionPhi();
374 mHist2Dpoint->Fill( R*cos(Phi+.2618) , R*sin(Phi+.2618) );
450 if( !mFileNameBase.empty() ){
453 std::string filename;
455 filename = mPath +
"/";
456 filename += mFileNameBase;
457 if( !mFileNameKey.empty() )
458 filename += std::string(
"." ) + mFileNameKey;
462 gROOT->SetStyle(
"Plain");
463 TCanvas *canAPV =
new TCanvas(
"fgtTrackQAcanAPV",
"fgtTrackQAcanAPV", 900, 400 );
464 gStyle->SetOptStat(0);
465 gStyle->SetOptDate(0);
468 for( Int_t i=0;i<10;i++) {
474 TCanvas *can2Dpoint =
new TCanvas(
"fgtTrackQAcan2Dpoint",
"fgtTrackQAcan2Dpoint", 900, 400 );
475 gStyle->SetOptStat(0);
476 gStyle->SetOptDate(0);
477 mHist2Dpoint->Draw();
480 TCanvas *can1Dcluster =
new TCanvas(
"fgtTrackQAcan1Dcluster",
"fgtTrackQAcan1Dcluster", 900, 400 );
481 gStyle->SetOptStat(100000);
482 gStyle->SetOptDate(0);
483 can1Dcluster->Divide(2,1);
485 mHist1Dcluster[0]->Draw();
487 mHist1Dcluster[1]->Draw();
489 TCanvas *can1Dclusters =
new TCanvas(
"fgtTrackQAcan1Dclusters",
"fgtTrackQAcan1Dclusters", 900, 400 );
490 gStyle->SetOptStat(100000);
491 gStyle->SetOptDate(0);
492 mHist1Dclusters->Draw();
494 canAPV->Print( filename.data() );
495 can2Dpoint->Print( filename.data() );
496 can1Dcluster->Print( filename.data() );
497 can1Dclusters->Print( filename.data() );
501 delete can1Dclusters;
virtual const char * GetName() const
special overload
void Clear(Option_t *opt="")
User defined functions.