/////////////////////////////////////////////////////////// // Chimera Event UnPacker // CsI Identification // partially adapted upon KaliVeda (C) 2005 by J.D. Frankland // identification methods for CsI(Tl) // // E. De Filippo v 1.1 // TCHILNS / Exochim - AsyEos collaboration // TCHIGridCsI implementation /////////////////////////////////////////////////////////// #include "TCHIGridCsI.h" // Constructor TCHIGridCsI::TCHIGridCsI(string filename) : fgridfilename(filename), fgridOK(false) { for(int i=0; i=k) { fmod[ntel] = j-k; } else { fmod[ntel] = j; } ntel++; } } } //read grids file bool TCHIGridCsI::ReadAsciiFile() { int row = 0; int ntel = 0; int ncut = 0; int ngri = 0; fgridOK = false; ifstream gridf(fgridfilename.c_str()); if (!gridf.good()) { cout<<"TCHIGridCsI>> "<< "File "<> The ascii file for Csi Chimera Identification should\n"<< "follow the KaliVeda grid format standard: missing KVIDGCsi label" <>rmin>>rmax; } // End of telescope grid, next telescope starts if(s.find("!")==0) { ntel++; telnum = -1; continue; } //read the telescope number and create the relative object if(s.find(" IDTelescopes=CSI_R_L_")==0) { s.erase(0, 33); istringstream os(s); os>>telnum; if(telnum>=0 && telnum<= MAXTEL) { if(rmin>0 && rmax>0) { frmin[telnum] = rmin; frmax[telnum] = rmax; rmin = 0; rmax = 0; } if(fgraph[telnum] != 0) { cout<<"TCHIGridCsI>> Warning telescope "<> Severe error ID not found at row "<> Severe error OK:cut not found at row "<> Read "<> Processed "<> Stored "<>Z>>A; // special case for 8Be. We write Z=2 A=8 in order to // maintain 8Be between alpha and Z=3 during "sorting" // GetZ method know this and will give the // correct Z=4 for this line. if(Z==4 && A==8) { Z=2; } name<<"Z"<>npar; TGraph *pg = new TGraph(npar); pg->SetName(name.str().c_str()); //set name to grid pg->SetTitle(name.str().c_str()); //set title to grid for(int i=0; i>x>>y; pg->SetPoint(i, x, y); } if(fgraph[tel] != 0) { fgraph[tel]->GetGrid()->Add(pg); // Add the grid to the list } fgraph[tel]->SetValidGrid(true); return npar; } // Add cuts lines int TCHIGridCsI::AddCut(ifstream &gridf, int *row, int tel, ECut cuttype) { string s; stringstream name; int Z, A, npar; float x,y; TGraph *pg; TGraph *gamma = fgraph[tel]->GetGammaL(); TGraph *imf = fgraph[tel]->GetIMFL(); if(tel==-1)return -1; getline(gridf,s); (*row)++; if(cuttype == kgamma) { name<<"gamma_line_"<>npar; if(cuttype == kgamma) { pg = gamma; if(pg->GetN() != 0) { cout<<"TCHIGridCsI>> Warning gamma line already existing for tel "<GetN() != 0) { cout<<"TCHIGridCsI>> Warning IMF line already existing for tel "<SetName(ntit); //set name to grid pg->SetTitle(ntit); //set title to grid for(int i=0; i>x>>y; pg->SetPoint(i, x, y); } fgraph[tel]->SetValidCuts(true); return npar; } // Print grid contents on stdout void TCHIGridCsI::PrintLine(int ntel, int opt) { TList *lg; //Security pointers check if(fgraph[ntel] == 0 ) { cout<<"TCHIGridCsI>> Grid line not existing for telescope "<HasValidGrid()) { lg = fgraph[ntel]->GetGrid(); TIter next(lg); TGraph *gr = 0; int i=0; while ( (gr = (TGraph *)next()) ) { int np = gr->GetN(); cout<<"Name: "<GetName()<<" Points "<> "<< "File "<HasValidGrid()) { chiout<GetGrid(); int nlines = lg->GetEntries(); if(lg>0) { if(currg->IsIMFlineadded())nlines--; chiout<GetGammaL(); int ng = gamma->GetN(); chiout<GetN(); chiout<GetZ(gr)<GetA(gr)<GetIMFL(); int nm = IMFLine->GetN(); chiout<GetX(); Double_t *fy = gamma->GetY(); int j=5; chiout.setf(ios::fixed); chiout<GetN(); fx = gr->GetX(); fy = gr->GetY(); for(Int_t i=0; iGetX(); fy = IMFLine->GetY(); for(Int_t i=0; iHasValidGrid()) { fgraph[ntel]->Initialize(); } } } // Set Z and A of nucleus based on position in R-L grid // The identification of gammas (kICODE10) and charged particles is performed // Main Identification method [heavily modified respect to kaliveda but it is // supposed doing the same things] // * adapted from KVIDGCsI::Identify void TCHIGridCsI::Identify(int ntel, Double_t x, Double_t y, TCHIResult *idr) { TCHIGraphCsI *currg = fgraph[ntel]; // the current lines+cuts object for tel ntel idr->Init(); if(!currg) { //no pointer, no grids idr->fcod = kICODE_nogrid; return; } if(!currg->HasValidGrid()) { idr->fcod = kICODE9; //incomplete grids return; } TList *Identifiers = currg->GetGrid(); //the current list of identifiers (grids) TGraph *IMFLine = currg->GetIMFL(); //the IMF closing line // before first use of this method, we add the IMF line to the list of identifiers // which is necessary for IdentZA to work correctly. IMF line is cloned in order // to avoid problems with class destructors if(!currg->IsIMFlineadded()) { TGraph *newIMF = (TGraph *)IMFLine->Clone(); if(IMFLine)Identifiers->AddLast(newIMF); currg->SetIMFLineAdded(kTRUE); } if(!currg->IsIdentifiable(x, y)) { //point below gamma line idr->fcod = kICODE10; idr->fZ = 0; idr->fA = 0; idr->fIDOK = kTRUE; return; } if (!currg->FindFourEmbracingLines(x,y,"above")) { //no lines corresponding to point were found idr->fcod = kICODE8; // Z indetermine ou (x,y) hors limites return; } Int_t Z; Double_t A; currg->IdentZA(x, y, Z, A); // Main identification Tassan-Got-like routine if(Z>10) cout << "dentro TCHIGridCsI linea 496 ntel= " << ntel << " Z= "<< Z << endl; idr->fZ = Z; idr->fA = currg->GetAint(); idr->fPID = A; idr->fcod = currg->GetICode(); if(idr->fcod < kICODE4){ idr->fIDOK = kTRUE; idr->fZident = kTRUE; idr->fAident = kTRUE; } }