CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes | Static Private Attributes
AlignmentStats Class Reference

#include <AlignmentStats.h>

Inheritance diagram for AlignmentStats:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 AlignmentStats (const edm::ParameterSet &iConfig)
 
void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
void beginJob () override
 
void endJob () override
 
 ~AlignmentStats () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef std::map< uint32_t, uint32_t > DetHitMap
 

Private Attributes

float Chi2n [MAXTRKS_]
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordesTokenTkGeo_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdesTokenTTopo_
 
float Eta [MAXTRKS_]
 
int event_
 
DetHitMap hitmap_
 
std::string hitsTreeName_
 
bool keepHitPopulation_
 
bool keepTrackStats_
 
int Nhits [MAXTRKS_][7]
 
unsigned int ntracks
 
TTree * outtree_
 
edm::InputTag overlapAM_
 
DetHitMap overlapmap_
 
float P [MAXTRKS_]
 
float Phi [MAXTRKS_]
 
uint32_t prescale_
 
float Pt [MAXTRKS_]
 
int run_
 
edm::InputTag src_
 
std::string statsTreeName_
 
uint32_t tmpPresc_
 
std::unique_ptr< TrackerGeometrytrackerGeometry_
 
std::unique_ptr< TrackerTopologytrackerTopology_
 
TFile * treefile_
 

Static Private Attributes

static const int MAXTRKS_ = 200
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 28 of file AlignmentStats.h.

Member Typedef Documentation

◆ DetHitMap

typedef std::map<uint32_t, uint32_t> AlignmentStats::DetHitMap
private

Definition at line 62 of file AlignmentStats.h.

Constructor & Destructor Documentation

◆ AlignmentStats()

AlignmentStats::AlignmentStats ( const edm::ParameterSet iConfig)

Definition at line 28 of file AlignmentStats.cc.

31  src_(iConfig.getParameter<edm::InputTag>("src")),
32  overlapAM_(iConfig.getParameter<edm::InputTag>("OverlapAssoMap")),
33  keepTrackStats_(iConfig.getParameter<bool>("keepTrackStats")),
34  keepHitPopulation_(iConfig.getParameter<bool>("keepHitStats")),
35  statsTreeName_(iConfig.getParameter<string>("TrkStatsFileName")),
36  hitsTreeName_(iConfig.getParameter<string>("HitStatsFileName")),
37  prescale_(iConfig.getParameter<uint32_t>("TrkStatsPrescale")) {
38  //sanity checks
39 
40  //init
41  outtree_ = nullptr;
42 
43 } //end constructor

References outtree_.

◆ ~AlignmentStats()

AlignmentStats::~AlignmentStats ( )
override

Definition at line 45 of file AlignmentStats.cc.

45  {
46  //
47 }

Member Function Documentation

◆ analyze()

void AlignmentStats::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 78 of file AlignmentStats.cc.

