Dear Erik, [Erik Jacobsen, NBI] In regard to your question on reading geant files (.cdat) for looking at Mult si-det I do not know of any easily accesible file. Let me give you a few pointers where to look. - For general checkout of .cdat file to look at their content is the dumpcdat.c program in geant/ana. you will have to compile etc. - To checkout the names of data structure you should look in the gbr2c.f file that is usually called when generating geant events. This defines the NAME of the struct.To understand the geometry you will have to look at the geant code (I guess). - To perform an analysis you really should get into the BRAT setup that has the proper tools to read the files. You will have to write the macros to get the data, perform calculations, histograms them etc. I enclose an example in this e-mail for your information. This read data from the TOFW detector and makes some simple analysis ( taken and modified from some macro Ian wrote). - Since you are new to this software I will strongly suggest you subscribe to the brahms-soft-l@bnl.gov listserver if you have not already done so, , and pose questions to that list rather than to individual people.The idea has always been that this kind of questions as well as their answer should go to the list to propagate common knowledge on software. regards Flemming ------------------------------ Flemming Videbaek Physics Department Brookhaven National Laboratory tlf: 516-344-4106 fax: 516-344-1334 videbaek@bnl.gov // ReadGeantTOFW.C // ============= // // Checkout of the Geant Input package. // This one assumed that the Base libraries function // ok. // Modified from Ian's H1 analysis to look at Tofw instead // // #ifndef __CINT__ #include "TROOT.h" #include "TH1.h" #include "TH2.h" #include "TFile.h" #include "TStopwatch.h" #include "TNamed.h" #include "BrModuleContainer.h" #include "BrModule.h" #include "BrEvent.h" #include "BrGeantData.h" #include "BrDigitizeTof.h" #include "BrDetectorVolume.h" #include "BrDetectorParamsTof.h" #include "BrDataTable.h" #include "BrGeantTrack.h" #include "BrGeantHit.h" #include "BrGeantInput.h" #include "BrDigTof.h" // Compiled file for file for testing of int main(int argc, char** argv) { TROOT brat("Brat","Brahms Analysis Toolkit"); #else { file://should start macro gROOT->Reset(); gROOT->LoadMacro("Load.C"); load(); #endif // cout << "\n**********************************\n"; cout << " Start of ReadGeantTOFW.C\n"; cout << "**********************************\n"; cout << flush; // // Create a geant input module // BrGeantInput *ginp = new BrGeantInput("geant"); ginp->Print(); ginp->Info(); TFile *h_file = new TFile("tofwh.root","RECREATE"); // // // create some histograms // TH1F* hTracks = new TH1F("htracks","Tracks per event", 1000, 0.,1000.); TH1F* hHitstofwa = new TH1F("hHitstofwa","", 30, 0.,30.); TH1F* hHitstofw1 = new TH1F("hHitstofw1","", 30, 0.,30.); TH1F* hHitstofw4 = new TH1F("hHitstofw4","", 30, 0.,30.); TH1F* hHitstofw2 = new TH1F("hHitstofw2","Hits tofw E", 30, 0.,30.); TH1F* hHitstofw3 = new TH1F("hHitstofw3","Hits tofw T", 30, 0.,30.); file://make histo for hits when neighboring slats hit in same event TH1F* hHitsh1c = new TH1F("hHitstofwc","", 30, 0.,30.); Int_t nslats= 255; TH1F* hDettofwa = new TH1F("hDettofwa","TOFW, all", nslats, 0.5,nslats+.5); TH1F* hDettofwa_prim = new TH1F("hDettofwa_prim","TOFW, primary",nslats, 0.5,nslats+.5); TH1F* hDettofwb = new TH1F("hDettofwb","TOFW, E>MIP", nslats, 0.5,nslats+.5); TH1F* hDettofwc = new TH1F("hDettofwc","TOFW, prompt",nslats, 0.5,nslats+.5); TH1F* hDettofwd = new TH1F("hDettofwd","TOFW, E,tof",nslats, 0.5,nslats+.5); TH1F* hToftofwa = new TH1F("hToftofwa","tof tofw", 350, 10, 60.); TH1F* hToftofwb = new TH1F("hToftofwb","tof tofw e>mip", 350, 10., 60.); TH1F* hToftofwc = new TH1F("hToftofwc","tof tofw prompt", 350, 10., 60.); TH1F* hToftofwd = new TH1F("hToftofwd","tof tofw prompt,e>mip", 350, 10., 60.); TH1F* hDedxtofwa = new TH1F("hDedxtofwa","dedx", 800, 0., 8.); TH1F* hDedxtofwb = new TH1F("hDedxtofw", "dedx > mip", 800, 0., 8.); TH1F* hDedxtofwc = new TH1F("hDedxtofwc","dedx prompt", 800, 0., 8.); TH1F* hDedxtofwd = new TH1F("hDedxtofwd","dedx prompt,>mip", 800, 0., 8.); TH1F* hYtofw = new TH1F("hYtofw","tofw y", 200, -20., 20.); TH2F* hSlvYtofwa = new TH2F("hSlvYtofwa","tofw slat vs tofwY",40,0.5,40.5,200,-20.,20.); TH2F* hSlvYtofwb = new TH2F("hSlvYtofwb","tofw slat vs tofwY",40,0.5,40.5,200,-20.,20.); TH2F* hEvToftofw = new TH2F("hEvToftofw","tofw Ev slat vs tofwY",40,0.5,40.5,200,-20.,20.); // // Set default directory to memory such that only histograms // will be written to file (I hope) // gROOT->cd(); int evno; if(ginp->Open("/brahms/mds/gbrahms_output/mdc1/sim_144.cdat")){ Int_t nev=500; BrDataTable* GList, *TrackList; // file://initialize DetNo, which is the number of the hit slat, file://nh, the number of the hit in the event file://DetTemp a place to store the slat number of the previous hit // so that I can see how often neighboring slats are hit... // nhits, number of hits on given hodo for given event... int DetNo, nh, DetTemp, nhits, loopy, bob, ntrak; BrGeantHit* ghit_p; BrGeantTrack* track_p; BrEvent *gevent; for(evno=0;evno<nev;evno++) { gevent = new BrEvent("geant",0,0); ginp->Event(gevent); if(ginp->Eof()) { cout << "End Of Data" << endl; cout << "**Event no." << evno << endl; break; } if(ginp->Error()) { cout << "File error" << endl; cout << "**Last Event no." << evno << endl; break; } if( evno < 100) cout << "**Event no." << (evno+1) << endl; else if ( (evno+1)%100==0) cout << "-**Event no." << (evno+1) << endl; TrackList = gevent->GetDataTable("GeantTracks"); ntrak = TrackList->Entries(); if(TrackList != NULL) { hTracks->Fill(TrackList-> Entries()); if(evno < 10) cout << TrackList->Entries() << endl; } GList = gevent->GetDataTable("GeantHits TOFW"); if(GList != NULL) { if(evno < 10) cout << "TOFW hits " <<GList->Entries() << endl; hHitstofwa->Fill(GList->Entries()); int nhit1 = 0; int nhit2 = 0; int nhit3 = 0; int nhit4 = 0; for(nh =0; nh < GList->Entries(); nh++) { ghit_p = (BrGeantHit*) GList->At(nh); float* pos; pos = ghit_p->GlobalPosOut(); float tofwX = pos[0]; float tofwY = pos[1]; float tofwZ = pos[2]; DetNo = ghit_p->Isub(); if(nh==0) loopy = DetNo; if (GList->Entries()>=1) { file://Find the track corresponsing to this hit // track_p = NULL; for(int nt =0; nt < TrackList->Entries(); nt++) { track_p = (BrGeantTrack*) TrackList->At(nt); if(track_p->TrackNo() == ghit_p->TrackNo()) break; } if(track_p == NULL) { cerr << "Null track no encountered should not happen" << endl; break; } if(ghit_p->Dedx() > 0.0) { hDettofwa->Fill(DetNo); if(track_p->Vz() == 0.0) hDettofwa_prim->Fill(DetNo); hToftofwa->Fill(ghit_p->Tof()); hDedxtofwa->Fill(ghit_p->Dedx()); nhit1++; hYtofw->Fill(tofwY); hSlvYtofwa->Fill(DetNo,tofwY); } if(ghit_p->Dedx() > 0.80) { hDettofwb->Fill(DetNo); hToftofwb->Fill(ghit_p->Tof()); hDedxtofwb->Fill(ghit_p->Dedx()); nhit2++; } // // dedx // if(ghit_p->Tof() < 25.) { hDettofwc->Fill(DetNo); hToftofwc->Fill(ghit_p->Tof()); hDedxtofwc->Fill(ghit_p->Dedx()); nhit3++; if(ghit_p->Dedx() > .8) { hSlvYtofwb->Fill(DetNo,tofwY); hDettofwd->Fill(DetNo); hToftofwd->Fill(ghit_p->Tof()); hDedxtofwd->Fill(ghit_p->Dedx()); nhit4++; } } } // two hits in TOFW } // loop over hits hHitstofw1->Fill(nhit1); hHitstofw2->Fill(nhit2); hHitstofw3->Fill(nhit3); hHitstofw4->Fill(nhit4); } // hits in TOFW // file://try to find out how often neighboring slats are hit in tofw // if it is often, could be too many showers in the first row // } file://ntrak==1 delete gevent; } // // End of event or error // ginp->Info(); ginp->Close(); float factor=1.0/evno; hDettofwa->Add(hDettofwa, hDettofwa, 0.0, factor); hDettofwa_prim->Add(hDettofwa_prim, hDettofwa_prim, 0.0, factor); h_file->cd(); h_file->ls(); h_file->Write(); h_file->Close(); } else cout << "cannot open file " << endl; }
This archive was generated by hypermail 2b29 : Sun Mar 05 2000 - 17:44:09 EST