00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00028
00029
00030
00031
00032 #include "StDAQMaker/StDAQReader.h"
00033 #include "StDaqLib/TPC/trans_table.hh"
00034
00035 #include "Stiostream.h"
00036 #include <Stsstream.h>
00037 #include <math.h>
00038
00039 #include "TH1.h"
00040 #include "TH2.h"
00041
00042 #include "StTpcCalibSector.h"
00043 #include "StTpcCalibSetup.h"
00044
00045 ClassImp(StTpcCalibSector)
00046
00047
00048
00049 StTpcCalibSector::StTpcCalibSector(const StTpcCalibSetup* aSetup,
00050 const int aSectorId,
00051 const int* aNumberOfPadAtRow)
00052 :
00053 mSectorId(aSectorId),
00054 mSetup(aSetup),
00055 mNumberOfPadAtRow(aNumberOfPadAtRow)
00056 {
00057
00058
00059 int tMaxNumberOfPad=182;
00060
00061 int tNumberOfRow=45;
00062
00063 int tNumberOfInnerRow=13;
00064
00065 int tFirstOuterRow=14;
00066
00067 int tLastOuterRow=45;
00068 int tNumberOfOuterRow=tLastOuterRow-tFirstOuterRow+1;
00069
00070 int tMaxNumberOfOuterPad=144;
00071
00072 mNEvt=0;
00073
00074
00075 {
00076 ostrstream tHName,tHTitle;
00077 tHName << "HCor" << mSectorId << ends;
00078 tHTitle <<"Number of corrupted pad, sector " << mSectorId << ends;
00079
00080 mHCorrupted= new TH1F(tHName.str(),tHTitle.str(),513,0.,512.);
00081 }
00082 {
00083 ostrstream tHName,tHTitle;
00084 tHName << "HRMS" << mSectorId << ends;
00085 tHTitle <<"Mean RMS, sector " << mSectorId << ends;
00086
00087 mHMeanRMS= new TH1F(tHName.str(),tHTitle.str(),65,0.,16.);
00088 }
00089 {
00090 ostrstream tHName,tHTitle;
00091 tHName << "HCorMap" << mSectorId << ends;
00092 tHTitle <<"Corrupted pad, sector " << mSectorId << ends;
00093
00094 mHCorruptedMap= new TH2F(tHName.str(),tHTitle.str(),
00095 tMaxNumberOfPad, 0.5, tMaxNumberOfPad+0.5,
00096 tNumberOfRow, 0.5, tNumberOfRow+0.5);
00097 }
00098 {
00099 ostrstream tHName,tHTitle;
00100 tHName << "HBadMap" << mSectorId << ends;
00101 tHTitle <<"Bad pad map, sector " << mSectorId << ends;
00102
00103 mHBadMap = new TH2S(tHName.str(),tHTitle.str(),
00104 tMaxNumberOfPad, 0.5, tMaxNumberOfPad+0.5,
00105 tNumberOfRow, 0.5, tNumberOfRow+0.5);
00106 }
00107 {
00108 ostrstream tHName,tHTitle;
00109 tHName << "HBadFEE" << mSectorId << ends;
00110 tHTitle << "Number of bad pads per FEE, sector " << mSectorId << ends;
00111
00112 mHBadFEE = new TH1S(tHName.str(),tHTitle.str(),182,0.5,182.5);
00113 }
00114 {
00115 ostrstream tHName,tHTitle;
00116 tHName << "HBadRDO" << mSectorId << ends;
00117 tHTitle <<"Number of bad pads per RDO, sector " << mSectorId << ends;
00118
00119 mHBadRDO = new TH1S(tHName.str(),tHTitle.str(),6,0.5,6.5);
00120 }
00121 {
00122
00123 ostrstream tHName,tHTitle;
00124 tHName << "HAmp" << mSectorId << ends;
00125 tHTitle <<"Cluster amplitude, sector " << mSectorId << ends;
00126
00127 mHAmp = new TH1F(tHName.str(),tHTitle.str(),201,0.,2000.);
00128
00129 }
00130 {
00131 ostrstream tHName,tHTitle;
00132 tHName << "HNSeq" << mSectorId << ends;
00133 tHTitle <<"Number sequence per pads, sector " << mSectorId << ends;
00134
00135 mHNSequence = new TH1F(tHName.str(),tHTitle.str(),101,0.,100.);
00136 }
00137 {
00138 ostrstream tHName,tHTitle;
00139 tHName << "HNSeqMap" << mSectorId << ends;
00140 tHTitle <<"Number sequence per pads, sector " << mSectorId << ends;
00141
00142 mHNSequenceMap = new TH2F(tHName.str(),tHTitle.str(),
00143 tMaxNumberOfPad, 0.5, tMaxNumberOfPad+0.5,
00144 tNumberOfRow, 0.5, tNumberOfRow+0.5);
00145 }
00146 {
00147 ostrstream tHName,tHTitle;
00148 tHName << "HT0" << mSectorId << ends;
00149 tHTitle << "t0 distribution, sector " << mSectorId << ends;
00150
00151 mHT0 = new TH1F(tHName.str() ,tHTitle.str() ,100,
00152 mSetup->getExpectedPulsePos()-mSetup->getMinDistToPulse(),
00153 mSetup->getExpectedPulsePos()+mSetup->getMinDistToPulse());
00154
00155 }
00156 {
00157 ostrstream tHName,tHTitle;
00158 tHName << "HAmpMap" << mSectorId << ends;
00159 tHTitle << "Cluster amplitude, sector " << mSectorId << ends;
00160
00161 mHAmpMap = new TH2F(tHName.str() ,tHTitle.str() ,
00162 tMaxNumberOfPad, 0.5, tMaxNumberOfPad+0.5,
00163 tNumberOfRow, 0.5, tNumberOfRow+0.5);
00164 }
00165
00166 {
00167 ostrstream tHName,tHTitle;
00168 tHName << "HT0Map" << mSectorId << ends;
00169 tHTitle << "Cluster t0, sector " << mSectorId << ends;
00170
00171 mHT0Map = new TH2F(tHName.str() ,tHTitle.str() ,
00172 tMaxNumberOfPad, 0.5, tMaxNumberOfPad+0.5,
00173 tNumberOfRow, 0.5, tNumberOfRow+0.5);
00174
00175 }
00176 {
00177 ostrstream tHName,tHTitle;
00178 tHName << "HFoundMap" << mSectorId << ends;
00179 tHTitle << "N Cluster found, sector " << mSectorId << ends;
00180
00181 mHFoundMap = new TH2F(tHName.str() ,tHTitle.str() ,
00182 tMaxNumberOfPad, 0.5, tMaxNumberOfPad+0.5,
00183 tNumberOfRow, 0.5, tNumberOfRow+0.5);
00184
00185 }
00186 {
00187 ostrstream tHName,tHTitle;
00188 tHName << "HDeadMap" << mSectorId << ends;
00189 tHTitle << "Dead pads, sector " << mSectorId << ends;
00190
00191 mHDeadMap = new TH2F(tHName.str() ,tHTitle.str() ,
00192 tMaxNumberOfPad, 0.5, tMaxNumberOfPad+0.5,
00193 tNumberOfRow, 0.5, tNumberOfRow+0.5);
00194
00195 }
00196 {
00197 ostrstream tHName,tHTitle;
00198 tHName << "HDeadFEE" << mSectorId << ends;
00199 tHTitle << "Number of dead pads per FEE, sector " << mSectorId << ends;
00200
00201 mHDeadFEE = new TH1S(tHName.str() ,tHTitle.str() ,182,0.5,182.5);
00202
00203 }
00204 {
00205 ostrstream tHName,tHTitle;
00206 tHName << "HDeadRDO" << mSectorId << ends;
00207 tHTitle << "Number of dead pads per RDO, sector " << mSectorId << ends;
00208
00209 mHDeadRDO = new TH1S(tHName.str() ,tHTitle.str() ,6,0.5,6.5);
00210
00211 }
00212 {
00213 ostrstream tHName,tHTitle;
00214
00215 tHName << "HICal" << mSectorId << ends;
00216 tHTitle << "Calibration coeficient, inner sector " << mSectorId << ends;
00217
00218 mHInnerCalibMap = new TH2F(tHName.str() ,tHTitle.str() ,
00219 tMaxNumberOfPad, 0.5, tMaxNumberOfPad+0.5,
00220 tNumberOfInnerRow, 0.5, tNumberOfInnerRow+0.5);
00221
00222 }
00223 {
00224 ostrstream tHName,tHTitle;
00225 tHName << "HOCal" << mSectorId << ends;
00226 tHTitle << "Calibration coeficient, outer sector " << mSectorId << ends;
00227
00228 mHOuterCalibMap = new TH2F(tHName.str() ,tHTitle.str() ,
00229 tMaxNumberOfOuterPad, 0.5, tMaxNumberOfOuterPad+0.5,
00230 tNumberOfOuterRow, tFirstOuterRow-0.5,
00231 tLastOuterRow+0.5);
00232 }
00233
00234 }
00235
00236
00237 StTpcCalibSector::~StTpcCalibSector(){
00238 delete mHCorrupted;
00239 delete mHCorruptedMap;
00240 delete mHMeanRMS;
00241 delete mHBadMap;
00242 delete mHNSequence;
00243 delete mHAmp;
00244 delete mHAmpMap;
00245 delete mHT0;
00246 delete mHT0Map;
00247 delete mHFoundMap;
00248 delete mHDeadMap;
00249 delete mHInnerCalibMap;
00250 delete mHOuterCalibMap;
00251 }
00252
00253
00254
00255
00256
00257 void StTpcCalibSector::updateBad(StTPCReader* aRMSReader){
00258 cout << "StTpcCalibSector::updateBad " << mSectorId << endl;
00259
00260 int tNumberOfRows=45;
00261 int tOk,tNTB;
00262 unsigned char* tRMSArray;
00263 for(int tiRow=1;
00264 tiRow<=tNumberOfRows;
00265 tiRow++){
00266 for(int tiPad=1;
00267 tiPad<=mNumberOfPadAtRow[tiRow-1];
00268 tiPad++){
00269 tOk = aRMSReader->getRMSPedestals(mSectorId, tiRow, tiPad,
00270 tNTB, tRMSArray);
00271
00272 float tMeanRMS=0.;
00273 int tNCorrupted=0;
00274 int tN=0;
00275 if(tOk && tNTB==512){
00276 for(int tiTB=mSetup->getFirstTB();tiTB<=mSetup->getLastTB();tiTB++){
00277 if(((int)tRMSArray[tiTB])==255){
00278 tNCorrupted++;
00279 }
00280 tMeanRMS+=((int)tRMSArray[tiTB])/16.;
00281 tN++;
00282 }
00283 }
00284 tMeanRMS/=tN;
00285 mHCorrupted->Fill(tNCorrupted);
00286 mHMeanRMS->Fill(tMeanRMS);
00287 mHCorruptedMap->Fill(tiPad,tiRow,tNCorrupted);
00288 if(tNCorrupted>mSetup->getMaxNumberOfCorruptedTB() || tMeanRMS==0.){
00289 mHBadMap->Fill(tiPad,tiRow,1.);
00290 }
00291 }
00292 }
00293 }
00294
00295
00296 void StTpcCalibSector::updateDead(StTPCReader* aZSupReader){
00297 updateGain(aZSupReader);
00298 }
00299
00300
00301 void StTpcCalibSector::updateGain(StTPCReader* aZSupReader){
00302
00303 mNEvt++;
00304 int tNumberOfRows=45;
00305
00306 float tDistToPulseTBPos;
00307 int tFound;
00308 double tPeakPos=-9999,tPeakAmp=-9999;
00309 TPCSequence* tSeq;
00310 unsigned char* tPadList;
00311 int tADC;
00312
00313 for(int tRowId=1;tRowId<=tNumberOfRows;tRowId++){
00314 int tNPad = aZSupReader->getPadList(mSectorId,tRowId, tPadList);
00315
00316
00317 int tNSeq;
00318 int tOk;
00319 for(int tPadId=0;tPadId<tNPad;tPadId++){
00320 tDistToPulseTBPos=(float)mSetup->getMinDistToPulse();
00321 tFound=0;
00322 int tThisPad=tPadList[tPadId];
00323 tOk = aZSupReader->getSequences(mSectorId,tRowId, tThisPad
00324 , tNSeq, tSeq);
00325
00326 if (tOk==0 && tNSeq>0) {
00327 for(int tISeq=0;tISeq<tNSeq;tISeq++){
00328 int tClAmp=0;
00329 double tClPos=0;
00330 for(int tSeqL=0;tSeqL<tSeq[tISeq].Length;tSeqL++){
00331 tADC=tSeq[tISeq].FirstAdc[tSeqL];
00332 tADC=log8to10_table[tADC];
00333 tClAmp+=tADC;
00334 tClPos+=tADC*(tSeq[tISeq].startTimeBin+tSeqL);
00335 }
00336 tClPos/=tClAmp;
00337 float tCurDistToPulseTBPos=fabs(tClPos-
00338 mSetup->getExpectedPulsePos());
00339 if(tCurDistToPulseTBPos<tDistToPulseTBPos){
00340 tFound=1;
00341 tPeakPos=tClPos;
00342 tPeakAmp=tClAmp;
00343 tDistToPulseTBPos=tCurDistToPulseTBPos;
00344 }
00345 }
00346 }
00347 mHNSequence->Fill(tNSeq);
00348 mHNSequenceMap->Fill(tThisPad,tRowId,tNSeq);
00349 if(tFound){
00350 mHAmp->Fill(tPeakAmp);
00351 mHT0->Fill(tPeakPos);
00352 mHAmpMap->Fill(tThisPad,tRowId,tPeakAmp);
00353 mHT0Map->Fill(tThisPad,tRowId,tPeakPos);
00354 mHFoundMap->Fill(tThisPad,tRowId,1.);
00355 }
00356 }
00357 }
00358 }
00359
00360
00361
00362
00363
00364 void StTpcCalibSector::findBad(){
00365
00366 }
00367
00368
00369 void StTpcCalibSector::findBadElectronics(int** aPadToFeeConvertor,
00370 int** aPadToRDOConvertor){
00371 for(int tiRow=1;tiRow<=mHBadMap->GetNbinsY();tiRow++){
00372 for(int tiPad=1; tiPad<=mHBadMap->GetNbinsX();tiPad++){
00373 if(mHBadMap->GetCellContent(tiPad,tiRow)==1) {
00374
00375
00376
00377 mHBadFEE->Fill(aPadToFeeConvertor[tiRow-1][tiPad-1],1.);
00378 mHBadRDO->Fill(aPadToRDOConvertor[tiRow-1][tiPad-1],1.);
00379 }
00380 }
00381 }
00382 }
00383
00384
00385 void StTpcCalibSector::findDead(){
00386
00387 int tNumberOfRows=45;
00388
00389 for(int tiRow=1;
00390 tiRow<=tNumberOfRows;
00391 tiRow++){
00392 for(int tiPad=1;
00393 tiPad<=mNumberOfPadAtRow[tiRow-1];
00394 tiPad++){
00395 if(mHBadMap->GetCellContent(tiPad,tiRow)!=1 &&
00396 (mHFoundMap->GetCellContent(tiPad,tiRow)/mNEvt)<0.95){
00397 mHDeadMap->Fill(tiPad,tiRow,1.);
00398 }
00399 }
00400 }
00401 }
00402
00403
00404 void StTpcCalibSector::findDeadElectronics(int** aPadToFeeConvertor,
00405 int** aPadToRDOConvertor){
00406 for(int tiRow=1;tiRow<=mHDeadMap->GetNbinsY();tiRow++){
00407 for(int tiPad=1; tiPad<=mHDeadMap->GetNbinsX();tiPad++){
00408 if(mHDeadMap->GetCellContent(tiPad,tiRow)==1) {
00409 mHDeadFEE->Fill(aPadToFeeConvertor[tiRow-1][tiPad-1],1.);
00410 mHDeadRDO->Fill(aPadToRDOConvertor[tiRow-1][tiPad-1],1.);
00411 }
00412 }
00413 }
00414 }
00415
00416
00417 void StTpcCalibSector::calcGainCoeficient(){
00418 const int tPadExcluded=mSetup->getNSidePadsExcluded();
00419
00420 int tFirstOuterPadRow=14;
00421
00422 int tNumberOfRows=45;
00423
00424 double tGood=0.; double tAll=0.;
00425 int tiRow,tiPad;
00426 double tMeanSectorAmp;
00427 int tNCount;
00428
00429 mHAmpMap->Divide(mHFoundMap);
00430 mHT0Map->Divide(mHFoundMap);
00431
00432
00433
00434 tMeanSectorAmp=0.;
00435 tNCount=0;
00436 for(tiRow=1;
00437 tiRow<tFirstOuterPadRow;
00438 tiRow++){
00439 for(tiPad=tPadExcluded;
00440 tiPad<=(mNumberOfPadAtRow[tiRow-1]
00441 -tPadExcluded);
00442 tiPad++){
00443 if(mHBadMap->GetCellContent(tiPad,tiRow)==0 &&
00444 mHDeadMap->GetCellContent(tiPad,tiRow)==0) {
00445 tMeanSectorAmp+=mHAmpMap->GetCellContent(tiPad,tiRow);
00446 tNCount++;
00447 }
00448 }
00449 }
00450 tMeanSectorAmp/=tNCount;
00451
00452 for(tiRow=1;
00453 tiRow<tFirstOuterPadRow;
00454 tiRow++){
00455 for(tiPad=1;
00456 tiPad<=mNumberOfPadAtRow[tiRow-1];
00457 tiPad++){
00458 double tCalibCoef=0.;
00459 if(mHBadMap->GetCellContent(tiPad,tiRow)==0) {
00460 if(mHDeadMap->GetCellContent(tiPad,tiRow)==1 ||
00461 tMeanSectorAmp==0. || tiPad<tPadExcluded ||
00462 tiPad>(mNumberOfPadAtRow[tiRow-1]
00463 -tPadExcluded)){
00464 tCalibCoef=1.;
00465 }
00466 else{
00467 tCalibCoef=tMeanSectorAmp/mHAmpMap->GetCellContent(tiPad,tiRow);
00468 }
00469 }
00470 tAll++;
00471 tGood+=tCalibCoef;
00472 mHInnerCalibMap->Fill(tiPad,tiRow,tCalibCoef);
00473 }
00474 }
00475
00476
00477
00478 tMeanSectorAmp=0.;
00479 tNCount=0;
00480 for(tiRow=tFirstOuterPadRow;tiRow<=tNumberOfRows;tiRow++){
00481 for(tiPad=tPadExcluded;
00482 tiPad<=(mNumberOfPadAtRow[tiRow-1]
00483 -tPadExcluded);
00484 tiPad++){
00485 if(mHBadMap->GetCellContent(tiPad,tiRow)==0 &&
00486 mHDeadMap->GetCellContent(tiPad,tiRow)==0) {
00487 tMeanSectorAmp+=mHAmpMap->GetCellContent(tiPad,tiRow);
00488 tNCount++;
00489 }
00490 }
00491 }
00492 tMeanSectorAmp/=tNCount;
00493
00494 for(tiRow=tFirstOuterPadRow;tiRow<=tNumberOfRows;tiRow++){
00495 for(tiPad=1;
00496 tiPad<=mNumberOfPadAtRow[tiRow-1];
00497 tiPad++){
00498 double tCalibCoef=0.;
00499 if(mHBadMap->GetCellContent(tiPad,tiRow)==0) {
00500 if(mHDeadMap->GetCellContent(tiPad,tiRow)==1 ||
00501 tMeanSectorAmp==0. ||
00502 tiPad<tPadExcluded ||
00503 tiPad>(mNumberOfPadAtRow[tiRow-1]
00504 -tPadExcluded)){
00505 tCalibCoef=1.;
00506 }
00507 else{
00508 tCalibCoef=tMeanSectorAmp/mHAmpMap->GetCellContent(tiPad,tiRow);
00509 }
00510 }
00511 tAll++;
00512 tGood+=tCalibCoef;
00513 mHOuterCalibMap->Fill(tiPad,tiRow,tCalibCoef);
00514 }
00515 }
00516
00517 }
00518
00519
00520
00521
00522
00523 void StTpcCalibSector::writeBadTable(ofstream* aOutFile){
00524 int tNBadRows=0;
00525 for(int tiRow=1;tiRow<=mHBadMap->GetNbinsY();tiRow++){
00526 if(mHBadMap->Integral(1,mHBadMap->GetNbinsX(),tiRow,tiRow)!=0) {
00527 tNBadRows++;
00528 }
00529 }
00530 (*aOutFile) << "Sector " << mSectorId << " " << tNBadRows << endl;
00531 if(tNBadRows!=0){
00532 int tNBadPads;
00533 for(int tiRow=1;tiRow<=mHBadMap->GetNbinsY();tiRow++){
00534 tNBadPads=(int)mHBadMap->Integral(1,mHBadMap->GetNbinsX(),tiRow,tiRow);
00535 if(tNBadPads!=0) {
00536 (*aOutFile) << "Row " << tiRow << " "
00537 <<tNBadPads << endl;
00538 for(int tiPad=1; tiPad<=mHBadMap->GetNbinsX();tiPad++){
00539 if(mHBadMap->GetCellContent(tiPad,tiRow)==1) {
00540 (*aOutFile) << tiPad << " ";
00541 }
00542 }
00543 (*aOutFile) << endl;
00544 }
00545 }
00546 }
00547 }
00548
00549
00550
00551
00552 void StTpcCalibSector::readBadTable(ifstream* aInFile){
00553
00554 int tSectId, tNBadRows;
00555 char tCharBuff[10];
00556 int tRowId, tNBadPads;
00557 int tPadId;
00558 (*aInFile) >> tCharBuff >> tSectId >> tNBadRows;
00559 while(tSectId!=mSectorId && !aInFile->eof()){
00560 for(int tiRow=0;tiRow<tNBadRows;tiRow++){
00561 (*aInFile) >> tCharBuff >> tRowId >> tNBadPads;
00562 for(int tiPad=0; tiPad<tNBadPads; tiPad++){
00563 (*aInFile) >> tPadId;
00564 }
00565 }
00566 (*aInFile) >> tCharBuff >> tSectId >> tNBadRows;
00567 }
00568 if(tSectId==mSectorId){
00569 cout << "Found bad data, sector " << mSectorId << endl;
00570 for(int tiRow=0;tiRow<tNBadRows;tiRow++){
00571 (*aInFile) >> tCharBuff >> tRowId >> tNBadPads;
00572 for(int tiPad=0; tiPad<tNBadPads; tiPad++){
00573 (*aInFile) >> tPadId;
00574 mHBadMap->Fill(tPadId,tRowId,1.);
00575 }
00576 }
00577 }
00578 else{
00579 cout << "Error, bad data not found, sector " << mSectorId << endl;
00580 }
00581 }
00582
00583
00584 void StTpcCalibSector::writeDeadTable(ofstream* aOutFile){
00585 int tNDeadRows=0;
00586 for(int tiRow=1;tiRow<=mHDeadMap->GetNbinsY();tiRow++){
00587 if(mHDeadMap->Integral(1,mHDeadMap->GetNbinsX(),tiRow,tiRow)!=0) {
00588 tNDeadRows++;
00589 }
00590 }
00591 (*aOutFile) << "Sector " << mSectorId << " " << tNDeadRows << endl;
00592 if(tNDeadRows!=0){
00593 int tNDeadPads;
00594 for(int tiRow=1;tiRow<=mHDeadMap->GetNbinsY();tiRow++){
00595 tNDeadPads=(int)mHDeadMap->Integral(1,mHDeadMap->GetNbinsX(),tiRow,tiRow);
00596 if(tNDeadPads!=0) {
00597 (*aOutFile) << "Row " << tiRow << " "
00598 <<tNDeadPads << endl;
00599 for(int tiPad=1; tiPad<=mHDeadMap->GetNbinsX();tiPad++){
00600 if(mHDeadMap->GetCellContent(tiPad,tiRow)==1) {
00601 (*aOutFile) << tiPad << " ";
00602 }
00603 }
00604 (*aOutFile) << endl;
00605 }
00606 }
00607 }
00608 }
00609
00610
00611 void StTpcCalibSector::readDeadTable(ifstream* aInFile){
00612 int tSectId, tNDeadRows;
00613 char tCharBuff[10];
00614 int tRowId, tNDeadPads;
00615 int tPadId;
00616 (*aInFile) >> tCharBuff >> tSectId >> tNDeadRows;
00617 while(tSectId!=mSectorId && !aInFile->eof()){
00618 for(int tiRow=0; tiRow<tNDeadRows; tiRow++){
00619 (*aInFile) >> tCharBuff >> tRowId >> tNDeadPads;
00620 for(int tiPad=0; tiPad<tNDeadPads; tiPad++){
00621 (*aInFile) >> tPadId;
00622 }
00623 }
00624 (*aInFile) >> tCharBuff >> tSectId >> tNDeadRows;
00625 }
00626 if(tSectId==mSectorId){
00627 cout << "Found dead data, sector " << mSectorId << endl;
00628 for(int tiRow=0;tiRow<tNDeadRows;tiRow++){
00629 (*aInFile) >> tCharBuff >> tRowId >> tNDeadPads;
00630 for(int tiPad=0; tiPad<tNDeadPads; tiPad++){
00631 (*aInFile) >> tPadId;
00632 mHDeadMap->Fill(tPadId,tRowId,1.);
00633 }
00634 }
00635 }
00636 else{
00637 cout << "Error, dead data not found, sector " << mSectorId << endl;
00638 }
00639
00640 }
00641
00642
00643 void StTpcCalibSector::writeCalibCoefTable(ofstream* aOutFile){
00644 (*aOutFile) << "Sector " << mSectorId << endl;
00645
00646 int tNInnerSectorRow=13;
00647 int tFirstOuterSectorRow=14;
00648 int tLastOuterSectorRow=45;
00649 int tiRow;
00650 for(tiRow=1;tiRow<=tNInnerSectorRow;tiRow++){
00651 (*aOutFile) << "Row " << tiRow << " "
00652 << mNumberOfPadAtRow[tiRow-1] <<endl;
00653 for(int tiPad=1; tiPad<=mNumberOfPadAtRow[tiRow-1];tiPad++){
00654 (*aOutFile) << mHInnerCalibMap->GetCellContent(tiPad,tiRow) << " ";
00655 }
00656 (*aOutFile) << endl;
00657 }
00658
00659 for(tiRow=tFirstOuterSectorRow;
00660 tiRow<=tLastOuterSectorRow;tiRow++){
00661 (*aOutFile) << "Row " << tiRow << " "
00662 << mNumberOfPadAtRow[tiRow-1] <<endl;
00663 for(int tiPad=1; tiPad<=mNumberOfPadAtRow[tiRow-1];tiPad++){
00664 (*aOutFile) << mHOuterCalibMap->GetCellContent(tiPad,tiRow-tNInnerSectorRow) << " ";
00665 }
00666 (*aOutFile) << endl;
00667 }
00668
00669 }
00670
00671
00672 void StTpcCalibSector::writeBadHisto(){
00673 mHCorrupted->Write();
00674 mHMeanRMS->Write();
00675 mHCorruptedMap->Write();
00676 mHBadMap->Write();
00677 mHBadFEE->Write();
00678 mHBadRDO->Write();
00679 }
00680
00681
00682 void StTpcCalibSector::writeDeadHisto(){
00683 mHFoundMap->Write();
00684 mHNSequence->Write();
00685 mHDeadMap->Write();
00686 mHDeadFEE->Write();
00687 mHDeadRDO->Write();
00688 }
00689
00690
00691 void StTpcCalibSector::writeGainHisto(){
00692 mHAmp->Write();
00693 mHT0->Write();
00694 mHAmpMap->Write();
00695 mHT0Map->Write();
00696 mHInnerCalibMap->Write();
00697 mHOuterCalibMap->Write();
00698 }
00699
00700
00701 void StTpcCalibSector::writeAllHisto(){
00702 writeBadHisto();
00703 writeDeadHisto();
00704 writeGainHisto();
00705 }
00706
00707