78  {
79  //load list of detunits needed then in endJob
80  if (!trackerGeometry_) {
81  trackerGeometry_ = std::make_unique<TrackerGeometry>(iSetup.getData(esTokenTkGeo_));
82  }
83 
84  if (!trackerTopology_) {
85  trackerTopology_ = std::make_unique<TrackerTopology>(iSetup.getData(esTokenTTopo_));
86  }
87 
88  //take trajectories and tracks to loop on
89  // edm::Handle<TrajTrackAssociationCollection> TrackAssoMap;
91  iEvent.getByLabel(src_, Tracks);
92 
93  //take overlap HitAssomap
95  iEvent.getByLabel(overlapAM_, hMap);
96  const AliClusterValueMap &OverlapMap = *hMap;
97 
98  // Initialise
99  run_ = 1;
100  event_ = 1;
101  ntracks = 0;
102  run_ = iEvent.id().run();
103  event_ = iEvent.id().event();
104  ntracks = Tracks->size();
105  // if(ntracks>1) std::cout<<"~~~~~~~~~~~~\n For this event processing "<<ntracks<<" tracks"<<std::endl;
106 
107  unsigned int trk_cnt = 0;
108 
109  for (int j = 0; j < MAXTRKS_; j++) {
110  Eta[j] = -9999.0;
111  Phi[j] = -8888.0;
112  P[j] = -7777.0;
113  Pt[j] = -6666.0;
114  Chi2n[j] = -2222.0;
115  for (int k = 0; k < 7; k++) {
116  Nhits[j][k] = 0;
117  }
118  }
119 
120  // int npxbhits=0;
121 
122  //loop on tracks
123  for (std::vector<reco::Track>::const_iterator ittrk = Tracks->begin(), edtrk = Tracks->end(); ittrk != edtrk;
124  ++ittrk) {
125  Eta[trk_cnt] = ittrk->eta();
126  Phi[trk_cnt] = ittrk->phi();
127  Chi2n[trk_cnt] = ittrk->normalizedChi2();
128  P[trk_cnt] = ittrk->p();
129  Pt[trk_cnt] = ittrk->pt();
130  Nhits[trk_cnt][0] = ittrk->numberOfValidHits();
131 
132  // if(ntracks>1)std::cout<<"Track #"<<trk_cnt+1<<" params: Eta="<< Eta[trk_cnt]<<" Phi="<< Phi[trk_cnt]<<" P="<<P[trk_cnt]<<" Nhits="<<Nhits[trk_cnt][0]<<std::endl;
133 
134  int nhit = 0;
135  //loop on tracking rechits
136  //std::cout << " loop on hits of track #" << (itt - tracks->begin()) << std::endl;
137  for (auto const &hit : ittrk->recHits()) {
138  if (!hit->isValid())
139  continue;
140  DetId detid = hit->geographicalId();
141  int subDet = detid.subdetId();
142  uint32_t rawId = hit->geographicalId().rawId();
143 
144  // if(subDet==1)npxbhits++;
145 
146  //look if you find this detid in the map
147  DetHitMap::iterator mapiter;
148  mapiter = hitmap_.find(rawId);
149  if (mapiter != hitmap_.end()) { //present, increase its value by one
150  // hitmap_[rawId]=hitmap_[rawId]+1;
151  ++(hitmap_[rawId]);
152  } else { //not present, let's add this key to the map with value=1
153  hitmap_.insert(pair<uint32_t, uint32_t>(rawId, 1));
154  }
155 
156  AlignmentClusterFlag inval;
157 
158  bool hitInPixel = (subDet == PixelSubdetector::PixelBarrel) || (subDet == PixelSubdetector::PixelEndcap);
159  bool hitInStrip = (subDet == SiStripDetId::TIB) || (subDet == SiStripDetId::TID) ||
160  (subDet == SiStripDetId::TOB) || (subDet == SiStripDetId::TEC);
161 
162  if (!(hitInPixel || hitInStrip)) {
163  //skip only this hit, don't stop everything throwing an exception
164  edm::LogError("AlignmentStats") << "Hit not belonging neither to pixels nor to strips! Skipping it. SubDet= "
165  << subDet;
166  continue;
167  }
168 
169  //check also if the hit is an overlap. If yes fill a dedicated hitmap
170  if (hitInStrip) {
171  const std::type_info &type = typeid(*hit);
172 
173  if (type == typeid(SiStripRecHit1D)) {
174  //Notice the difference respect to when one loops on Trajectories: the recHit is a TrackingRecHit and not a TransientTrackingRecHit
175  const SiStripRecHit1D *striphit = dynamic_cast<const SiStripRecHit1D *>(hit);
176  if (striphit != nullptr) {
177  SiStripRecHit1D::ClusterRef stripclust(striphit->cluster());
178  inval = OverlapMap[stripclust];
179  } else {
180  // edm::LogError("AlignmentStats")<<"ERROR in <AlignmentStats::analyze>: Dynamic cast of Strip RecHit1D failed! TypeId of the RecHit: "<<className(*hit);
181  throw cms::Exception("NullPointerError")
182  << "ERROR in <AlignmentStats::analyze>: Dynamic cast of Strip RecHit1D failed! TypeId of the RecHit: "
183  << className(*hit);
184  }
185  } //end if sistriprechit1D
186  if (type == typeid(SiStripRecHit2D)) {
187  const SiStripRecHit2D *striphit = dynamic_cast<const SiStripRecHit2D *>(hit);
188  if (striphit != nullptr) {
189  SiStripRecHit2D::ClusterRef stripclust(striphit->cluster());
190  inval = OverlapMap[stripclust];
191  //cout<<"Taken the Strip Cluster with ProdId "<<stripclust.id() <<"; the Value in the map is "<<inval<<" (DetId is "<<hit->geographicalId().rawId()<<")"<<endl;
192  } else {
193  throw cms::Exception("NullPointerError")
194  << "ERROR in <AlignmentStats::analyze>: Dynamic cast of Strip RecHit2D failed! TypeId of the RecHit: "
195  << className(*hit);
196  // edm::LogError("AlignmentStats")<<"ERROR in <AlignmentStats::analyze>: Dynamic cast of Strip RecHit2D failed! TypeId of the RecHit: "<<className(*hit);
197  }
198  } //end if sistriprechit2D
199 
200  } //end if hit in Strips
201  else {
202  const SiPixelRecHit *pixelhit = dynamic_cast<const SiPixelRecHit *>(hit);
203  if (pixelhit != nullptr) {
204  SiPixelClusterRefNew pixclust(pixelhit->cluster());
205  inval = OverlapMap[pixclust];
206  //cout<<"Taken the Pixel Cluster with ProdId "<<pixclust.id() <<"; the Value in the map is "<<inval<<" (DetId is "<<hit->geographicalId().rawId()<<")"<<endl;
207  } else {
208  edm::LogError("AlignmentStats")
209  << "ERROR in <AlignmentStats::analyze>: Dynamic cast of Pixel RecHit failed! TypeId of the RecHit: "
210  << className(*hit);
211  }
212  } //end else hit is in Pixel
213 
214  bool isOverlapHit(inval.isOverlap());
215 
216  if (isOverlapHit) {
217  //cout<<"This hit is an overlap !"<<endl;
218  DetHitMap::iterator overlapiter;
219  overlapiter = overlapmap_.find(rawId);
220 
221  if (overlapiter !=
222  overlapmap_.end()) { //the det already collected at least an overlap, increase its value by one
223  overlapmap_[rawId] = overlapmap_[rawId] + 1;
224  } else { //first overlap on det unit, let's add it to the map
225  overlapmap_.insert(pair<uint32_t, uint32_t>(rawId, 1));
226  }
227  } //end if the hit is an overlap
228 
229  int subdethit = static_cast<int>(hit->geographicalId().subdetId());
230  // if(ntracks>1)std::cout<<"Hit in SubDet="<<subdethit<<std::endl;
231  Nhits[trk_cnt][subdethit] = Nhits[trk_cnt][subdethit] + 1;
232  nhit++;
233  } //end loop on trackingrechits
234  trk_cnt++;
235 
236  } //end loop on tracks
237 
238  // cout<<"Total number of pixel hits is "<<npxbhits<<endl;
239 
240  tmpPresc_--;
241  if (tmpPresc_ < 1) {
242  outtree_->Fill();
244  }
245  if (trk_cnt != ntracks)
246  edm::LogError("AlignmentStats") << "\nERROR! trk_cnt=" << trk_cnt << " ntracks=" << ntracks;
247 
248  return;
249 }

References Chi2n, className(), SiStripRecHit1D::cluster(), SiStripRecHit2D::cluster(), esTokenTkGeo_, esTokenTTopo_, Eta, event_, Exception, edm::EventSetup::getData(), hitmap_, iEvent, AlignmentClusterFlag::isOverlap(), dqmiolumiharvest::j, dqmdumpme::k, MAXTRKS_, Nhits, ntracks, outtree_, overlapAM_, overlapmap_, Phi, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, pixelClusterTagInfos_cfi::pixelhit, prescale_, Pt, run_, src_, DetId::subdetId(), SiStripDetId::TEC, SiStripDetId::TIB, SiStripDetId::TID, tmpPresc_, SiStripDetId::TOB, trackerGeometry_, trackerTopology_, and gather_cfg::Tracks.

◆ beginJob()

void AlignmentStats::beginJob ( )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 49 of file AlignmentStats.cc.

49  { // const edm::EventSetup &iSetup
50 
51  //book track stats tree
52  treefile_ = new TFile(statsTreeName_.c_str(), "RECREATE");
53  treefile_->cd();
54  outtree_ = new TTree("AlignmentTrackStats", "Statistics of Tracks used for Alignment");
55  // int nHitsinPXB[MAXTRKS_], nHitsinPXE[MAXTRKS_], nHitsinTEC[MAXTRKS_], nHitsinTIB[MAXTRKS_],nHitsinTOB[MAXTRKS_],nHitsinTID[MAXTRKS_];
56 
57  outtree_->Branch("Ntracks", &ntracks, "Ntracks/i");
58  outtree_->Branch("Run_", &run_, "Run_Nr/I");
59  outtree_->Branch("Event", &event_, "EventNr/I");
60  outtree_->Branch("Eta", &Eta, "Eta[Ntracks]/F");
61  outtree_->Branch("Phi", &Phi, "Phi[Ntracks]/F");
62  outtree_->Branch("P", &P, "P[Ntracks]/F");
63  outtree_->Branch("Pt", &Pt, "Pt[Ntracks]/F");
64  outtree_->Branch("Chi2n", &Chi2n, "Chi2n[Ntracks]/F");
65  outtree_->Branch("Nhits", &Nhits, "Nhits[Ntracks][7]/I");
66  /*
67  outtree_->Branch("NhitsPXB" , ,);
68  outtree_->Branch("NhitsPXE" , ,);
69  outtree_->Branch("NhitsTIB" , ,);
70  outtree_->Branch("NhitsTID" , ,);
71  outtree_->Branch("NhitsTOB" , ,);
72  outtree_->Branch("NhitsTOB" , ,);
73  */
74 
76 } //end beginJob

References Chi2n, Eta, event_, Nhits, ntracks, outtree_, Phi, prescale_, Pt, run_, statsTreeName_, tmpPresc_, and treefile_.

◆ endJob()

void AlignmentStats::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 251 of file AlignmentStats.cc.

251  {
252  treefile_->cd();
253  edm::LogInfo("AlignmentStats") << "Writing out the TrackStatistics in " << gDirectory->GetPath() << std::endl;
254  outtree_->Write();
255  delete outtree_;
256 
257  //create tree with hit maps (hitstree)
258  //book track stats tree
259  TFile *hitsfile = new TFile(hitsTreeName_.c_str(), "RECREATE");
260  hitsfile->cd();
261  TTree *hitstree = new TTree("AlignmentHitMap", "Maps of Hits used for Alignment");
262 
263  unsigned int id = 0, nhits = 0, noverlaps = 0;
264  float posX(-99999.0), posY(-77777.0), posZ(-88888.0);
265  float posEta(-6666.0), posPhi(-5555.0), posR(-4444.0);
266  int subdet = 0;
267  unsigned int layer = 0;
268  bool is2D = false, isStereo = false;
269  hitstree->Branch("DetId", &id, "DetId/i");
270  hitstree->Branch("Nhits", &nhits, "Nhits/i");
271  hitstree->Branch("Noverlaps", &noverlaps, "Noverlaps/i");
272  hitstree->Branch("SubDet", &subdet, "SubDet/I");
273  hitstree->Branch("Layer", &layer, "Layer/i");
274  hitstree->Branch("is2D", &is2D, "is2D/B");
275  hitstree->Branch("isStereo", &isStereo, "isStereo/B");
276  hitstree->Branch("posX", &posX, "posX/F");
277  hitstree->Branch("posY", &posY, "posY/F");
278  hitstree->Branch("posZ", &posZ, "posZ/F");
279  hitstree->Branch("posR", &posR, "posR/F");
280  hitstree->Branch("posEta", &posEta, "posEta/F");
281  hitstree->Branch("posPhi", &posPhi, "posPhi/F");
282 
283  /*
284  TTree *overlapstree=new TTree("OverlapHitMap","Maps of Overlaps used for Alignment");
285  hitstree->Branch("DetId", &id , "DetId/i");
286  hitstree->Branch("NOverlaps", &nhits , "Nhits/i");
287  hitstree->Branch("SubDet", &subdet, "SubDet/I");
288  hitstree->Branch("Layer", &layer, "Layer/i");
289  hitstree->Branch("is2D" , &is2D, "is2D/B");
290  hitstree->Branch("isStereo",&isStereo,"isStereo/B");
291  hitstree->Branch("posX", &posX, "posX/F");
292  hitstree->Branch("posY", &posY, "posY/F");
293  hitstree->Branch("posZ", &posZ, "posZ/F");
294  hitstree->Branch("posR", &posR, "posR/F");
295  hitstree->Branch("posEta", &posEta, "posEta/F");
296  hitstree->Branch("posPhi", &posPhi, "posPhi/F");
297  */
298 
299  std::unique_ptr<AlignableTracker> theAliTracker =
300  std::make_unique<AlignableTracker>(trackerGeometry_.get(), trackerTopology_.get());
301  const auto &Detunitslist = theAliTracker->deepComponents();
302  int ndetunits = Detunitslist.size();
303  edm::LogInfo("AlignmentStats") << "Number of DetUnits in the AlignableTracker: " << ndetunits << std::endl;
304 
305  for (int det_cnt = 0; det_cnt < ndetunits; ++det_cnt) {
306  //re-initialize for safety
307  id = 0;
308  nhits = 0;
309  noverlaps = 0;
310  posX = -99999.0;
311  posY = -77777.0;
312  posZ = -88888.0;
313  posEta = -6666.0;
314  posPhi = -5555.0;
315  posR = -4444.0;
316  subdet = 0;
317  layer = 0;
318  is2D = false;
319  isStereo = false;
320 
321  //if detunit in vector is found also in the map, look for how many hits were collected
322  //and save in the tree this number
323  id = static_cast<uint32_t>(Detunitslist[det_cnt]->id());
324  if (hitmap_.find(id) != hitmap_.end()) {
325  nhits = hitmap_[id];
326  }
327  //if not, save nhits=0
328  else {
329  nhits = 0;
330  hitmap_.insert(pair<uint32_t, uint32_t>(id, 0));
331  }
332 
333  if (overlapmap_.find(id) != overlapmap_.end()) {
334  noverlaps = overlapmap_[id];
335  }
336  //if not, save nhits=0
337  else {
338  noverlaps = 0;
339  overlapmap_.insert(pair<uint32_t, uint32_t>(id, 0));
340  }
341 
342  //take other geometrical infos from the det
343  posX = Detunitslist[det_cnt]->globalPosition().x();
344  posY = Detunitslist[det_cnt]->globalPosition().y();
345  posZ = Detunitslist[det_cnt]->globalPosition().z();
346 
347  align::GlobalVector vec(posX, posY, posZ);
348  posR = vec.perp();
349  posPhi = vec.phi();
350  posEta = vec.eta();
351  // posPhi = atan2(posY,posX);
352 
353  DetId detid(id);
354  subdet = detid.subdetId();
355 
356  //get layers, petals, etc...
357  if (subdet == PixelSubdetector::PixelBarrel) { //PXB
358 
359  layer = trackerTopology_->pxbLayer(id);
360  is2D = true;
361  isStereo = false;
362  } else if (subdet == PixelSubdetector::PixelEndcap) {
363  layer = trackerTopology_->pxfDisk(id);
364  is2D = true;
365  isStereo = false;
366  } else if (subdet == SiStripDetId::TIB) {
367  layer = trackerTopology_->tibLayer(id);
368  is2D = trackerTopology_->tibIsDoubleSide(id);
369  isStereo = trackerTopology_->tibIsStereo(id);
370  } else if (subdet == SiStripDetId::TID) {
371  layer = trackerTopology_->tidWheel(id);
372  is2D = trackerTopology_->tidIsDoubleSide(id);
373  isStereo = trackerTopology_->tidIsStereo(id);
374  } else if (subdet == SiStripDetId::TOB) {
375  layer = trackerTopology_->tobLayer(id);
376  is2D = trackerTopology_->tobIsDoubleSide(id);
377  isStereo = trackerTopology_->tobIsStereo(id);
378  } else if (subdet == SiStripDetId::TEC) {
379  layer = trackerTopology_->tecWheel(id);
380  is2D = trackerTopology_->tecIsDoubleSide(id);
381  isStereo = trackerTopology_->tecIsStereo(id);
382  } else {
383  edm::LogError("AlignmentStats") << "Detector not belonging neither to pixels nor to strips! Skipping it. SubDet= "
384  << subdet;
385  }
386 
387  //write in the hitstree
388  hitstree->Fill();
389  } //end loop over detunits
390 
391  //save hitstree
392  hitstree->Write();
393  delete hitstree;
394  //delete Detunitslist;
395  hitmap_.clear();
396  overlapmap_.clear();
397  delete hitsfile;
398 }

