Classes | |
| struct | BeamMonMap::bmon1 |
| struct | BeamMonMap::bmon2 |
Functions | |
| std::map< VldTimeStamp, BeamMonTV > | MakeBeamMonMap (const char *path) |
| BeamMonTV | FindClosestSpill (const std::map< VldTimeStamp, BeamMonTV > &m, VldTimeStamp vts) |
| bool | IsGoodSpill (BeamMonTV b) |
| BeamMonTV | FillBeamMonTV (struct bmon1 bmn) |
| BeamMonTV | FillBeamMonTV (struct bmon2 bmn) |
|
|
|
||||||||||||
|
Definition at line 155 of file BeamMonMap.cxx. References BeamMonTV::closestspill. Referenced by MadMKAnalysis::CreatePAN(). 00156 {
00157 if(m.size()==0){
00158 BeamMonTV b;
00159 return b;
00160 }
00161
00162 std::map<VldTimeStamp, BeamMonTV>::const_iterator lb = m.lower_bound(vts);
00163 if(lb==m.begin()){ return lb->second; }
00164 std::map<VldTimeStamp, BeamMonTV>::const_iterator prev=lb;
00165 prev--;
00166 if(lb==m.end()){ return prev->second; }
00167
00168 double early = fabs(vts-prev->first);
00169 double late = fabs(lb->first-vts);
00170
00171 // std::cout<<"early "<<early<<" late "<<late<<std::endl;
00172
00173 if(early<late){
00174 BeamMonTV bmtv = prev->second;
00175 bmtv.closestspill=early;
00176 return bmtv;
00177 }
00178 BeamMonTV bmtv2 = lb->second;
00179 bmtv2.closestspill=late;
00180 return bmtv2;
00181 }
|
|
|
Definition at line 183 of file BeamMonMap.cxx. References BeamMonTV::bI, BeamMonTV::closestspill, BeamMonTV::hbw, BeamMonTV::hpos2, BeamMonTV::vbw, and BeamMonTV::vpos2. Referenced by MadMKAnalysis::CreatePAN(). 00184 {
00185
00186 if(b.bI>0.1&&
00187 b.hbw<2&&b.vbw<2&&
00188 b.hpos2<-1.5&&b.hpos2>-2.0&&
00189 b.vpos2>.2&&b.hpos2<1.8&&b.closestspill<2){
00190 return true;
00191 }
00192 return false;
00193 }
|
|
|
Definition at line 91 of file BeamMonMap.cxx. References atoi(), BeamMonMap::bmon2::beamIntensity, BeamMonMap::bmon1::beamIntensity, FillBeamMonTV(), BeamMonMap::bmon2::timeStampSec, and BeamMonMap::bmon1::timeStampSec. Referenced by MadMKAnalysis::CreatePAN(). 00092 {
00093
00094 std::map<VldTimeStamp, BeamMonTV> m;
00095 if(path==NULL){
00096 std::cout<<"Didn't specify a path for beam mon files, wont get em in your tree"<<std::endl;
00097 return m;
00098 }
00099 std::cout<<"opening dir "<<path<<std::endl;
00100
00101 DIR *dfd;
00102 dirent *dp;
00103 if(!(dfd = opendir(path))){
00104 std::cout<<" path "<<path<<" "<<dfd<<std::endl;
00105 return m;
00106 }
00107
00108 std::vector<std::string> names;
00109 while((dp=readdir(dfd))!=NULL){
00110 if(strstr(dp->d_name,"beamsummary_")!=NULL){
00111 names.push_back((std::string)(dp->d_name));
00112 }
00113 }
00114
00115 std::cout<<"Found "<<names.size()<<" names "<<std::endl;
00116 for(unsigned int i=0;i<names.size();i++){
00117 //figure out what version of bmon ntuple we've got
00118 std::string n=names[i].substr(names[i].find_last_of("_")+1,
00119 names[i].find_last_of(".")-names[i].find_last_of("_")-1);
00120 // std::cout<<"n is "<<n<<std::endl;
00121
00122 //open tree file
00123 std::string fname = path+names[i];
00124 TFile f(fname.c_str());
00125 TTree *b = (TTree *)(f.Get("btree"));
00126 if(atoi(n.c_str())<=7){
00127 struct bmon1 bs;
00128 b->SetBranchAddress("Beaminfo",&bs.beamIntensity);
00129 // std::cout<<"In first type"<<std::endl;
00130 //loop over tree
00131 for(int z=0;z<b->GetEntries();z++){
00132 b->GetEntry(z);
00133 BeamMonTV bmtv = FillBeamMonTV(bs);
00134 VldTimeStamp vts(bs.timeStampSec,0);
00135 m[vts]=bmtv;
00136 }
00137 }
00138 else{
00139 // std::cout<<"In second type"<<std::endl;
00140 struct bmon2 bs;
00141 b->SetBranchAddress("Beaminfo",&bs.beamIntensity);
00142 //loop over tree
00143 for(int z=0;z<b->GetEntries();z++){
00144 b->GetEntry(z);
00145 BeamMonTV bmtv = FillBeamMonTV(bs);
00146 VldTimeStamp vts(bs.timeStampSec,0);
00147 m[vts]=bmtv;
00148 }
00149 }
00150 f.Close();
00151 }
00152 return m;
00153 }
|
1.3.9.1