/* * PitchAngleExpositionAction.cpp * * Created on: 04-april-2010 * Author: Vitaly Malakhov */ /*! @file PitchAngleExpositionAction.cpp The PitchAngleExpositionAction class implementation file. */ #include "PitchAngleExpositionAction.h" #include "TMatrixD.h" #include "OrientationInfo.h" #define XBINS_F 3600 #define YBINS_F 400 PitchAngleExpositionAction::PitchAngleExpositionAction(const char *actionName, TString outFileBase, TString mode, bool outRoot, bool outText, TString title, bool CalcPitchExpo, UInt_t nPitchBins, Float_t lowerPitch, Float_t upperPitch) : Histo2DAction (actionName, title, outFileBase, mode, outRoot, outText), _calcPitchExpo(CalcPitchExpo), _nPitchBins(nPitchBins), _lowerPitch(lowerPitch), _upperPitch(upperPitch) { } void PitchAngleExpositionAction::OnGood(PamLevel2 *event) { Float_t Bx = -event->GetOrbitalInfo()->Bdown; Float_t By = event->GetOrbitalInfo()->Beast; Float_t Bz = event->GetOrbitalInfo()->Bnorth; OrientationInfo* PO = new OrientationInfo(); TMatrixD Fij = PO->ECItoGreenwich(PO->QuatoECI(event->GetOrbitalInfo()->q0,event->GetOrbitalInfo()->q1,event->GetOrbitalInfo()->q2,event->GetOrbitalInfo()->q3),event->GetOrbitalInfo()->absTime); TMatrixD Dij = PO->GreenwichtoGEO(event->GetOrbitalInfo()->lat,event->GetOrbitalInfo()->lon,Fij); TMatrixD Iij = PO->ColPermutation(Dij); TMatrixD Sij = Iij; Sij.Invert(); TMatrixD Nij = PO->PamelatoGEO(Sij,Bx,By,Bz); Float_t BZen = acos(Nij(2,0)) * TMath::RadToDeg(); Float_t angle = 0; if(Nij(0,0)!=0)angle = atan(Nij(1,0)/Nij(0,0)) * TMath::RadToDeg();else angle = 90.; Float_t BAz = 360. + angle; if(Nij(0,0) >=0 && Nij(1,0) >=0) BAz = angle; if(Nij(0,0)<0) BAz = 180. + angle; Float_t weight = event->GetTrigLevel2()->dltime[0] * 0.16 /1000.; Fill(BAz, BZen, weight); PO->Delete(); } void PitchAngleExpositionAction::Finalize() { Histo2DAction::Finalize(); if(_calcPitchExpo){ TH2F tmphisto; tmphisto.SetBins(XBINS_F,0,360,YBINS_F,140,180); TString tmpname = GetRootHisto()->GetName(); Float_t delta = (_upperPitch - _lowerPitch)/_nPitchBins; for(UInt_t i=0; i<_nPitchBins; i++){ _pitchAngleHisto.push_back(tmphisto); TString tmp = tmpname; TString tmp2 = ""; tmp+=i*delta; tmp+="_"; tmp+=(i+1)*delta; tmp+="deg"; for(Int_t j = 0; jGetXaxis()->GetXmax()/GetRootHisto()->GetNbinsX(); Float_t BinWidthY = GetRootHisto()->GetYaxis()->GetXmax()/GetRootHisto()->GetNbinsY(); Float_t tetaB = 0.; //Zenith angle of Magnetic field vector B in PAMELA reference frame Float_t fiB = 0.; //Azimuth angle of Magnetic field vector B in PAMELA reference frame Float_t Psi = 0.; //Pitch-Angle; Float_t Ksi = 0.; //Azimuth-angle according pitch-angle Psi Bool_t pth[XBINS_F][YBINS_F]; for(Int_t i=1;i<=GetRootHisto()->GetNbinsX();i++){ cout<GetNbinsX()<GetNbinsY();j++){ if(GetRootHisto()->GetBinContent(i,j)!=0){ cout<<"j = "<