References PV3DBase< T, PVType, FrameType >::eta(), hitmap_, hitsTreeName_, triggerObjects_cff::id, fastTrackerRecHitType::is2D(), phase1PixelTopology::layer, nhits, outtree_, overlapmap_, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, RecoTauValidation_cfi::posX, RecoTauValidation_cfi::posY, DetId::subdetId(), SiStripDetId::TEC, SiStripDetId::TIB, SiStripDetId::TID, SiStripDetId::TOB, trackerGeometry_, trackerTopology_, and treefile_.

Referenced by o2olib.O2ORunMgr::executeJob().

Member Data Documentation

◆ Chi2n

float AlignmentStats::Chi2n[MAXTRKS_]
private

Definition at line 58 of file AlignmentStats.h.

Referenced by analyze(), and beginJob().

◆ esTokenTkGeo_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> AlignmentStats::esTokenTkGeo_
private

Definition at line 39 of file AlignmentStats.h.

Referenced by analyze().

◆ esTokenTTopo_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> AlignmentStats::esTokenTTopo_
private

Definition at line 38 of file AlignmentStats.h.

Referenced by analyze().

◆ Eta

float AlignmentStats::Eta[MAXTRKS_]
private

Definition at line 58 of file AlignmentStats.h.

Referenced by analyze(), and beginJob().

◆ event_

int AlignmentStats::event_
private

Definition at line 56 of file AlignmentStats.h.

Referenced by analyze(), and beginJob().

◆ hitmap_

DetHitMap AlignmentStats::hitmap_
private

Definition at line 63 of file AlignmentStats.h.

Referenced by analyze(), and endJob().

◆ hitsTreeName_

std::string AlignmentStats::hitsTreeName_
private

Definition at line 47 of file AlignmentStats.h.

Referenced by endJob().

◆ keepHitPopulation_

bool AlignmentStats::keepHitPopulation_
private

Definition at line 45 of file AlignmentStats.h.

◆ keepTrackStats_

bool AlignmentStats::keepTrackStats_
private

Definition at line 44 of file AlignmentStats.h.

◆ MAXTRKS_

const int AlignmentStats::MAXTRKS_ = 200
staticprivate

Definition at line 55 of file AlignmentStats.h.

Referenced by analyze().

◆ Nhits

int AlignmentStats::Nhits[MAXTRKS_][7]
private

Definition at line 59 of file AlignmentStats.h.

Referenced by analyze(), and beginJob().

◆ ntracks

unsigned int AlignmentStats::ntracks
private

Definition at line 57 of file AlignmentStats.h.

Referenced by analyze(), and beginJob().

