{ ////////////////////////////////////////////////////////// // This file has been automatically generated // (Tue May 2 18:14:45 2006 by ROOT version4.01/02) // from TTree digi/digitization, from ancsvx // found on file: from_anc.root ////////////////////////////////////////////////////////// //Reset ROOT and connect tree file gROOT->Reset(); TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("fromanc.root"); if (!f) { f = new TFile("fromanc.root"); } TTree *digi = (TTree*)gDirectory->Get("digi"); //Declaration of leaves types Float_t dummy; Float_t fevent; Float_t track; Float_t flayer; Float_t xglobal; Float_t yglobal; Float_t zglobal; Float_t zlocin; Float_t zlocout; Float_t xlocin; Float_t xlocout; Float_t dele; Float_t fiang; Float_t fir; Float_t filr; Float_t fnstrips; Float_t istrip[20]; Float_t mstrips; Float_t estrip[20]; Float_t a37; Float_t a38; Float_t a39; // Set branch addresses. digi->SetBranchAddress("dummy",&dummy); digi->SetBranchAddress("event",&fevent); digi->SetBranchAddress("track",&track); digi->SetBranchAddress("layer",&flayer); digi->SetBranchAddress("xglobal",&xglobal); digi->SetBranchAddress("yglobal",&yglobal); digi->SetBranchAddress("zglobal",&zglobal); digi->SetBranchAddress("zlocin",&zlocin); digi->SetBranchAddress("zlocout",&zlocout); digi->SetBranchAddress("xlocin",&xlocin); digi->SetBranchAddress("xlocout",&xlocout); digi->SetBranchAddress("dele",&dele); digi->SetBranchAddress("iang",&fiang); digi->SetBranchAddress("ir",&fir); digi->SetBranchAddress("ilr",&filr); digi->SetBranchAddress("nstrips",&fnstrips); digi->SetBranchAddress("istrip1",&istrip[0]); digi->SetBranchAddress("istrip2",&istrip[1]); digi->SetBranchAddress("istrip3",&istrip[2]); digi->SetBranchAddress("istrip4",&istrip[3]); digi->SetBranchAddress("istrip5",&istrip[4]); digi->SetBranchAddress("istrip6",&istrip[5]); digi->SetBranchAddress("istrip7",&istrip[6]); digi->SetBranchAddress("istrip8",&istrip[7]); digi->SetBranchAddress("istrip9",&istrip[8]); digi->SetBranchAddress("istrip10",&istrip[9]); digi->SetBranchAddress("istrip11",&istrip[10]); digi->SetBranchAddress("istrip12",&istrip[11]); digi->SetBranchAddress("istrip13",&istrip[12]); digi->SetBranchAddress("istrip14",&istrip[13]); digi->SetBranchAddress("istrip15",&istrip[14]); digi->SetBranchAddress("istrip16",&istrip[15]); digi->SetBranchAddress("istrip17",&istrip[16]); digi->SetBranchAddress("istrip18",&istrip[17]); digi->SetBranchAddress("istrip19",&istrip[18]); digi->SetBranchAddress("istrip20",&istrip[19]); digi->SetBranchAddress("mstrips",&mstrips); digi->SetBranchAddress("estrip1",&estrip[0]); digi->SetBranchAddress("estrip2",&estrip[1]); digi->SetBranchAddress("estrip3",&estrip[2]); digi->SetBranchAddress("estrip4",&estrip[3]); digi->SetBranchAddress("estrip5",&estrip[4]); digi->SetBranchAddress("estrip6",&estrip[5]); digi->SetBranchAddress("estrip7",&estrip[6]); digi->SetBranchAddress("estrip8",&estrip[7]); digi->SetBranchAddress("estrip9",&estrip[8]); digi->SetBranchAddress("estrip10",&estrip[9]); digi->SetBranchAddress("estrip11",&estrip[10]); digi->SetBranchAddress("estrip12",&estrip[11]); digi->SetBranchAddress("estrip13",&estrip[12]); digi->SetBranchAddress("estrip14",&estrip[13]); digi->SetBranchAddress("estrip15",&estrip[14]); digi->SetBranchAddress("estrip16",&estrip[15]); digi->SetBranchAddress("estrip17",&estrip[16]); digi->SetBranchAddress("estrip18",&estrip[17]); digi->SetBranchAddress("estrip19",&estrip[18]); digi->SetBranchAddress("estrip20",&estrip[19]); // digi->SetBranchAddress("a57",&a57); // digi->SetBranchAddress("a58",&a58); // digi->SetBranchAddress("a59",&a59); // This is the loop skeleton // To read only selected branches, Insert statements like: // digi->SetBranchStatus("*",0); // disable all branches // TTreePlayer->SetBranchStatus("branchname",1); // activate branchname //--------------------------------------------------------------------------------------- //------------- declarations: ----------------------------------------------------------- Float_t es[1600]; Int_t oldevent, ichip, i2x2, istart, layer, ir, ilr, iang, nstrips, nst, imod48, jstrip, event, ndata, is, ts[1600], ndone=0, L9C3S10=0, nclusters, itrid, iclsize, nmerge, nstripson, nempty; Float_t data[8][200][210]; // layers 5-12, 48x2x2 chips, 3x70 data entries for (int i=0; i<8; i++) { for (int j=0; j<200; j++) { for (int k=0; k<210; k++) { data[i][j][k] = 0.0; } } } printf("Data[][][] cleared.\n"); //------------- histos: ------------------------------------------------------------------ TH1F *a01 = new TH1F("a01"," buffer size used",180, 0.0, 180.0); TH1F *a02 = new TH1F("a02"," strip number",100, 0.0, 2000.0); TH1F *a03 = new TH1F("a03"," track ID number",100, 0.0, 7500.); TH1F *d04 = new TH1F("d04"," electrons per cell",100, 0.0, 1.e5); TH1F *a04 = new TH1F("a04"," electrons per cell",100, 0.0, 50000.); TH1F *a05 = new TH1F("a05"," angle index",240, -5, 55); TH2F *a06 = new TH2F("a06"," radius index, left-right index",5,0.25,2.75,5,0.25,2.75); TH1F *a07 = new TH1F("a07"," strip number for layer9 ichip 3",100, 0.0, 2000.0); TH1F *a08 = new TH1F("a08"," cluster size (from buffer)", 25, 0.0, 25.0); TH1F *a09 = new TH1F("a09"," clusters per column", 50, 0.0, 50.0); TH1F *a10 = new TH1F("a10"," cluster size (from ntuple)", 25, 0.0, 25.0); TH1F *a11 = new TH1F("a11"," merged clusters per column", 10, 0.0, 10.0); TH1F *a12 = new TH1F("a12"," strips on per column", 70, 0.0, 70.0); TH1F *a13 = new TH1F("a13"," space between clusters", 200, 0.0, 200.0); TH1F *a14 = new TH1F("a14"," electrons", 100, 0.0, 50000.0); TH1F *a15 = new TH1F("a15"," cluster location", 100, 0.0, 2000.0); TH2F *a16 = new TH2F("a16"," cluster size vs. location", 100, 0.0, 2000.0, 10, 0., 10.); //---------------------------------------------------------------------------------------- Long64_t nentries = digi->GetEntries(); oldevent = 2; Int_t nbytes = 0; for (Long64_t ientry=0; ientryGetEntry(ientry); layer = int(flayer); ir = int(fir); ilr=int(filr); iang = int(fiang); nstrips = int(fnstrips); event = int(fevent); } else { // trick to force analysis of the last event event = 1000000001; } //============================= fill the chip buffers: ======================================== if(event==oldevent) { i2x2 = (ir-1)*2 + ilr -1; // left-right, inner-outer 0-1-2-3 ichip = i2x2*48 + iang; // master index of a chip in a layer if(layer==9) { a10->Fill(float(nstrips)); //printf("a10: event %d, layer %d, ichip %d, nstrips %d\n",event, layer, ichip, nstrips); } if (ichip>199){printf("//////// error /////////// \n");} istart = int(data[layer-8][ichip][0]); // start of free buffer space if (istart+3*nstrips > 210-1) { // don't overflow the buffer //printf(" ** WARNING ** buffer overflow in data[][][%d] (>210) %d %d \n", // istart+2*nstrips, istart, nstrips); istart = 160; // error marker in a01 a01->Fill(float(istart)); // } // buffer overflow else { // no overflow: //if (layer==9 && ichip==3) { //xxx check: // printf("chip #3: nstrips %d, istrip[0] %d, istrip[1] %d \n",nstrips, istrip[0], istrip[1]); //} for (int i=1; i<=nstrips; i++) { data[layer-8][ichip][3*i-2 +istart] = float(istrip[i-1]); // strip number data[layer-8][ichip][3*i-1 +istart] = track; // track number data[layer-8][ichip][3*i +istart] = estrip[i-1]; // # electrons d04->Fill(estrip[i-1]); if (estrip[i-1]==0){printf("*** 1) ENERGY=0 *** nstrips %d, i %d \n",nstrips,i);} } data[layer-8][ichip][0] = data[layer-8][ichip][0] + float(3*nstrips); // update free buffer pointer a01->Fill(data[layer-8][ichip][0]); // shows buffer usage } // no overflow } // same event //==================================analyze the buffers: ======================================= else { printf(" new event seen %d, analyzing the previous one... \n", event); oldevent = event; for (layer==9; layer<=12; layer++) { //for (layer==9; layer<=9; layer++) { // ichip=1-95 cycles over inner radius chips // ichip=1-191 cycles over all chips in a layer for (int ichip=1; ichip<=95; ichip++) { for (int i=0; i<1600; i++) {es[i] = 0; ts[i]=0;} // clear // to decode ichip = i2x2*48 + iang; i2x2= (ir-1)*2 + ilr -1; iang = ichip%48; i2x2 = ichip/48; ilr = i2x2%2 +1; ir = i2x2/2 +1; a05->Fill(float(iang)); a06->Fill(float(ilr),float(ir)); // copy into strips: ndata = int(data[layer-8][ichip][0]); for (int i=1; i<=ndata/3; i++) { is = data[layer-8][ichip][3*i-2]; // strip number ts[is] = data[layer-8][ichip][3*i-1]; // track number es[is] = es[is] + data[layer-8][ichip][3*i-0]; // energy //es[is] = data[layer-8][ichip][3*i-0]; // energy if (es[is]==0){printf("*** 2) ENERGY=0 *** ndata %d, i %d \n",ndata,i);} a02->Fill(float(is)); // strip number a03->Fill(ts[is]); a04->Fill(es[is]); if (layer==9 && ichip==3) { a07->Fill(float(is)); // strip number //printf("entry for L9C3 S<=10 %d \n", is); L9C3S10++; } } // all data copied into the strips // now look at the strips - number of clusters --------------- nstripson = 0; // strips on nclusters = 0; // clusters in this column iclsize = 0; // cluster size nmerge = 0; // overlapping clusters nempty = 0; // space between clusters itrid = 0; // current track id for (int ii=0; ii<1320; ii++) { // loop over strips //if (event==10 && ichip==3) { //printf(" %d",itrid); if (ts[ii] !=0 ){ nstripson++; a14->Fill(es[ii]); } // strip is on if ( ts[ii]!=0 && itrid==0) { // new cluster seen itrid = ts[ii]; // current ID nclusters++; iclsize++; a13->Fill(float(nempty)); nempty = 0; } else if ( ts[ii]==0 && itrid!=0) { // end of current cluster a08->Fill(float(iclsize)); // plot cluster size a15->Fill(float(ii-1)); // plot cluster location a16->Fill(float(ii-1),float(iclsize));// see where the big clusters are itrid = 0; // reset id iclsize = 0; // reset cl size counter nempty++; // start of empty space } else if ( ts[ii]!=0 && itrid!=0) { // continue current cluster iclsize++; // increment if ( ts[ii] != itrid) { // but a different track ID is seen nmerge++; // overlapping cluster //printf("track id: %d %d \n", itrid, ts[ii]); if (event==10 && ts[ii]==1534) { for (int jj=0; jj<1320; jj++){ printf(" %d",ts[jj]);} printf("\n ichip: %d \n", ichip); } itrid = ts[ii]; } } else if ( ts[ii]==0 && itrid==0) { // continue current empty space nempty++; } //} } // loop over strips in a column a09->Fill(float(nclusters)); a11->Fill(float(nmerge)); if (event==10 && ichip==64) {printf("nmerge= %d \n",nmerge);} a12->Fill(float(nstripson)); } // loop over chips in a layer } // loop over layers //----------------------- clear old buffers: ----------------- for (int i=0; i<8; i++) { for (int j=0; j<200; j++) { for (int k=0; k<210; k++) { data[i][j][k] = 0.0; } } } for (int i=0; i<1600; i++) {es[i] = 0; ts[i]=0;} ndone++; printf("Analysis done for %d events, data[][][] cleared...\n", ndone); //---------------- end clear buffer ------------------------ } // end analysis section } // end loop over records printf("entries in L9C3S10: %d \n", L9C3S10); } // end macro