ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/plugins/LinkSynchroAnalysis.cc
(Generate patch)

Comparing UserCode/L1RpcTriggerAnalysis/plugins/LinkSynchroAnalysis.cc (file contents):
Revision 1.3 by konec, Sun Jun 6 16:45:43 2010 UTC vs.
Revision 1.4 by konec, Thu Jun 17 00:47:03 2010 UTC

# Line 12 | Line 12
12   #include "CondFormats/RPCObjects/interface/RPCEMap.h"
13   #include "CondFormats/DataRecord/interface/RPCEMapRcd.h"
14  
15 + #include "UserCode/L1RpcTriggerAnalysis/interface/SynchroSelectorTrack.h"
16 + #include "UserCode/L1RpcTriggerAnalysis/interface/SynchroSelectorMuon.h"
17  
18   #include "DataFormats/MuonDetId/interface/RPCDetId.h"
19   #include "TFile.h"
# Line 26 | Line 28 | struct LessGP { bool operator () (const
28   LinkSynchroAnalysis::LinkSynchroAnalysis(const edm::ParameterSet& cfg)
29      : RPCMonitorLinkSynchro(cfg.getParameter<edm::ParameterSet>("linkMonitorPSet")), theAnaConfig(cfg),theCabling(0), theEventCounter(0) { }
30  
31 < LinkSynchroAnalysis::~LinkSynchroAnalysis(){ delete theCabling;}
31 > LinkSynchroAnalysis::~LinkSynchroAnalysis()
32 > {
33 >  delete theCabling;
34 >  for (std::vector<SynchroSelector* >::iterator ix=theSynchroFilters.begin(); ix != theSynchroFilters.end(); ++ix) delete (*ix);
35 >  theSynchroFilters.clear();
36 > }
37 >
38  
39   void LinkSynchroAnalysis::beginJob()
40   {
41    RPCMonitorLinkSynchro::beginJob();
42    theHistos.SetOwner();
43    theHistos.Add(new TH1F("hBX","hBX",3564,0.,3564));
44 <  theHistos.Add(new TH1F("hDeltaPhi","hDeltaPhi",100, 0., 1.));
45 <  theHistos.Add(new TH1F("hDeltaEta","hDeltaEta",100, 0., 1.));
46 <  theHistos.Add(new TH1F("hDxy","hDxy",100.,0.,1.));
47 <  theHistos.Add(new TH1F("hNumTracks","hNumTracks",50,0.,250.));
48 <  theHistos.Add(new TH1F("hDistB","hDistB",50,0.,200.));
41 <  theHistos.Add(new TH1F("hDistE","hDistE",50,0.,500.));
42 <  theHistos.Add(new TH1F("hPenetrationB","hPenetrationB",10,0.,10.));
43 <  theHistos.Add(new TH1F("hPenetrationE","hPenetrationE",10,0.,10.));
44 <  theHistos.Add(new TH1F("hPullX","hPullX",100,-10.,10.));
45 <  theHistos.Add(new TH1F("hDistX","hDistX",100,-100.,100.));
46 <
47 <  typedef std::vector<edm::ParameterSet> VPSet;
48 <  VPSet selectorConfigs = theAnaConfig.getParameter<VPSet>("ORedSynchroFilters");
49 <  for (VPSet::const_iterator it=selectorConfigs.begin(); it != selectorConfigs.end(); ++it) {
50 <    SynchroSelector f(*it);
51 <    if (it->getParameter<std::string>("collection") == "generalTracks") {
52 <      f.setHistoNum(static_cast<TH1F* >(theHistos.FindObject("hNumTracks")));
53 <      f.setHistoPhi(static_cast<TH1F* >(theHistos.FindObject("hDeltaPhi")));
54 <      f.setHistoEta(static_cast<TH1F* >(theHistos.FindObject("hDeltaEta")));
55 <      f.setHistoDxy(static_cast<TH1F* >(theHistos.FindObject("hDxy")));
56 <      f.setHistoPullX(static_cast<TH1F* >(theHistos.FindObject("hPullX")));
57 <      f.setHistoDistX(static_cast<TH1F* >(theHistos.FindObject("hDistX")));
58 <    }
59 <    if (it->getParameter<std::string>("collection") == "globalMuons") {
60 <    }
61 <    theSynchroFilters.push_back(f);
62 <  }
44 >
45 >  if (theAnaConfig.exists("synchroSelectorMuon"))  theSynchroFilters.push_back( new SynchroSelectorMuon(theAnaConfig.getParameter<edm::ParameterSet>("synchroSelectorMuon"), theHistos) );
46 >  if (theAnaConfig.exists("synchroSelectorTrack")) theSynchroFilters.push_back( new SynchroSelectorTrack(theAnaConfig.getParameter<edm::ParameterSet>("synchroSelectorTrack"), theHistos) );
47 >  std::cout << "SIZE OF SELECTORS IS: " << theSynchroFilters.size()<<std::endl;
48 >
49   }
50  
51   void LinkSynchroAnalysis::endJob()
# Line 92 | Line 78 | const RPCRawSynchro::ProdItem& LinkSynch
78      LogTrace("") << "LinkSynchroAnalysis - record has CHANGED!!, read map, VERSION: " << theCabling->version();
79    }
80  
95  theSynchroFilters[0].resetPos();
81    for(RPCRawSynchro::ProdItem::const_iterator it = vItem.begin(); it != vItem.end(); ++it) {
82      const LinkBoardElectronicIndex & path = it->first;
83      const  std::vector<FebConnectorSpec> & febs = theCabling->location(path)->febs();
# Line 102 | Line 87 | const RPCRawSynchro::ProdItem& LinkSynch
87      bool takeIt = false;
88      for ( std::map<uint32_t,bool>::const_iterator im = dets.begin(); im != dets.end(); ++im) {
89        RPCDetId rpcDet(im->first);
90 <      for (std::vector<SynchroSelector>::iterator ix=theSynchroFilters.begin(); ix != theSynchroFilters.end(); ++ix) if(ix->takeIt(rpcDet,ev,es) ) takeIt = true;
90 >      for (std::vector<SynchroSelector* >::iterator ix=theSynchroFilters.begin(); ix != theSynchroFilters.end(); ++ix) if((*ix)->takeIt(rpcDet,ev,es) ) takeIt = true;
91      }
92      if (takeIt) selected.push_back(*it);
93      if (takeIt) wasTakeIt = true;
94    }
95  
111 /*
112  std::vector<GlobalPoint> pos = theSynchroFilters[0].positions();
113 std::sort(pos.begin(), pos.end(), LessGP());
114  GlobalPoint last(0.,0.,0.);
115  unsigned int points = 0;
116  bool barrel = false;
117  bool endcap = false;
118  for (std::vector<GlobalPoint>::const_iterator ip= pos.begin(); ip != pos.end(); ++ip) {
119    double dist = 0.;
120    if (fabs(ip->eta()) > 1.24 && fabs(ip->eta()) < 1.6 ) endcap = true;
121    if (fabs(ip->eta()) < 0.93)  barrel= true;
122    if (barrel) dist = ((*ip)-last).perp();
123    if (endcap) dist = fabs(((*ip)-last).z());
124    if (barrel) static_cast<TH1F* >(theHistos.FindObject("hDistB"))->Fill(dist);
125    if (endcap) static_cast<TH1F* >(theHistos.FindObject("hDistE"))->Fill(dist);
126    if (endcap&& dist > 50.) points++;
127    if (barrel&& dist > 30.) points++;
128    last = *ip;
129    std::cout <<"HERE,  barrel: " <<barrel<<" endcap:"<< endcap<<" dist: " << dist <<" points: "<<points<< *ip<<std::endl;
130  }
131  std::cout <<"POINTS: " << points << std::endl;
132  if (barrel && endcap) std::cout << "PROBLEM" << std::endl;
133  if (wasTakeIt && barrel ) static_cast<TH1F* >(theHistos.FindObject("hPenetrationB"))->Fill(points);
134  if (wasTakeIt && endcap) static_cast<TH1F* >(theHistos.FindObject("hPenetrationE"))->Fill(points);
135
136 */
96    if (wasTakeIt) static_cast<TH1*>(theHistos.FindObject("hBX"))->Fill( ev.bunchCrossing());
97    if (wasTakeIt) theEventCounter++;
98    return selected;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines