00001 class EEfeeDataBlock;
00002 class EEfeeRawEvent;
00003 class EEfeeRunDescr;
00004
00005 TFile *f;
00006
00007 void rdFeeTTreeUser1(int max=10000) {
00008 gSystem->Load("StRoot/StEEmcUtil/EEfeeRaw/libEEfeeRaw.so");
00009 gStyle->SetPalette(1,0);
00010
00011 TH2F *h2[8];
00012 initHisto(h2);
00013
00014 TH2F *hd[8];
00015 initHistoD(hd);
00016
00017 TString fname="/star/u/eemcdb/miniDaq/Mar1/run01001.root";
00018
00019 TFile *f = new TFile(fname);
00020 TTree *t = (TTree *)f->Get("fee");
00021 TBranch *bd = t->GetBranch("desc");
00022 TBranch *be = t->GetBranch("evt");
00023
00024 EEfeeRawEvent *eve = new EEfeeRawEvent();
00025 EEfeeRunDescr *des = new EEfeeRunDescr();
00026
00027 be->SetAddress(&eve);
00028 bd->SetAddress(&des);
00029
00030 Int_t nentries = (Int_t)t->GetEntries();
00031 cout << nentries << endl;
00032 Int_t nbe=0;
00033 Int_t nbd=0;
00034 int nAcc=0;
00035 for(Int_t ieve=0; ieve<nentries && ieve<max; ieve++) {
00036 nbe += be->GetEntry(ieve);
00037 nbd += bd->GetEntry(ieve);
00038 TClonesArray *block=eve->block;
00039 if(ieve%20==0)printf("EfeeRawEvent ID=%d with DataBlock entered=%d of %d, accepted %d events of %d\n", eve->getID(),block->GetEntries(),block->GetSize(), nAcc,ieve);
00040 int j;
00041
00042
00043
00044
00045
00046
00047 int token=-1;
00048 int n256=0;
00049 for(j=0;j<block->GetEntries();j++) {
00050 EEfeeDataBlock *blk= (EEfeeDataBlock *)block->At(j);
00051 if(j==0) token=blk->getToken();
00052 if(token!=blk->getToken()){ token=-2; break;}
00053 if(blk->getCrateID()<3 || blk->getCrateID()>5) { token =-3; break;}
00054
00055 if(blk->getCrateID()!=j+3) {
00056
00057 token=-4; break;
00058 }
00059
00060
00061
00062 for(int k=0;k<128;k++) {
00063 int adc=blk->getData()[k];
00064 if(adc==256)n256++;
00065 }
00066 if(n256>5){ token =-5; ;break;}
00067 }
00068
00069 if(token<0) {
00070
00071 continue;
00072 }
00073
00074 nAcc++;
00075
00076
00077
00078 int x3_71=-1;
00079 int x3_61=-1;
00080 int x4_10=-1;
00081 int x4_1=-1;
00082 int x5_95=-1;
00083 int x5_99=-1;
00084
00085 for(j=0;j<block->GetEntries();j++) {
00086 EEfeeDataBlock *blk= (EEfeeDataBlock *)block->At(j);
00087
00088 for(int k=0;k<128;k++) {
00089 int adc=blk->getData()[k];
00090 h2[j]->Fill(adc,k);
00091 }
00092
00093 switch( blk->getCrateID()) {
00094 case 3: x3_71=blk->getData()[71];x3_61=blk->getData()[61]; break;
00095 case 4: x4_10=blk->getData()[10];x4_1=blk->getData()[1]; break;
00096 case 5: x5_95=blk->getData()[95];x5_99=blk->getData()[99]; break;
00097 }
00098 }
00099
00100 hd[0]->Fill(x4_10,x3_71);
00101 hd[1]->Fill(x4_10,x5_95);
00102 hd[2]->Fill(x4_10,x4_1);
00103
00104 hd[3]->Fill(x3_61,x3_71);
00105 hd[4]->Fill(x3_61,x4_1);
00106 hd[5]->Fill(x5_99,x4_1);
00107 hd[6]->Fill(x5_99,x5_95);
00108 if(x4_10>40 && x4_1 >40 && x3_71>60 && x3_61>80 && x5_99>60 && x5_95>80 )
00109 eve->print();
00110 }
00111
00112
00113
00114
00115 c=new TCanvas();
00116 c->Divide(1,3);
00117 int i;
00118 for (i=0;i<3;i++){
00119 c->cd(i+1);
00120 h2[i]->Draw("colz");
00121 gPad->SetLogz();
00122 }
00123
00124 c=new TCanvas();
00125 c->Divide(3,3);
00126 for (i=0;i<7;i++){
00127 c->cd(i+1);
00128 hd[i]->Draw("colz");
00129 gPad->SetLogz();
00130 }
00131 }
00132
00133
00134 void initHisto(TH2F **h2) {
00135
00136 int i;
00137 for(i=0;i<3;i++) {
00138 int crate=i+3;
00139 char tt1[100], tt2[100];
00140 sprintf(tt1,"cr%dspeR",crate);
00141 sprintf(tt2,"chan vs. raw ADC , carte=%d",crate);
00142
00143 h2[i]= new TH2F(tt1,tt2, 200,0.,400,129,-0.5,128.5);
00144 }
00145 }
00146
00147
00148 void initHistoD(TH2F **h2) {
00149
00150 h2[0]= new TH2F("dd0"," cr3/ch71 vs. cr4/ch10", 100,0.,200,100,0.,200);
00151 h2[1]= new TH2F("dd1"," cr5/ch95 vs. cr4/ch10", 100,0.,200,100,0.,200);
00152 h2[2]= new TH2F("dd2"," cr4/ch1 vs. cr4/ch10", 100,0.,200,100,0.,200);
00153 h2[3]= new TH2F("dd3"," cr3/ch71 vs. cr3/ch61", 100,0.,200,100,0.,200);
00154 h2[4]= new TH2F("dd4"," cr4/ch1 vs. cr3/ch61", 100,0.,200,100,0.,200);
00155 h2[5]= new TH2F("dd5"," cr4/ch1 vs. cr5/ch99", 100,0.,200,100,0.,200);
00156 h2[6]= new TH2F("dd6"," cr5/ch95 vs. cr5/ch99", 100,0.,200,100,0.,200);
00157 }
00158