◆ outtree_

TTree* AlignmentStats::outtree_
private

Definition at line 54 of file AlignmentStats.h.

Referenced by AlignmentStats(), analyze(), beginJob(), and endJob().

◆ overlapAM_

edm::InputTag AlignmentStats::overlapAM_
private

Definition at line 43 of file AlignmentStats.h.

Referenced by analyze().

◆ overlapmap_

DetHitMap AlignmentStats::overlapmap_
private

Definition at line 64 of file AlignmentStats.h.

Referenced by analyze(), and endJob().

◆ P

float AlignmentStats::P[MAXTRKS_]
private

Definition at line 58 of file AlignmentStats.h.

◆ Phi

float AlignmentStats::Phi[MAXTRKS_]
private

Definition at line 58 of file AlignmentStats.h.

Referenced by analyze(), and beginJob().

◆ prescale_

uint32_t AlignmentStats::prescale_
private

Definition at line 48 of file AlignmentStats.h.

Referenced by analyze(), and beginJob().

◆ Pt

float AlignmentStats::Pt[MAXTRKS_]
private

Definition at line 58 of file AlignmentStats.h.

Referenced by analyze(), and beginJob().

◆ run_

int AlignmentStats::run_
private

Definition at line 56 of file AlignmentStats.h.

Referenced by analyze(), and beginJob().

◆ src_

edm::InputTag AlignmentStats::src_
private

Definition at line 42 of file AlignmentStats.h.

Referenced by analyze().

◆ statsTreeName_

std::string AlignmentStats::statsTreeName_
private

Definition at line 46 of file AlignmentStats.h.

Referenced by beginJob().

◆ tmpPresc_

uint32_t AlignmentStats::tmpPresc_
private

Definition at line 50 of file AlignmentStats.h.

Referenced by analyze(), and beginJob().

◆ trackerGeometry_

std::unique_ptr<TrackerGeometry> AlignmentStats::trackerGeometry_
private

Definition at line 67 of file AlignmentStats.h.

Referenced by analyze(), and endJob().

◆ trackerTopology_

std::unique_ptr<TrackerTopology> AlignmentStats::trackerTopology_
private

Definition at line 66 of file AlignmentStats.h.

Referenced by analyze(), and endJob().

◆ treefile_

TFile* AlignmentStats::treefile_
private

Definition at line 53 of file AlignmentStats.h.

Referenced by beginJob(), and endJob().

