/[PAMELA software]/eventviewer/flight/src/FEVdetector.cpp
ViewVC logotype

Diff of /eventviewer/flight/src/FEVdetector.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by mocchiut, Mon Feb 26 12:51:09 2007 UTC revision 1.11 by mocchiut, Mon Feb 26 17:30:32 2007 UTC
# Line 88  void FEVdetector::checkctrlword(){ Line 88  void FEVdetector::checkctrlword(){
88    var.AC = 0;    var.AC = 0;
89    var.RUN = 1;    var.RUN = 1;
90    var.TRK = 0;    var.TRK = 0;
91      var.ORB = 0;
92      var.TRG = 0;
93    var.CALO = 0;    var.CALO = 0;
94    var.S4 = 0;    var.S4 = 0;
95    var.ND = 0;    var.ND = 0;
# Line 129  void FEVdetector::SetDDEC(TString de){ Line 131  void FEVdetector::SetDDEC(TString de){
131    
132  void FEVdetector::GetWindow(){  void FEVdetector::GetWindow(){
133    otr->GetEntry(maxevent);    otr->GetEntry(maxevent);
134      //
135    if ( level.file < 2 ){    if ( level.file < 2 ){
136      ph = eh->GetPscuHeader();      ph = eh->GetPscuHeader();
137      lastevno = (int)ph->Counter;      lastevno = (int)ph->Counter;
138    } else {    } else {
139      lastevno = L2->GetOrbitalInfo()->pkt_num; // to be changed as soon as we will have pkt_counter in the level2 file!      if ( var.ORB ){
140          lastevno = L2->GetOrbitalInfo()->pkt_num;
141        } else {
142          lastevno = 0;
143        };
144    };    };
145    otr->GetEntry(minevent);    otr->GetEntry(minevent);
146    if ( level.file < 2 ){    if ( level.file < 2 ){
147      ph = eh->GetPscuHeader();      ph = eh->GetPscuHeader();
148      firstevno = (int)ph->Counter;      firstevno = (int)ph->Counter;
149    } else {    } else {
150      firstevno = L2->GetOrbitalInfo()->pkt_num; // to be changed as soon as we will have pkt_counter in the level2 file!      if ( var.ORB ){
151          firstevno = L2->GetOrbitalInfo()->pkt_num;
152        } else {
153          firstevno = 0;
154        };
155    };    };
156  }  }
157    
# Line 485  void FEVdetector::GetGeneralInfo(){ Line 496  void FEVdetector::GetGeneralInfo(){
496      trcs = (TString)trc.str().c_str();      trcs = (TString)trc.str().c_str();
497    } else {    } else {
498      headcold = headc;      headcold = headc;
499      headc = L2->GetOrbitalInfo()->pkt_num; // to be changed as soon as we will have obt in the level2 file!      if ( var.ORB ){
500      OBT = L2->GetOrbitalInfo()->OBT; // to be changed as soon as we will have obt in the level2 file!        headc = L2->GetOrbitalInfo()->pkt_num;
501      DOBT = OBT - OOBT;        OBT = L2->GetOrbitalInfo()->OBT;
502      OOBT = OBT;        DOBT = OBT - OOBT;
503      if ( thisentry == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0;        OOBT = OBT;
504      var.etime = OBT;        if ( thisentry == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0;
505          var.etime = OBT;
506        } else {
507          var.etime = 0;
508        };
509      //            //      
510      // who gave the trigger?      // who gave the trigger?
511      //      //
512      calotrig = 0;      Int_t trigconf = 0;
513      if ( L2->GetTrigLevel2()->patterntrig[0] ) calotrig = 1;      if ( var.TRG ){
514      toftrig = 0;        calotrig = 0;
515      if ( L2->GetTrigLevel2()->patterntrig[2] || L2->GetTrigLevel2()->patterntrig[3] || L2->GetTrigLevel2()->patterntrig[4] || L2->GetTrigLevel2()->patterntrig[5] ) toftrig = 1;        if ( L2->GetTrigLevel2()->patterntrig[0] ) calotrig = 1;
516      s4pulser = 0;        toftrig = 0;
517      if ( L2->GetTrigLevel2()->patterntrig[1] & (1<<0) ) s4pulser = 1;        if ( L2->GetTrigLevel2()->patterntrig[2] || L2->GetTrigLevel2()->patterntrig[3] || L2->GetTrigLevel2()->patterntrig[4] || L2->GetTrigLevel2()->patterntrig[5] ) toftrig = 1;
518      //        s4pulser = 0;
519      // TOF and calorimeter when giving a trigger will always set this flag since the time window of the signal is greater than 100 ns.        if ( L2->GetTrigLevel2()->patterntrig[1] & (1<<0) ) s4pulser = 1;
520      // S4 sometimes could not set the flag even if the trigger is given. This is a workaround to fix this "bug":        //
521      //        // TOF and calorimeter when giving a trigger will always set this flag since the time window of the signal is greater than 100 ns.
522      if ( !calotrig && !toftrig ) s4pulser = 1;        // S4 sometimes could not set the flag even if the trigger is given. This is a workaround to fix this "bug":
523      //        //
524      Int_t trigconf = L2->GetTrigLevel2()->trigconf;        if ( !calotrig && !toftrig ) s4pulser = 1;
525          //
526          trigconf = L2->GetTrigLevel2()->trigconf;
527        } else {
528          trigconf = 0;
529        }
530      stringstream trc;      stringstream trc;
531      trc.str("");      trc.str("");
532      if ( trigconf & (1<<0) ) trc << "TOF1";      if ( trigconf & (1<<0) ) trc << "TOF1";
# Line 615  int FEVdetector::SelectEvent(){ Line 635  int FEVdetector::SelectEvent(){
635        //        //
636        if ( level.file == -1 ) isOK = gApplication->ProcessLine("filter((TTree *)otr,-1,(Variables &)var);");        if ( level.file == -1 ) isOK = gApplication->ProcessLine("filter((TTree *)otr,-1,(Variables &)var);");
637        //        //
638        if ( level.file ==  2 ) isOK = gApplication->ProcessLine("filter((PamLevel2 *)L2,2);");        //      if ( level.file ==  2 ) isOK = gApplication->ProcessLine("filter((PamLevel2 *)L2,2);");
639          if ( level.file ==  2 ) isOK = gApplication->ProcessLine("filter();");
640        //        //
641        // progress bar in text window        // progress bar in text window
642        //        //
# Line 629  int FEVdetector::SelectEvent(){ Line 650  int FEVdetector::SelectEvent(){
650  }  }
651    
652  Int_t FEVdetector::Load(TTree &mainotr, TFile &mainfile){  Int_t FEVdetector::Load(TTree &mainotr, TFile &mainfile){
653      //Int_t FEVdetector::Load(TChain &mainotr, TFile &mainfile){
654    file = &mainfile;    file = &mainfile;
655    otr = &mainotr;    otr = &mainotr;
656    L2 = new PamLevel2();    L2 = new PamLevel2();
657    //    //
658    if ( level.file == 2 ){    if ( level.file == 2 ){
659      //    otr = L2->LoadPamTrees(file);      //    otr = L2->LoadPamTrees(file);
660      //    printf(" %s \n",ddec.Data());      printf(" %s \n",ddec.Data());
661        //    otr->Refresh();
662        //    otr->Clear();
663        //    otr = new TTree();
664      otr = L2->GetPamTree(file,ddec.Data());      otr = L2->GetPamTree(file,ddec.Data());
665      //      //
666      if ( !otr ) return(0);      if ( !otr ) return(0);
667      // ********************      // ********************
668      // load magnetic field      // load magnetic field
669      // ********************      // ********************
670      const char *pam_calib = pathtocalibration();      //    const char *pam_calib = pathtocalibration();
671      //      //
672      stringstream magfie;      //    stringstream magfie;
673      magfie.str("");      //    magfie.str("");
674      //    magfie << "/localdisk/mocchiut/test/calib/trk-param/field_param-0/";      //    magfie << "/localdisk/mocchiut/test/calib/trk-param/field_param-0/";
675      magfie << pam_calib;      // magfie << pam_calib;
676      magfie << "/trk-param/field_param-0/";      //magfie << "/trk-param/field_param-0/";
677      //      //
678      L2->GetTrkLevel2()->LoadField(magfie.str().c_str());      //L2->GetTrkLevel2()->LoadField(magfie.str().c_str());
679    } else {    } else {
680      //      //
681      // load calorimeter ADC2MIP conversion file      // load calorimeter ADC2MIP conversion file
# Line 785  Int_t FEVdetector::Load(TTree &mainotr, Line 810  Int_t FEVdetector::Load(TTree &mainotr,
810      };      };
811    };    };
812    //    //
813      //  printf("qua\n");
814    return(1);    return(1);
815    //        //    
816  }  }
# Line 3846  void FEVdetector::ShowAC(){ Line 3872  void FEVdetector::ShowAC(){
3872      pcasp4b->Draw("f");      pcasp4b->Draw("f");
3873      pcasp4b->Draw();      pcasp4b->Draw();
3874    };    };
3875    Float_t alfa = 1.2020334;    //  Float_t alfax = 1.2020334;
3876      Float_t alfax = 1.22157778;
3877      Float_t alfay = 1.27393111;
3878    Float_t lcrd = 0.1815/2.;    Float_t lcrd = 0.1815/2.;
3879    Float_t wcrd = 0.008;    Float_t wcrd = 0.008;
3880    if ( true ){    if ( true ){
# Line 4057  void FEVdetector::ShowAC(){ Line 4085  void FEVdetector::ShowAC(){
4085      //      //
4086      //    Float_t cardcx = 0.143168*var.sfx;      //    Float_t cardcx = 0.143168*var.sfx;
4087      //Float_t cardcy = 0.1475*var.sfy;      //Float_t cardcy = 0.1475*var.sfy;
4088      Float_t cardcx = 0.153168*var.sfx;      //
4089      Float_t cardcy = 0.1575*var.sfy;      //    Float_t cardcx = 0.153168*var.sfx;
4090      Float_t acrdx[4] = {-lcrd*cos(alfa), lcrd*cos(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)};      //
4091      Float_t acrdy[4] = {-lcrd*sin(alfa), lcrd*sin(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)};      Float_t cardcx = (0.19123*(1.-lcrd*cos(alfax)))*var.sfx;
4092      Float_t bcrdx[4] = { lcrd*cos(alfa), lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), lcrd*cos(alfa)};      //    Float_t cardcy = 0.1575*var.sfy;
4093      Float_t bcrdy[4] = { lcrd*sin(alfa), lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), lcrd*sin(alfa)};      Float_t cardcy = (0.179212*(1.-lcrd*sin(alfax)))*var.sfy;
4094        Float_t acrdx[4] = {-lcrd*cos(alfax), lcrd*cos(alfax), -lcrd*cos(alfax)+wcrd*sin(alfax), -lcrd*cos(alfax)};
4095        Float_t acrdy[4] = {-lcrd*sin(alfax), lcrd*sin(alfax), -lcrd*sin(alfax)-wcrd*cos(alfax), -lcrd*sin(alfax)};
4096        Float_t bcrdx[4] = { lcrd*cos(alfax), lcrd*cos(alfax)+wcrd*sin(alfax), -lcrd*cos(alfax)+wcrd*sin(alfax), lcrd*cos(alfax)};
4097        Float_t bcrdy[4] = { lcrd*sin(alfax), lcrd*sin(alfax)-wcrd*cos(alfax), -lcrd*sin(alfax)-wcrd*cos(alfax), lcrd*sin(alfax)};
4098    
4099      //      //
4100      // CARD3  X/  Y      // CARD3  X/  Y
# Line 4122  void FEVdetector::ShowAC(){ Line 4154  void FEVdetector::ShowAC(){
4154    };    };
4155    
4156    if ( true ){    if ( true ){
4157      Float_t acrdx[4] = {-lcrd*cos(alfa), lcrd*cos(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)};      Float_t acrdx[4] = {-lcrd*cos(alfay), lcrd*cos(alfay), -lcrd*cos(alfay)+wcrd*sin(alfay), -lcrd*cos(alfay)};
4158      Float_t acrdy[4] = {-lcrd*sin(alfa), lcrd*sin(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)};      Float_t acrdy[4] = {-lcrd*sin(alfay), lcrd*sin(alfay), -lcrd*sin(alfay)-wcrd*cos(alfay), -lcrd*sin(alfay)};
4159      Float_t bcrdx[4] = { lcrd*cos(alfa), lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), lcrd*cos(alfa)};      Float_t bcrdx[4] = { lcrd*cos(alfay), lcrd*cos(alfay)+wcrd*sin(alfay), -lcrd*cos(alfay)+wcrd*sin(alfay), lcrd*cos(alfay)};
4160      Float_t bcrdy[4] = { lcrd*sin(alfa), lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), lcrd*sin(alfa)};      Float_t bcrdy[4] = { lcrd*sin(alfay), lcrd*sin(alfay)-wcrd*cos(alfay), -lcrd*sin(alfay)-wcrd*cos(alfay), lcrd*sin(alfay)};
4161      //      //
4162      // CARD - Y-view      // CARD - Y-view
4163      //      //
4164      Float_t cardcx = 0.12*var.sfx;      //    Float_t cardcx = 0.12*var.sfx;
4165      Float_t cardcy = 0.1475*var.sfy;      Float_t cardcx = (0.16014*(1.-lcrd*cos(alfay)))*var.sfx;
4166        //    Float_t cardcy = 0.178818*var.sfy;
4167        Float_t cardcy = (0.178818*(1.-lcrd*sin(alfay)))*var.sfy;
4168        //    Float_t cardcy = 0.1475*var.sfy;
4169      //      //
4170      // CARD4  X  Y/      // CARD4  X  Y/
4171      //      //

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.23