#include "tpc/PndTpcGem.h" #include "tpc/PndTpcPadPlane.h" #include "tpc/PndTpcPadShapePool.h" #include "tpc/PndTpcSignal.h" #include "tpc/PndTpcDigi.h" #include "tpc/PndTpcDriftedElectron.h" #include "tpc/PndTpcAvalanche.h" #include "TFile.h" #include "TClonesArray.h" #include "TTree.h" #include "TH2D.h" #include "TH1D.h" #include "TH1I.h" #include "TH2I.h" #include "TStyle.h" #include void plotDigiOutput(char* filename){ gStyle->SetFillColor(kWhite); TFile* file = new TFile(filename); TTree *t=(TTree*)file->Get("cbmsim") ; if(t==NULL){ std::cout<<"Data tree not found. Aborting." <SetBranchAddress("PndTpcDriftedElectron",&da); //Get Avalanches TClonesArray *aa=new TClonesArray("PndTpcAvalanche"); t->SetBranchAddress("PndTpcAvalanche",&aa); //Get Signals TClonesArray *sa=new TClonesArray("PndTpcSignal"); t->SetBranchAddress("PndTpcSignal",&sa); //Get Signals TClonesArray *diga=new TClonesArray("PndTpcDigi"); t->SetBranchAddress("PndTpcDigi",&diga); // Event loop Int_t nevents=t->GetEntriesFast(); for (Int_t j=0; jGetEntry(j); // look at drifted electrons ------------------------------------------ Int_t nde=da->GetEntriesFast(); for (Int_t i=0; iAt(i); double x,y,t; x=de->x(); y=de->y(); t=de->t(); // look through all other electrons for(Int_t i2=i+1; i2At(i2); double dx=x-de2->x(); double dy=y-de2->y(); double dt=t-de2->t(); double dr=sqrt(dx*dx+dy*dy); de_dist_H->Fill(dr); if(dr<0.3)de_dt_H->Fill(fabs(dt)); } } // look at avalanches -------------------------------------- Int_t nav=aa->GetEntriesFast(); for (Int_t i=0; iAt(i); double x,y,t; x=a->x(); y=a->y(); t=a->t(); // look through all other electrons for(Int_t i2=i+1; i2At(i2); double dx=x-a2->x(); double dy=y-a2->y(); double dt=t-a2->t(); double dr=sqrt(dx*dx+dy*dy); av_dist_H->Fill(dr); if(dr<0.3)av_dt_H->Fill(fabs(dt)); } } //look at signals --------------------------------------------------- Int_t nsig=sa->GetEntriesFast(); // map of hit pads -> how often has one pad been hit? std::map hitpads; for (Int_t i=0; iAt(i); unsigned int id=sig->padId(); (hitpads[id])++; } std::map::iterator padit=hitpads.begin(); while(padit!=hitpads.end()){ nsig_per_pad_H->Fill((*padit).second); ++padit; } //look at Digis Int_t ndigi=diga->GetEntriesFast(); // map of hit pads -> what are the times between digis? std::map digitimes; for (Int_t i=0; iAt(i); unsigned int id=digi->padId(); unsigned int t=digi->t(); if(t==0)std::cout<<"warning t==0!"<Fill(dt); digi_tdt_H->Fill(dt,t); } digitimes[id]=t; } } // end event loop }