Vector3DBase< Scalar, GlobalTag >
SiStripRecHit2D::cluster
ClusterRef cluster() const
Definition: SiStripRecHit2D.h:22
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
AlignmentStats::hitmap_
DetHitMap hitmap_
Definition: AlignmentStats.h:63
AlignmentStats::esTokenTTopo_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > esTokenTTopo_
Definition: AlignmentStats.h:38
AlignmentStats::esTokenTkGeo_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > esTokenTkGeo_
Definition: AlignmentStats.h:39
AlignmentStats::prescale_
uint32_t prescale_
Definition: AlignmentStats.h:48
AlignmentStats::Phi
float Phi[MAXTRKS_]
Definition: AlignmentStats.h:58
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
AlignmentStats::overlapAM_
edm::InputTag overlapAM_
Definition: AlignmentStats.h:43
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
AlignmentStats::trackerTopology_
std::unique_ptr< TrackerTopology > trackerTopology_
Definition: AlignmentStats.h:66
AlignmentStats::Chi2n
float Chi2n[MAXTRKS_]
Definition: AlignmentStats.h:58
edm::Handle< reco::TrackCollection >
AlignmentStats::hitsTreeName_
std::string hitsTreeName_
Definition: AlignmentStats.h:47
SiPixelRecHit
Our base class.
Definition: SiPixelRecHit.h:23
edm::Ref
Definition: AssociativeIterator.h:58
AlignmentStats::outtree_
TTree * outtree_
Definition: AlignmentStats.h:54
AlignmentStats::statsTreeName_
std::string statsTreeName_
Definition: AlignmentStats.h:46
AlignmentStats::MAXTRKS_
static const int MAXTRKS_
Definition: AlignmentStats.h:55
DetId
Definition: DetId.h:17
pixelClusterTagInfos_cfi.pixelhit
pixelhit
Definition: pixelClusterTagInfos_cfi.py:6
AlignmentStats::keepTrackStats_
bool keepTrackStats_
Definition: AlignmentStats.h:44
RecoTauValidation_cfi.posX
posX
Definition: RecoTauValidation_cfi.py:287
dqmdumpme.k
k
Definition: dqmdumpme.py:60
nhits
Definition: HIMultiTrackSelector.h:42
AlignmentStats::keepHitPopulation_
bool keepHitPopulation_
Definition: AlignmentStats.h:45
SiStripDetId::TEC
static constexpr auto TEC
Definition: SiStripDetId.h:40
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
AlignmentStats::src_
edm::InputTag src_
Definition: AlignmentStats.h:42
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
AlignmentStats::ntracks
unsigned int ntracks
Definition: AlignmentStats.h:57
iEvent
int iEvent
Definition: GenABIO.cc:224
gather_cfg.Tracks
Tracks
Definition: gather_cfg.py:251
AlignmentStats::Nhits
int Nhits[MAXTRKS_][7]
Definition: AlignmentStats.h:59
SiStripDetId::TOB
static constexpr auto TOB
Definition: SiStripDetId.h:39
SiStripRecHit1D::cluster
ClusterRef cluster() const
Definition: SiStripRecHit1D.h:18
AlignmentStats::Eta
float Eta[MAXTRKS_]
Definition: AlignmentStats.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SiStripRecHit1D
Definition: SiStripRecHit1D.h:8
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
SiStripDetId::TID
static constexpr auto TID
Definition: SiStripDetId.h:38
AlignmentStats::trackerGeometry_
std::unique_ptr< TrackerGeometry > trackerGeometry_
Definition: AlignmentStats.h:67
AlignmentStats::Pt
float Pt[MAXTRKS_]
Definition: AlignmentStats.h:58
AlignmentStats::tmpPresc_
uint32_t tmpPresc_
Definition: AlignmentStats.h:50
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
AlignmentStats::overlapmap_
DetHitMap overlapmap_
Definition: AlignmentStats.h:64
AlignmentStats::treefile_
TFile * treefile_
Definition: AlignmentStats.h:53
edm::ValueMap
Definition: ValueMap.h:107
Exception
Definition: hltDiff.cc:245
fastTrackerRecHitType::is2D
bool is2D(HitType hitType)
Definition: FastTrackerRecHit.h:36
SiStripDetId::TIB
static constexpr auto TIB
Definition: SiStripDetId.h:37
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
AlignmentClusterFlag::isOverlap
bool isOverlap() const
Definition: AlignmentClusterFlag.cc:16
AlignmentStats::run_
int run_
Definition: AlignmentStats.h:56
className
std::string className(const T &t)
Definition: ClassName.h:31
AlignmentStats::event_
int event_
Definition: AlignmentStats.h:56
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:206
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
P
std::pair< OmniClusterRef, TrackingParticleRef > P
Definition: BDHadronTrackMonitoringAnalyzer.cc:203
edm::InputTag
Definition: InputTag.h:15
AlignmentClusterFlag
Definition: AlignmentClusterFlag.h:15
RecoTauValidation_cfi.posY
posY
Definition: RecoTauValidation_cfi.py:288
hit
Definition: SiStripHitEffFromCalibTree.cc:88