/** * \file TrkCalib.cpp * \author Elena Vannuccini */ #include using namespace pamela; TrkCalib::TrkCalib(){ calib1 = new CalibTrk1Event(); }; TrkCalib::~TrkCalib(){ calib1->Delete(); }; /** * Method to get the view number of the ipkt-th stored DSP-packet. * The view number is extracted from the DSP-header. */ Int_t TrkCalib::GetView(Int_t ipkt){ if( ipkt <0 || ipkt >=6 )return 0; return calib1->DSPnumber[ipkt]; }; Int_t TrkCalib::EvaluatePar(TString what, Int_t ipkt, Int_t ivk, Float_t* result){ // vector to store mean, RMS, n.points // Float_t* result = new Float_t[3]; *(result) = -1.; *(result+1) = 0.; *(result+2) = 0.; // evaluate strip range Int_t from = (ivk-1)*128 ; Int_t to= ivk*128; if( ivk > 0 && ivk <= 24){ from = (ivk-1)*128 ; to = ivk*128; }else if( ivk==0 ){ from = 0; to = 3072; }else if( ivk < 0 && ivk >= -3 ){ from = (-ivk-1)*1024; to = -ivk*1024; }else{ return 0; } float mean =0; float rms =0; int nstrip =0; float *pt; if( what.Contains("PED") ){ pt = (float*)(calib1->DSPped_par); }else if( what.Contains("SIG") ){ pt = (float*)(calib1->DSPsig_par); }else{ cout << "TrkCalib::EvaluatePar() --> "<DSPbad_par); for(Int_t is=from; is 0 && ivk <= 24){ from = (ivk-1)*128 ; // to = ivk*128; }else if( ivk==0 ){ from = 0; // to = 3072; }else if( ivk < 0 && ivk >= -3 ){ from = (-ivk-1)*1024; // to = -ivk*1024; }else{ return NULL; } float *pt; if( !what.CompareTo("PED") ){ pt = (float*)(calib1->DSPped_par); }else if( !what.CompareTo("SIG") ){ pt = (float*)(calib1->DSPsig_par); }else{ cout << "TrkCalib::Get(TString what, Int_t ipkt) --> "<DSPnumber[ipkt]<DAQmode[ipkt]< "<ped_l1[ipkt]<<" "<ped_l2[ipkt]<<" "<ped_l3[ipkt]<<" "< "<sig_l1[ipkt]<<" "<sig_l2[ipkt]<<" "<sig_l3[ipkt]<<" "<nbad_l1[ipkt]<<" "<nbad_l2[ipkt]<<" "<nbad_l3[ipkt]<<" "<ncalib_event[ipkt]<cal_flag[ipkt]< 0 && ivk <= 24){ from = (ivk-1)*128 ; to = ivk*128; }else if( ivk==0 ){ from = 0; to = 3072; }else if( ivk < 0 && ivk >= -3 ){ from = (-ivk-1)*1024; to = -ivk*1024; }else{ return NULL; } TString title =""; title.Form(" view %i ",GetView(ipkt)); title = what + title; TH1F* h = new TH1F("h",title.Data(),to-from,from,to); Float_t* v = Get(what,ipkt,ivk); HeaderDump(ipkt); for(Int_t i=from; iFill(i,v[i-from]); if(rebin !=0 )h->Rebin(rebin); if(rebin !=0 )h->Scale(1./(float)rebin); return h; } ClassImp(TrkCalib);