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