#include "tpc/TpcGem.h" #include "tpc/TpcPadPlane.h" #include "tpc/TpcPadShapePool.h" #include "tpc/TpcDigi.h" #include "TCanvas.h" #include "TFile.h" #include "TClonesArray.h" #include "TTree.h" #include "TH2D.h" #include "TStyle.h" #include "algorithm" #include "sstream" #include "tpc/TpcDigiAge.h" void plotDigis(){ gStyle->SetFillColor(kWhite); TCanvas* c=new TCanvas("c1","Tpc Digis",0,0,600,600); //TODO: Get these things from Database!!! TpcGem* _gem=new TpcGem(5000, // Gain 0.02); // Spread TpcPadShapePool* _padShapes = new TpcPadShapePool("2mmPads.dat", *_gem, 0.5, // lookup range 0.02, // Lookup Step 0.01); // LookupIntegrationStep TpcPadPlane* _padPlane= new TpcPadPlane(100,100, 1.,1., -50.,-50.); // Put Pads into PadPlane _padPlane->ReadFromFile("padplane.dat", _padShapes); TFile* file = new TFile("data/pion.20deg.raw.root"); //TGeoManager *geoMan = (TGeoManager*) file->Get("CBMGeom"); TTree *t=(TTree*)file->Get("cbmsim") ; TClonesArray *sa=new TClonesArray("TpcDigi"); t->SetBranchAddress("TpcDigi",&sa); TH2D* ma=new TH2D("map","Hit pads",420,-42,42,420,-42,42); for (Int_t j=0; j< t->GetEntriesFast(); j++) { t->GetEntry(j); for (Int_t i=0; iGetEntriesFast(); i++) { TpcDigi *sig=(TpcDigi*)sa->At(i); double x,y; _padPlane->GetPadXY(sig->padId(),x,y); ma->Fill(x,y); } } ma->Draw("BOX"); c->SaveAs("allDigis.eps"); // Produce movie ma->Reset(); ma->SetDrawOption("BOX"); // get first event t->GetEntry(0); std::vector vd; Int_t ndig=sa->GetEntriesFast(); for (Int_t i=0; iAt(i); vd.push_back(sig); } //sort in time; sort(vd.begin(),vd.end(),TpcDigiAge()); // make frames Int_t t1=0; int counter=0; for(Int_t i=0; it()-t1>4){ t1=sig->t(); // print frame std::ostringstream file; file<<"frames/digi"; if(counter<100)file<<"0"; if(counter<10)file<<"0"; file<Draw("BOX"); c->SaveAs(file.str().c_str()); ma->Reset(); } double x,y; _padPlane->GetPadXY(sig->padId(),x,y); ma->Fill(x,y); } }