34 #include "StFgtQaClusterChargePerAPV.h"
39 #include "StFgtQaMaker.h"
40 #include "StRoot/StFgtPool/StFgtCosmicTestStandGeom/StFgtCosmicTestStandGeom.h"
42 #include "StRoot/StEvent/StFgtCollection.h"
43 #include "StRoot/StEvent/StFgtHitCollection.h"
44 #include "StRoot/StEvent/StFgtHit.h"
47 StFgtQaClusterChargePerAPV::StFgtQaClusterChargePerAPV(
const Char_t* name,
51 const Char_t* quadName ) :
53 mNbins( 160 ), mChargeMin( -512 ), mChargeMax( 2048 ), mUnits(
"arb. units")
56 for( Int_t i=0; i<10; ++i ){
64 mNbins( 160 ), mChargeMin( -512 ), mChargeMax( 2048 ), mUnits(
"arb. units") {
67 for( Int_t i=0; i<10; ++i ){
71 if( other.mHistR[i] ){
72 std::string name = std::string( other.mHistR[i]->GetName() ) +
"_copy";
73 mHistR[i] =
static_cast< TH1F*
>( other.mHistR[i]->Clone(name.data()) );
77 std::string name = std::string( other.mHistPhi[i]->GetName() ) +
"_copy";
78 mHistPhi[i] =
static_cast< TH1F*
>( other.mHistPhi[i]->Clone( name.data() ) );
84 StFgtQaClusterChargePerAPV::~StFgtQaClusterChargePerAPV(){
85 for( Int_t i=0; i<10; ++i ){
95 StFgtQaMaker::operator=( rhs );
97 for( Int_t i=0; i<10; ++i ){
108 for( Int_t i=0; i<10; ++i ){
113 std::string name = std::string( rhs.mHistR[i]->GetName() ) +
"_copy";
114 mHistR[i] =
static_cast< TH1F*
>( rhs.mHistR[i]->Clone(name.data()) );
118 std::string name = std::string( rhs.mHistPhi[i]->GetName() ) +
"_copy";
119 mHistPhi[i] =
static_cast< TH1F*
>( rhs.mHistPhi[i]->Clone( name.data() ) );
126 Int_t StFgtQaClusterChargePerAPV::Init(){
127 Int_t ierr = StFgtQaMaker::Init();
132 for( Int_t i=0; i<10; ++i ){
143 std::stringstream ss;
144 ss <<
GetName() <<
"_" << mDiscId <<
"_" << mQuadId <<
"_" << i;
148 mHistR[i] =
new TH1F( ( name +
"_histR" ).
data(),
"", mNbins, mChargeMin, mChargeMax );
149 mHistPhi[i] =
new TH1F( ( name +
"_histPhi").
data(),
"", mNbins, mChargeMin, mChargeMax );
151 std::string titleR =
"R-strip Charge per Cluster,";
152 std::string titlePhi =
"#phi-strip Charge per Cluster,";
156 std::stringstream ss;
157 ss <<
"Quad " << mQuadName <<
", APV " << i;
160 middle +=
"; Charge per strip [";
168 titleR +=
"R-strip Id.";
169 titlePhi +=
"#phi-strip Id.";
171 mHistR[i]->SetTitle( titleR.data() );
172 mHistPhi[i]->SetTitle( titlePhi.data() );
184 hitCollectionPtr = mFgtCollectionPtr->getHitCollection( mDiscId );
187 if( hitCollectionPtr ){
188 const StSPtrVecFgtHit &hitVec = hitCollectionPtr->getHitVec();
189 StSPtrVecFgtHitConstIterator hitIter;
190 stripWeightMap_t::iterator stripMapIter;
192 for( hitIter = hitVec.begin(); hitIter != hitVec.end(); ++hitIter ){
193 stripWeightMap_t& stripWeightMap = (*hitIter)->getStripWeightMap();
195 Float_t maxCharge = -99999;
200 for( stripMapIter = stripWeightMap.begin(); stripMapIter != stripWeightMap.end(); ++stripMapIter ){
201 const StFgtStrip *stripPtr = stripMapIter->first;
202 Float_t w = stripMapIter->second;
204 Float_t stripCharge = 0;
206 stripCharge = w*stripPtr->getCharge();
208 if( stripCharge > maxCharge ){
209 geoId4Max = stripPtr->getGeoId();
210 maxCharge = stripCharge;
214 if( maxCharge > -99999 ){
216 Int_t rdo, arm, apv, channel;
217 Short_t disc, quad, strip;
220 StFgtCosmicTestStandGeom::decodeGeoId( geoId4Max, disc, quad, layer, strip );
221 if( quad == mQuadId && disc == mDiscId ){
222 StFgtCosmicTestStandGeom::getNaiveElecCoordFromGeoId( geoId4Max, rdo, arm, apv, channel);
225 if( apv > -1 && apv < 10 )
226 ( layer ==
'R' ? mHistR[apv] : mHistPhi[apv] )->Fill( maxCharge );
virtual const char * GetName() const
special overload