00001 00002 // RockEvent.cxx 00003 // A reduced version of NuEvent for storing the rock events 00005 00006 #include <iostream> 00007 #include <cmath> 00008 #include "MessageService/MsgService.h" 00009 #include "RockMuons/RockEvent.h" 00010 #include "NtupleUtils/NuEvent.h" 00011 #include "NtupleUtils/NuCutImps.h" 00012 #include "NtupleUtils/NuReco.h" 00013 00014 #include "TMath.h" 00015 00016 CVSID(""); 00017 00018 //...................................................................... 00019 RockEvent::RockEvent() 00020 { 00021 this->Reset(); 00022 } 00023 00024 //...................................................................... 00025 00026 RockEvent::RockEvent(const NuEvent& nu) : neuEnMCBin(-1), binNumber(-1) 00027 { 00028 this->Fill(nu); 00029 } 00030 00031 //...................................................................... 00032 00033 void RockEvent::Reset(void) 00034 { 00035 // Create a new, blank NuEvent so that the reset values will always be the same 00036 this->Fill(NuEvent()); 00037 00038 this->neuEnMCBin = -1; 00039 this->binNumber = -1; 00040 } 00041 00042 //...................................................................... 00043 00044 void RockEvent::Fill(NuEvent nu, const bool dohoveshift) 00045 { 00046 // Apply geometry corrections. This is not the ideal place to do it, but 00047 // Justin and I (Matt) decided that this was the best way that is feasible 00048 // at the moment. For the next analysis round, this should be handled 00049 // in NuReco::ApplyReweights in the same way as energy shifts are. 00050 // Make sure this is done only for monte carlo and fake data (which is, 00051 // of course, monte carlo and so still gets SimFlag::kMC) 00052 if(dohoveshift && nu.simFlag == SimFlag::kMC) 00053 ShiftHoveStrip(nu); 00054 00055 // Event variables 00056 this->rw = nu.rw; 00057 00058 // Binning/histogram selecting variables 00059 00060 this->regionTrkVtx = nu.regionTrkVtx; 00061 00062 this->edgeRegionTrkVtx = nu.edgeRegionTrkVtx; 00063 this->stripHoveNumTrkVtx = nu.stripHoveNumTrkVtx; 00064 this->stripTrkBegPerpFlag = nu.stripTrkBegPerpFlag; 00065 this->parallelStripTrkVtx = nu.parallelStripTrkVtx; 00066 this->planeTrkBegu = nu.planeTrkBegu; 00067 this->planeTrkBegv = nu.planeTrkBegv; 00068 00069 // edgemid = Edge Medium Identification 00070 // Possible media are: 00071 // 0 = rock-like 00072 // 1 = detector-like 00073 // 00074 // this has a value whether or not a track vertex is near an edge 00075 // Vertices far from an edge should all be labeled detector-like, 00076 // although near the ends of each supermodule this is not reliable 00077 this->edgemid = NuCutImps::EdgeMID(nu.edgeRegionTrkVtx, nu.stripHoveNumTrkVtx, 00078 nu.parallelStripTrkVtx); 00079 00080 // "Best" track energy of the "primary" track, where "best" and "primary" 00081 // are defined upstream. Force the correct definition of containment 00082 // for choosing range or curvature. 00083 const float trkEn = (nu.containmentFlagCC0250Std == 1) ? nu.trkEnRange : nu.trkEnCurv; 00084 if(fabs(trkEn-nu.trkEn) > 1e-3){ 00085 MAXMSG("RockEvent", Msg::kWarning, 10) 00086 << "Adjusting trkEn because it doesn't agree with " 00087 << "containmentFlagCC0250Std. Are you using old DSTs?" << endl; 00088 } 00089 this->trkEn = trkEn; 00090 00091 this->dirCosNu = nu.dirCosNu; 00092 00093 // Angle of the track with respect to the beam direction, in degrees. 00094 // It's easier to bin sensibly than dirCosNu 00095 this->dang = TMath::ACos(nu.dirCosNu)*180/TMath::Pi(); 00096 00097 // Truth variables 00098 this->neuEnMC = nu.neuEnMC; 00099 this->inu = nu.inu; 00100 this->iaction = nu.iaction; 00101 this->trkStartEnMC = nu.trkStartEnMC; 00102 } 00103 //...................................................................... 00104 00105 std::ostream& operator<<(std::ostream& out,const RockEvent& val) 00106 { 00107 out << "Rock Event Energy Trk: " << val.trkEn 00108 << " MC: " << val.neuEnMC << "\n" 00109 " Region: " << val.regionTrkVtx << " rw: " << val.rw 00110 << " inu: " << val.inu; 00111 return out; 00112 }