00001
00002 class StEmcDetector;
00003 class StChain;
00004 class StEmcRawData;
00005 class EEfeeDataBlock;
00006 class Collection;
00007 StChain *chain=0;
00008
00009 void rdSt2print(Int_t nevents=100){
00010
00011 char * fname="/star/data09/reco/ppProductionTrans/FullField/dev/2006/129/7129060/st_physics_7129060_raw_1030002.event.root";
00012
00013 gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
00014 loadSharedLibraries();
00015 cout << " loading done " << endl;
00016
00017
00018
00019
00020 chain = new StChain("bfc");
00021
00022
00023
00024
00025
00026 StIOMaker* ioMaker = new StIOMaker();
00027
00028 ioMaker->SetFile(fname);
00029
00030 ioMaker->SetIOMode("r");
00031 ioMaker->SetBranch("*",0,"0");
00032 ioMaker->SetBranch("geantBranch",0,"r");
00033 ioMaker->SetBranch("eventBranch",0,"r");
00034 ioMaker->SetIOMode("r");
00035
00036
00037
00038
00039
00040
00041
00042
00043 chain->PrintInfo();
00044 chain->ls(3);
00045 Int_t initStat = chain->Init();
00046 if (initStat) chain->Fatal(initStat, "during Init()");
00047
00048 int istat=0,iev=1;
00049
00050
00051 while(iev<=nevents && istat!=2) {
00052 chain->Clear();
00053 cout << "---------------------- Processing Event : " << iev << " ----------------------" << endl;
00054 istat = chain->Make(iev);
00055 iev++;
00056 if (istat == kStEOF || istat == kStFatal) break;
00057
00058 StEvent* mEvent = (StEvent*)chain->GetInputDS("StEvent");
00059 assert(mEvent);
00060
00061 int nV=mEvent->numberOfPrimaryVertices();
00062 if(nV==0) continue;
00063 int iv;
00064 printf("eveID=%d nPrimVert=%d\n", mEvent->id(),nV);
00065 for(iv=0;iv<nV;iv++) {
00066 StPrimaryVertex *V=mEvent->primaryVertex(iv);
00067 assert(V);
00068 StThreeVectorF &r=V->position();
00069 StThreeVectorF &er=V->positionError();
00070 printf("iv=%d Vz=%.2f +/-%.2f \n",iv,r.z(),er.z() );
00071 printf(" nDaugh=%d , VFid=%d:: ntr=%d nCtb=%d nBemc=%d nEEmc=%d nTpc=%d sumPt=%.1f rank=%g xchi2=%g\n"
00072 ,V->numberOfDaughters(), V->vertexFinderId() ,V->numTracksUsedInFinder() ,V->numMatchesWithCTB() ,V-> numMatchesWithBEMC() ,V->numMatchesWithEEMC() ,V->numTracksCrossingCentralMembrane() ,V->sumOfTrackPt() ,V->ranking(), V->chiSquared());
00073 }
00074
00075
00076 StEmcCollection* emcC =(StEmcCollection*)mEvent->emcCollection(); assert(emcC);
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 printRawBEMC(emcC->bemcRawData());
00088
00089 }
00090 chain->Finish();
00091
00092
00093
00094 }
00095
00096
00097
00098 void printRawBEMC(StEmcRawData *raw) {
00099
00100
00101 if(!raw) return;
00102
00103
00104
00105
00106
00107
00108
00109
00110 int NBANK = 13;
00111
00112
00113
00114
00115 for(int i = 0; i<NBANK;i++) {
00116 int size = raw->sizeHeader(i);
00117 printf("\n======\nBANK=%d headerSize=%d dataSize=%d\n",i,size,raw->sizeData(i));
00118
00119 if(raw->header(i)) {
00120 for(int j = 0;j<size;j++) {
00121 if(j%16==0) printf("\n");
00122 printf("0x%04x ",raw->header(i,j));
00123 }
00124 }
00125 int tot=0;
00126 #if 1
00127 if(raw->data(i)) {
00128 int size = raw->sizeData(i);
00129 printf("\nBANK=%d data size=%d",i,size);
00130 for(int j = 0;j<size;j++) {
00131 if(j%16==0) printf("\n");
00132 printf("0x%04x ",raw->data(i,j));
00133 tot++;
00134 }
00135 }
00136 #endif
00137 printf("\n tot=%d\n",tot);
00138 }
00139 }
00140
00141
00142
00143
00144
00145
00146
00147 printRaw( StEmcRawData* raw) {
00148
00149 printf("printRaw(%p)\n",raw);
00150
00151 assert(raw);
00152 int icr;
00153 printf("nBlocks=%d\n",raw->getNBlocks());
00154 EEfeeDataBlock block;
00155 for(icr=0; icr<raw->getNBlocks();icr++) {
00156 if(raw->sizeData(icr)<=0) continue;
00157
00158 const UShort_t* head=raw->header(icr);
00159 const UShort_t* data=raw->data(icr);
00160 assert(head);
00161 printf("icr=%d, size: head=%d data=%d\n",icr,raw->sizeHeader(icr),raw->sizeData(icr));
00162
00163 int i;
00164 block.clear();
00165 block.setHead(raw->header(icr));
00166 block.setDataArray(raw->data(icr),raw->sizeData(icr));
00167 if(icr>=6) continue;
00168 block.print(0);
00169
00170 }
00171
00172 }
00173
00174
00175
00176
00177 printETOW( StEmcDetector* det) {
00178
00179 printf("printTw(%p)\n",det);
00180 assert(det);
00181 printf("towers nHit=%d nMod=%d\n",det->numberOfHits(),det->numberOfModules());
00182 int nPos=0;
00183 for(int mod=1;mod<=det->numberOfModules();mod++) {
00184 StEmcModule* module=det->module(mod);
00185 printf("ETOW sector=%d nHit=%d\n",mod,module->numberOfHits());
00186 StSPtrVecEmcRawHit& hit= module->hits();
00187 int ih;
00188 for(ih=0;ih<hit.size();ih++){
00189 StEmcRawHit *x=hit[ih];
00190 int sec=x->module();
00191 char sub='A'+x->sub()-1;
00192 int eta=x->eta();
00193 int adc=x->adc();
00194
00195 printf("ih=%d %02dT%c%02d -->adc=%d ener=%f\n",ih,sec,sub,eta,adc, x->energy());
00196 if(adc>0) nPos++;
00197 int adcX=1000+ (eta-1) + (sub-'A')*12 +(sec-1)*60;
00198
00199
00200
00201 }
00202 printf("nPos=%d\n",nPos);
00203 }
00204 printf("total nPos=%d\n",nPos);
00205 printf("nPos=%d of %d \n",nPos,det->numberOfHits());
00206
00207 }
00208
00209
00210
00211
00212
00213
00214 printEPRE( StEmcDetector* det) {
00215
00216 printf("printPre/post(%p)\n",det);
00217 assert(det);
00218 printf("pre/post nHit=%d nMod=%d\n",det->numberOfHits(),det->numberOfModules());
00219 int nPos=0;
00220 for(int imod=1;imod<=det->numberOfModules();imod++) {
00221 StEmcModule* module=det->module(imod);
00222 printf("EPRE sect=%d nHit=%d\n",imod, module->numberOfHits());
00223 StSPtrVecEmcRawHit& hit= module->hits();
00224 int ih;
00225 for(ih=0;ih<hit.size();ih++){
00226 StEmcRawHit *x=hit[ih];
00227 int sec=x->module();
00228 int ss=x->sub()-1;
00229 char sub='A'+ss%5;
00230 char preL='P'+ss/5;
00231 int eta=x->eta();
00232 int adc=x->adc();
00233 printf("ih=%d %02d%c%c%02d ss=%d -->adc=%d ener=%f ss=%d\n",ih,sec,preL,sub,eta,ss,adc, x->energy(),ss);
00234 if(adc>0) nPos++;
00235 int adcX= (eta-1) + (sub-'A')*12 +(sec-1)*60 + 1000*(preL-'P'+1);
00236
00237 }
00238 printf("nPos=%d\n",nPos);
00239 }
00240
00241 printf("nPos=%d of %d \n",nPos,det->numberOfHits());
00242
00243 }
00244
00245
00246
00247
00248
00249
00250
00251 printESMD( StEmcDetector* det) {
00252
00253 printf("printSMD/post(%p)\n",det);
00254 assert(det);
00255 printf("U-SMD nHit=%d nMod=%d\n",det->numberOfHits(),det->numberOfModules());
00256 int nPos=0;
00257 for(int imod=1;imod<=det->numberOfModules();imod++) {
00258 StEmcModule* module=det->module(imod);
00259 printf("ESMD sector=%d nHit=%d\n",imod, module->numberOfHits());
00260 StSPtrVecEmcRawHit& hit= module->hits();
00261 int ih;
00262 for(ih=0;ih<hit.size();ih++){
00263 StEmcRawHit *x=hit[ih];
00264 int sec=x->module();
00265 int strip=x->eta();
00266 int adc=x->adc();
00267 printf("ih=%d %02dU%03d -->adc=%d ener=%f\n",ih,sec,strip,adc, x->energy());
00268 if(adc>0) nPos++;
00269 int adcX= 1000+(strip -1) +(sec-1)*300;
00270
00271 }
00272 printf(" nPos=%d\n",nPos);
00273 }
00274 printf("nPos=%d of %d \n",nPos,det->numberOfHits());
00275
00276
00277 }
00278
00279
00280
00281
00282
00283